From 22ce09c4ad06a966a65d5fa1f512239eb0b1ae1a Mon Sep 17 00:00:00 2001 From: Mitch Date: Sun, 26 Feb 2017 19:44:12 -0500 Subject: [PATCH 001/535] Begin 1.10.2 update --- .../core/featurehack/GameDataManipulator.java | 2 +- .../java/codechicken/lib/vec/Cuboid6.java | 2 +- .../java/codechicken/lib/vec/CuboidCoord.java | 2 +- .../codechicken/nei/ContainerCreativeInv.java | 2 +- .../codechicken/nei/WorldOverlayRenderer.java | 2 +- .../java/codechicken/nei/api/ItemInfo.java | 6 +- dependencies/main/java/ic2/api/Direction.java | 2 +- .../api/block/IOxygenReliantBlock.java | 2 +- .../api/block/IPartialSealableBlock.java | 2 +- .../api/block/ITerraformableBlock.java | 2 +- .../galacticraft/api/entity/ILandable.java | 2 +- .../api/event/wgen/GCCoreEventPopulate.java | 2 +- .../prefab/entity/EntitySpaceshipBase.java | 2 +- .../api/prefab/entity/EntityTieredRocket.java | 2 +- .../prefab/world/gen/BiomeDecoratorSpace.java | 2 +- .../prefab/world/gen/ChunkProviderSpace.java | 12 +- .../world/gen/WorldChunkManagerSpace.java | 2 +- .../prefab/world/gen/WorldProviderSpace.java | 2 +- .../api/recipe/ISchematicPage.java | 2 +- .../mods/galacticraft/api/tile/IFuelDock.java | 2 +- .../api/tile/ILandingPadAttachable.java | 2 +- .../galacticraft/api/vector/BlockVec3.java | 2 +- .../galacticraft/api/vector/BlockVec3Dim.java | 2 +- .../mods/galacticraft/api/vector/Vector3.java | 11 +- .../galacticraft/api/world/OxygenHooks.java | 2 +- .../mods/galacticraft/core/GCBlocks.java | 10 +- .../galacticraft/core/TransformerHooks.java | 2 +- .../core/blocks/BlockAdvanced.java | 9 +- .../core/blocks/BlockAdvancedTile.java | 2 +- .../core/blocks/BlockAirLockFrame.java | 16 +-- .../core/blocks/BlockAirLockWall.java | 92 ++++++++------- .../core/blocks/BlockAluminumWire.java | 14 +-- .../galacticraft/core/blocks/BlockBasic.java | 20 ++-- .../core/blocks/BlockBasicMoon.java | 19 +-- .../core/blocks/BlockBossSpawner.java | 12 +- .../core/blocks/BlockBreathableAir.java | 18 +-- .../core/blocks/BlockBrightAir.java | 14 +-- .../core/blocks/BlockBrightBreathableAir.java | 17 +-- .../core/blocks/BlockBrightLamp.java | 100 ++++++++-------- .../core/blocks/BlockCargoLoader.java | 10 +- .../galacticraft/core/blocks/BlockCheese.java | 110 ++++++++---------- .../galacticraft/core/blocks/BlockDish.java | 8 +- .../core/blocks/BlockDoubleSlabGC.java | 4 +- .../core/blocks/BlockEnclosed.java | 33 +++--- .../core/blocks/BlockFallenMeteor.java | 10 +- .../core/blocks/BlockFluidGC.java | 8 +- .../core/blocks/BlockFluidPipe.java | 25 ++-- .../core/blocks/BlockFluidTank.java | 21 ++-- .../core/blocks/BlockFuelLoader.java | 10 +- .../core/blocks/BlockGlowstoneTorch.java | 96 ++++++++------- .../core/blocks/BlockLandingPad.java | 10 +- .../core/blocks/BlockLandingPadFull.java | 33 +++--- .../core/blocks/BlockMachine.java | 8 +- .../core/blocks/BlockMachine2.java | 8 +- .../core/blocks/BlockMachineTiered.java | 8 +- .../galacticraft/core/blocks/BlockMulti.java | 19 +-- .../core/blocks/BlockNasaWorkbench.java | 12 +- .../core/blocks/BlockOxygenCollector.java | 10 +- .../core/blocks/BlockOxygenCompressor.java | 10 +- .../core/blocks/BlockOxygenDetector.java | 6 +- .../core/blocks/BlockOxygenDistributor.java | 10 +- .../core/blocks/BlockOxygenSealer.java | 10 +- .../core/blocks/BlockParaChest.java | 17 +-- .../core/blocks/BlockRefinery.java | 10 +- .../galacticraft/core/blocks/BlockScreen.java | 9 +- .../galacticraft/core/blocks/BlockSlabGC.java | 6 +- .../galacticraft/core/blocks/BlockSolar.java | 10 +- .../core/blocks/BlockSpaceStationBase.java | 8 +- .../core/blocks/BlockSpinThruster.java | 33 +++--- .../core/blocks/BlockT1TreasureChest.java | 15 +-- .../core/blocks/BlockTelemetry.java | 6 +- .../galacticraft/core/blocks/BlockTileGC.java | 2 +- .../core/blocks/BlockTransmitter.java | 12 +- .../core/blocks/BlockUnlitTorch.java | 30 ++--- .../galacticraft/core/blocks/BlockWallGC.java | 10 +- .../core/client/fx/EntityFXOilDrip.java | 2 +- .../core/client/gui/GuiHandler.java | 2 +- .../client/gui/container/GuiOxygenSealer.java | 2 +- .../gui/container/GuiSchematicBuggy.java | 2 +- .../gui/container/GuiSchematicInput.java | 2 +- .../container/GuiSchematicTier1Rocket.java | 2 +- .../core/client/model/ModelBipedGC.java | 4 +- .../core/command/CommandGCAstroMiner.java | 2 +- .../core/command/CommandGCInv.java | 2 +- .../core/command/CommandPlanetTeleport.java | 2 +- .../command/CommandSpaceStationAddOwner.java | 2 +- .../CommandSpaceStationRemoveOwner.java | 2 +- .../core/dimension/SpinManager.java | 4 +- .../core/energy/grid/NetworkFinder.java | 2 +- .../core/energy/tile/TileBaseConductor.java | 4 +- .../energy/tile/TileBaseElectricBlock.java | 2 +- .../core/entities/EntityBossBase.java | 6 +- .../core/entities/EntityCelestialFake.java | 2 +- .../core/entities/EntityFlag.java | 4 +- .../core/entities/EntityLander.java | 2 +- .../core/entities/EntityLanderBase.java | 2 +- .../core/entities/EntityParachest.java | 2 +- .../core/entities/player/FreefallHandler.java | 10 +- .../core/entities/player/GCPlayerHandler.java | 2 +- .../entities/player/GCPlayerStatsClient.java | 2 +- .../core/entities/player/PlayerServer.java | 2 +- .../core/event/EventHandlerGC.java | 4 +- .../core/event/EventLandingPadRemoval.java | 2 +- .../core/event/EventWakePlayer.java | 2 +- .../galacticraft/core/fluid/FluidNetwork.java | 2 +- .../core/fluid/OxygenPressureProtocol.java | 6 +- .../core/fluid/ThreadFindSeal.java | 18 +-- .../core/inventory/ContainerBuggyBench.java | 2 +- .../core/inventory/ContainerSchematic.java | 2 +- .../ContainerSchematicTier1Rocket.java | 2 +- .../core/inventory/SlotBuggyBench.java | 2 +- .../core/inventory/SlotRocketBench.java | 2 +- .../core/items/ItemBlockEnclosed.java | 2 +- .../galacticraft/core/items/ItemFlag.java | 6 +- .../core/items/ItemTier1Rocket.java | 2 +- .../core/items/ItemUniversalWrench.java | 2 +- .../core/nei/GCNEIHighlightHandler.java | 2 +- .../core/network/NetworkUtil.java | 2 +- .../core/network/PacketDynamic.java | 2 +- .../core/network/PacketDynamicInventory.java | 2 +- .../network/PacketFluidNetworkUpdate.java | 2 +- .../core/proxy/ClientProxyCore.java | 6 +- .../core/recipe/RecipeManagerGC.java | 4 +- .../core/schematic/SchematicAdd.java | 2 +- .../core/schematic/SchematicMoonBuggy.java | 2 +- .../core/schematic/SchematicRocketT1.java | 2 +- .../core/tick/TickHandlerClient.java | 2 +- .../core/tick/TickHandlerServer.java | 2 +- .../core/tile/AirLockProtocol.java | 2 +- .../galacticraft/core/tile/FluidTankGC.java | 2 +- .../galacticraft/core/tile/IMultiBlock.java | 2 +- .../tile/TileEntityAirLockController.java | 20 ++-- .../core/tile/TileEntityArclamp.java | 22 ++-- .../core/tile/TileEntityBuggyFueler.java | 6 +- .../tile/TileEntityBuggyFuelerSingle.java | 4 +- .../core/tile/TileEntityCargoUnloader.java | 2 +- .../core/tile/TileEntityDish.java | 16 +-- .../core/tile/TileEntityDungeonSpawner.java | 10 +- .../core/tile/TileEntityFluidPipe.java | 2 +- .../core/tile/TileEntityFluidTank.java | 2 +- .../core/tile/TileEntityFluidTransmitter.java | 4 +- .../core/tile/TileEntityFuelLoader.java | 2 +- .../core/tile/TileEntityLandingPad.java | 8 +- .../core/tile/TileEntityLandingPadSingle.java | 4 +- .../core/tile/TileEntityMulti.java | 8 +- .../core/tile/TileEntityNasaWorkbench.java | 6 +- .../core/tile/TileEntityOxygenCollector.java | 2 +- .../core/tile/TileEntityOxygenDetector.java | 4 +- .../tile/TileEntityOxygenDistributor.java | 2 +- .../core/tile/TileEntityOxygenSealer.java | 2 +- .../core/tile/TileEntityParaChest.java | 4 +- .../core/tile/TileEntitySolar.java | 16 +-- .../core/tile/TileEntitySpaceStationBase.java | 2 +- .../core/tile/TileEntityTelemetry.java | 2 +- .../core/util/ConfigManagerCore.java | 2 +- .../galacticraft/core/util/FluidUtil.java | 2 +- .../mods/galacticraft/core/util/MapUtil.java | 6 +- .../galacticraft/core/util/OxygenUtil.java | 8 +- .../galacticraft/core/util/RedstoneUtil.java | 2 +- .../galacticraft/core/util/WorldUtil.java | 2 +- .../core/world/ChunkLoadingCallback.java | 2 +- .../galacticraft/core/world/IChunkLoader.java | 2 +- .../core/world/gen/BiomeDecoratorMoon.java | 2 +- .../core/world/gen/ChunkProviderMoon.java | 10 +- .../core/world/gen/ChunkProviderOrbit.java | 2 +- .../core/world/gen/MapGenCavesMoon.java | 8 +- .../core/world/gen/OreGenOtherMods.java | 2 +- .../core/world/gen/OverworldGenerator.java | 2 +- .../core/world/gen/StructureComponentGC.java | 2 +- .../world/gen/StructureComponentMoon.java | 4 +- .../world/gen/StructureComponentVillage.java | 2 +- .../gen/StructureComponentVillageField.java | 2 +- .../gen/StructureComponentVillageField2.java | 2 +- .../gen/StructureComponentVillageHouse.java | 8 +- .../gen/StructureComponentVillagePathGen.java | 4 +- .../gen/StructureComponentVillageTorch.java | 2 +- .../gen/StructureComponentVillageWell.java | 8 +- .../gen/StructureComponentVillageWoodHut.java | 8 +- .../core/world/gen/WorldGenMinableMeta.java | 2 +- .../core/world/gen/WorldGenSpaceStation.java | 2 +- .../core/world/gen/dungeon/Corridor.java | 2 +- .../core/world/gen/dungeon/RoomBoss.java | 6 +- .../core/world/gen/dungeon/RoomChest.java | 2 +- .../core/world/gen/dungeon/RoomEmpty.java | 4 +- .../core/world/gen/dungeon/RoomEntrance.java | 6 +- .../core/world/gen/dungeon/RoomSpawner.java | 2 +- .../core/world/gen/dungeon/RoomTreasure.java | 6 +- .../core/wrappers/ScheduledBlockChange.java | 2 +- .../planets/asteroids/AsteroidsModule.java | 2 +- .../asteroids/AsteroidsModuleClient.java | 2 +- .../asteroids/blocks/BlockBasicAsteroids.java | 17 ++- .../asteroids/blocks/BlockBeamReceiver.java | 27 ++--- .../asteroids/blocks/BlockBeamReflector.java | 8 +- .../asteroids/blocks/BlockIceAsteroids.java | 7 +- .../asteroids/blocks/BlockMinerBase.java | 10 +- .../asteroids/blocks/BlockMinerBaseFull.java | 12 +- .../blocks/BlockShortRangeTelepad.java | 8 +- .../asteroids/blocks/BlockTelepadFake.java | 19 +-- .../asteroids/blocks/BlockWalkway.java | 12 +- .../client/gui/GuiSchematicAstroMiner.java | 2 +- .../client/gui/GuiSchematicTier3Rocket.java | 2 +- .../dimension/TeleportTypeAsteroids.java | 2 +- .../asteroids/entities/EntityAstroMiner.java | 4 +- .../asteroids/entities/EntityEntryPod.java | 2 +- .../ContainerSchematicAstroMiner.java | 2 +- .../ContainerSchematicTier3Rocket.java | 2 +- .../inventory/SlotSchematicAstroMiner.java | 2 +- .../inventory/SlotSchematicTier3Rocket.java | 2 +- .../asteroids/items/ItemAstroMiner.java | 2 +- .../items/ItemCanisterLiquidNitrogen.java | 2 +- .../asteroids/items/ItemTier3Rocket.java | 2 +- .../network/PacketSimpleAsteroids.java | 2 +- .../schematic/SchematicAstroMiner.java | 2 +- .../schematic/SchematicTier3Rocket.java | 2 +- .../asteroids/tile/TileEntityBeamOutput.java | 2 +- .../asteroids/tile/TileEntityMinerBase.java | 8 +- .../tile/TileEntityMinerBaseSingle.java | 2 +- .../tile/TileEntityShortRangeTelepad.java | 6 +- .../asteroids/tile/TileEntityTelepadFake.java | 2 +- .../world/gen/ChunkProviderAsteroids.java | 8 +- .../planets/mars/EventHandlerMars.java | 2 +- .../galacticraft/planets/mars/MarsModule.java | 2 +- .../planets/mars/MarsModuleClient.java | 2 +- .../planets/mars/blocks/BlockBasicMars.java | 12 +- .../mars/blocks/BlockCavernousVine.java | 19 +-- .../planets/mars/blocks/BlockCreeperEgg.java | 7 +- .../planets/mars/blocks/BlockMachineMars.java | 6 +- .../mars/blocks/BlockMachineMarsT2.java | 8 +- .../mars/blocks/BlockSlimelingEgg.java | 13 ++- .../planets/mars/blocks/BlockSludge.java | 6 +- .../mars/client/fx/EntityBacterialDripFX.java | 2 +- .../client/gui/GuiSchematicCargoRocket.java | 2 +- .../client/gui/GuiSchematicTier2Rocket.java | 2 +- .../mars/entities/EntityCreeperBoss.java | 2 +- .../mars/entities/EntitySludgeling.java | 4 +- .../ContainerSchematicCargoRocket.java | 2 +- .../ContainerSchematicTier2Rocket.java | 2 +- .../inventory/SlotSchematicCargoRocket.java | 2 +- .../inventory/SlotSchematicTier2Rocket.java | 2 +- .../planets/mars/items/ItemBlockMachine.java | 2 +- .../planets/mars/items/ItemTier2Rocket.java | 2 +- .../mars/nei/GCMarsNEIHighlightHandler.java | 2 +- .../mars/network/PacketSimpleMars.java | 2 +- .../mars/schematic/SchematicCargoRocket.java | 2 +- .../mars/schematic/SchematicTier2Rocket.java | 2 +- .../mars/tile/TileEntityCryogenicChamber.java | 6 +- .../mars/tile/TileEntityLaunchController.java | 2 +- .../mars/tile/TileEntityTerraformer.java | 6 +- .../mars/world/gen/MapGenCaveMars.java | 8 +- .../mars/world/gen/MapGenCavernMars.java | 8 +- .../planets/mars/world/gen/RoomBossMars.java | 6 +- .../mars/world/gen/RoomTreasureMars.java | 6 +- .../planets/mars/world/gen/WorldGenEggs.java | 2 +- .../mars/world/gen/WorldGenTerraformTree.java | 2 +- .../planets/venus/VenusModule.java | 2 +- .../planets/venus/VenusModuleClient.java | 2 +- .../planets/venus/blocks/BlockBasicVenus.java | 12 +- .../venus/blocks/BlockCrashedProbe.java | 8 +- .../blocks/BlockGeothermalGenerator.java | 10 +- .../venus/blocks/BlockScorchedRock.java | 4 +- .../planets/venus/blocks/BlockSpout.java | 4 +- .../venus/blocks/BlockSulphuricAcid.java | 2 +- .../planets/venus/blocks/BlockTorchWeb.java | 19 +-- .../venus/client/TickHandlerClientVenus.java | 2 +- .../venus/entities/EntityEntryPodVenus.java | 4 +- .../planets/venus/entities/EntityJuicer.java | 2 +- .../venus/entities/EntitySpiderQueen.java | 2 +- .../entities/ai/PathNavigateCeiling.java | 2 +- .../entities/ai/WalkNodeProcessorCeiling.java | 2 +- .../venus/items/ItemVolcanicPickaxe.java | 4 +- .../tile/TileEntityGeothermalGenerator.java | 2 +- .../venus/world/gen/BiomeDecoratorVenus.java | 2 +- .../venus/world/gen/ChunkProviderVenus.java | 2 +- .../venus/world/gen/MapGenCaveVenus.java | 2 +- .../venus/world/gen/MapGenLavaVenus.java | 12 +- .../world/gen/WorldChunkManagerVenus.java | 2 +- .../venus/world/gen/WorldGenCrashedProbe.java | 4 +- .../venus/world/gen/WorldGenLakesVenus.java | 4 +- .../venus/world/gen/WorldGenVaporPool.java | 8 +- .../world/gen/dungeon/CorridorVenus.java | 6 +- .../world/gen/dungeon/RoomBossVenus.java | 6 +- .../world/gen/dungeon/RoomChestVenus.java | 2 +- .../world/gen/dungeon/RoomEmptyVenus.java | 4 +- .../world/gen/dungeon/RoomEntranceVenus.java | 6 +- .../world/gen/dungeon/RoomSpawnerVenus.java | 2 +- .../world/gen/dungeon/RoomTreasureVenus.java | 6 +- 286 files changed, 1017 insertions(+), 980 deletions(-) diff --git a/dependencies/main/java/codechicken/core/featurehack/GameDataManipulator.java b/dependencies/main/java/codechicken/core/featurehack/GameDataManipulator.java index 87368b695d..18dee0ce83 100644 --- a/dependencies/main/java/codechicken/core/featurehack/GameDataManipulator.java +++ b/dependencies/main/java/codechicken/core/featurehack/GameDataManipulator.java @@ -13,7 +13,7 @@ public static void replaceItem(int id, Item item) { Item.itemRegistry.registryObjects.put(name, item); Item.itemRegistry.underlyingIntegerMap.put(item, id); Block block = Block.getBlockById(id); - if (block != Blocks.air) { + if (block != Blocks.AIR) { GameData.getBlockItemMap().put(block, item); } } catch (Exception e) { diff --git a/dependencies/main/java/codechicken/lib/vec/Cuboid6.java b/dependencies/main/java/codechicken/lib/vec/Cuboid6.java index 7f83e4e3a0..0fdb2b0c03 100644 --- a/dependencies/main/java/codechicken/lib/vec/Cuboid6.java +++ b/dependencies/main/java/codechicken/lib/vec/Cuboid6.java @@ -2,7 +2,7 @@ import codechicken.lib.util.Copyable; import net.minecraft.block.Block; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import java.math.BigDecimal; import java.math.MathContext; diff --git a/dependencies/main/java/codechicken/lib/vec/CuboidCoord.java b/dependencies/main/java/codechicken/lib/vec/CuboidCoord.java index 577cb37abc..6618d013fd 100644 --- a/dependencies/main/java/codechicken/lib/vec/CuboidCoord.java +++ b/dependencies/main/java/codechicken/lib/vec/CuboidCoord.java @@ -1,7 +1,7 @@ package codechicken.lib.vec; import codechicken.lib.util.Copyable; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import java.util.Iterator; diff --git a/dependencies/main/java/codechicken/nei/ContainerCreativeInv.java b/dependencies/main/java/codechicken/nei/ContainerCreativeInv.java index c82a93e708..cc3a130fb0 100644 --- a/dependencies/main/java/codechicken/nei/ContainerCreativeInv.java +++ b/dependencies/main/java/codechicken/nei/ContainerCreativeInv.java @@ -43,7 +43,7 @@ public SlotBlockArmor(IInventory inv, int slot, int x, int y, int armor) { @Override public boolean isItemValid(ItemStack stack) { - return super.isItemValid(stack) || stack != null;// && Block.getBlockFromItem(stack.getItem()) != Blocks.air; + return super.isItemValid(stack) || stack != null;// && Block.getBlockFromItem(stack.getItem()) != Blocks.AIR; } } diff --git a/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java b/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java index 7f277ce5ef..3729aee17b 100644 --- a/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java +++ b/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java @@ -10,7 +10,7 @@ import net.minecraft.entity.EntityLiving.SpawnPlacementType; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.passive.EntityPig; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.SpawnerAnimals; diff --git a/dependencies/main/java/codechicken/nei/api/ItemInfo.java b/dependencies/main/java/codechicken/nei/api/ItemInfo.java index 34aea1d942..e49a4dd19f 100644 --- a/dependencies/main/java/codechicken/nei/api/ItemInfo.java +++ b/dependencies/main/java/codechicken/nei/api/ItemInfo.java @@ -148,7 +148,7 @@ public String[] header() { @Override public String[] dump(Item item, int id, String name) { - return new String[] { name, Integer.toString(id), Boolean.toString(Block.getBlockFromItem(item) != Blocks.air), ItemInfo.itemOwners.get(item), item.getClass().getCanonicalName() }; + return new String[] { name, Integer.toString(id), Boolean.toString(Block.getBlockFromItem(item) != Blocks.AIR), ItemInfo.itemOwners.get(item), item.getClass().getCanonicalName() }; } @Override @@ -273,13 +273,13 @@ private static void addDefaultDropDowns() { API.addSubset("Items", new ItemFilter() { @Override public boolean matches(ItemStack item) { - return Block.getBlockFromItem(item.getItem()) == Blocks.air; + return Block.getBlockFromItem(item.getItem()) == Blocks.AIR; } }); API.addSubset("Blocks", new ItemFilter() { @Override public boolean matches(ItemStack item) { - return Block.getBlockFromItem(item.getItem()) != Blocks.air; + return Block.getBlockFromItem(item.getItem()) != Blocks.AIR; } }); API.addSubset("Blocks.MobSpawners", ItemStackSet.of(Blocks.mob_spawner)); diff --git a/dependencies/main/java/ic2/api/Direction.java b/dependencies/main/java/ic2/api/Direction.java index 7483a99a37..0465d6c82c 100644 --- a/dependencies/main/java/ic2/api/Direction.java +++ b/dependencies/main/java/ic2/api/Direction.java @@ -79,7 +79,7 @@ public TileEntity applyToTileEntity(TileEntity te) { */ public TileEntity applyTo(World world, BlockPos pos) { - if (world != null && world.getBlockState(pos).getBlock() != Blocks.air) { + if (world != null && world.getBlockState(pos).getBlock() != Blocks.AIR) { try { return world.getTileEntity(pos); } catch (Exception e) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/block/IOxygenReliantBlock.java b/src/main/java/micdoodle8/mods/galacticraft/api/block/IOxygenReliantBlock.java index f72bd1d388..28de55d158 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/block/IOxygenReliantBlock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/block/IOxygenReliantBlock.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.api.block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/block/IPartialSealableBlock.java b/src/main/java/micdoodle8/mods/galacticraft/api/block/IPartialSealableBlock.java index e32dabf147..4bf83f17db 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/block/IPartialSealableBlock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/block/IPartialSealableBlock.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.api.block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/block/ITerraformableBlock.java b/src/main/java/micdoodle8/mods/galacticraft/api/block/ITerraformableBlock.java index 865d6ca2a1..0286a5fec1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/block/ITerraformableBlock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/block/ITerraformableBlock.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.api.block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface ITerraformableBlock diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/entity/ILandable.java b/src/main/java/micdoodle8/mods/galacticraft/api/entity/ILandable.java index aecc645fc1..1334d37256 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/entity/ILandable.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/entity/ILandable.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.api.entity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; /** * An entity which requires a hook into landing pad events should implement this interface diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/event/wgen/GCCoreEventPopulate.java b/src/main/java/micdoodle8/mods/galacticraft/api/event/wgen/GCCoreEventPopulate.java index 1d7e87d11c..c343d006f0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/event/wgen/GCCoreEventPopulate.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/event/wgen/GCCoreEventPopulate.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.api.event.wgen; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.eventhandler.Event; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java index afb9f7301d..725f671853 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java @@ -24,7 +24,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java index d1d2e5e6fd..2d8e0a42ae 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java @@ -25,7 +25,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldServer; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/BiomeDecoratorSpace.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/BiomeDecoratorSpace.java index 738608db6d..5f2371c0ba 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/BiomeDecoratorSpace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/BiomeDecoratorSpace.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.api.prefab.world.gen; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java index e768dae7f6..7b096c14c2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java @@ -7,7 +7,7 @@ import net.minecraft.block.BlockFalling; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -176,7 +176,7 @@ public void replaceBlocksForBiome(int par1, int par2, ChunkPrimer primer, BiomeG // final Block var18 = arrayOfIDs[index]; Block var18 = primer.getBlockState(index).getBlock(); - if (Blocks.air == var18) + if (Blocks.AIR == var18) { var13 = -1; } @@ -188,7 +188,7 @@ else if (var18 == this.getStoneBlock().getBlock()) { if (var12 <= 0) { - var14 = Blocks.air; + var14 = Blocks.AIR; var14m = 0; var15 = this.getStoneBlock().getBlock(); var15m = this.getStoneBlock().getMetadata(); @@ -308,10 +308,10 @@ public void makeCrater(int craterX, int craterZ, int chunkX, int chunkZ, int siz int helper = 0; for (int y = 127; y > 0; y--) { - if (Blocks.air != primer.getBlockState(this.getIndex(x, y, z)).getBlock() && helper <= yDev) + if (Blocks.AIR != primer.getBlockState(this.getIndex(x, y, z)).getBlock() && helper <= yDev) { - primer.setBlockState(getIndex(x, y, z), Blocks.air.getDefaultState()); -// chunkArray[this.getIndex(x, y, z)] = Blocks.air; + primer.setBlockState(getIndex(x, y, z), Blocks.AIR.getDefaultState()); +// chunkArray[this.getIndex(x, y, z)] = Blocks.AIR; // metaArray[this.getIndex(x, y, z)] = 0; helper++; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldChunkManagerSpace.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldChunkManagerSpace.java index 7f29299559..b629d71a5a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldChunkManagerSpace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldChunkManagerSpace.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.api.prefab.world.gen; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.biome.BiomeCache; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManager; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldProviderSpace.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldProviderSpace.java index e2a141bd45..f625fc8c17 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldProviderSpace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldProviderSpace.java @@ -6,7 +6,7 @@ import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/recipe/ISchematicPage.java b/src/main/java/micdoodle8/mods/galacticraft/api/recipe/ISchematicPage.java index 7d3e7aad7e..28ccdf41f6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/recipe/ISchematicPage.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/recipe/ISchematicPage.java @@ -4,7 +4,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/tile/IFuelDock.java b/src/main/java/micdoodle8/mods/galacticraft/api/tile/IFuelDock.java index c6b12c3058..a8e71973e7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/tile/IFuelDock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/tile/IFuelDock.java @@ -1,7 +1,7 @@ package micdoodle8.mods.galacticraft.api.tile; import micdoodle8.mods.galacticraft.api.entity.IDockable; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import java.util.HashSet; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/tile/ILandingPadAttachable.java b/src/main/java/micdoodle8/mods/galacticraft/api/tile/ILandingPadAttachable.java index 90bef5ecdf..3a71e96075 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/tile/ILandingPadAttachable.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/tile/ILandingPadAttachable.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.api.tile; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; /** diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java index 55a11d0cc3..2d1508495c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java @@ -8,7 +8,7 @@ import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.util.ReportedException; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3Dim.java b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3Dim.java index e75fb2addb..928e254711 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3Dim.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3Dim.java @@ -10,7 +10,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.ReportedException; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java b/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java index aae18be48f..172b930e42 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java @@ -5,7 +5,10 @@ import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import org.apache.commons.lang3.builder.EqualsBuilder; @@ -64,7 +67,7 @@ public Vector3(TileEntity par1) this(par1.getPos()); } - public Vector3(Vec3 par1) + public Vector3(Vec3d par1) { this(par1.xCoord, par1.yCoord, par1.zCoord); @@ -430,7 +433,7 @@ public Vector3 toFloor() @SuppressWarnings("unchecked") public List getEntitiesWithin(World worldObj, Class par1Class) { - return worldObj.getEntitiesWithinAABB(par1Class, AxisAlignedBB.fromBounds(this.intX(), this.intY(), this.intZ(), this.intX() + 1, this.intY() + 1, this.intZ() + 1)); + return worldObj.getEntitiesWithinAABB(par1Class, new AxisAlignedBB(this.intX(), this.intY(), this.intZ(), this.intX() + 1, this.intY() + 1, this.intZ() + 1)); } /** @@ -713,7 +716,7 @@ public MovingObjectPosition rayTraceEntities(World world, Vector3 target) Vec3 reachPoint = new Vec3(startingPosition.xCoord + look.xCoord * reachDistance, startingPosition.yCoord + look.yCoord * reachDistance, startingPosition.zCoord + look.zCoord * reachDistance); double checkBorder = 1.1 * reachDistance; - AxisAlignedBB boxToScan = AxisAlignedBB.fromBounds(-checkBorder, -checkBorder, -checkBorder, checkBorder, checkBorder, checkBorder).offset(this.x, this.y, this.z); + AxisAlignedBB boxToScan = new AxisAlignedBB(-checkBorder, -checkBorder, -checkBorder, checkBorder, checkBorder, checkBorder).offset(this.x, this.y, this.z); List entitiesHit = world.getEntitiesWithinAABBExcludingEntity(null, boxToScan); double closestEntity = reachDistance; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/world/OxygenHooks.java b/src/main/java/micdoodle8/mods/galacticraft/api/world/OxygenHooks.java index 2baba4b1fb..3168b4305c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/world/OxygenHooks.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/world/OxygenHooks.java @@ -3,7 +3,7 @@ import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/GCBlocks.java b/src/main/java/micdoodle8/mods/galacticraft/core/GCBlocks.java index 42c7df0254..df42edef57 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/GCBlocks.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/GCBlocks.java @@ -105,8 +105,8 @@ public static void initBlocks() GCBlocks.nasaWorkbench = new BlockNasaWorkbench("rocket_workbench"); GCBlocks.fallenMeteor = new BlockFallenMeteor("fallen_meteor"); GCBlocks.basicBlock = new BlockBasic("basic_block_core"); - GCBlocks.airLockFrame = new BlockAirLockFrame("air_lock_frame"); - GCBlocks.airLockSeal = new BlockAirLockWall("air_lock_seal"); + GCBlocks.AIRLockFrame = new BlockAirLockFrame("air_lock_frame"); + GCBlocks.AIRLockSeal = new BlockAirLockWall("air_lock_seal"); GCBlocks.refinery = new BlockRefinery("refinery"); GCBlocks.oxygenCompressor = new BlockOxygenCompressor(false, "oxygen_compressor"); GCBlocks.fuelLoader = new BlockFuelLoader("fuel_loader"); @@ -139,7 +139,7 @@ public static void initBlocks() GCBlocks.wallGC = new BlockWallGC("wall_gc"); // Hide certain items from NEI - GCBlocks.hiddenBlocks.add(GCBlocks.airLockSeal); + GCBlocks.hiddenBlocks.add(GCBlocks.AIRLockSeal); GCBlocks.hiddenBlocks.add(GCBlocks.breatheableAir); GCBlocks.hiddenBlocks.add(GCBlocks.brightBreatheableAir); GCBlocks.hiddenBlocks.add(GCBlocks.brightAir); @@ -346,8 +346,8 @@ public static void registerBlocks() registerBlock(GCBlocks.cargoLoader, ItemBlockCargoLoader.class); registerBlock(GCBlocks.nasaWorkbench, ItemBlockDesc.class); registerBlock(GCBlocks.basicBlock, ItemBlockBase.class); - registerBlock(GCBlocks.airLockFrame, ItemBlockAirLock.class); - registerBlock(GCBlocks.airLockSeal, ItemBlockGC.class); + registerBlock(GCBlocks.AIRLockFrame, ItemBlockAirLock.class); + registerBlock(GCBlocks.AIRLockSeal, ItemBlockGC.class); registerBlock(GCBlocks.sealableBlock, ItemBlockEnclosed.class); registerBlock(GCBlocks.spaceStationBase, ItemBlockGC.class); registerBlock(GCBlocks.fakeBlock, ItemBlockDummy.class); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java b/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java index 6d8d0ee993..918b13808d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java @@ -25,7 +25,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Vec3; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java index b91e164d34..2a3895a436 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java @@ -6,8 +6,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.lang.reflect.Method; @@ -26,7 +27,7 @@ public BlockAdvanced(Material material) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { /** * Check if the player is holding a wrench or an electric item. If so, @@ -40,14 +41,14 @@ public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, { if (this.onSneakUseWrench(worldIn, pos, playerIn, side, hitX, hitY, hitZ)) { - playerIn.swingItem(); + playerIn.swingArm(hand); return true; } } if (this.onUseWrench(worldIn, pos, playerIn, side, hitX, hitY, hitZ)) { - playerIn.swingItem(); + playerIn.swingArm(hand); return true; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvancedTile.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvancedTile.java index b339d4b2ae..2374646f49 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvancedTile.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvancedTile.java @@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.Random; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java index f53b9eba0a..468f2a5df2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java @@ -6,10 +6,10 @@ import micdoodle8.mods.galacticraft.core.tile.TileEntityAirLockController; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; -import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; @@ -17,9 +17,9 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -64,10 +64,10 @@ public String getName() public BlockAirLockFrame(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setDefaultState(this.blockState.getBaseState().withProperty(AIR_LOCK_TYPE, EnumAirLockType.AIR_LOCK_FRAME)); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -118,7 +118,7 @@ public TileEntity createTileEntity(World world, IBlockState state) } @Override - public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side) + public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { return true; } @@ -169,9 +169,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, AIR_LOCK_TYPE); + return new BlockStateContainer(this, AIR_LOCK_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockWall.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockWall.java index 6aee4f3db7..9105dc72c3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockWall.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockWall.java @@ -5,20 +5,22 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockBreakable; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import javax.annotation.Nullable; import java.util.Random; public class BlockAirLockWall extends BlockBreakable implements IPartialSealableBlock, ISortableBlock @@ -47,43 +49,43 @@ public String getName() public BlockAirLockWall(String assetName) { - super(Material.iron, false); + super(Material.IRON, false); this.setTickRandomly(true); this.setHardness(1000.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } - @Override - public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) - { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getCollisionBoundingBox(worldIn, pos, state); - } - - @Override - public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) - { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getSelectedBoundingBox(worldIn, pos); - } - - @Override - public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) - { - switch (getConnection(worldIn, pos)) - { - case FLAT: - this.setBlockBounds(0.0F, 0.25F, 0.0F, 1.0F, 0.75F, 1.0F); - break; - case X: - this.setBlockBounds(0.25F, 0.0F, 0.0F, 0.75F, 1.0F, 1.0F); - break; - case Z: - this.setBlockBounds(0.0F, 0.0F, 0.25F, 1.0F, 1.0F, 0.75F); - break; - } - } +// @Override +// public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) +// { +// this.setBlockBoundsBasedOnState(worldIn, pos); +// return super.getCollisionBoundingBox(worldIn, pos, state); +// } +// +// @Override +// public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) +// { +// this.setBlockBoundsBasedOnState(worldIn, pos); +// return super.getSelectedBoundingBox(worldIn, pos); +// } +// +// @Override +// public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) +// { +// switch (getConnection(worldIn, pos)) +// { +// case FLAT: +// this.setBlockBounds(0.0F, 0.25F, 0.0F, 1.0F, 0.75F, 1.0F); +// break; +// case X: +// this.setBlockBounds(0.25F, 0.0F, 0.0F, 0.75F, 1.0F, 1.0F); +// break; +// case Z: +// this.setBlockBounds(0.0F, 0.0F, 0.25F, 1.0F, 1.0F, 0.75F); +// break; +// } +// } @Override public boolean isOpaqueCube() @@ -116,11 +118,11 @@ public boolean isSealed(World worldIn, BlockPos pos, EnumFacing direction) return true; } - @Override - public Item getItem(World world, BlockPos pos) - { - return null; - } +// @Override +// public Item getItem(World world, BlockPos pos) +// { +// return null; +// } @Override public EnumSortCategoryBlock getCategory(int meta) @@ -129,9 +131,9 @@ public EnumSortCategoryBlock getCategory(int meta) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, CONNECTION_TYPE); + return new BlockStateContainer(this, CONNECTION_TYPE); } @Override @@ -144,8 +146,8 @@ private EnumAirLockSealConnection getConnection(IBlockAccess worldIn, BlockPos p { EnumAirLockSealConnection connection; - Block frameID = GCBlocks.airLockFrame; - Block sealID = GCBlocks.airLockSeal; + Block frameID = GCBlocks.AIRLockFrame; + Block sealID = GCBlocks.AIRLockSeal; Block idXMin = worldIn.getBlockState(pos.offset(EnumFacing.WEST)).getBlock(); Block idXMax = worldIn.getBlockState(pos.offset(EnumFacing.WEST)).getBlock(); @@ -164,7 +166,7 @@ private EnumAirLockSealConnection getConnection(IBlockAccess worldIn, BlockPos p { Block blockID = worldIn.getBlockState(pos.offset(dir)).getBlock(); - if (blockID == GCBlocks.airLockFrame || blockID == GCBlocks.airLockSeal) + if (blockID == GCBlocks.AIRLockFrame || blockID == GCBlocks.AIRLockSeal) { adjacentCount++; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java index 3b10f4886c..ca0d20286e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java @@ -7,11 +7,11 @@ import micdoodle8.mods.galacticraft.core.tile.TileEntityAluminumWire; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; -import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -66,10 +66,10 @@ public String getName() public BlockAluminumWire(String assetName) { - super(Material.cloth); - this.setStepSound(Block.soundTypeCloth); + super(Material.CLOTH); + this.setSoundType(SoundType.CLOTH); this.setResistance(0.2F); - this.setBlockBounds(0.4F, 0.4F, 0.4F, 0.6F, 0.6F, 0.6F); +// this.setBlockBounds(0.4F, 0.4F, 0.4F, 0.6F, 0.6F, 0.6F); this.setHardness(0.075F); this.setUnlocalizedName(assetName); } @@ -179,9 +179,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, WIRE_TYPE, UP, DOWN, NORTH, EAST, SOUTH, WEST); + return new BlockStateContainer(this, WIRE_TYPE, UP, DOWN, NORTH, EAST, SOUTH, WEST); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java index d5aa6b5b51..0862d3cacd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java @@ -7,16 +7,16 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.IStringSerializable; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.Explosion; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -75,7 +75,7 @@ public String getName() public BlockBasic(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); this.blockResistance = 15F; this.setDefaultState(this.blockState.getBaseState().withProperty(BASIC_TYPE, EnumBlockBasic.ALUMINUM_DECORATION_BLOCK_0)); @@ -157,9 +157,9 @@ else if (metadata > 8) } @Override - public float getBlockHardness(World world, BlockPos pos) + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { - int metadata = getMetaFromState(world.getBlockState(pos)); + int metadata = getMetaFromState(blockState); if (metadata == 5 || metadata == 6) { @@ -204,7 +204,7 @@ public boolean isValueable(IBlockState state) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = getMetaFromState(world.getBlockState(pos)); @@ -213,7 +213,7 @@ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos return new ItemStack(Item.getItemFromBlock(this), 1, metadata); } - return super.getPickBlock(target, world, pos, player); + return super.getPickBlock(state, target, world, pos, player); } @Override @@ -229,9 +229,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, BASIC_TYPE); + return new BlockStateContainer(this, BASIC_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java index 0b5282ff46..2f525ba3c3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java @@ -20,14 +20,16 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IPlantable; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -87,7 +89,7 @@ public String getName() public BlockBasicMoon(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 1.5F; this.blockResistance = 2.5F; this.setDefaultState(this.blockState.getBaseState().withProperty(BASIC_TYPE_MOON, EnumBlockBasicMoon.ORE_COPPER_MOON)); @@ -124,7 +126,7 @@ else if (type == EnumBlockBasicMoon.ORE_COPPER_MOON || type == EnumBlockBasicMoo } @Override - public float getBlockHardness(World worldIn, BlockPos pos) + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { EnumBlockBasicMoon type = ((EnumBlockBasicMoon) worldIn.getBlockState(pos).getValue(BASIC_TYPE_MOON)); @@ -246,7 +248,7 @@ public boolean isValueable(IBlockState state) } @Override - public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) + public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) { EnumBlockBasicMoon type = ((EnumBlockBasicMoon) world.getBlockState(pos).getValue(BASIC_TYPE_MOON)); @@ -258,7 +260,6 @@ public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing dire plantable.getPlant(world, pos.offset(EnumFacing.UP)); return plantable instanceof BlockFlower; - } @Override @@ -288,7 +289,7 @@ public boolean isTerraformable(World world, BlockPos pos) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { // int metadata = getMetaFromState(world.getBlockState(pos)); // if (metadata == 2) @@ -296,7 +297,7 @@ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos // return new ItemStack(Item.getItemFromBlock(this), 1, metadata); // } - return super.getPickBlock(target, world, pos, player); + return super.getPickBlock(state, target, world, pos, player); } @Override @@ -359,9 +360,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, BASIC_TYPE_MOON); + return new BlockStateContainer(this, BASIC_TYPE_MOON); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBossSpawner.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBossSpawner.java index f80ebcd240..c907683678 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBossSpawner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBossSpawner.java @@ -11,10 +11,10 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -24,7 +24,7 @@ public class BlockBossSpawner extends Block implements ITileEntityProvider { public BlockBossSpawner(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 1000000.0F; this.blockResistance = 1000000.0F; this.setUnlocalizedName(assetName); @@ -51,7 +51,7 @@ public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFaci @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override @@ -67,7 +67,7 @@ public TileEntity createNewTileEntity(World worldIn, int meta) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBreathableAir.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBreathableAir.java index 2b5f420aa0..77b17b7a85 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBreathableAir.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBreathableAir.java @@ -4,12 +4,14 @@ import micdoodle8.mods.galacticraft.core.fluid.OxygenPressureProtocol; import net.minecraft.block.Block; import net.minecraft.block.BlockAir; +import net.minecraft.block.SoundType; +import net.minecraft.block.material.EnumPushReaction; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -22,7 +24,6 @@ public BlockBreathableAir(String assetName) this.setResistance(1000.0F); this.setHardness(0.0F); this.setUnlocalizedName(assetName); - this.setStepSound(new SoundType("sand", 0.0F, 1.0F)); } @Override @@ -38,15 +39,15 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) } @Override - public int getMobilityFlag() + public EnumPushReaction getMobilityFlag(IBlockState state) { - return 1; + return EnumPushReaction.DESTROY; } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override @@ -64,13 +65,14 @@ public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFaci } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - if (Blocks.air != neighborBlock && neighborBlock != GCBlocks.brightAir) + IBlockState neighborBlock = worldIn.getBlockState(neighborBlockPos); + if (Blocks.AIR != neighborBlock && neighborBlock != GCBlocks.brightAir) //Do nothing if an air neighbour was replaced (probably because replacing with breatheableAir) //but do a check if replacing breatheableAir as that could be dividing a sealed space { - OxygenPressureProtocol.onEdgeBlockUpdated(worldIn, pos); + OxygenPressureProtocol.onEdgeBlockUpdated((World) worldIn, pos); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightAir.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightAir.java index f5690a40d7..847d544aa3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightAir.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightAir.java @@ -1,11 +1,12 @@ package micdoodle8.mods.galacticraft.core.blocks; import net.minecraft.block.BlockAir; +import net.minecraft.block.material.EnumPushReaction; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -19,7 +20,6 @@ public BlockBrightAir(String assetName) this.setResistance(1000.0F); this.setHardness(0.0F); this.setUnlocalizedName(assetName); - this.setStepSound(new SoundType("sand", 0.0F, 1.0F)); this.setLightLevel(1.0F); } @@ -36,15 +36,15 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) } @Override - public int getMobilityFlag() + public EnumPushReaction getMobilityFlag(IBlockState state) { - return 1; + return EnumPushReaction.DESTROY; } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override @@ -54,8 +54,8 @@ public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFaci } @Override - public int getLightValue(IBlockAccess world, BlockPos pos) + public int getLightValue(IBlockState state) { - return 15 - getMetaFromState(world.getBlockState(pos)); + return 15 - getMetaFromState(state); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightBreathableAir.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightBreathableAir.java index 981b3c98e8..5357f6b53f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightBreathableAir.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightBreathableAir.java @@ -4,11 +4,12 @@ import micdoodle8.mods.galacticraft.core.fluid.OxygenPressureProtocol; import net.minecraft.block.Block; import net.minecraft.block.BlockAir; +import net.minecraft.block.material.EnumPushReaction; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -22,7 +23,6 @@ public BlockBrightBreathableAir(String assetName) this.setResistance(1000.0F); this.setHardness(0.0F); this.setUnlocalizedName(assetName); - this.setStepSound(new SoundType("sand", 0.0F, 1.0F)); this.setLightLevel(1.0F); } @@ -39,15 +39,15 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) } @Override - public int getMobilityFlag() + public EnumPushReaction getMobilityFlag(IBlockState state) { - return 1; + return EnumPushReaction.DESTROY; } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override @@ -65,13 +65,14 @@ public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFaci } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - if (Blocks.air != neighborBlock && neighborBlock != GCBlocks.brightAir) + IBlockState neighborBlock = worldIn.getBlockState(neighborBlockPos); + if (Blocks.AIR != neighborBlock && neighborBlock != GCBlocks.brightAir) //Do nothing if an air neighbour was replaced (probably because replacing with breatheableAir) //but do a check if replacing breatheableAir as that could be dividing a sealed space { - OxygenPressureProtocol.onEdgeBlockUpdated(worldIn, pos); + OxygenPressureProtocol.onEdgeBlockUpdated((World) worldIn, pos); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java index 157ccfd471..8c9bbfdd0d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java @@ -8,17 +8,20 @@ import micdoodle8.mods.galacticraft.core.util.RedstoneUtil; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyDirection; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -31,10 +34,10 @@ public class BlockBrightLamp extends BlockAdvanced implements IShiftDescription, public BlockBrightLamp(String assetName) { - super(Material.glass); + super(Material.GLASS); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.UP).withProperty(ACTIVE, true)); this.setHardness(0.1F); - this.setStepSound(Block.soundTypeWood); + this.setSoundType(SoundType.WOOD); this.setUnlocalizedName(assetName); this.setLightLevel(1.0F); } @@ -64,7 +67,7 @@ public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlock { double boundsMin = 0.2D; double boundsMax = 0.8D; - return AxisAlignedBB.fromBounds(pos.getX() + boundsMin, pos.getY() + boundsMin, pos.getZ() + boundsMin, pos.getX() + boundsMax, pos.getY() + boundsMax, pos.getZ() + boundsMax); + return new AxisAlignedBB(pos.getX() + boundsMin, pos.getY() + boundsMin, pos.getZ() + boundsMin, pos.getX() + boundsMax, pos.getY() + boundsMax, pos.getZ() + boundsMax); } @Override @@ -114,58 +117,55 @@ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, * neighbor blockID */ @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { + IBlockState state = worldIn.getBlockState(pos); EnumFacing side = (EnumFacing) state.getValue(FACING); BlockPos offsetPos = pos.offset(side); IBlockState state1 = worldIn.getBlockState(offsetPos); - if (state1.getBlock().isSideSolid(worldIn, offsetPos, EnumFacing.getFront(side.getIndex() ^ 1))) + if (state1.getBlock().isSideSolid(state1, worldIn, offsetPos, EnumFacing.getFront(side.getIndex() ^ 1))) { return; } - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); - } - - /** - * Ray traces through the blocks collision from start vector to end vector - * returning a ray trace hit. Args: world, x, y, z, startVec, endVec - */ - @Override - public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) - { - EnumFacing side = worldIn.getBlockState(pos).getValue(FACING); - float var8 = 0.3F; - - if (side == EnumFacing.WEST) - { - this.setBlockBounds(0.0F, 0.2F, 0.5F - var8, var8 * 2.0F, 0.8F, 0.5F + var8); - } - else if (side == EnumFacing.EAST) - { - this.setBlockBounds(1.0F - var8 * 2.0F, 0.2F, 0.5F - var8, 1.0F, 0.8F, 0.5F + var8); - } - else if (side == EnumFacing.NORTH) - { - this.setBlockBounds(0.5F - var8, 0.2F, 0.0F, 0.5F + var8, 0.8F, var8 * 2.0F); - } - else if (side == EnumFacing.SOUTH) - { - this.setBlockBounds(0.5F - var8, 0.2F, 1.0F - var8 * 2.0F, 0.5F + var8, 0.8F, 1.0F); - } - else if (side == EnumFacing.DOWN) - { - this.setBlockBounds(0.5F - var8, 0.0F, 0.5F - var8, 0.5F + var8, 0.6F, 0.5F + var8); - } - else - { - this.setBlockBounds(0.5F - var8, 0.4F, 0.5F - var8, 0.5F + var8, 1.0F, 0.5F + var8); - } - - return super.collisionRayTrace(worldIn, pos, start, end); - } + this.dropBlockAsItem((World) worldIn, pos, state, 0); + ((World) worldIn).setBlockToAir(pos); + } + +// @Override +// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +// { +// EnumFacing side = worldIn.getBlockState(pos).getValue(FACING); +// float var8 = 0.3F; +// +// if (side == EnumFacing.WEST) +// { +// this.setBlockBounds(0.0F, 0.2F, 0.5F - var8, var8 * 2.0F, 0.8F, 0.5F + var8); +// } +// else if (side == EnumFacing.EAST) +// { +// this.setBlockBounds(1.0F - var8 * 2.0F, 0.2F, 0.5F - var8, 1.0F, 0.8F, 0.5F + var8); +// } +// else if (side == EnumFacing.NORTH) +// { +// this.setBlockBounds(0.5F - var8, 0.2F, 0.0F, 0.5F + var8, 0.8F, var8 * 2.0F); +// } +// else if (side == EnumFacing.SOUTH) +// { +// this.setBlockBounds(0.5F - var8, 0.2F, 1.0F - var8 * 2.0F, 0.5F + var8, 0.8F, 1.0F); +// } +// else if (side == EnumFacing.DOWN) +// { +// this.setBlockBounds(0.5F - var8, 0.0F, 0.5F - var8, 0.5F + var8, 0.6F, 0.5F + var8); +// } +// else +// { +// this.setBlockBounds(0.5F - var8, 0.4F, 0.5F - var8, 0.5F + var8, 1.0F, 0.5F + var8); +// } +// +// return super.collisionRayTrace(worldIn, pos, start, end); +// } @Override public boolean onUseWrench(World world, BlockPos pos, EntityPlayer entityPlayer, EnumFacing side, float hitX, float hitY, float hitZ) @@ -225,9 +225,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, new IProperty[] { FACING, ACTIVE }); + return new BlockStateContainer(this, new IProperty[] { FACING, ACTIVE }); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCargoLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCargoLoader.java index c770927702..aac712bab6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCargoLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCargoLoader.java @@ -20,7 +20,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MathHelper; @@ -76,9 +76,9 @@ public String getName() public BlockCargoLoader(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -245,9 +245,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE); + return new BlockStateContainer(this, FACING, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java index 483cb5a0aa..6f6c65ac2d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java @@ -4,19 +4,21 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyInteger; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -30,61 +32,47 @@ public class BlockCheese extends Block implements IShiftDescription, ISortableBl public BlockCheese(String assetName) { - super(Material.cake); + super(Material.CAKE); this.setTickRandomly(true); this.disableStats(); this.setHardness(0.5F); this.setDefaultState(this.blockState.getBaseState().withProperty(BITES, Integer.valueOf(0))); - this.setStepSound(Block.soundTypeCloth); + this.setSoundType(SoundType.CLOTH); this.setUnlocalizedName(assetName); } - /** - * Updates the blocks bounds based on its current state. Args: world, x, y, - * z - */ - @Override - public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) - { - float f = 0.0625F; - float f1 = (float) (1 + ((Integer) worldIn.getBlockState(pos).getValue(BITES)).intValue() * 2) / 16.0F; - float f2 = 0.5F; - this.setBlockBounds(f1, 0.0F, f, 1.0F - f, f2, 1.0F - f); - } - - /** - * Sets the block's bounds for rendering it as an item - */ - @Override - public void setBlockBoundsForItemRender() - { - float f = 0.0625F; - float f1 = 0.5F; - this.setBlockBounds(f, 0.0F, f, 1.0F - f, f1, 1.0F - f); - } - - /** - * Returns a bounding box from the pool of bounding boxes (this means this - * box can change after the pool has been cleared to be reused) - */ - @Override - public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) - { - float f = 0.0625F; - float f1 = (float) (1 + ((Integer) state.getValue(BITES)).intValue() * 2) / 16.0F; - float f2 = 0.5F; - return new AxisAlignedBB((double) ((float) pos.getX() + f1), (double) pos.getY(), (double) ((float) pos.getZ() + f), (double) ((float) (pos.getX() + 1) - f), (double) ((float) pos.getY() + f2), (double) ((float) (pos.getZ() + 1) - f)); - } - - @Override - @SideOnly(Side.CLIENT) - /** - * Returns the bounding box of the wired rectangular prism to render. - */ - public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) - { - return this.getCollisionBoundingBox(worldIn, pos, worldIn.getBlockState(pos)); - } +// @Override +// public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) +// { +// float f = 0.0625F; +// float f1 = (float) (1 + ((Integer) worldIn.getBlockState(pos).getValue(BITES)).intValue() * 2) / 16.0F; +// float f2 = 0.5F; +// this.setBlockBounds(f1, 0.0F, f, 1.0F - f, f2, 1.0F - f); +// } +// +// @Override +// public void setBlockBoundsForItemRender() +// { +// float f = 0.0625F; +// float f1 = 0.5F; +// this.setBlockBounds(f, 0.0F, f, 1.0F - f, f1, 1.0F - f); +// } +// +// @Override +// public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) +// { +// float f = 0.0625F; +// float f1 = (float) (1 + ((Integer) state.getValue(BITES)).intValue() * 2) / 16.0F; +// float f2 = 0.5F; +// return new AxisAlignedBB((double) ((float) pos.getX() + f1), (double) pos.getY(), (double) ((float) pos.getZ() + f), (double) ((float) (pos.getX() + 1) - f), (double) ((float) pos.getY() + f2), (double) ((float) (pos.getZ() + 1) - f)); +// } +// +// @Override +// @SideOnly(Side.CLIENT) +// public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) +// { +// return this.getCollisionBoundingBox(worldIn, pos, worldIn.getBlockState(pos)); +// } @Override public boolean isFullCube() @@ -99,7 +87,7 @@ public boolean isOpaqueCube() } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { this.eatCheeseSlice(worldIn, pos, worldIn.getBlockState(pos), playerIn); return true; @@ -136,11 +124,11 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - if (!this.canBlockStay(worldIn, pos)) + if (!this.canBlockStay((World) worldIn, pos)) { - worldIn.setBlockToAir(pos); + ((World) worldIn).setBlockToAir(pos); } } @@ -158,7 +146,7 @@ public int quantityDropped(Random par1Random) @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override @@ -188,9 +176,9 @@ public Item getItem(World worldIn, BlockPos pos) @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override @@ -200,9 +188,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, new IProperty[] { BITES }); + return new BlockStateContainer(this, new IProperty[] { BITES }); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java index a8823eccd9..53229908a7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java @@ -15,7 +15,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; @@ -25,9 +25,9 @@ public class BlockDish extends BlockTileGC implements IShiftDescription, IPartia { public BlockDish(String assetName) { - super(Material.iron); + super(Material.IRON); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -133,7 +133,7 @@ public boolean onSneakMachineActivated(World world, BlockPos pos, EntityPlayer e } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = this.getDamageValue(world, pos); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDoubleSlabGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDoubleSlabGC.java index f099347f89..632e30f639 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDoubleSlabGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDoubleSlabGC.java @@ -6,7 +6,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -54,7 +54,7 @@ public int damageDropped(IBlockState state) @Override @SideOnly(Side.CLIENT) - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(this, 1, this.getMetaFromState(world.getBlockState(pos)) & 7); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java index 1d077041a7..894bc5face 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java @@ -21,9 +21,10 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -226,18 +227,20 @@ public int getDamageValue(World worldIn, BlockPos pos) } @Override - public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block block) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { + IBlockState state = worldIn.getBlockState(pos); + IBlockState neighborBlock = worldIn.getBlockState(neighborBlockPos); int metadata = state.getBlock().getMetaFromState(state); - final TileEntity tileEntity = world.getTileEntity(pos); + final TileEntity tileEntity = worldIn.getTileEntity(pos); if (metadata == EnumEnclosedBlockType.TE_CONDUIT.getMeta()) { - super.onNeighborBlockChange(world, pos, state, block); + super.onNeighborChange(worldIn, pos, neighborBlockPos); } else if (metadata == EnumEnclosedBlockType.OXYGEN_PIPE.getMeta()) { - super.onNeighborBlockChange(world, pos, state, block); + super.onNeighborChange(worldIn, pos, neighborBlockPos); if (tileEntity instanceof INetworkConnection) { @@ -246,12 +249,12 @@ else if (metadata == EnumEnclosedBlockType.OXYGEN_PIPE.getMeta()) } else if (metadata <= 6) { - super.onNeighborBlockChange(world, pos, state, block); + super.onNeighborChange(worldIn, pos, neighborBlockPos); if (CompatibilityManager.isIc2Loaded() && tileEntity != null) { try { - onBlockNeighbourChangeIC2.invoke(tileEntity, block); + onBlockNeighbourChangeIC2.invoke(tileEntity, neighborBlock.getBlock()); return; } catch (Exception e) @@ -268,7 +271,7 @@ else if (metadata <= 12) { try { - blockPipeBC.onNeighborBlockChange(world, pos, state, block); + blockPipeBC.onNeighborChange(worldIn, pos, neighborBlockPos); } catch (Exception e) { @@ -278,19 +281,19 @@ else if (metadata <= 12) } } - super.onNeighborBlockChange(world, pos, state, block); + super.onNeighborChange(worldIn, pos, neighborBlockPos); } else if (metadata <= EnumEnclosedBlockType.ME_CABLE.getMeta()) { - super.onNeighborBlockChange(world, pos, state, block); + super.onNeighborChange(worldIn, pos, neighborBlockPos); if (CompatibilityManager.isAppEngLoaded()) { - world.markBlockForUpdate(pos); +// worldIn.markBlockForUpdate(pos); TODO } } else if (metadata <= EnumEnclosedBlockType.ALUMINUM_WIRE.getMeta()) { - super.onNeighborBlockChange(world, pos, state, block); + super.onNeighborChange(worldIn, pos, neighborBlockPos); if (tileEntity instanceof IConductor) { ((IConductor) tileEntity).refresh(); @@ -298,7 +301,7 @@ else if (metadata <= EnumEnclosedBlockType.ALUMINUM_WIRE.getMeta()) } else if (metadata <= EnumEnclosedBlockType.ALUMINUM_WIRE_HEAVY.getMeta()) { - super.onNeighborBlockChange(world, pos, state, block); + super.onNeighborChange(worldIn, pos, neighborBlockPos); if (tileEntity instanceof IConductor) { ((IConductor) tileEntity).refresh(); @@ -493,9 +496,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, TYPE); + return new BlockStateContainer(this, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFallenMeteor.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFallenMeteor.java index 7f749fbfe0..d6ce03be66 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFallenMeteor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFallenMeteor.java @@ -19,7 +19,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumParticleTypes; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -30,7 +30,7 @@ public class BlockFallenMeteor extends Block implements ITileEntityProvider, ISh { public BlockFallenMeteor(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setBlockBounds(0.2F, 0.2F, 0.2F, 0.8F, 0.8F, 0.8F); this.setHardness(50.0F); this.setStepSound(Block.soundTypeStone); @@ -117,9 +117,9 @@ public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + ((World)worldIn).scheduleUpdate(pos, this, this.tickRate((World) worldIn)); } @Override @@ -136,7 +136,7 @@ private void tryToFall(World world, BlockPos pos, IBlockState state) if (this.canFallBelow(world, pos.down()) && pos.getY() >= 0) { int prevHeatLevel = ((TileEntityFallenMeteor) world.getTileEntity(pos)).getHeatLevel(); - world.setBlockState(pos, Blocks.air.getDefaultState(), 3); + world.setBlockState(pos, Blocks.AIR.getDefaultState(), 3); BlockPos blockpos1; for (blockpos1 = pos.down(); this.canFallBelow(world, blockpos1) && blockpos1.getY() > 0; blockpos1 = blockpos1.down()) {} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidGC.java index b599c41384..ab718ca0a3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidGC.java @@ -8,7 +8,9 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -39,14 +41,14 @@ public BlockFluidGC(Fluid fluid, String assetName) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote && this.fluidName.startsWith("oil") && playerIn instanceof EntityPlayerSP) { ClientProxyCore.playerClientHandler.onBuild(7, (EntityPlayerSP) playerIn); } - return super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ); + return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidPipe.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidPipe.java index 821e7c04ba..2e726fa184 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidPipe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidPipe.java @@ -23,7 +23,10 @@ import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.NetworkRegistry; @@ -43,7 +46,7 @@ public class BlockFluidPipe extends BlockTransmitter implements ITileEntityProvi public BlockFluidPipe(String assetName, EnumPipeMode mode) { - super(Material.glass); + super(Material.GLASS); this.setHardness(0.3F); this.setStepSound(Block.soundTypeGlass); this.setDefaultState(this.blockState.getBaseState().withProperty(COLOR, EnumDyeColor.WHITE)); @@ -84,10 +87,10 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); - worldIn.notifyLightSet(pos); + super.onNeighborChange(worldIn, pos, neighborBlockPos); + ((World) worldIn).notifyLightSet(pos); } @Override @@ -114,11 +117,11 @@ public boolean onUseWrench(World world, BlockPos pos, EntityPlayer entityPlayer, } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { final TileEntityFluidPipe tileEntity = (TileEntityFluidPipe) worldIn.getTileEntity(pos); - if (super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ)) + if (super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ)) { return true; } @@ -223,9 +226,9 @@ public String getShiftDescription(int meta) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, COLOR, UP, DOWN, NORTH, EAST, SOUTH, WEST); + return new BlockStateContainer(this, COLOR, UP, DOWN, NORTH, EAST, SOUTH, WEST); } @Override @@ -236,9 +239,9 @@ public boolean showDescription(int meta) @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidTank.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidTank.java index 4d890077d5..09c4b5d340 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidTank.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidTank.java @@ -16,10 +16,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidUtil; @@ -36,7 +37,7 @@ public class BlockFluidTank extends Block implements IShiftDescription, ISortabl public BlockFluidTank(String assetName) { - super(Material.glass); + super(Material.GLASS); this.setHardness(3.0F); this.setResistance(8.0F); this.setUnlocalizedName(assetName); @@ -62,9 +63,9 @@ public CreativeTabs getCreativeTabToDisplayOn() @SideOnly(Side.CLIENT) @Override - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override @@ -98,9 +99,9 @@ public boolean showDescription(int meta) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, UP, DOWN); + return new BlockStateContainer(this, UP, DOWN); } @Override @@ -157,9 +158,9 @@ public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { - if (super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ)) + if (super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ)) { return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFuelLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFuelLoader.java index 85dde01a05..4b3a2451c6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFuelLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFuelLoader.java @@ -17,7 +17,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -28,9 +28,9 @@ public class BlockFuelLoader extends BlockAdvancedTile implements IShiftDescript public BlockFuelLoader(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -137,9 +137,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java index a0637ff776..de80b628fb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java @@ -5,14 +5,18 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -25,12 +29,12 @@ public class BlockGlowstoneTorch extends Block implements IShiftDescription, ISo public BlockGlowstoneTorch(String assetName) { - super(Material.circuits); + super(Material.CIRCUITS); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.UP)); this.setTickRandomly(true); this.setUnlocalizedName(assetName); this.setLightLevel(0.85F); - this.setStepSound(Block.soundTypeWood); + this.setSoundType(SoundType.WOOD); } @Override @@ -119,14 +123,16 @@ public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - this.onNeighborChangeInternal(worldIn, pos, state); + this.onNeighborChangeInternal(worldIn, pos, neighborBlockPos); } - protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state) + public boolean onNeighborChangeInternal(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - if (!this.checkForDrop(worldIn, pos, state)) + IBlockState state = worldIn.getBlockState(pos); + + if (!this.checkForDrop((World) worldIn, pos, state)) { return true; } @@ -141,15 +147,15 @@ protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockSt { flag = true; } - else if (enumfacing$axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1))) + else if (enumfacing$axis.isVertical() && !this.canPlaceOn((World) worldIn, pos.offset(enumfacing1))) { flag = true; } if (flag) { - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); + this.dropBlockAsItem((World) worldIn, pos, state, 0); + ((World) worldIn).setBlockToAir(pos); return true; } else @@ -188,36 +194,36 @@ public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random ra } } - @Override - public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) - { - int l = getMetaFromState(worldIn.getBlockState(pos)) & 7; - float f = 0.15F; - - if (l == 1) - { - this.setBlockBounds(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f); - } - else if (l == 2) - { - this.setBlockBounds(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f); - } - else if (l == 3) - { - this.setBlockBounds(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F); - } - else if (l == 4) - { - this.setBlockBounds(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F); - } - else - { - f = 0.1F; - this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f); - } - - return super.collisionRayTrace(worldIn, pos, start, end); - } +// @Override +// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +// { +// int l = getMetaFromState(worldIn.getBlockState(pos)) & 7; +// float f = 0.15F; +// +// if (l == 1) +// { +// this.setBlockBounds(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f); +// } +// else if (l == 2) +// { +// this.setBlockBounds(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f); +// } +// else if (l == 3) +// { +// this.setBlockBounds(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F); +// } +// else if (l == 4) +// { +// this.setBlockBounds(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F); +// } +// else +// { +// f = 0.1F; +// this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f); +// } +// +// return super.collisionRayTrace(worldIn, pos, start, end); +// } @Override public IBlockState getStateFromMeta(int meta) @@ -276,15 +282,15 @@ public int getMetaFromState(IBlockState state) @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, new IProperty[] { FACING }); + return new BlockStateContainer(this, new IProperty[] { FACING }); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPad.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPad.java index d8a41c7c12..37cdb9cdbf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPad.java @@ -17,7 +17,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.world.World; @@ -63,11 +63,11 @@ public String getName() public BlockLandingPad(String assetName) { - super(Material.iron); + super(Material.IRON); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 3 / 16.0F, 1.0F); this.setHardness(1.0F); this.setResistance(10.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -191,9 +191,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, PAD_TYPE); + return new BlockStateContainer(this, PAD_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPadFull.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPadFull.java index 205a642a5b..72cb5e952f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPadFull.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPadFull.java @@ -5,16 +5,17 @@ import micdoodle8.mods.galacticraft.core.tile.IMultiBlock; import micdoodle8.mods.galacticraft.core.tile.TileEntityBuggyFueler; import micdoodle8.mods.galacticraft.core.tile.TileEntityLandingPad; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -59,10 +60,10 @@ public String getName() public BlockLandingPadFull(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); this.setResistance(10.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); this.maxY = 0.25F; } @@ -104,13 +105,13 @@ public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlock switch (getMetaFromState(state)) { case 0: - return AxisAlignedBB.fromBounds(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, + return new AxisAlignedBB(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, pos.getX() + this.maxX, pos.getY() + this.maxY, pos.getZ() + this.maxZ); // case 2: -// return AxisAlignedBB.fromBounds(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, +// return new AxisAlignedBB(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, // pos.getX() + this.maxX, pos.getY() + this.maxY, pos.getZ() + this.maxZ); default: - return AxisAlignedBB.fromBounds(pos.getX() + 0.0D, pos.getY() + 0.0D, pos.getZ() + 0.0D, + return new AxisAlignedBB(pos.getX() + 0.0D, pos.getY() + 0.0D, pos.getZ() + 0.0D, pos.getX() + 1.0D, pos.getY() + 0.2D, pos.getZ() + 1.0D); } } @@ -122,13 +123,13 @@ public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) switch (getMetaFromState(worldIn.getBlockState(pos))) { case 0: - return AxisAlignedBB.fromBounds(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, + return new AxisAlignedBB(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, pos.getX() + this.maxX, pos.getY() + this.maxY, pos.getZ() + this.maxZ); // case 2: -// return AxisAlignedBB.fromBounds(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, +// return new AxisAlignedBB(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, // pos.getX() + this.maxX, pos.getY() + this.maxY, pos.getZ() + this.maxZ); default: - return AxisAlignedBB.fromBounds(pos.getX() + 0.0D, pos.getY() + 0.0D, pos.getZ() + 0.0D, + return new AxisAlignedBB(pos.getX() + 0.0D, pos.getY() + 0.0D, pos.getZ() + 0.0D, pos.getX() + 1.0D, pos.getY() + 0.2D, pos.getZ() + 1.0D); } } @@ -174,9 +175,9 @@ public TileEntity createTileEntity(World world, IBlockState state) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - worldIn.markBlockForUpdate(pos); + ((World) worldIn).markBlockForUpdate(pos); } @Override @@ -205,7 +206,7 @@ public boolean isSealed(World worldIn, BlockPos pos, EnumFacing direction) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = getMetaFromState(world.getBlockState(pos)); return new ItemStack(Item.getItemFromBlock(GCBlocks.landingPad), 1, metadata); @@ -224,8 +225,8 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, PAD_TYPE); + return new BlockStateContainer(this, PAD_TYPE); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine.java index 2f8ca3caf9..7b1b5befc6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine.java @@ -76,7 +76,7 @@ public BlockMachine(String assetName) { super(GCBlocks.machine); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -229,7 +229,7 @@ public int damageDropped(IBlockState state) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = this.getDamageValue(world, pos); @@ -270,9 +270,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE); + return new BlockStateContainer(this, FACING, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine2.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine2.java index b00b34f5e5..a9cfd59df0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine2.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine2.java @@ -72,7 +72,7 @@ public BlockMachine2(String assetName) { super(GCBlocks.machine); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -255,7 +255,7 @@ else if (metadata >= BlockMachine2.ELECTRIC_COMPRESSOR_METADATA) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = this.getDamageValue(world, pos); @@ -298,9 +298,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE); + return new BlockStateContainer(this, FACING, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachineTiered.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachineTiered.java index 9a543a9c6b..dc89426f9c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachineTiered.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachineTiered.java @@ -72,7 +72,7 @@ public BlockMachineTiered(String assetName) { super(GCBlocks.machine); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -194,7 +194,7 @@ public int damageDropped(IBlockState state) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = this.getDamageValue(world, pos); @@ -236,9 +236,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE, FILL_VALUE); + return new BlockStateContainer(this, FACING, TYPE, FILL_VALUE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java index 2b4ebbe6e1..648c347d54 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java @@ -17,7 +17,10 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -73,7 +76,7 @@ public BlockMulti(String assetName) { super(GCBlocks.machine); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); this.setResistance(1000000000000000.0F); } @@ -158,7 +161,7 @@ public void makeFakeBlock(World worldObj, BlockPos pos, BlockPos mainBlock, int } @Override - public float getBlockHardness(World worldIn, BlockPos pos) + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { TileEntity tileEntity = worldIn.getTileEntity(pos); @@ -209,7 +212,7 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) } @Override - public boolean onMachineActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onMachineActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntityMulti tileEntity = (TileEntityMulti) worldIn.getTileEntity(pos); return tileEntity.onBlockActivated(worldIn, pos, playerIn); @@ -250,7 +253,7 @@ public TileEntity createNewTileEntity(World var1, int meta) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof TileEntityMulti) @@ -261,7 +264,7 @@ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos { Block mainBlockID = world.getBlockState(mainBlockPosition).getBlock(); - if (Blocks.air != mainBlockID) + if (Blocks.AIR != mainBlockID) { return mainBlockID.getPickBlock(target, world, mainBlockPosition, player); } @@ -360,9 +363,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, MULTI_TYPE, RENDER_TYPE); + return new BlockStateContainer(this, MULTI_TYPE, RENDER_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java index ac2c2d545b..4487bdc42b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java @@ -23,7 +23,9 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -35,10 +37,10 @@ public class BlockNasaWorkbench extends BlockContainer implements ITileEntityPro { public BlockNasaWorkbench(String assetName) { - super(Material.iron); + super(Material.IRON); this.setBlockBounds(-0.3F, 0.0F, -0.3F, 1.3F, 0.5F, 1.3F); this.setHardness(2.5F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -63,7 +65,7 @@ public boolean isFullCube() @Override public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) { - return AxisAlignedBB.fromBounds((double) pos.getX() + -0.0F, (double) pos.getY() + 0.0F, (double) pos.getZ() + -0.0F, (double) pos.getX() + 1.0F, (double) pos.getY() + 1.4F, (double) pos.getZ() + 1.0F); + return new AxisAlignedBB((double) pos.getX() + -0.0F, (double) pos.getY() + 0.0F, (double) pos.getZ() + -0.0F, (double) pos.getX() + 1.0F, (double) pos.getY() + 1.4F, (double) pos.getZ() + 1.0F); } @SideOnly(Side.CLIENT) @@ -214,7 +216,7 @@ else if (y != 0 && y != 3) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { playerIn.openGui(GalacticraftCore.instance, SchematicRegistry.getMatchingRecipeForID(0).getGuiID(), worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCollector.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCollector.java index 3f9ca7c39c..417f2e8954 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCollector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCollector.java @@ -17,7 +17,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -32,9 +32,9 @@ public class BlockOxygenCollector extends BlockAdvancedTile implements IShiftDes public BlockOxygenCollector(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -149,9 +149,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCompressor.java index cc56211605..6cf34d69a2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCompressor.java @@ -65,9 +65,9 @@ public String getName() public BlockOxygenCompressor(boolean isActive, String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -163,7 +163,7 @@ else if (metadata >= BlockOxygenCompressor.OXYGEN_COMPRESSOR_METADATA) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = this.getDamageValue(world, pos); return new ItemStack(this, 1, metadata); @@ -203,9 +203,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE); + return new BlockStateContainer(this, FACING, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDetector.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDetector.java index ef389ea5a3..fdaa0ac5e1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDetector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDetector.java @@ -12,7 +12,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -21,9 +21,9 @@ public class BlockOxygenDetector extends BlockContainer implements ITileEntityPr { public BlockOxygenDetector(String assetName) { - super(Material.iron); + super(Material.IRON); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDistributor.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDistributor.java index 28b1f72bba..17cb0188d1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDistributor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDistributor.java @@ -16,7 +16,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; @@ -30,9 +30,9 @@ public class BlockOxygenDistributor extends BlockAdvancedTile implements IShiftD public BlockOxygenDistributor(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } @@ -125,9 +125,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenSealer.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenSealer.java index e42a0ff974..2e1a454774 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenSealer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenSealer.java @@ -16,7 +16,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -27,9 +27,9 @@ public class BlockOxygenSealer extends BlockAdvancedTile implements IShiftDescri public BlockOxygenSealer(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -128,9 +128,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java index 219b2edebf..51a5f15e12 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java @@ -24,8 +24,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -43,7 +44,7 @@ public BlockParaChest(String assetName) { super(Material.wood); this.setHardness(3.0F); - this.setStepSound(Block.soundTypeWood); + this.setSoundType(SoundType.WOOD); this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); this.setUnlocalizedName(assetName); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); @@ -86,7 +87,7 @@ public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { @@ -112,7 +113,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { TileEntityParaChest tileentitychest = (TileEntityParaChest) worldIn.getTileEntity(pos); @@ -193,7 +194,7 @@ else if (BlockParaChest.isOcelotBlockingChest(par1World, pos)) public static boolean isOcelotBlockingChest(World par0World, BlockPos pos) { - Iterator iterator = par0World.getEntitiesWithinAABB(EntityOcelot.class, AxisAlignedBB.fromBounds(pos.getX(), pos.getY() + 1, pos.getZ(), pos.getX() + 1, pos.getY() + 2, pos.getZ() + 1)).iterator(); + Iterator iterator = par0World.getEntitiesWithinAABB(EntityOcelot.class, new AxisAlignedBB(pos.getX(), pos.getY() + 1, pos.getZ(), pos.getX() + 1, pos.getY() + 2, pos.getZ() + 1)).iterator(); EntityOcelot entityocelot; do @@ -248,9 +249,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, COLOR, FACING); + return new BlockStateContainer(this, COLOR, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockRefinery.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockRefinery.java index 7582ccab7b..05fab63e68 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockRefinery.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockRefinery.java @@ -18,7 +18,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.MathHelper; @@ -36,9 +36,9 @@ public class BlockRefinery extends BlockAdvancedTile implements IShiftDescriptio public BlockRefinery(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -188,9 +188,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java index 14e53a74c5..907fd0ee24 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java @@ -19,6 +19,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -33,7 +34,7 @@ public class BlockScreen extends BlockAdvanced implements IShiftDescription, IPa //Metadata: 0-5 = direction of screen back; bit 3 = reserved for future use public BlockScreen(String assetName) { - super(Material.circuits); + super(Material.CIRCUITS); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(LEFT, false).withProperty(RIGHT, false).withProperty(UP, false).withProperty(DOWN, false)); this.setHardness(0.1F); this.setStepSound(Block.soundTypeGlass); @@ -106,7 +107,7 @@ public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityScreen) @@ -179,9 +180,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, LEFT, RIGHT, UP, DOWN); + return new BlockStateContainer(this, FACING, LEFT, RIGHT, UP, DOWN); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java index 07869439cc..9af929b41e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java @@ -14,7 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.Explosion; @@ -96,7 +96,7 @@ public float getExplosionResistance(World world, BlockPos pos, Entity exploder, } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(this, 1, this.getMetaFromState(world.getBlockState(pos)) & 7); } @@ -152,7 +152,7 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { return this.isDouble() ? new BlockState(this, VARIANT) : new BlockState(this, HALF, VARIANT); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSolar.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSolar.java index 2d76de0aac..89a4ad5906 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSolar.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSolar.java @@ -67,9 +67,9 @@ public String getName() public BlockSolar(String assetName) { - super(Material.iron); + super(Material.IRON); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -201,7 +201,7 @@ public int damageDropped(IBlockState state) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = this.getDamageValue(world, pos); @@ -273,9 +273,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE); + return new BlockStateContainer(this, FACING, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpaceStationBase.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpaceStationBase.java index 4be2b0b942..51bbe0d189 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpaceStationBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpaceStationBase.java @@ -10,7 +10,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; @@ -19,13 +19,13 @@ public class BlockSpaceStationBase extends BlockContainer implements ITileEntity public BlockSpaceStationBase(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(-1); this.setUnlocalizedName(assetName); } @Override - public float getBlockHardness(World worldIn, BlockPos pos) + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { return -1.0F; } @@ -81,7 +81,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java index a296e40d3e..f2fa550636 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java @@ -17,6 +17,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -29,9 +31,9 @@ public class BlockSpinThruster extends BlockAdvanced implements IShiftDescriptio public BlockSpinThruster(String assetName) { - super(Material.circuits); + super(Material.CIRCUITS); this.setHardness(0.1F); - this.setStepSound(Block.soundTypeWood); + this.setSoundType(SoundType.WOOD); this.setUnlocalizedName(assetName); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } @@ -120,45 +122,46 @@ public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - if (this.dropTorchIfCantStay(worldIn, pos)) + IBlockState state = worldIn.getBlockState(pos); + if (this.dropTorchIfCantStay((World) worldIn, pos)) { final int var6 = getMetaFromState(state) & 7; boolean var7 = false; - if (!BlockSpinThruster.isBlockSolidOnSide(worldIn, pos.offset(EnumFacing.WEST), EnumFacing.EAST) && var6 == 1) + if (!BlockSpinThruster.isBlockSolidOnSide((World) worldIn, pos.offset(EnumFacing.WEST), EnumFacing.EAST) && var6 == 1) { var7 = true; } - if (!BlockSpinThruster.isBlockSolidOnSide(worldIn, pos.offset(EnumFacing.EAST), EnumFacing.WEST) && var6 == 2) + if (!BlockSpinThruster.isBlockSolidOnSide((World) worldIn, pos.offset(EnumFacing.EAST), EnumFacing.WEST) && var6 == 2) { var7 = true; } - if (!BlockSpinThruster.isBlockSolidOnSide(worldIn, pos.offset(EnumFacing.NORTH), EnumFacing.SOUTH) && var6 == 3) + if (!BlockSpinThruster.isBlockSolidOnSide((World) worldIn, pos.offset(EnumFacing.NORTH), EnumFacing.SOUTH) && var6 == 3) { var7 = true; } - if (!BlockSpinThruster.isBlockSolidOnSide(worldIn, pos.offset(EnumFacing.SOUTH), EnumFacing.NORTH) && var6 == 4) + if (!BlockSpinThruster.isBlockSolidOnSide((World) worldIn, pos.offset(EnumFacing.SOUTH), EnumFacing.NORTH) && var6 == 4) { var7 = true; } if (var7) { - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); + this.dropBlockAsItem((World) worldIn, pos, state, 0); + ((World)worldIn).setBlockToAir(pos); } } - if (!worldIn.isRemote) + if (!((World) worldIn).isRemote) { - if (worldIn.provider instanceof WorldProviderZeroGravity) + if (((World) worldIn).provider instanceof WorldProviderZeroGravity) { - ((WorldProviderZeroGravity) worldIn.provider).getSpinManager().refresh(pos, true); + ((WorldProviderZeroGravity) ((World) worldIn).provider).getSpinManager().refresh(pos, true); } } } @@ -323,9 +326,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockT1TreasureChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockT1TreasureChest.java index 6ce16be44f..8c34d32017 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockT1TreasureChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockT1TreasureChest.java @@ -21,8 +21,9 @@ import net.minecraft.inventory.InventoryHelper; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; @@ -410,9 +411,9 @@ private boolean isDoubleChest(World worldIn, BlockPos pos) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + super.onNeighborChange(worldIn, pos, neighborBlockPos); TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityTreasureChest) @@ -436,7 +437,7 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { @@ -537,9 +538,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java index ef80d15dda..c4a9472116 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java @@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; @@ -30,9 +30,9 @@ public class BlockTelemetry extends BlockAdvancedTile implements IShiftDescripti //Metadata: 0-3 = orientation; bits 2,3 = reserved for future use public BlockTelemetry(String assetName) { - super(Material.iron); + super(Material.IRON); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTileGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTileGC.java index 854fd5c532..33bc441a00 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTileGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTileGC.java @@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.Random; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java index d6280eb56f..26bc1dd369 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java @@ -15,8 +15,8 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -39,16 +39,14 @@ public BlockTransmitter(Material material) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + super.onNeighborChange(worldIn, pos, neighborBlockPos); TileEntity tile = worldIn.getTileEntity(pos); this.setBlockBoundsBasedOnState(worldIn, pos); - GalacticraftCore.packetPipeline.sendToAllAround(new PacketSimple(EnumSimplePacket.C_UPDATE_WIRE_BOUNDS, worldIn.provider.getDimensionId(), new Object[] { pos }), new NetworkRegistry.TargetPoint(worldIn.provider.getDimensionId(), pos.getX(), pos.getY(), pos.getZ(), 10.0D)); - - TileEntity tileEntity = worldIn.getTileEntity(pos); + GalacticraftCore.packetPipeline.sendToAllAround(new PacketSimple(EnumSimplePacket.C_UPDATE_WIRE_BOUNDS, ((World) worldIn).provider.getDimension(), new Object[] { pos }), new NetworkRegistry.TargetPoint(((World) worldIn).provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 10.0D)); if (tile instanceof INetworkConnection) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java index cb543c4826..d890e4bc3b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java @@ -14,6 +14,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -34,12 +35,12 @@ public class BlockUnlitTorch extends Block implements IOxygenReliantBlock public BlockUnlitTorch(boolean lit, String assetName) { - super(Material.circuits); + super(Material.CIRCUITS); this.setTickRandomly(true); this.lit = lit; this.setLightLevel(lit ? 0.9375F : 0.2F); this.setHardness(0.0F); - this.setStepSound(Block.soundTypeWood); + this.setSoundType(SoundType.WOOD); this.setUnlocalizedName(assetName); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.UP)); } @@ -203,14 +204,15 @@ public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) * neighbor blockID */ @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - this.onNeighborChangeInternal(worldIn, pos, state); + this.onNeighborChangeInternal(worldIn, pos, neighborBlockPos); } - protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state) + public boolean onNeighborChangeInternal(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - if (!this.checkForDrop(worldIn, pos, state)) + IBlockState state = worldIn.getBlockState(pos); + if (!this.checkForDrop((World) worldIn, pos, state)) { return true; } @@ -225,20 +227,20 @@ protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockSt { flag = true; } - else if (enumfacingAxis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1))) + else if (enumfacingAxis.isVertical() && !this.canPlaceOn((World) worldIn, pos.offset(enumfacing1))) { flag = true; } if (flag) { - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); + this.dropBlockAsItem((World) worldIn, pos, state, 0); + ((World) worldIn).setBlockToAir(pos); return true; } else { - this.checkOxygen(worldIn, pos); + this.checkOxygen((World) worldIn, pos); return false; } } @@ -416,15 +418,15 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, new IProperty[] { FACING }); + return new BlockStateContainer(this, new IProperty[] { FACING }); } @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java index f051e2da9a..147767a3e8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java @@ -14,8 +14,8 @@ import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.world.IBlockAccess; @@ -36,7 +36,7 @@ public class BlockWallGC extends Block /* Do not extend BlockWall */ implements public BlockWallGC(String name) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.5F); this.setResistance(2.5F); this.setDefaultState(this.getDefaultState().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)).withProperty(VARIANT, BlockType.TIN_1_WALL)); @@ -174,9 +174,9 @@ public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPo } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, new IProperty[] { UP, NORTH, EAST, WEST, SOUTH, VARIANT }); + return new BlockStateContainer(this, new IProperty[] { UP, NORTH, EAST, WEST, SOUTH, VARIANT }); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/EntityFXOilDrip.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/EntityFXOilDrip.java index fc6e9f7786..199ca31cc6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/EntityFXOilDrip.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/EntityFXOilDrip.java @@ -4,7 +4,7 @@ import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.particle.EntityFX; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java index 09da1bb22e..2bf05d2629 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java @@ -21,7 +21,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenSealer.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenSealer.java index 9347f12a74..ff5e5b9fdc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenSealer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenSealer.java @@ -17,7 +17,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicBuggy.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicBuggy.java index 278a50ab69..f9b8e03fb5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicBuggy.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicBuggy.java @@ -7,7 +7,7 @@ import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.FMLClientHandler; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicInput.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicInput.java index 56b4c473ab..c2054a3e91 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicInput.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicInput.java @@ -11,7 +11,7 @@ import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicTier1Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicTier1Rocket.java index 783c4984c2..2daafc3728 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicTier1Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicTier1Rocket.java @@ -7,7 +7,7 @@ import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/model/ModelBipedGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/model/ModelBipedGC.java index 057f5f7993..71209117ac 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/model/ModelBipedGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/model/ModelBipedGC.java @@ -15,7 +15,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.MathHelper; import java.util.List; @@ -118,7 +118,7 @@ public static void setRotationAngles(ModelBiped biped, float par1, float par2, f } } - final List l = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, AxisAlignedBB.fromBounds(player.posX - 20, 0, player.posZ - 20, player.posX + 20, 200, player.posZ + 20)); + final List l = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, new AxisAlignedBB(player.posX - 20, 0, player.posZ - 20, player.posX + 20, 200, player.posZ + 20)); for (int i = 0; i < l.size(); i++) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java index 1d8dcfcbb9..5f4f3baa60 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java @@ -9,7 +9,7 @@ import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import java.util.List; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCInv.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCInv.java index a298d1b1cf..52fcc8b31a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCInv.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCInv.java @@ -12,7 +12,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.*; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandPlanetTeleport.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandPlanetTeleport.java index 8ab07e7e49..2fbeb36a93 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandPlanetTeleport.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandPlanetTeleport.java @@ -14,7 +14,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.WorldServer; public class CommandPlanetTeleport extends CommandBase diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java index 7857b6d315..51673e3bbf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java @@ -10,7 +10,7 @@ import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import java.util.List; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java index 818778f703..ecac19f3a6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java @@ -11,7 +11,7 @@ import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import java.util.*; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java index 77ed398793..c2a99555b8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java @@ -23,7 +23,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraftforge.client.IRenderHandler; import net.minecraftforge.common.MinecraftForge; @@ -576,7 +576,7 @@ else if (this.thrustersFiring) for (int z = zm; z <= zz; z++) { BlockPos pos = new BlockPos(x, y, z); - if (this.worldProvider.worldObj.isBlockLoaded(pos) && Blocks.air != this.worldProvider.worldObj.getBlockState(pos).getBlock()) + if (this.worldProvider.worldObj.isBlockLoaded(pos) && Blocks.AIR != this.worldProvider.worldObj.getBlockState(pos).getBlock()) { freefall = false; break BLOCKCHECK; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/energy/grid/NetworkFinder.java b/src/main/java/micdoodle8/mods/galacticraft/core/energy/grid/NetworkFinder.java index 8c0719394f..e04b9707a0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/energy/grid/NetworkFinder.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/energy/grid/NetworkFinder.java @@ -3,7 +3,7 @@ import micdoodle8.mods.galacticraft.api.transmission.tile.IConductor; import micdoodle8.mods.galacticraft.api.vector.BlockVec3; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.HashSet; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseConductor.java b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseConductor.java index 218c471131..d4ac08c63a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseConductor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseConductor.java @@ -11,7 +11,7 @@ import micdoodle8.mods.galacticraft.core.tick.TickHandlerServer; import micdoodle8.mods.galacticraft.core.tile.TileEntityAdvanced; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -152,7 +152,7 @@ public boolean canConnect(EnumFacing direction, NetworkType type) @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getPos().getX() + 1, this.getPos().getY() + 1, this.getPos().getZ() + 1); + return new AxisAlignedBB(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getPos().getX() + 1, this.getPos().getY() + 1, this.getPos().getZ() + 1); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java index c6b86a1f98..2dfa9577e8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java @@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java index 0c105fac13..8e3dde45f9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java @@ -14,7 +14,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.WeightedRandomChestContent; @@ -163,7 +163,7 @@ public void onLivingUpdate() if (this.roomCoords != null && this.roomSize != null) { List playersWithin = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, - AxisAlignedBB.fromBounds( + new AxisAlignedBB( this.roomCoords.intX(), this.roomCoords.intY(), this.roomCoords.intZ(), @@ -175,7 +175,7 @@ public void onLivingUpdate() if (this.entitiesWithin == 0 && this.entitiesWithinLast != 0) { - List entitiesWithin2 = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.fromBounds(this.roomCoords.intX() - 11, this.roomCoords.intY() - 11, this.roomCoords.intZ() - 11, this.roomCoords.intX() + this.roomSize.intX() + 10, this.roomCoords.intY() + this.roomSize.intY() + 10, this.roomCoords.intZ() + this.roomSize.intZ() + 10)); + List entitiesWithin2 = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(this.roomCoords.intX() - 11, this.roomCoords.intY() - 11, this.roomCoords.intZ() - 11, this.roomCoords.intX() + this.roomSize.intX() + 10, this.roomCoords.intY() + this.roomSize.intY() + 10, this.roomCoords.intZ() + this.roomSize.intZ() + 10)); for (EntityPlayer p : entitiesWithin2) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityCelestialFake.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityCelestialFake.java index 9b79fa62a6..9a5ca53b7d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityCelestialFake.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityCelestialFake.java @@ -11,7 +11,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityFlag.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityFlag.java index 0a913148af..48b058be44 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityFlag.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityFlag.java @@ -11,8 +11,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLander.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLander.java index 70cd12d3cc..fbdc45d5ae 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLander.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLander.java @@ -11,7 +11,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLanderBase.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLanderBase.java index d2cbfcfac4..5841cb3ff8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLanderBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLanderBase.java @@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java index 29645c5967..0d1abcd0a3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java @@ -15,7 +15,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidRegistry; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java index 1330fb2629..0482df7939 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java @@ -14,8 +14,8 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; @@ -148,9 +148,9 @@ private boolean testFreefall(EntityPlayerSP p, boolean flag) { for (int z = zm; z <= zz; z++) { - //Blocks.air is hard vacuum - we want to check for that, here + //Blocks.AIR is hard vacuum - we want to check for that, here Block b = world.getBlockState(new BlockPos(x, y, z)).getBlock(); - if (Blocks.air != b && GCBlocks.brightAir != b) + if (Blocks.AIR != b && GCBlocks.brightAir != b) { return false; } @@ -220,7 +220,7 @@ private boolean testFreefall(EntityPlayerSP p, boolean flag) for(int x = xmin; x <= xmax; x++) for (int z = zmin; z <= zmax; z++) for (int y = ymin; y <= ymax; y++) - if (Blocks.air != this.worldProvider.worldObj.getBlock(x, y, z)) + if (Blocks.AIR != this.worldProvider.worldObj.getBlock(x, y, z)) { freefall = false; break BLOCKCHECK0; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java index 25638b70c6..64916a572a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java @@ -44,7 +44,7 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.MathHelper; import net.minecraft.world.ChunkCoordIntPair; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java index 3102ae6285..851548efb9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java @@ -4,7 +4,7 @@ import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.common.IExtendedEntityProperties; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java index 156d95351b..719819bada 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java @@ -15,7 +15,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java index d663c5123f..3f96fa3a16 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java @@ -265,7 +265,7 @@ else if (event.action.equals(PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)) { if (!worldObj.isRemote && event.action.equals(PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)) { - if (idClicked != Blocks.tnt && OxygenUtil.noAtmosphericCombustion(event.entityPlayer.worldObj.provider) && !OxygenUtil.isAABBInBreathableAirBlock(event.entityLiving.worldObj, AxisAlignedBB.fromBounds(event.pos.getX(), event.pos.getY(), event.pos.getZ(), event.pos.getX() + 1, event.pos.getY() + 2, event.pos.getZ() + 1))) + if (idClicked != Blocks.tnt && OxygenUtil.noAtmosphericCombustion(event.entityPlayer.worldObj.provider) && !OxygenUtil.isAABBInBreathableAirBlock(event.entityLiving.worldObj, new AxisAlignedBB(event.pos.getX(), event.pos.getY(), event.pos.getZ(), event.pos.getX() + 1, event.pos.getY() + 2, event.pos.getZ() + 1))) { event.setCanceled(true); } @@ -873,7 +873,7 @@ public void onSoundPlayed(PlaySoundEvent event) { // If the player doesn't have a frequency module, and the player isn't in an oxygenated environment // Note: this is a very simplistic approach, and nowhere near realistic, but required for performance reasons - AxisAlignedBB bb = AxisAlignedBB.fromBounds(x - 0.0015D, y - 0.0015D, z - 0.0015D, x + 0.0015D, y + 0.0015D, z + 0.0015D); + AxisAlignedBB bb = new AxisAlignedBB(x - 0.0015D, y - 0.0015D, z - 0.0015D, x + 0.0015D, y + 0.0015D, z + 0.0015D); boolean playerInAtmosphere = OxygenUtil.isAABBInBreathableAirBlock(player); boolean soundInAtmosphere = OxygenUtil.isAABBInBreathableAirBlock(player.worldObj, bb); if ((!playerInAtmosphere || !soundInAtmosphere)) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventLandingPadRemoval.java b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventLandingPadRemoval.java index 21c9c68b78..9298aaa1ce 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventLandingPadRemoval.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventLandingPadRemoval.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.event; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.eventhandler.Event; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventWakePlayer.java b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventWakePlayer.java index c7d114bdef..c795454b1d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventWakePlayer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventWakePlayer.java @@ -2,7 +2,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer.EnumStatus; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.fml.common.eventhandler.Cancelable; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/FluidNetwork.java b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/FluidNetwork.java index 92e5e85f02..764ca1b472 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/FluidNetwork.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/FluidNetwork.java @@ -18,7 +18,7 @@ import micdoodle8.mods.galacticraft.core.network.PacketFluidNetworkUpdate; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/OxygenPressureProtocol.java b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/OxygenPressureProtocol.java index dec7e0e358..80948e50d4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/OxygenPressureProtocol.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/OxygenPressureProtocol.java @@ -9,7 +9,7 @@ import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; @@ -77,7 +77,7 @@ public static void onEdgeBlockUpdated(World world, BlockPos vec) { if (ConfigManagerCore.enableSealerEdgeChecks) { - TickHandlerServer.scheduleNewEdgeCheck(world.provider.getDimensionId(), vec); + TickHandlerServer.scheduleNewEdgeCheck(world.provider.getDimension(), vec); } } @@ -97,7 +97,7 @@ public static boolean canBlockPassAir(World world, Block block, BlockPos pos, En if (block.isOpaqueCube()) { - return block instanceof BlockGravel || block.getMaterial() == Material.cloth || block instanceof BlockSponge; + return block instanceof BlockGravel || block.getMaterial() == Material.CLOTH || block instanceof BlockSponge; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java index daafed420a..ee883ab5f9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java @@ -14,7 +14,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; @@ -140,7 +140,7 @@ public void check() if (this.head.x < -29990000 || this.head.z < -29990000 || this.head.x >= 29990000 || this.head.z >= 29990000) { Block b = this.head.getBlockID_noChunkLoad(this.world); - if (Blocks.air == b) + if (Blocks.AIR == b) { this.airToReplace.add(this.head.clone()); } @@ -153,7 +153,7 @@ else if (b == GCBlocks.brightAir) else { Block headblock = this.head.getBlockIDsafe_noChunkLoad(this.world); - if (Blocks.air == headblock) + if (Blocks.AIR == headblock) { this.airToReplace.add(this.head.clone()); } @@ -407,7 +407,7 @@ private void makeSealBad() List changeList = new LinkedList(); for (BlockVec3 checkedVec : this.breatheableToReplace) { - changeList.add(new ScheduledBlockChange(checkedVec.clone(), Blocks.air, 0, 2)); + changeList.add(new ScheduledBlockChange(checkedVec.clone(), Blocks.AIR, 0, 2)); } for (BlockVec3 checkedVec : this.breatheableToReplaceBright) { @@ -489,7 +489,7 @@ else if (id == oxygenSealerID) else { checkedLocal.add(sideVec); - if (id != null && Blocks.air != id && id != GCBlocks.brightAir && this.canBlockPassAirCheck(id, sideVec, EnumFacing.getFront(side))) + if (id != null && Blocks.AIR != id && id != GCBlocks.brightAir && this.canBlockPassAirCheck(id, sideVec, EnumFacing.getFront(side))) { //Look outbound through partially sealable blocks in case there is breatheableAir to clear beyond nextLayer.add(sideVec); @@ -576,7 +576,7 @@ else if (id == oxygenSealerID) else { checkedLocal.add(sideVec); - if (id != null && Blocks.air != id && id != GCBlocks.brightAir && this.canBlockPassAirCheck(id, sideVec, EnumFacing.getFront(side))) + if (id != null && Blocks.AIR != id && id != GCBlocks.brightAir && this.canBlockPassAirCheck(id, sideVec, EnumFacing.getFront(side))) { //Look outbound through partially sealable blocks in case there is breatheableAir to clear beyond nextLayer.add(sideVec); @@ -596,7 +596,7 @@ private void doLayer() { //Local variables are fractionally faster than statics Block breatheableAirID = GCBlocks.breatheableAir; - Block airID = Blocks.air; + Block airID = Blocks.AIR; Block breatheableAirIDBright = GCBlocks.brightBreatheableAir; Block airIDBright = GCBlocks.brightAir; Block oxygenSealerID = GCBlocks.oxygenSealer; @@ -724,7 +724,7 @@ private void doLayerNearMapEdge() { //Local variables are fractionally faster than statics Block breatheableAirID = GCBlocks.breatheableAir; - Block airID = Blocks.air; + Block airID = Blocks.AIR; Block breatheableAirIDBright = GCBlocks.brightBreatheableAir; Block airIDBright = GCBlocks.brightAir; Block oxygenSealerID = GCBlocks.oxygenSealer; @@ -914,7 +914,7 @@ private boolean canBlockPassAirCheck(Block block, BlockVec3 vec, EnumFacing side if (block.isOpaqueCube()) { //Gravel, wool and sponge are porous - return block instanceof BlockGravel || block.getMaterial() == Material.cloth || block instanceof BlockSponge; + return block instanceof BlockGravel || block.getMaterial() == Material.CLOTH || block instanceof BlockSponge; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggyBench.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggyBench.java index 4488038566..5962bbae01 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggyBench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggyBench.java @@ -10,7 +10,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerBuggyBench extends Container diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematic.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematic.java index cba2ecfd0a..5161380718 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematic.java @@ -8,7 +8,7 @@ import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerSchematic extends Container diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java index af079a01e1..bf62db4f99 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java @@ -11,7 +11,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerSchematicTier1Rocket extends Container diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotBuggyBench.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotBuggyBench.java index d89ca971d5..94fef295f6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotBuggyBench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotBuggyBench.java @@ -9,7 +9,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public class SlotBuggyBench extends Slot { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotRocketBench.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotRocketBench.java index 6083fd83ed..9ff32d21d7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotRocketBench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotRocketBench.java @@ -9,7 +9,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.client.FMLClientHandler; public class SlotRocketBench extends Slot diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java index 57a2661a9a..b5c2d42eb3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java @@ -9,7 +9,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java index c22e259481..e010ffc37f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java @@ -14,8 +14,8 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition.MovingObjectType; @@ -67,7 +67,7 @@ public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, Entit { final EntityFlag flag = new EntityFlag(par2World, pos.getX() + 0.5F, pos.getY() + 1.0F, pos.getZ() + 0.5F, (int) (par3EntityPlayer.rotationYaw - 90)); - if (par2World.getEntitiesWithinAABB(EntityFlag.class, AxisAlignedBB.fromBounds(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 3, pos.getZ() + 1)).isEmpty()) + if (par2World.getEntitiesWithinAABB(EntityFlag.class, new AxisAlignedBB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 3, pos.getZ() + 1)).isEmpty()) { par2World.spawnEntityInWorld(flag); flag.setType(par1ItemStack.getItemDamage()); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java index b8068c0ffc..429ac823e8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java @@ -20,7 +20,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java index efeb0a736f..d98fe5a9d9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java @@ -13,7 +13,7 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/nei/GCNEIHighlightHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/nei/GCNEIHighlightHandler.java index 44280568de..f65fcbb359 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/nei/GCNEIHighlightHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/nei/GCNEIHighlightHandler.java @@ -13,7 +13,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/NetworkUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/NetworkUtil.java index 78f4d2a5c4..6bc2b86520 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/NetworkUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/NetworkUtil.java @@ -16,7 +16,7 @@ import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java index 7f7fbdb766..8c67e33984 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java @@ -7,7 +7,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLLog; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamicInventory.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamicInventory.java index 757fd15a3e..9c299367f1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamicInventory.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamicInventory.java @@ -9,7 +9,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import java.io.IOException; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketFluidNetworkUpdate.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketFluidNetworkUpdate.java index 4809cbb8ea..09cfcbe7e3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketFluidNetworkUpdate.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketFluidNetworkUpdate.java @@ -6,7 +6,7 @@ import micdoodle8.mods.galacticraft.core.fluid.FluidNetwork; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java index eff998cf65..0f4551e165 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java @@ -535,9 +535,9 @@ private static void registerInventoryJsons() ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.basicBlock, 10, "block_tin_gc"); ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.basicBlock, 11, "block_aluminum_gc"); ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.basicBlock, 12, "block_meteoric_iron_gc"); - ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.airLockFrame, 0, "air_lock_frame"); - ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.airLockFrame, 1, "air_lock_controller"); - ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.airLockSeal, 0, "air_lock_seal"); + ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.AIRLockFrame, 0, "air_lock_frame"); + ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.AIRLockFrame, 1, "air_lock_controller"); + ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.AIRLockSeal, 0, "air_lock_seal"); ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.refinery); ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.fuelLoader); ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.landingPadFull, 0, "landing_pad_full"); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java index 7e9407502c..2f979260e4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java @@ -379,9 +379,9 @@ private static void addUniversalRecipes() CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(GCItems.oxygenVent, 1), new Object[] { "compressedTin", "compressedTin", "compressedTin", "compressedSteel" })); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.airLockFrame, 4, 0), new Object[] { "XXX", "YZY", "XXX", 'X', "compressedAluminum", 'Y', "compressedSteel", 'Z', GCItems.oxygenConcentrator }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.AIRLockFrame, 4, 0), new Object[] { "XXX", "YZY", "XXX", 'X', "compressedAluminum", 'Y', "compressedSteel", 'Z', GCItems.oxygenConcentrator }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.airLockFrame, 1, 1), new Object[] { "YYY", "WZW", "YYY", 'W', "compressedMeteoricIron", 'Y', "compressedSteel", 'Z', new ItemStack(GCItems.basicItem, 1, 13) }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.AIRLockFrame, 1, 1), new Object[] { "YYY", "WZW", "YYY", 'W', "compressedMeteoricIron", 'Y', "compressedSteel", 'Z', new ItemStack(GCItems.basicItem, 1, 13) }); // Disable oil extractor: // RecipeUtil.addRecipe(new ItemStack(GCItems.oilExtractor), new Object[] { "X ", " XY", "ZYY", 'X', "compressedSteel", 'Y', "compressedBronze", 'Z', Items.redstone }); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicAdd.java b/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicAdd.java index a751baa88c..126652e857 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicAdd.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicAdd.java @@ -9,7 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicMoonBuggy.java b/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicMoonBuggy.java index 995026af23..48ae5973cf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicMoonBuggy.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicMoonBuggy.java @@ -10,7 +10,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicRocketT1.java b/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicRocketT1.java index b8decff867..8e8cd04469 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicRocketT1.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicRocketT1.java @@ -9,7 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java index ea0dc76a22..d9f69e611a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java @@ -48,7 +48,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.world.WorldProviderSurface; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java index e43de25be2..2ea2805b48 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java @@ -34,7 +34,7 @@ import net.minecraft.init.Blocks; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/AirLockProtocol.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/AirLockProtocol.java index 83300698fb..d70bcb075f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/AirLockProtocol.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/AirLockProtocol.java @@ -1,7 +1,7 @@ package micdoodle8.mods.galacticraft.core.tile; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.ArrayList; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/FluidTankGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/FluidTankGC.java index 69e0b84b11..85fb820377 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/FluidTankGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/FluidTankGC.java @@ -1,7 +1,7 @@ package micdoodle8.mods.galacticraft.core.tile; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/IMultiBlock.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/IMultiBlock.java index 0dab276c56..d634f4d2f0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/IMultiBlock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/IMultiBlock.java @@ -2,7 +2,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IMultiBlock diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAirLockController.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAirLockController.java index 9e8d960d10..0829646bbc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAirLockController.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAirLockController.java @@ -8,8 +8,8 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import java.util.ArrayList; @@ -86,7 +86,7 @@ public void update() Vector3 thisPos = new Vector3(this).translate(0.5F); Vector3 minPos = new Vector3(thisPos).translate(-distance); Vector3 maxPos = new Vector3(thisPos).translate(distance); - AxisAlignedBB matchingRegion = AxisAlignedBB.fromBounds(minPos.x, minPos.y, minPos.z, maxPos.x, maxPos.y, maxPos.z); + AxisAlignedBB matchingRegion = new AxisAlignedBB(minPos.x, minPos.y, minPos.z, maxPos.x, maxPos.y, maxPos.z); List playersWithin = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, matchingRegion); boolean foundPlayer = false; @@ -167,7 +167,7 @@ public void sealAirLock() int y = this.lastProtocol.minY + (this.lastProtocol.maxY - this.lastProtocol.minY) / 2; int z = this.lastProtocol.minZ + (this.lastProtocol.maxZ - this.lastProtocol.minZ) / 2; - if (this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock() != GCBlocks.airLockSeal) + if (this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock() != GCBlocks.AIRLockSeal) { this.worldObj.playSoundEffect(x, y, z, Constants.TEXTURE_PREFIX + "player.openairlock", 1.0F, 1.0F); } @@ -184,7 +184,7 @@ public void sealAirLock() if (blockAt.isAir(this.worldObj, new BlockPos(x, y, z))) { - this.worldObj.setBlockState(new BlockPos(x, this.protocol.minY, z), GCBlocks.airLockSeal.getDefaultState(), 3); + this.worldObj.setBlockState(new BlockPos(x, this.protocol.minY, z), GCBlocks.AIRLockSeal.getDefaultState(), 3); } } } @@ -202,7 +202,7 @@ public void sealAirLock() if (blockAt.isAir(this.worldObj, new BlockPos(x, y, z))) { - this.worldObj.setBlockState(new BlockPos(x, y, this.protocol.minZ), GCBlocks.airLockSeal.getDefaultState(), 3); + this.worldObj.setBlockState(new BlockPos(x, y, this.protocol.minZ), GCBlocks.AIRLockSeal.getDefaultState(), 3); } } } @@ -217,7 +217,7 @@ else if (this.protocol.minZ != this.protocol.maxZ) if (blockAt.isAir(this.worldObj, new BlockPos(x, y, z))) { - this.worldObj.setBlockState(new BlockPos(this.protocol.minX, y, z), GCBlocks.airLockSeal.getDefaultState(), 3); + this.worldObj.setBlockState(new BlockPos(this.protocol.minX, y, z), GCBlocks.AIRLockSeal.getDefaultState(), 3); } } } @@ -251,7 +251,7 @@ public void unsealAirLock() { Block blockAt = this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock(); - if (blockAt == GCBlocks.airLockSeal) + if (blockAt == GCBlocks.AIRLockSeal) { this.worldObj.setBlockToAir(new BlockPos(x, this.protocol.minY, z)); } @@ -269,7 +269,7 @@ public void unsealAirLock() { Block blockAt = this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock(); - if (blockAt == GCBlocks.airLockSeal) + if (blockAt == GCBlocks.AIRLockSeal) { this.worldObj.setBlockToAir(new BlockPos(x, y, this.lastProtocol.minZ)); } @@ -284,7 +284,7 @@ else if (this.lastProtocol.minZ != this.lastProtocol.maxZ) { Block blockAt = this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock(); - if (blockAt == GCBlocks.airLockSeal) + if (blockAt == GCBlocks.AIRLockSeal) { this.worldObj.setBlockToAir(new BlockPos(this.lastProtocol.minX, y, z)); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java index 0e4fe0a0d8..d7db819fc7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java @@ -17,8 +17,8 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.pathfinding.PathNavigate; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ITickable; import net.minecraft.util.Vec3; import net.minecraft.world.World; @@ -81,12 +81,12 @@ else if (!this.isActive) case 0: this.sideRear = side; //Down this.facingSide = this.facing + 2; - this.thisAABB = AxisAlignedBB.fromBounds(this.getPos().getX() - 20, this.getPos().getY() - 8, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 20); + this.thisAABB = new AxisAlignedBB(this.getPos().getX() - 20, this.getPos().getY() - 8, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 20); break; case 1: this.sideRear = side; //Up this.facingSide = this.facing + 2; - this.thisAABB = AxisAlignedBB.fromBounds(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 8, this.getPos().getZ() + 20); + this.thisAABB = new AxisAlignedBB(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 8, this.getPos().getZ() + 20); break; case 2: this.sideRear = side; //North @@ -95,7 +95,7 @@ else if (!this.isActive) { this.facingSide = 7 - this.facing; } - this.thisAABB = AxisAlignedBB.fromBounds(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 8, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 20); + this.thisAABB = new AxisAlignedBB(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 8, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 20); break; case 3: this.sideRear = side; //South @@ -104,12 +104,12 @@ else if (!this.isActive) { this.facingSide += 2; } - this.thisAABB = AxisAlignedBB.fromBounds(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 8); + this.thisAABB = new AxisAlignedBB(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 8); break; case 4: this.sideRear = side; //West this.facingSide = this.facing; - this.thisAABB = AxisAlignedBB.fromBounds(this.getPos().getX() - 8, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 20); + this.thisAABB = new AxisAlignedBB(this.getPos().getX() - 8, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 20); break; case 5: this.sideRear = side; //East @@ -118,7 +118,7 @@ else if (!this.isActive) { this.facingSide = 5 - this.facing; } - this.thisAABB = AxisAlignedBB.fromBounds(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 8, this.getPos().getY() + 20, this.getPos().getZ() + 20); + this.thisAABB = new AxisAlignedBB(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 8, this.getPos().getY() + 20, this.getPos().getZ() + 20); break; default: return; @@ -209,7 +209,7 @@ public void invalidate() public void lightArea() { - Block air = Blocks.air; + Block air = Blocks.AIR; Block breatheableAirID = GCBlocks.breatheableAir; Block brightAir = GCBlocks.brightAir; Block brightBreatheableAir = GCBlocks.brightBreatheableAir; @@ -296,7 +296,7 @@ public void lightArea() Block id = vec.getBlockIDsafe_noChunkLoad(world); if (id.isAir(world, vec.toBlockPos())) { - if (Blocks.air == id) + if (Blocks.AIR == id) { world.setBlockState(vec.toBlockPos(), brightAir.getDefaultState(), 2); this.airToRestore.add(vec); @@ -385,7 +385,7 @@ private void revertAir() Block b = vec.getBlock(this.worldObj); if (b == brightAir) { - this.worldObj.setBlockState(vec.toBlockPos(), Blocks.air.getDefaultState(), 2); + this.worldObj.setBlockState(vec.toBlockPos(), Blocks.AIR.getDefaultState(), 2); } else if (b == brightBreatheableAir) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFueler.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFueler.java index 7fc8f13e09..04c0ef7727 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFueler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFueler.java @@ -13,8 +13,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ITickable; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -40,7 +40,7 @@ public void update() if (!this.worldObj.isRemote) { - final List list = this.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.fromBounds(this.getPos().getX() - 1.5D, this.getPos().getY() - 2.0, this.getPos().getZ() - 1.5D, + final List list = this.worldObj.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(this.getPos().getX() - 1.5D, this.getPos().getY() - 2.0, this.getPos().getZ() - 1.5D, this.getPos().getX() + 1.5D, this.getPos().getY() + 4.0, this.getPos().getZ() + 1.5D), new Predicate() { @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFuelerSingle.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFuelerSingle.java index 5118083c6f..789289f722 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFuelerSingle.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFuelerSingle.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.core.blocks.BlockLandingPadFull; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ITickable; import java.util.ArrayList; @@ -36,7 +36,7 @@ public void update() for (final TileEntity tile : attachedLaunchPads) { tile.invalidate(); - tile.getWorld().setBlockState(tile.getPos(), Blocks.air.getDefaultState(), 3); + tile.getWorld().setBlockState(tile.getPos(), Blocks.AIR.getDefaultState(), 3); } this.worldObj.setBlockState(this.getPos(), GCBlocks.landingPadFull.getStateFromMeta(BlockLandingPadFull.EnumLandingPadFullType.BUGGY_PAD.getMeta()), 3); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java index 374727b0c0..3161089900 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java @@ -14,7 +14,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.world.IBlockAccess; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java index a6279fc73b..62d76b5e0f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java @@ -15,8 +15,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.world.World; @@ -94,11 +94,11 @@ else if (celestialAngle > 150) this.currentAngle += difference / 20.0F; } - @Override - public boolean onActivated(EntityPlayer entityPlayer) - { - return this.getBlockType().onBlockActivated(this.worldObj, this.getPos(), this.worldObj.getBlockState(this.getPos()), entityPlayer, EnumFacing.DOWN, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); - } +// @Override TODO +// public boolean onActivated(EntityPlayer entityPlayer) +// { +// return this.getBlockType().onBlockActivated(this.worldObj, this.getPos(), this.worldObj.getBlockState(this.getPos()), entityPlayer, EnumFacing.DOWN, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); +// } @Override public void onCreate(World world, BlockPos placedPosition) @@ -216,7 +216,7 @@ public EnumSet getElectricalInputDirections() @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); + return new AxisAlignedBB(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); } // @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java index 68ad058238..f03f98e83f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java @@ -8,8 +8,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.lang.reflect.Constructor; @@ -59,7 +59,7 @@ public void update() } final Vector3 thisVec = new Vector3(this); - final List l = this.worldObj.getEntitiesWithinAABB(bossClass, AxisAlignedBB.fromBounds(thisVec.x - 15, thisVec.y - 15, thisVec.z - 15, thisVec.x + 15, thisVec.y + 15, thisVec.z + 15)); + final List l = this.worldObj.getEntitiesWithinAABB(bossClass, new AxisAlignedBB(thisVec.x - 15, thisVec.y - 15, thisVec.z - 15, thisVec.x + 15, thisVec.y + 15, thisVec.z + 15)); for (final Entity e : l) { @@ -72,7 +72,7 @@ public void update() } } - List entitiesWithin = this.worldObj.getEntitiesWithinAABB(EntityMob.class, AxisAlignedBB.fromBounds(this.roomCoords.intX() - 3, this.roomCoords.intY() - 3, this.roomCoords.intZ() - 3, this.roomCoords.intX() + this.roomSize.intX() + 3, this.roomCoords.intY() + this.roomSize.intY() + 3, this.roomCoords.intZ() + this.roomSize.intZ() + 3)); + List entitiesWithin = this.worldObj.getEntitiesWithinAABB(EntityMob.class, new AxisAlignedBB(this.roomCoords.intX() - 3, this.roomCoords.intY() - 3, this.roomCoords.intZ() - 3, this.roomCoords.intX() + this.roomSize.intX() + 3, this.roomCoords.intY() + this.roomSize.intY() + 3, this.roomCoords.intZ() + this.roomSize.intZ() + 3)); for (Entity mob : entitiesWithin) { @@ -82,7 +82,7 @@ public void update() } } - List playersWithin = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.fromBounds(this.roomCoords.intX(), this.roomCoords.intY(), this.roomCoords.intZ(), this.roomCoords.intX() + this.roomSize.intX(), this.roomCoords.intY() + this.roomSize.intY(), this.roomCoords.intZ() + this.roomSize.intZ())); + List playersWithin = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(this.roomCoords.intX(), this.roomCoords.intY(), this.roomCoords.intZ(), this.roomCoords.intX() + this.roomSize.intX(), this.roomCoords.intY() + this.roomSize.intY(), this.roomCoords.intZ() + this.roomSize.intZ())); if (this.boss == null && !this.isBossDefeated && !playersWithin.isEmpty()) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidPipe.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidPipe.java index c9750a780f..cbef784ea5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidPipe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidPipe.java @@ -14,7 +14,7 @@ import net.minecraft.item.EnumDyeColor; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java index 703e5a15c0..598d5f2cdc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java @@ -10,7 +10,7 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraftforge.fluids.*; import net.minecraftforge.fml.client.FMLClientHandler; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTransmitter.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTransmitter.java index 9459a4432a..2e6eb2e67b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTransmitter.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTransmitter.java @@ -16,7 +16,7 @@ import micdoodle8.mods.miccore.Annotations; import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.EnumFacing; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; @@ -225,7 +225,7 @@ public boolean canConnect(EnumFacing direction, NetworkType type) @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getPos().getX() + 1, this.getPos().getY() + 1, this.getPos().getZ() + 1); + return new AxisAlignedBB(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getPos().getX() + 1, this.getPos().getY() + 1, this.getPos().getZ() + 1); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java index 1d5127b452..164e16a1b7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java @@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.world.IBlockAccess; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPad.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPad.java index f20ecade07..19f01eecfb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPad.java @@ -14,8 +14,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; @@ -42,7 +42,7 @@ public void update() if (!this.worldObj.isRemote) { - final List list = this.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.fromBounds(this.getPos().getX() - 0.5D, this.getPos().getY(), this.getPos().getZ() - 0.5D, this.getPos().getX() + 0.5D, this.getPos().getY() + 1.0D, this.getPos().getZ() + 0.5D)); + final List list = this.worldObj.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(this.getPos().getX() - 0.5D, this.getPos().getY(), this.getPos().getZ() - 0.5D, this.getPos().getX() + 0.5D, this.getPos().getY() + 1.0D, this.getPos().getZ() + 0.5D)); boolean docked = false; @@ -240,7 +240,7 @@ public RemovalResult removeCargo(boolean doRemove) @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 0.4D, getPos().getZ() + 2); + return new AxisAlignedBB(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 0.4D, getPos().getZ() + 2); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPadSingle.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPadSingle.java index 26a75ce0f9..65a55213df 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPadSingle.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPadSingle.java @@ -3,7 +3,7 @@ import micdoodle8.mods.galacticraft.core.GCBlocks; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ITickable; import java.util.ArrayList; @@ -35,7 +35,7 @@ public void update() for (final TileEntity tile : attachedLaunchPads) { tile.invalidate(); - tile.getWorld().setBlockState(tile.getPos(), Blocks.air.getDefaultState(), 3); + tile.getWorld().setBlockState(tile.getPos(), Blocks.AIR.getDefaultState(), 3); // ((GCCoreBlockLandingPadFull)GCCoreBlocks.landingPadFull).onBlockAdded(worldObj, // tile.xCoord, tile.yCoord, tile.zCoord); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityMulti.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityMulti.java index 55945ccc3c..d16dea56a2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityMulti.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityMulti.java @@ -5,9 +5,11 @@ import micdoodle8.mods.miccore.Annotations.NetworkedField; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -67,7 +69,7 @@ public boolean onBlockActivated(World worldIn, BlockPos pos, EntityPlayer player return false; } - public boolean onBlockWrenched(World world, BlockPos pos, EntityPlayer entityPlayer, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockWrenched(World world, BlockPos pos, EntityPlayer entityPlayer, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (this.mainBlockPosition != null) { @@ -75,7 +77,7 @@ public boolean onBlockWrenched(World world, BlockPos pos, EntityPlayer entityPla if (state.getBlock() instanceof BlockAdvanced) { - return ((BlockAdvanced) state.getBlock()).onBlockActivated(world, this.mainBlockPosition, state, entityPlayer, side, hitX, hitY, hitZ); + return ((BlockAdvanced) state.getBlock()).onBlockActivated(world, this.mainBlockPosition, state, entityPlayer, hand, heldItem, side, hitX, hitY, hitZ); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityNasaWorkbench.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityNasaWorkbench.java index 2764f40b1c..eb8aa6c92c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityNasaWorkbench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityNasaWorkbench.java @@ -7,8 +7,8 @@ import micdoodle8.mods.galacticraft.core.client.gui.GuiIdsCore; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; @@ -110,6 +110,6 @@ else if (y != 0 && y != 3) @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); + return new AxisAlignedBB(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java index c2c845bb31..5cd2b347e7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java @@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.world.chunk.Chunk; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDetector.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDetector.java index b13ad876bf..cf24dd7c95 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDetector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDetector.java @@ -2,7 +2,7 @@ import micdoodle8.mods.galacticraft.core.blocks.BlockOxygenDetector; import micdoodle8.mods.galacticraft.core.util.OxygenUtil; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; public class TileEntityOxygenDetector extends TileEntityAdvanced { @@ -17,7 +17,7 @@ public void update() if (this.blockType != null && this.blockType instanceof BlockOxygenDetector) { - ((BlockOxygenDetector) this.blockType).updateOxygenState(this.worldObj, this.getPos(), OxygenUtil.isAABBInBreathableAirBlock(this.worldObj, AxisAlignedBB.fromBounds(this.getPos().getX() - 1, this.getPos().getY() - 1, this.getPos().getZ() - 1, this.getPos().getX() + 2, this.getPos().getY() + 2, this.getPos().getZ() + 2))); + ((BlockOxygenDetector) this.blockType).updateOxygenState(this.worldObj, this.getPos(), OxygenUtil.isAABBInBreathableAirBlock(this.worldObj, new AxisAlignedBB(this.getPos().getX() - 1, this.getPos().getY() - 1, this.getPos().getZ() - 1, this.getPos().getX() + 2, this.getPos().getY() + 2, this.getPos().getZ() + 2))); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java index b1b6f2a6d9..e519150f75 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java @@ -138,7 +138,7 @@ public void addExtraNetworkedData(List networkedList) @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(this.getPos().getX() - this.bubbleSize, this.getPos().getY() - this.bubbleSize, this.getPos().getZ() - this.bubbleSize, this.getPos().getX() + this.bubbleSize, this.getPos().getY() + this.bubbleSize, this.getPos().getZ() + this.bubbleSize); + return new AxisAlignedBB(this.getPos().getX() - this.bubbleSize, this.getPos().getY() - this.bubbleSize, this.getPos().getZ() - this.bubbleSize, this.getPos().getX() + this.bubbleSize, this.getPos().getY() + this.bubbleSize, this.getPos().getZ() + this.bubbleSize); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java index 2c1aefc64d..89f9d1c693 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java @@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java index 83d416bb66..4ac67c4c33 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java @@ -16,7 +16,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.IChatComponent; import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fml.relauncher.Side; @@ -248,7 +248,7 @@ public void update() { this.numUsingPlayers = 0; f = 5.0F; - List list = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.fromBounds(this.getPos().getX() - f, this.getPos().getY() - f, this.getPos().getZ() - f, this.getPos().getX() + 1 + f, this.getPos().getY() + 1 + f, this.getPos().getZ() + 1 + f)); + List list = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(this.getPos().getX() - f, this.getPos().getY() - f, this.getPos().getZ() - f, this.getPos().getX() + 1 + f, this.getPos().getY() + 1 + f, this.getPos().getZ() + 1 + f)); Iterator iterator = list.iterator(); while (iterator.hasNext()) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java index b92e93b37f..5edc450aa1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java @@ -23,7 +23,9 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; @@ -256,11 +258,11 @@ public float getSolarBoost() return (float) (this.worldObj.provider instanceof ISolarLevel ? ((ISolarLevel) this.worldObj.provider).getSolarEnergyMultiplier() : 1.0F); } - @Override - public boolean onActivated(EntityPlayer entityPlayer) - { - return this.getBlockType().onBlockActivated(this.worldObj, this.getPos(), this.worldObj.getBlockState(getPos()), entityPlayer, EnumFacing.DOWN, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); - } +// @Override TODO +// public boolean onActivated(EntityPlayer entityPlayer) +// { +// return this.getBlockType().onBlockActivated(this.worldObj, this.getPos(), this.worldObj.getBlockState(getPos()), entityPlayer, EnumFacing.DOWN, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); +// } // @Override // public boolean canUpdate() @@ -416,7 +418,7 @@ public EnumFacing getElectricalOutputDirectionMain() @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); + return new AxisAlignedBB(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySpaceStationBase.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySpaceStationBase.java index 539405889a..274cbaea6f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySpaceStationBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySpaceStationBase.java @@ -5,7 +5,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class TileEntitySpaceStationBase extends TileEntityMulti implements IMultiBlock diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTelemetry.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTelemetry.java index 26f5f08955..a6e8feb0c8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTelemetry.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTelemetry.java @@ -21,7 +21,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ITickable; import net.minecraft.util.MathHelper; import net.minecraft.world.WorldProvider; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/ConfigManagerCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/ConfigManagerCore.java index 6357421203..44fe9e61c7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/ConfigManagerCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/ConfigManagerCore.java @@ -761,7 +761,7 @@ public static BlockTuple stringToBlock(String s, String caller, boolean logging) catch (NumberFormatException ex) { } - if (Blocks.air == block) + if (Blocks.AIR == block) { if (logging) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java index 51578834c2..d9d2508c16 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java @@ -9,7 +9,7 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraftforge.fluids.*; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java index 08861199f6..1be0c33f2f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java @@ -16,7 +16,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -127,7 +127,7 @@ public static void getLocalMap(World world, int chunkXPos, int chunkZPos, Buffer for (int x = 0; x < 16; x++) { int l4 = chunk.getHeight(new BlockPos(x, 0, z)) + 1; - Block block = Blocks.air; + Block block = Blocks.AIR; IBlockState i5 = null; if (l4 > 1) @@ -922,7 +922,7 @@ public static void makeVanillaMap(int dim, int chunkXPos, int chunkZPos, File ba for (int x = 0; x < 16; x++) { int l4 = chunk.getHeightValue(x, z) + 1; - Block block = Blocks.air; + Block block = Blocks.AIR; IBlockState i5 = block.getDefaultState(); if (l4 > 1) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java index 1974f8bcbb..74edf7fa16 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java @@ -28,8 +28,8 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -86,7 +86,7 @@ public static boolean isAABBInBreathableAirBlock(EntityLivingBase entity, boolea //A good first estimate of head size is that it's the smallest of the entity's 3 dimensions (e.g. front to back, for Steve) double smin = Math.min(sx, Math.min(sy, sz)) / 2; - return OxygenUtil.isAABBInBreathableAirBlock(entity.worldObj, AxisAlignedBB.fromBounds(x - smin, y - smin, z - smin, x + smin, y + smin, z + smin)); + return OxygenUtil.isAABBInBreathableAirBlock(entity.worldObj, new AxisAlignedBB(x - smin, y - smin, z - smin, x + smin, y + smin, z + smin)); } public static boolean isAABBInBreathableAirBlock(World world, AxisAlignedBB bb) @@ -230,7 +230,7 @@ private static int testContactWithBreathableAir(World world, Block block, BlockP { if (block.isOpaqueCube()) { - if (block instanceof BlockGravel || block.getMaterial() == Material.cloth || block instanceof BlockSponge) + if (block instanceof BlockGravel || block.getMaterial() == Material.CLOTH || block instanceof BlockSponge) { permeableFlag = true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/RedstoneUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/RedstoneUtil.java index f4ecb2c03c..e1a6dfd7c0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/RedstoneUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/RedstoneUtil.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.util; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java index d5467f5543..f64ce108b1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java @@ -42,7 +42,7 @@ import net.minecraft.network.play.server.S1FPacketSetExperience; import net.minecraft.potion.PotionEffect; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.*; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/ChunkLoadingCallback.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/ChunkLoadingCallback.java index d7c5cf4d51..d192b56e98 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/ChunkLoadingCallback.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/ChunkLoadingCallback.java @@ -5,7 +5,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraft.world.WorldServer; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/IChunkLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/IChunkLoader.java index c9a114d109..4d10953589 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/IChunkLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/IChunkLoader.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.world; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.ForgeChunkManager.Ticket; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java index de852211a5..bfa634c3b8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java @@ -7,7 +7,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.pattern.BlockHelper; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java index 3fb2c23341..094c9f2349 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java @@ -14,7 +14,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; @@ -135,7 +135,7 @@ public void replaceBlocksForBiome(int par1, int par2, ChunkPrimer primer, BiomeG else { IBlockState var18 = primer.getBlockState(index); - if (Blocks.air == var18) + if (Blocks.AIR == var18) { var13 = -1; } @@ -145,7 +145,7 @@ else if (var18 == BLOCK_LOWER) { if (var12 <= 0) { - state0 = Blocks.air.getDefaultState(); + state0 = Blocks.AIR.getDefaultState(); state1 = BLOCK_LOWER; } else if (var16 >= var5 - -16 && var16 <= var5 + 1) @@ -244,9 +244,9 @@ private void makeCrater(int craterX, int craterZ, int chunkX, int chunkZ, int si int helper = 0; for (int y = 127; y > 0; y--) { - if (Blocks.air != primer.getBlockState(this.getIndex(x, y, z)).getBlock() && helper <= yDev) + if (Blocks.AIR != primer.getBlockState(this.getIndex(x, y, z)).getBlock() && helper <= yDev) { - primer.setBlockState(this.getIndex(x, y, z), Blocks.air.getDefaultState()); + primer.setBlockState(this.getIndex(x, y, z), Blocks.AIR.getDefaultState()); helper++; } if (helper > yDev) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderOrbit.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderOrbit.java index ae55d186aa..d528906ac6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderOrbit.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderOrbit.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.core.tile.IMultiBlock; import net.minecraft.block.BlockFalling; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java index 119d4a7d0d..8b5062d4f6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java @@ -175,13 +175,13 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime { if (state.getBlock().getMetaFromState(state) == 3 || state.getBlock().getMetaFromState(state) == 4) { - primer.setBlockState(coords, Blocks.air.getDefaultState()); -// blockIdArray[coords] = Blocks.air; + primer.setBlockState(coords, Blocks.AIR.getDefaultState()); +// blockIdArray[coords] = Blocks.AIR; } else if (state.getBlock().getMetaFromState(state) == 5) { - primer.setBlockState(coords, Blocks.air.getDefaultState()); -// blockIdArray[coords] = Blocks.air; + primer.setBlockState(coords, Blocks.AIR.getDefaultState()); +// blockIdArray[coords] = Blocks.AIR; } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OreGenOtherMods.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OreGenOtherMods.java index 9da76fffaa..5a95ccdcde 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OreGenOtherMods.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OreGenOtherMods.java @@ -12,7 +12,7 @@ import micdoodle8.mods.galacticraft.planets.mars.blocks.MarsBlocks; import micdoodle8.mods.galacticraft.planets.mars.dimension.WorldProviderMars; import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraft.world.gen.feature.WorldGenerator; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java index d48881203b..9c93b2bcc5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java @@ -4,7 +4,7 @@ import net.minecraft.block.Block; import net.minecraft.block.state.pattern.BlockHelper; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentGC.java index cc8d39cec8..ffe2ce8e41 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentGC.java @@ -2,7 +2,7 @@ import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntityMobSpawner; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java index 6e6c148c14..f82f930358 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java @@ -3,7 +3,7 @@ import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntityMobSpawner; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -224,7 +224,7 @@ protected void fillBlocksRotated(World var1, StructureBoundingBox var2, int var3 protected void fillAirRotated(World var1, StructureBoundingBox var2, int var3, int var4, int var5, int var6, int var7, int var8, int var9) { - this.fillBlocksRotated(var1, var2, var3, var4, var5, var6, var7, var8, Blocks.air, 0, var9); + this.fillBlocksRotated(var1, var2, var3, var4, var5, var6, var7, var8, Blocks.AIR, 0, var9); } protected int getStairMeta(int var1) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java index 3801633b02..a46c106976 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java @@ -2,7 +2,7 @@ import micdoodle8.mods.galacticraft.core.entities.EntityAlienVillager; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField.java index f4d336c58e..0565764f48 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField.java @@ -64,7 +64,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 7 - 1, 0); } - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 12, 4, 8, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 12, 4, 8, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 2, 0, 7, Blocks.dirt.getDefaultState(), Blocks.dirt.getDefaultState(), false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 1, 5, 0, 7, Blocks.dirt.getDefaultState(), Blocks.dirt.getDefaultState(), false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 0, 1, 8, 0, 7, Blocks.dirt.getDefaultState(), Blocks.dirt.getDefaultState(), false); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField2.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField2.java index 4baebdbbfe..be7acc6b20 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField2.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField2.java @@ -99,7 +99,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 4 - 1, 0); } - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 12, 4, 8, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 12, 4, 8, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 2, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 1, 5, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 0, 1, 8, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java index 3cbb7a12ec..5a203204f1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java @@ -109,7 +109,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 5, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 6, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 7, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 1, yLevel, 8, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 1, yLevel, 8, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 9, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 10, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 11, par3StructureBoundingBox); @@ -122,7 +122,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 5, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 6, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 7, yLevel, 15, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 8, yLevel, 15, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 8, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 9, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 10, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 11, yLevel, 15, par3StructureBoundingBox); @@ -135,7 +135,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 11, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 10, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 9, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 15, yLevel, 8, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 15, yLevel, 8, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 7, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 6, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 5, par3StructureBoundingBox); @@ -148,7 +148,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 11, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 10, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 9, yLevel, 1, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 8, yLevel, 1, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 8, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 7, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 6, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 5, yLevel, 1, par3StructureBoundingBox); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java index 900dee46ff..21c1913d89 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java @@ -5,7 +5,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -145,7 +145,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo { BlockPos pos = new BlockPos(var5, par1World.getTopSolidOrLiquidBlock(new BlockPos(var5, 0, var6)).getY() - 1, var6); IBlockState state = par1World.getBlockState(pos); - if (par3StructureBoundingBox.isVecInside(new BlockPos(var5, 64, var6)) && (state.getBlock() == GCBlocks.blockMoon && state.getBlock().getMetaFromState(state) == 5 || Blocks.air == state.getBlock())) + if (par3StructureBoundingBox.isVecInside(new BlockPos(var5, 64, var6)) && (state.getBlock() == GCBlocks.blockMoon && state.getBlock().getMetaFromState(state) == 5 || Blocks.AIR == state.getBlock())) { final int var7 = par1World.getTopSolidOrLiquidBlock(new BlockPos(var5, 0, var6)).getY() - 1; par1World.setBlockState(new BlockPos(var5, var7, var6), var4.getStateFromMeta(1), 2); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java index 64a7cb75a5..8ce2a6dfbf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java @@ -69,7 +69,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 4 - 1, 0); } - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 2, 3, 1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 2, 3, 1, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 0, 0, par3StructureBoundingBox); this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 1, 0, par3StructureBoundingBox); this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 2, 0, par3StructureBoundingBox); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java index 34685fd268..5b107aa0ab 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java @@ -78,10 +78,10 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo } this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 4, 12, 4, GCBlocks.basicBlock.getStateFromMeta(4), Blocks.flowing_water.getDefaultState(), false); - this.setBlockState(par1World, Blocks.air.getDefaultState(), 2, 12, 2, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.air.getDefaultState(), 3, 12, 2, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.air.getDefaultState(), 2, 12, 3, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.air.getDefaultState(), 3, 12, 3, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.AIR.getDefaultState(), 2, 12, 2, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.AIR.getDefaultState(), 3, 12, 2, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.AIR.getDefaultState(), 2, 12, 3, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.AIR.getDefaultState(), 3, 12, 3, par3StructureBoundingBox); this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 13, 1, par3StructureBoundingBox); this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 14, 1, par3StructureBoundingBox); this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 4, 13, 1, par3StructureBoundingBox); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java index a78de34b40..46d6f14639 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java @@ -108,7 +108,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 5, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 6, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 7, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 1, yLevel, 8, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 1, yLevel, 8, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 9, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 10, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 11, par3StructureBoundingBox); @@ -121,7 +121,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 5, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 6, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 7, yLevel, 15, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 8, yLevel, 15, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 8, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 9, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 10, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 11, yLevel, 15, par3StructureBoundingBox); @@ -134,7 +134,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 11, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 10, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 9, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 15, yLevel, 8, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 15, yLevel, 8, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 7, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 6, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 5, par3StructureBoundingBox); @@ -147,7 +147,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 11, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 10, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 9, yLevel, 1, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 8, yLevel, 1, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 8, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 7, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 6, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 5, yLevel, 1, par3StructureBoundingBox); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java index d5eb41debf..97ab6c3a3f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java @@ -3,7 +3,7 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.pattern.BlockHelper; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenMinable; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenSpaceStation.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenSpaceStation.java index 984d3de7a7..a4f7098da9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenSpaceStation.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenSpaceStation.java @@ -2,7 +2,7 @@ import micdoodle8.mods.galacticraft.core.GCBlocks; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/Corridor.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/Corridor.java index 0dadd88853..c70e29afbd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/Corridor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/Corridor.java @@ -54,7 +54,7 @@ else if (this.getDirection().getAxis() == EnumFacing.Axis.X && (i + 1) % 4 == 0 } } - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, this.boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, this.boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomBoss.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomBoss.java index 24c7884ee4..0a1257151f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomBoss.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomBoss.java @@ -6,7 +6,7 @@ import micdoodle8.mods.galacticraft.core.tile.TileEntityDungeonSpawner; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -88,7 +88,7 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } else if ((i == 1 && k == 1) || (i == 1 && k == this.sizeZ - 1) || (i == this.sizeX - 1 && k == 1) || (i == this.sizeX - 1 && k == this.sizeZ - 1)) @@ -110,7 +110,7 @@ else if ((i == 1 && k == 2) || (i == 2 && k == 1) || } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java index 277f93e012..41b63d6f89 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java @@ -4,7 +4,7 @@ import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEmpty.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEmpty.java index 65906f64fd..05e02c57d6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEmpty.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEmpty.java @@ -75,12 +75,12 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEntrance.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEntrance.java index ec49be774a..94d06f3fb7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEntrance.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEntrance.java @@ -45,7 +45,7 @@ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundi Block block = getBlockStateFromPos(worldIn, i + range, j, k + range, boundingBox).getBlock(); - if (Blocks.air != block && block != null) + if (Blocks.AIR != block && block != null) { break; } @@ -72,7 +72,7 @@ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundi } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } @@ -92,7 +92,7 @@ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundi block1 = this.getBlockStateFromPos(worldIn, i + range, j, k + range, boundingBox); if (block1 == this.configuration.getBrickBlock() || j != this.sizeY) { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i + range, j, k + range, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i + range, j, k + range, boundingBox); helper++; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java index 98625e3d2e..dc8b350e04 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java @@ -3,7 +3,7 @@ import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityMobSpawner; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java index 460efb6e19..05bef75036 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.core.blocks.BlockT1TreasureChest; import micdoodle8.mods.galacticraft.core.tile.TileEntityTreasureChest; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -82,7 +82,7 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } else if ((i == 1 && k == 1) || (i == 1 && k == this.sizeZ - 1) || (i == this.sizeX - 1 && k == 1) || (i == this.sizeX - 1 && k == this.sizeZ - 1)) @@ -100,7 +100,7 @@ else if (i == this.sizeX / 2 && j == 1 && k == this.sizeZ / 2) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ScheduledBlockChange.java b/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ScheduledBlockChange.java index af0fa3c56d..11ead514aa 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ScheduledBlockChange.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ScheduledBlockChange.java @@ -2,7 +2,7 @@ import micdoodle8.mods.galacticraft.api.vector.BlockVec3; import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public class ScheduledBlockChange { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java index 213b75c090..826b1ab6b8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java @@ -38,7 +38,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java index 175822c76a..d6d4bf47bb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java @@ -37,7 +37,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.event.ModelBakeEvent; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBasicAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBasicAsteroids.java index ae371b9069..b587b394c0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBasicAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBasicAsteroids.java @@ -10,16 +10,16 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.IPlantable; @@ -71,7 +71,7 @@ public String getName() public BlockBasicAsteroids(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 3.0F; this.setUnlocalizedName(assetName); } @@ -186,15 +186,14 @@ public boolean isTerraformable(World world, BlockPos pos) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { - IBlockState state = world.getBlockState(pos); if (getMetaFromState(state) == 4) { return new ItemStack(Item.getItemFromBlock(this), 1, getMetaFromState(state)); } - return super.getPickBlock(target, world, pos, player); + return super.getPickBlock(state, target, world, pos, player); } @Override @@ -210,9 +209,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, BASIC_TYPE); + return new BlockStateContainer(this, BASIC_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java index 8132fc3f9d..26d204e9e0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java @@ -11,10 +11,9 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.planets.asteroids.tile.TileEntityBeamReceiver; -import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyDirection; -import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -23,10 +22,10 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; @@ -41,9 +40,9 @@ public class BlockBeamReceiver extends BlockTileGC implements IShiftDescription, public BlockBeamReceiver(String assetName) { - super(Material.iron); + super(Material.IRON); this.setUnlocalizedName(assetName); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); } @SideOnly(Side.CLIENT) @@ -54,19 +53,21 @@ public CreativeTabs getCreativeTabToDisplayOn() } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { + IBlockState state = worldIn.getBlockState(pos); + IBlockState neighborBlock = worldIn.getBlockState(neighborBlockPos); int oldMeta = getMetaFromState(worldIn.getBlockState(pos)); - int meta = this.getMetadataFromAngle(worldIn, pos, EnumFacing.getFront(oldMeta).getOpposite()); + int meta = this.getMetadataFromAngle((World) worldIn, pos, EnumFacing.getFront(oldMeta).getOpposite()); if (meta == -1) { - worldIn.destroyBlock(pos, true); + ((World) worldIn).destroyBlock(pos, true); } if (meta != oldMeta) { - worldIn.setBlockState(pos, getStateFromMeta(meta), 3); + ((World) worldIn).setBlockState(pos, getStateFromMeta(meta), 3); TileEntity thisTile = worldIn.getTileEntity(pos); if (thisTile instanceof TileEntityBeamReceiver) { @@ -77,7 +78,7 @@ public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state } } - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + super.onNeighborChange(worldIn, pos, neighborBlockPos); } @Override @@ -288,9 +289,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java index b62dc88f0d..6d87d04a91 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java @@ -16,8 +16,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -30,9 +30,9 @@ public class BlockBeamReflector extends BlockTileGC implements IShiftDescription { public BlockBeamReflector(String assetName) { - super(Material.iron); + super(Material.IRON); this.setUnlocalizedName(assetName); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockIceAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockIceAsteroids.java index 6b6d527e98..53ba016556 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockIceAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockIceAsteroids.java @@ -6,6 +6,7 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockBreakable; +import net.minecraft.block.material.EnumPushReaction; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; @@ -15,7 +16,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.IBlockAccess; @@ -120,9 +121,9 @@ public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random ra } @Override - public int getMobilityFlag() + public EnumPushReaction getMobilityFlag(IBlockState state) { - return 0; + return EnumPushReaction.NORMAL; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java index 854f88dea6..bfae7d8224 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java @@ -13,9 +13,9 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -26,7 +26,7 @@ public class BlockMinerBase extends BlockTileGC implements IShiftDescription, IS { public BlockMinerBase(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 3.0F; this.setUnlocalizedName(assetName); this.setCreativeTab(CreativeTabs.tabBlock); @@ -96,9 +96,9 @@ public boolean showDescription(int meta) @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java index 2339bbc639..33e733d720 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java @@ -9,9 +9,9 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -26,7 +26,7 @@ public class BlockMinerBaseFull extends BlockTileGC { public BlockMinerBaseFull(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 3.0F; this.setUnlocalizedName(assetName); this.setStepSound(soundTypeMetal); @@ -126,7 +126,7 @@ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState st } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(Item.getItemFromBlock(AsteroidBlocks.blockMinerBase), 1, 0); } @@ -144,8 +144,8 @@ public boolean onUseWrench(World world, BlockPos pos, EntityPlayer entityPlayer, @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java index 5f95df4d84..bb25223f5b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java @@ -22,8 +22,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; @@ -38,10 +38,10 @@ public class BlockShortRangeTelepad extends BlockTileGC implements IShiftDescrip { protected BlockShortRangeTelepad(String assetName) { - super(Material.iron); + super(Material.IRON); this.blockHardness = 3.0F; this.setUnlocalizedName(assetName); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java index 59081fb078..cf88dc5998 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java @@ -15,8 +15,9 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.Explosion; @@ -36,7 +37,7 @@ public class BlockTelepadFake extends BlockAdvancedTile implements ITileEntityPr public BlockTelepadFake(String assetName) { super(GCBlocks.machine); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); // this.setBlockTextureName(Constants.TEXTURE_PREFIX + assetName); this.setUnlocalizedName(assetName); // this.setBlockTextureName(Constants.TEXTURE_PREFIX + "launch_pad"); @@ -111,7 +112,7 @@ public void makeFakeBlock(World worldObj, BlockPos pos, BlockPos mainBlock, IBlo } @Override - public float getBlockHardness(World worldIn, BlockPos pos) + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { TileEntity tileEntity = worldIn.getTileEntity(pos); @@ -142,7 +143,7 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntityTelepadFake tileEntity = (TileEntityTelepadFake) worldIn.getTileEntity(pos); return tileEntity.onActivated(playerIn); @@ -178,7 +179,7 @@ public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Ra } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { TileEntity tileEntity = world.getTileEntity(pos); BlockPos mainBlockPosition = ((TileEntityTelepadFake) tileEntity).mainBlockPosition; @@ -187,7 +188,7 @@ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos { Block mainBlockID = world.getBlockState(mainBlockPosition).getBlock(); - if (Blocks.air != mainBlockID) + if (Blocks.AIR != mainBlockID) { return mainBlockID.getPickBlock(target, world, mainBlockPosition, player); } @@ -267,9 +268,9 @@ public boolean addDestroyEffects(World world, BlockPos pos, EffectRenderer effec } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, TOP, CONNECTABLE); + return new BlockStateContainer(this, TOP, CONNECTABLE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java index 1e41aad312..b24946c57d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java @@ -71,10 +71,10 @@ public String getName() protected BlockWalkway(String assetName) { - super(Material.iron); + super(Material.IRON); this.setHardness(1.0F); this.setUnlocalizedName(assetName); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.isBlockContainer = true; this.setDefaultState(this.blockState.getBaseState().withProperty(WALKWAY_TYPE, EnumWalkwayType.WALKWAY)); } @@ -297,9 +297,9 @@ public boolean showDescription(int meta) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, WALKWAY_TYPE, NORTH, EAST, SOUTH, WEST, DOWN); + return new BlockStateContainer(this, WALKWAY_TYPE, NORTH, EAST, SOUTH, WEST, DOWN); } @Override @@ -364,9 +364,9 @@ public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicAstroMiner.java index 53b6a5c9c0..4bb29fe80a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicAstroMiner.java @@ -10,7 +10,7 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicTier3Rocket.java index 1048589949..eb22d44092 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicTier3Rocket.java @@ -10,7 +10,7 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java index 4714c79378..c5717c9763 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java @@ -21,7 +21,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.WorldServer; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java index 76d72e1583..96053b7d74 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java @@ -150,7 +150,7 @@ public class EntityAstroMiner extends Entity implements IInventory, IPacketRecei public boolean stopForTurn; private static ArrayList noMineList = new ArrayList(); - public static BlockTuple blockingBlock = new BlockTuple(Blocks.air, 0); + public static BlockTuple blockingBlock = new BlockTuple(Blocks.AIR, 0); private int givenFailMessage = 0; private BlockVec3 mineLast = null; private int mineCountDown = 0; @@ -1491,7 +1491,7 @@ private boolean tryMineBlock(BlockPos pos) dropStack(pos, drops); } - this.worldObj.setBlockState(pos, Blocks.air.getDefaultState(), 3); + this.worldObj.setBlockState(pos, Blocks.AIR.getDefaultState(), 3); return false; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java index e5be4971e4..6c168d1801 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java @@ -10,7 +10,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; import java.util.Map; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicAstroMiner.java index 2d2891ad16..0e4930bb60 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicAstroMiner.java @@ -9,7 +9,7 @@ import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerSchematicAstroMiner extends Container diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicTier3Rocket.java index 8c44e53d04..18845b8bfb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicTier3Rocket.java @@ -11,7 +11,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerSchematicTier3Rocket extends Container diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java index 7dde2dce7f..f980c33d2d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java @@ -12,7 +12,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public class SlotSchematicAstroMiner extends Slot { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicTier3Rocket.java index ae77f5a906..2ba154e530 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicTier3Rocket.java @@ -10,7 +10,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public class SlotSchematicTier3Rocket extends Slot { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java index 9736a842f3..4b725b9bb3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java @@ -22,7 +22,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemCanisterLiquidNitrogen.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemCanisterLiquidNitrogen.java index 83b08992bf..d0a3f7f1e6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemCanisterLiquidNitrogen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemCanisterLiquidNitrogen.java @@ -10,7 +10,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java index 39e5723df0..95e6ccd2cb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java @@ -20,7 +20,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/network/PacketSimpleAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/network/PacketSimpleAsteroids.java index f21f2797c1..e272052683 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/network/PacketSimpleAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/network/PacketSimpleAsteroids.java @@ -16,7 +16,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicAstroMiner.java index 5645f97fa4..ff8ac2682e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicAstroMiner.java @@ -11,7 +11,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicTier3Rocket.java index 6cf6e758c4..fa9aeb815f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicTier3Rocket.java @@ -11,7 +11,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamOutput.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamOutput.java index 4265b5ed49..50fdd308cf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamOutput.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamOutput.java @@ -9,7 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java index 561242614a..eb8e390deb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java @@ -22,8 +22,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.world.World; @@ -539,7 +539,7 @@ public void onDestroy(TileEntity callingBlock) @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX() + 2, getPos().getY() + 2, getPos().getZ() + 2); + return new AxisAlignedBB(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX() + 2, getPos().getY() + 2, getPos().getZ() + 2); } @Override @@ -587,7 +587,7 @@ public void updateFacing() if (tileOffset != null && !(tileOffset instanceof TileEntityMinerBase)) { IBlockState state = this.worldObj.getBlockState(offset); - state.getBlock().onNeighborBlockChange(worldObj, offset, state, state.getBlock()); + state.getBlock().onNeighborChange(worldObj, this.getPos(), offset); worldObj.markBlockRangeForRenderUpdate(offset, offset); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBaseSingle.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBaseSingle.java index 77d2d50da9..ce149df8dc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBaseSingle.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBaseSingle.java @@ -2,7 +2,7 @@ import micdoodle8.mods.galacticraft.planets.asteroids.blocks.AsteroidBlocks; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ITickable; import java.util.ArrayList; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java index bd4f525e56..0d83fb4308 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java @@ -106,7 +106,7 @@ public void update() { if (this.targetAddressResult == EnumTelepadSearchResult.VALID && (this.ticks % 5 == 0 || teleporting)) { - List containedEntities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.fromBounds(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), + List containedEntities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getPos().getX() + 1, this.getPos().getY() + 2, this.getPos().getZ() + 1)); if (containedEntities.size() > 0 && this.getEnergyStoredGC() >= ENERGY_USE_ON_TELEPORT) @@ -137,7 +137,7 @@ public void update() if (finalPos != null) { TileEntity tileAt = finalPos.getTileEntity(this.worldObj); - List containedEntities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.fromBounds(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), + List containedEntities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getPos().getX() + 1, this.getPos().getY() + 2, this.getPos().getZ() + 1)); if (tileAt != null && tileAt instanceof TileEntityShortRangeTelepad) @@ -330,7 +330,7 @@ public void onDestroy(TileEntity callingBlock) @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); + return new AxisAlignedBB(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityTelepadFake.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityTelepadFake.java index 4c97a125b3..65796ab5e1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityTelepadFake.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityTelepadFake.java @@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java index 9f35818020..ecaab39fae 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java @@ -13,7 +13,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; @@ -383,8 +383,8 @@ else if (y < terrainY) } else { - primer.setBlockState(index, Blocks.air.getDefaultState()); -// blockArray[index] = Blocks.air; + primer.setBlockState(index, Blocks.AIR.getDefaultState()); +// blockArray[index] = Blocks.AIR; // metaArray[index] = 0; } } @@ -461,7 +461,7 @@ else if (shell != null && distance >= shellThickness) int indexAbove = indexBase | (y + 1); IBlockState state = primer.getBlockState(index); IBlockState stateAbove = primer.getBlockState(indexAbove); - if (Blocks.air == stateAbove.getBlock() && (state.getBlock() == ASTEROID_STONE || state.getBlock() == GRASS)) + if (Blocks.AIR == stateAbove.getBlock() && (state.getBlock() == ASTEROID_STONE || state.getBlock() == GRASS)) { if (this.rand.nextInt(GLOWSTONE_CHANCE) == 0) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java index a33b673990..6307952799 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java @@ -32,7 +32,7 @@ import net.minecraft.potion.Potion; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EntityDamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.WorldServer; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java index cfd1544b69..1ae1135345 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java @@ -41,7 +41,7 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java index 9aa1f9e082..8384db2774 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java @@ -37,7 +37,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.event.ModelBakeEvent; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockBasicMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockBasicMars.java index 1acbf0e90f..f45bc48cbf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockBasicMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockBasicMars.java @@ -22,7 +22,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MovingObjectPosition; @@ -81,7 +81,7 @@ public String getName() public BlockBasicMars(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setUnlocalizedName(assetName); } @@ -121,7 +121,7 @@ public CreativeTabs getCreativeTabToDisplayOn() } @Override - public float getBlockHardness(World worldIn, BlockPos pos) + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { IBlockState state = worldIn.getBlockState(pos); @@ -243,7 +243,7 @@ public boolean isTerraformable(World world, BlockPos pos) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { IBlockState state = world.getBlockState(pos); int metadata = state.getBlock().getMetaFromState(state); @@ -285,9 +285,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, BASIC_TYPE); + return new BlockStateContainer(this, BASIC_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java index 5a059ace68..754085cf5a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java @@ -20,6 +20,7 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.IShearable; @@ -100,13 +101,13 @@ public boolean canBlockStay(World worldIn, BlockPos pos) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + super.onNeighborChange(worldIn, pos, neighborBlockPos); - if (!this.canBlockStay(worldIn, pos)) + if (!this.canBlockStay((World) worldIn, pos)) { - worldIn.setBlockToAir(pos); + ((World) worldIn).setBlockToAir(pos); } } @@ -236,7 +237,7 @@ public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random ra @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override @@ -279,9 +280,9 @@ public boolean showDescription(int meta) @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override @@ -297,9 +298,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, VINE_TYPE); + return new BlockStateContainer(this, VINE_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java index 353b0be08e..ba443e4365 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java @@ -12,7 +12,8 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.Explosion; @@ -49,7 +50,7 @@ public boolean isFullCube() } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { return false; } @@ -62,7 +63,7 @@ public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn) @Override @SideOnly(Side.CLIENT) - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java index d979acc1ab..6e5edd6601 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java @@ -29,7 +29,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MathHelper; @@ -362,9 +362,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE); + return new BlockStateContainer(this, FACING, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java index 92a18ff373..fa43d7ac2e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java @@ -87,7 +87,7 @@ public String getName() public BlockMachineMarsT2(String assetName) { super(GCBlocks.machine); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -263,7 +263,7 @@ public int damageDropped(IBlockState state) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = this.getDamageValue(world, pos); @@ -345,9 +345,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE); + return new BlockStateContainer(this, FACING, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java index 1eb433329a..905bb58bd3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java @@ -23,7 +23,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MovingObjectPosition; @@ -68,7 +69,7 @@ public String getName() public BlockSlimelingEgg(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.625F, 0.75F); this.setUnlocalizedName(assetName); this.setDefaultState(this.blockState.getBaseState().withProperty(EGG_COLOR, EnumEggColor.RED).withProperty(BROKEN, false)); @@ -156,7 +157,7 @@ else if (player.capabilities.isCreativeMode) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { return beginHatch(worldIn, pos, playerIn); } @@ -238,7 +239,7 @@ public TileEntity createNewTileEntity(World world, int meta) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { IBlockState state = world.getBlockState(pos); int metadata = state.getBlock().getMetaFromState(state); @@ -283,9 +284,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, EGG_COLOR, BROKEN); + return new BlockStateContainer(this, EGG_COLOR, BROKEN); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSludge.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSludge.java index 858b0f1f0b..8b6a608f39 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSludge.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSludge.java @@ -7,8 +7,8 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; @@ -36,7 +36,7 @@ public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState s } int range = 5; - List l = worldIn.getEntitiesWithinAABB(EntitySludgeling.class, AxisAlignedBB.fromBounds(pos.getX() - range, pos.getY() - range, pos.getZ() - range, pos.getX() + range, pos.getY() + range, pos.getZ() + range)); + List l = worldIn.getEntitiesWithinAABB(EntitySludgeling.class, new AxisAlignedBB(pos.getX() - range, pos.getY() - range, pos.getZ() - range, pos.getX() + range, pos.getY() + range, pos.getZ() + range)); if (l.size() < 3) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/EntityBacterialDripFX.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/EntityBacterialDripFX.java index 5c548b47cb..3a4ded7afd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/EntityBacterialDripFX.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/EntityBacterialDripFX.java @@ -4,7 +4,7 @@ import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.particle.EntityFX; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicCargoRocket.java index 43db9dcf57..50c13be3f4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicCargoRocket.java @@ -8,7 +8,7 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicTier2Rocket.java index 6a5c9ff7a9..41e52d8615 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicTier2Rocket.java @@ -10,7 +10,7 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java index b04b542b38..56968131f1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java @@ -29,7 +29,7 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java index 7f9e036e68..bfbd1bdae8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java @@ -14,7 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class EntitySludgeling extends EntityMob implements IEntityBreathable @@ -102,7 +102,7 @@ protected void playStepSound(BlockPos pos, Block block) @Override protected Item getDropItem() { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicCargoRocket.java index dc1b028a10..ccc007c391 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicCargoRocket.java @@ -11,7 +11,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerSchematicCargoRocket extends Container diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicTier2Rocket.java index 7f3ef6e871..202e1ba730 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicTier2Rocket.java @@ -11,7 +11,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerSchematicTier2Rocket extends Container diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicCargoRocket.java index 49334924bb..6b713a125b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicCargoRocket.java @@ -10,7 +10,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public class SlotSchematicCargoRocket extends Slot { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicTier2Rocket.java index e6059e56c1..10ee39ed5c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicTier2Rocket.java @@ -10,7 +10,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public class SlotSchematicTier2Rocket extends Slot { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java index 12a91d6e97..92b71677ff 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java @@ -12,7 +12,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java index 1703597a03..19fea866db 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java @@ -24,7 +24,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GCMarsNEIHighlightHandler.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GCMarsNEIHighlightHandler.java index d90644beb9..f3582971de 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GCMarsNEIHighlightHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GCMarsNEIHighlightHandler.java @@ -10,7 +10,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/network/PacketSimpleMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/network/PacketSimpleMars.java index 192dfd7900..7f2aa85b37 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/network/PacketSimpleMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/network/PacketSimpleMars.java @@ -19,7 +19,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicCargoRocket.java index 96906d5b99..2eb2a4309f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicCargoRocket.java @@ -11,7 +11,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicTier2Rocket.java index 60a285d9dc..979c7a525d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicTier2Rocket.java @@ -11,7 +11,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java index 14db63458f..337c534223 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java @@ -16,8 +16,8 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -38,7 +38,7 @@ public TileEntityCryogenicChamber() @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 3, getPos().getZ() + 2); + return new AxisAlignedBB(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 3, getPos().getZ() + 2); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java index 37a4825ddd..f0b4755eb3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java @@ -23,7 +23,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.world.ChunkCoordIntPair; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java index 82a35d04ba..2fcbc85d5a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java @@ -20,8 +20,8 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraftforge.fluids.*; @@ -680,7 +680,7 @@ public IChatComponent getDisplayName() @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(this.getPos().getX() - this.bubbleSize, this.getPos().getY() - this.bubbleSize, this.getPos().getZ() - this.bubbleSize, this.getPos().getX() + this.bubbleSize, this.getPos().getY() + this.bubbleSize, this.getPos().getZ() + this.bubbleSize); + return new AxisAlignedBB(this.getPos().getX() - this.bubbleSize, this.getPos().getY() - this.bubbleSize, this.getPos().getZ() - this.bubbleSize, this.getPos().getX() + this.bubbleSize, this.getPos().getY() + this.bubbleSize, this.getPos().getZ() + this.bubbleSize); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java index ded1f563c5..fba5c10b8f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java @@ -178,13 +178,13 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime { if (metadata == 6 || metadata == 9) { - primer.setBlockState(coords, Blocks.air.getDefaultState()); -// blockIdArray[coords] = Blocks.air; + primer.setBlockState(coords, Blocks.AIR.getDefaultState()); +// blockIdArray[coords] = Blocks.AIR; } else if (metadata == 5 && random.nextInt(MapGenCaveMars.BREAK_THROUGH_CHANCE) == 0) { - primer.setBlockState(coords, Blocks.air.getDefaultState()); -// blockIdArray[coords] = Blocks.air; + primer.setBlockState(coords, Blocks.AIR.getDefaultState()); +// blockIdArray[coords] = Blocks.AIR; } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java index c3b3317211..8c3be5da2f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java @@ -199,8 +199,8 @@ protected void generateCaveNode(long par1, int origXChunkCoord, int origZChunkCo if (block == MarsBlocks.marsBlock || block == MarsBlocks.blockSludge || block == MarsBlocks.vine) { - primer.setBlockState(coords, Blocks.air.getDefaultState()); -// arrayOfIDs[coords] = Blocks.air; + primer.setBlockState(coords, Blocks.AIR.getDefaultState()); +// arrayOfIDs[coords] = Blocks.AIR; } } } @@ -231,13 +231,13 @@ protected void generateCaveNode(long par1, int origXChunkCoord, int origZChunkCo Block blockAbove = primer.getBlockState(var42, var50 + 1, var45).getBlock(); Block blockBelow = primer.getBlockState(var42, var50 - 1, var45).getBlock(); - if (Blocks.air == block) + if (Blocks.AIR == block) { if (blockAbove == MarsBlocks.marsBlock && this.rand.nextInt(200) == 0) { int modifier = 0; - while (Blocks.air == block && var50 + modifier > 0) + while (Blocks.AIR == block && var50 + modifier > 0) { primer.setBlockState(var42, var50 + modifier, var45, MarsBlocks.vine.getStateFromMeta(Math.abs(modifier) % 3)); // arrayOfIDs[coordsBelow] = MarsBlocks.vine; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomBossMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomBossMars.java index 4df23150de..5767331744 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomBossMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomBossMars.java @@ -6,7 +6,7 @@ import micdoodle8.mods.galacticraft.planets.mars.blocks.MarsBlocks; import micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityDungeonSpawnerMars; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -79,7 +79,7 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } else if (j == this.sizeY) @@ -99,7 +99,7 @@ else if (j == 1 && (i <= 2 || k <= 2 || i >= this.sizeX - 2 || k >= this.sizeZ - } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomTreasureMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomTreasureMars.java index 75d5860a4d..50e225bbac 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomTreasureMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomTreasureMars.java @@ -6,7 +6,7 @@ import micdoodle8.mods.galacticraft.planets.mars.blocks.MarsBlocks; import micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityTreasureChestMars; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -79,7 +79,7 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } else if ((i == 1 && k == 1) || (i == 1 && k == this.sizeZ - 1) || (i == this.sizeX - 1 && k == 1) || (i == this.sizeX - 1 && k == this.sizeZ - 1)) @@ -97,7 +97,7 @@ else if (i == this.sizeX / 2 && j == 1 && k == this.sizeZ / 2) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenEggs.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenEggs.java index c6306a40a2..c2b2d751b2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenEggs.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenEggs.java @@ -1,7 +1,7 @@ package micdoodle8.mods.galacticraft.planets.mars.world.gen; import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenTerraformTree.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenTerraformTree.java index 9fd5757238..4619ee9774 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenTerraformTree.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenTerraformTree.java @@ -8,7 +8,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java index f032f147a3..ebafc4376d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java @@ -37,7 +37,7 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java index 90d813db2a..567751ef94 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java @@ -35,7 +35,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.event.ModelBakeEvent; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockBasicVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockBasicVenus.java index 8c4776f014..3dfd30a1e9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockBasicVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockBasicVenus.java @@ -18,7 +18,7 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MathHelper; @@ -78,7 +78,7 @@ public String getName() public BlockBasicVenus(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 2.2F; this.blockResistance = 2.5F; this.setDefaultState(this.blockState.getBaseState().withProperty(BASIC_TYPE_VENUS, EnumBlockBasicVenus.ROCK_SOFT)); @@ -128,7 +128,7 @@ else if (type == EnumBlockBasicVenus.ORE_ALUMINUM || type == EnumBlockBasicVenus } @Override - public float getBlockHardness(World worldIn, BlockPos pos) + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { EnumBlockBasicVenus type = ((EnumBlockBasicVenus) worldIn.getBlockState(pos).getValue(BASIC_TYPE_VENUS)); @@ -270,7 +270,7 @@ public boolean isValueable(IBlockState state) } @Override - public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) + public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) { return false; } @@ -313,9 +313,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, BASIC_TYPE_VENUS); + return new BlockStateContainer(this, BASIC_TYPE_VENUS); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java index 0484dc5c19..fad5d04582 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java @@ -17,8 +17,10 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.WeightedRandomChestContent; @@ -46,7 +48,7 @@ public class BlockCrashedProbe extends Block implements ISortableBlock, ITileEnt public BlockCrashedProbe(String assetName) { - super(Material.iron); + super(Material.IRON); this.blockHardness = 4.5F; this.blockResistance = 2.5F; this.setTickRandomly(true); @@ -81,7 +83,7 @@ public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Ra } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { playerIn.openGui(GalacticraftPlanets.instance, GuiIdsPlanets.MACHINE_VENUS, worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java index 7626b5f126..58b7bf5a47 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java @@ -22,7 +22,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; @@ -35,9 +35,9 @@ public class BlockGeothermalGenerator extends BlockTileGC implements ITileEntity public BlockGeothermalGenerator(String assetName) { - super(Material.iron); + super(Material.IRON); this.setHardness(2.5F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -126,9 +126,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, ACTIVE); + return new BlockStateContainer(this, FACING, ACTIVE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockScorchedRock.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockScorchedRock.java index fa703c8031..921091631b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockScorchedRock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockScorchedRock.java @@ -7,7 +7,7 @@ import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumParticleTypes; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -19,7 +19,7 @@ public class BlockScorchedRock extends Block implements ISortableBlock { public BlockScorchedRock(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 0.9F; this.blockResistance = 2.5F; this.setTickRandomly(true); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSpout.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSpout.java index 387f4a71c4..9bcb07a60a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSpout.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSpout.java @@ -13,7 +13,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -26,7 +26,7 @@ public class BlockSpout extends Block implements ISortableBlock, ITileEntityProv { public BlockSpout(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 4.5F; this.blockResistance = 2.5F; this.setUnlocalizedName(assetName); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSulphuricAcid.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSulphuricAcid.java index 18c6ccae1c..76df9fcc63 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSulphuricAcid.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSulphuricAcid.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import micdoodle8.mods.galacticraft.planets.venus.VenusModule; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java index d0c894ffd6..0d29de049d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java @@ -16,6 +16,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.IShearable; @@ -118,13 +119,13 @@ public boolean canBlockStay(World worldIn, BlockPos pos) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + super.onNeighborChange(worldIn, pos, neighborBlockPos); - if (!this.canBlockStay(worldIn, pos)) + if (!this.canBlockStay((World) worldIn, pos)) { - worldIn.setBlockToAir(pos); + ((World) worldIn).setBlockToAir(pos); } } @@ -183,7 +184,7 @@ public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing facing) @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override @@ -221,9 +222,9 @@ public boolean showDescription(int meta) @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override @@ -239,9 +240,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, WEB_TYPE); + return new BlockStateContainer(this, WEB_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/TickHandlerClientVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/TickHandlerClientVenus.java index 514af4441a..45ecc9e730 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/TickHandlerClientVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/TickHandlerClientVenus.java @@ -10,7 +10,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java index 5f20628f97..dfe52fae0e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java @@ -10,8 +10,8 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.Map; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java index ddbd53c72c..6ae60886e8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java @@ -118,7 +118,7 @@ protected float getSoundPitch() @Override protected Item getDropItem() { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java index 9a49d1ecdb..d0dc23c413 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java @@ -22,7 +22,7 @@ import net.minecraft.pathfinding.PathNavigateGround; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java index 097efc7d98..7b37d9084e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java @@ -7,7 +7,7 @@ import net.minecraft.entity.passive.EntityChicken; import net.minecraft.pathfinding.PathFinder; import net.minecraft.pathfinding.PathNavigate; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java index 3d8846caa2..e554c86f6b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java @@ -5,7 +5,7 @@ import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.pathfinding.PathPoint; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.pathfinder.NodeProcessor; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemVolcanicPickaxe.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemVolcanicPickaxe.java index fec8e8300d..e5bb48d9b3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemVolcanicPickaxe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemVolcanicPickaxe.java @@ -17,7 +17,7 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; @@ -117,7 +117,7 @@ else if (facing.getAxis() == EnumFacing.Axis.X) IBlockState state = worldIn.getBlockState(pos1); if (worldIn.getBlockState(pos).equals(state)) { - worldIn.setBlockState(pos1, Blocks.air.getDefaultState()); + worldIn.setBlockState(pos1, Blocks.AIR.getDefaultState()); state.getBlock().harvestBlock(worldIn, (EntityPlayer) playerIn, pos1, state, worldIn.getTileEntity(pos1)); stack.damageItem(1, playerIn); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java index d6e6544ff6..0b6770d946 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java @@ -21,7 +21,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java index 9020eee914..0bcc22370d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java @@ -3,7 +3,7 @@ import micdoodle8.mods.galacticraft.api.event.wgen.GCCoreEventPopulate; import micdoodle8.mods.galacticraft.core.world.gen.WorldGenMinableMeta; import micdoodle8.mods.galacticraft.planets.venus.VenusBlocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java index 2b13dee4eb..ae896fe890 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java @@ -11,7 +11,7 @@ import net.minecraft.block.BlockFalling; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EnumCreatureType; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.util.MathHelper; import net.minecraft.world.ChunkCoordIntPair; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java index fb2c976bc7..51e9116ef2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java @@ -177,7 +177,7 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime { if (metadata == 1) { - primer.setBlockState(coords, Blocks.air.getDefaultState()); + primer.setBlockState(coords, Blocks.AIR.getDefaultState()); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java index 279a56a7b3..c5b9537e5b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java @@ -169,12 +169,12 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime BlockBasicVenus.EnumBlockBasicVenus type = (BlockBasicVenus.EnumBlockBasicVenus)toReplace.getValue(BlockBasicVenus.BASIC_TYPE_VENUS); if (type == BlockBasicVenus.EnumBlockBasicVenus.ROCK_HARD || type == BlockBasicVenus.EnumBlockBasicVenus.ROCK_SOFT) { - IBlockState north = localZ == 0 ? Blocks.air.getDefaultState() : primer.getBlockState((localX * 16 + localZ - 1) * 256 + localY); - IBlockState south = localZ == 15 ? Blocks.air.getDefaultState() : primer.getBlockState((localX * 16 + localZ + 1) * 256 + localY); - IBlockState east = localX == 15 ? Blocks.air.getDefaultState() : primer.getBlockState(((localX + 1) * 16 + localZ) * 256 + localY); - IBlockState west = localX == 0 ? Blocks.air.getDefaultState() : primer.getBlockState(((localX - 1) * 16 + localZ) * 256 + localY); - IBlockState below = localY == 0 ? Blocks.air.getDefaultState() : primer.getBlockState((localX * 16 + localZ) * 256 + localY - 1); - if (north.getBlock() == Blocks.air || south.getBlock() == Blocks.air || east.getBlock() == Blocks.air || west.getBlock() == Blocks.air || below.getBlock() == Blocks.air) + IBlockState north = localZ == 0 ? Blocks.AIR.getDefaultState() : primer.getBlockState((localX * 16 + localZ - 1) * 256 + localY); + IBlockState south = localZ == 15 ? Blocks.AIR.getDefaultState() : primer.getBlockState((localX * 16 + localZ + 1) * 256 + localY); + IBlockState east = localX == 15 ? Blocks.AIR.getDefaultState() : primer.getBlockState(((localX + 1) * 16 + localZ) * 256 + localY); + IBlockState west = localX == 0 ? Blocks.AIR.getDefaultState() : primer.getBlockState(((localX - 1) * 16 + localZ) * 256 + localY); + IBlockState below = localY == 0 ? Blocks.AIR.getDefaultState() : primer.getBlockState((localX * 16 + localZ) * 256 + localY - 1); + if (north.getBlock() == Blocks.AIR || south.getBlock() == Blocks.AIR || east.getBlock() == Blocks.AIR || west.getBlock() == Blocks.AIR || below.getBlock() == Blocks.AIR) { primer.setBlockState(coords, VenusBlocks.venusBlock.getDefaultState().withProperty(BlockBasicVenus.BASIC_TYPE_VENUS, BlockBasicVenus.EnumBlockBasicVenus.ROCK_MAGMA)); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldChunkManagerVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldChunkManagerVenus.java index 6295710a52..bae3ae16a4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldChunkManagerVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldChunkManagerVenus.java @@ -1,7 +1,7 @@ package micdoodle8.mods.galacticraft.planets.venus.world.gen; import micdoodle8.mods.galacticraft.planets.venus.world.gen.layer.GenLayerVenus; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeCache; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenCrashedProbe.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenCrashedProbe.java index 1441da86ce..d3db2733bd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenCrashedProbe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenCrashedProbe.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.planets.venus.blocks.BlockCrashedProbe; import micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityCrashedProbe; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; @@ -61,7 +61,7 @@ public boolean generate(World worldIn, Random rand, BlockPos position) BlockPos pos = new BlockPos(poolX + position.getX(), poolY + position.getY(), poolZ + position.getZ()); if (distance <= radiusSq) { - worldIn.setBlockState(pos, Blocks.air.getDefaultState(), 2); + worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); } else if (worldIn.getBlockState(pos).getBlock() == VenusBlocks.venusBlock && poolY < 0 && rand.nextInt(5) == 0) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java index 013b1ab607..3686d0ba14 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.planets.venus.blocks.BlockBasicVenus; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -99,7 +99,7 @@ public boolean generate(World worldIn, Random rand, BlockPos position) { if (aboolean[(l1 * 16 + i3) * 8 + i4]) { - worldIn.setBlockState(position.add(l1, i4, i3), i4 >= 4 ? Blocks.air.getDefaultState() : Blocks.lava.getDefaultState(), 2); + worldIn.setBlockState(position.add(l1, i4, i3), i4 >= 4 ? Blocks.AIR.getDefaultState() : Blocks.lava.getDefaultState(), 2); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenVaporPool.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenVaporPool.java index 600570e42d..f7fdd5efd3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenVaporPool.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenVaporPool.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.planets.venus.blocks.BlockBasicVenus; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; @@ -39,7 +39,7 @@ public boolean generate(World worldIn, Random rand, BlockPos position) if (distance <= radiusSq) { BlockPos pos = new BlockPos(poolX + position.getX(), poolY + position.getY(), poolZ + position.getZ()); - worldIn.setBlockState(pos, distance >= radiusSq - 16 ? venusSoft : (poolY <= 0 ? VenusBlocks.sulphuricAcid.getDefaultState() : Blocks.air.getDefaultState()), distance == radiusSq ? 3 : 2); + worldIn.setBlockState(pos, distance >= radiusSq - 16 ? venusSoft : (poolY <= 0 ? VenusBlocks.sulphuricAcid.getDefaultState() : Blocks.AIR.getDefaultState()), distance == radiusSq ? 3 : 2); } } } @@ -49,7 +49,7 @@ public boolean generate(World worldIn, Random rand, BlockPos position) for (int i = 255; i >= position.getY() + 1; --i) { BlockPos pos = new BlockPos(position.getX(), i, position.getZ()); - if (worldIn.getBlockState(pos).getBlock() != Blocks.air) + if (worldIn.getBlockState(pos).getBlock() != Blocks.AIR) { if (!firstSet) { @@ -58,7 +58,7 @@ public boolean generate(World worldIn, Random rand, BlockPos position) } else { - worldIn.setBlockState(pos, Blocks.air.getDefaultState(), 2); + worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/CorridorVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/CorridorVenus.java index af1e60774c..a783ea47ab 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/CorridorVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/CorridorVenus.java @@ -42,7 +42,7 @@ else if (i == 1 || i == this.boundingBox.getXSize() - 2) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, this.boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, this.boundingBox); } } else if (j == 2 && this.getDirection().getAxis() == EnumFacing.Axis.X && (i + 1) % 4 == 0 && i != this.boundingBox.getXSize() - 1) @@ -57,7 +57,7 @@ else if (k == 1 || k == this.boundingBox.getZSize() - 2) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, this.boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, this.boundingBox); } } else if ((this.getDirection().getAxis() == EnumFacing.Axis.Z && (i == 1 || i == this.boundingBox.getXSize() - 2)) || @@ -75,7 +75,7 @@ else if ((this.getDirection().getAxis() == EnumFacing.Axis.Z && (i == 0 || i == } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, this.boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, this.boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomBossVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomBossVenus.java index 35ed9be62e..c95367007d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomBossVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomBossVenus.java @@ -8,7 +8,7 @@ import micdoodle8.mods.galacticraft.planets.venus.entities.EntitySpiderQueen; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -104,7 +104,7 @@ public boolean addComponentParts(World worldIn, Random random, StructureBounding } else if (j < f) { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); if (j + 1 >= f && (dXZ > 5) && random.nextInt(12) == 0) { @@ -187,7 +187,7 @@ else if (j < f) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java index 24cb726e65..e80672ecc8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java @@ -3,7 +3,7 @@ import micdoodle8.mods.galacticraft.core.blocks.BlockT1TreasureChest; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEmptyVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEmptyVenus.java index d95e94e3d4..71406bcb02 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEmptyVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEmptyVenus.java @@ -76,12 +76,12 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEntranceVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEntranceVenus.java index 3470ac9fac..0eb95b8eac 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEntranceVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEntranceVenus.java @@ -45,7 +45,7 @@ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundi Block block = getBlockStateFromPos(worldIn, i + range, j, k + range, boundingBox).getBlock(); - if (Blocks.air != block && block != null) + if (Blocks.AIR != block && block != null) { break; } @@ -72,7 +72,7 @@ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundi } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } @@ -92,7 +92,7 @@ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundi block1 = this.getBlockStateFromPos(worldIn, i + range, j, k + range, boundingBox); if (block1 == this.configuration.getBrickBlockFloor() || j != this.sizeY) { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i + range, j, k + range, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i + range, j, k + range, boundingBox); helper++; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java index 0978337718..18b638d252 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java @@ -2,7 +2,7 @@ import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntityMobSpawner; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java index aa56ebec0a..2547d2f5d6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.planets.venus.VenusBlocks; import micdoodle8.mods.galacticraft.planets.venus.blocks.BlockTier3TreasureChest; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -83,7 +83,7 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } else if ((i == 1 && k == 1) || (i == 1 && k == this.sizeZ - 1) || (i == this.sizeX - 1 && k == 1) || (i == this.sizeX - 1 && k == this.sizeZ - 1)) @@ -101,7 +101,7 @@ else if (i == this.sizeX / 2 && j == 1 && k == this.sizeZ / 2) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } From 57e1550614e75a4c1055e69eeb2f74e1e1fb620c Mon Sep 17 00:00:00 2001 From: Mitch Date: Sun, 26 Feb 2017 19:44:12 -0500 Subject: [PATCH 002/535] Begin 1.10.2 update --- .../core/featurehack/GameDataManipulator.java | 2 +- .../java/codechicken/lib/vec/Cuboid6.java | 2 +- .../java/codechicken/lib/vec/CuboidCoord.java | 2 +- .../codechicken/nei/ContainerCreativeInv.java | 2 +- .../codechicken/nei/WorldOverlayRenderer.java | 2 +- .../java/codechicken/nei/api/ItemInfo.java | 6 +- dependencies/main/java/ic2/api/Direction.java | 2 +- .../api/block/IOxygenReliantBlock.java | 2 +- .../api/block/IPartialSealableBlock.java | 2 +- .../api/block/ITerraformableBlock.java | 2 +- .../galacticraft/api/entity/ILandable.java | 2 +- .../api/event/wgen/GCCoreEventPopulate.java | 2 +- .../prefab/entity/EntitySpaceshipBase.java | 2 +- .../api/prefab/entity/EntityTieredRocket.java | 2 +- .../prefab/world/gen/BiomeDecoratorSpace.java | 2 +- .../prefab/world/gen/ChunkProviderSpace.java | 12 +- .../world/gen/WorldChunkManagerSpace.java | 2 +- .../prefab/world/gen/WorldProviderSpace.java | 2 +- .../api/recipe/ISchematicPage.java | 2 +- .../mods/galacticraft/api/tile/IFuelDock.java | 2 +- .../api/tile/ILandingPadAttachable.java | 2 +- .../galacticraft/api/vector/BlockVec3.java | 2 +- .../galacticraft/api/vector/BlockVec3Dim.java | 2 +- .../mods/galacticraft/api/vector/Vector3.java | 11 +- .../galacticraft/api/world/OxygenHooks.java | 2 +- .../mods/galacticraft/core/GCBlocks.java | 10 +- .../galacticraft/core/TransformerHooks.java | 2 +- .../core/blocks/BlockAdvanced.java | 9 +- .../core/blocks/BlockAdvancedTile.java | 2 +- .../core/blocks/BlockAirLockFrame.java | 16 +-- .../core/blocks/BlockAirLockWall.java | 92 ++++++++------- .../core/blocks/BlockAluminumWire.java | 14 +-- .../galacticraft/core/blocks/BlockBasic.java | 20 ++-- .../core/blocks/BlockBasicMoon.java | 19 +-- .../core/blocks/BlockBossSpawner.java | 12 +- .../core/blocks/BlockBreathableAir.java | 18 +-- .../core/blocks/BlockBrightAir.java | 14 +-- .../core/blocks/BlockBrightBreathableAir.java | 17 +-- .../core/blocks/BlockBrightLamp.java | 100 ++++++++-------- .../core/blocks/BlockCargoLoader.java | 10 +- .../galacticraft/core/blocks/BlockCheese.java | 110 ++++++++---------- .../galacticraft/core/blocks/BlockDish.java | 8 +- .../core/blocks/BlockDoubleSlabGC.java | 4 +- .../core/blocks/BlockEnclosed.java | 33 +++--- .../core/blocks/BlockFallenMeteor.java | 10 +- .../core/blocks/BlockFluidGC.java | 8 +- .../core/blocks/BlockFluidPipe.java | 25 ++-- .../core/blocks/BlockFluidTank.java | 21 ++-- .../core/blocks/BlockFuelLoader.java | 10 +- .../core/blocks/BlockGlowstoneTorch.java | 96 ++++++++------- .../core/blocks/BlockLandingPad.java | 10 +- .../core/blocks/BlockLandingPadFull.java | 33 +++--- .../core/blocks/BlockMachine.java | 8 +- .../core/blocks/BlockMachine2.java | 8 +- .../core/blocks/BlockMachineTiered.java | 8 +- .../galacticraft/core/blocks/BlockMulti.java | 19 +-- .../core/blocks/BlockNasaWorkbench.java | 12 +- .../core/blocks/BlockOxygenCollector.java | 10 +- .../core/blocks/BlockOxygenCompressor.java | 10 +- .../core/blocks/BlockOxygenDetector.java | 6 +- .../core/blocks/BlockOxygenDistributor.java | 10 +- .../core/blocks/BlockOxygenSealer.java | 10 +- .../core/blocks/BlockParaChest.java | 17 +-- .../core/blocks/BlockRefinery.java | 10 +- .../galacticraft/core/blocks/BlockScreen.java | 9 +- .../galacticraft/core/blocks/BlockSlabGC.java | 6 +- .../galacticraft/core/blocks/BlockSolar.java | 10 +- .../core/blocks/BlockSpaceStationBase.java | 8 +- .../core/blocks/BlockSpinThruster.java | 33 +++--- .../core/blocks/BlockT1TreasureChest.java | 15 +-- .../core/blocks/BlockTelemetry.java | 6 +- .../galacticraft/core/blocks/BlockTileGC.java | 2 +- .../core/blocks/BlockTransmitter.java | 12 +- .../core/blocks/BlockUnlitTorch.java | 30 ++--- .../galacticraft/core/blocks/BlockWallGC.java | 10 +- .../core/client/fx/EntityFXOilDrip.java | 2 +- .../core/client/gui/GuiHandler.java | 2 +- .../client/gui/container/GuiOxygenSealer.java | 2 +- .../gui/container/GuiSchematicBuggy.java | 2 +- .../gui/container/GuiSchematicInput.java | 2 +- .../container/GuiSchematicTier1Rocket.java | 2 +- .../core/client/model/ModelBipedGC.java | 4 +- .../core/command/CommandGCAstroMiner.java | 2 +- .../core/command/CommandGCInv.java | 2 +- .../core/command/CommandPlanetTeleport.java | 2 +- .../command/CommandSpaceStationAddOwner.java | 2 +- .../CommandSpaceStationRemoveOwner.java | 2 +- .../core/dimension/SpinManager.java | 4 +- .../core/energy/grid/NetworkFinder.java | 2 +- .../core/energy/tile/TileBaseConductor.java | 4 +- .../energy/tile/TileBaseElectricBlock.java | 2 +- .../core/entities/EntityBossBase.java | 6 +- .../core/entities/EntityCelestialFake.java | 2 +- .../core/entities/EntityFlag.java | 4 +- .../core/entities/EntityLander.java | 2 +- .../core/entities/EntityLanderBase.java | 2 +- .../core/entities/EntityParachest.java | 2 +- .../core/entities/player/FreefallHandler.java | 10 +- .../core/entities/player/GCPlayerHandler.java | 2 +- .../entities/player/GCPlayerStatsClient.java | 2 +- .../core/entities/player/PlayerServer.java | 2 +- .../core/event/EventHandlerGC.java | 4 +- .../core/event/EventLandingPadRemoval.java | 2 +- .../core/event/EventWakePlayer.java | 2 +- .../galacticraft/core/fluid/FluidNetwork.java | 2 +- .../core/fluid/OxygenPressureProtocol.java | 6 +- .../core/fluid/ThreadFindSeal.java | 18 +-- .../core/inventory/ContainerBuggyBench.java | 2 +- .../core/inventory/ContainerSchematic.java | 2 +- .../ContainerSchematicTier1Rocket.java | 2 +- .../core/inventory/SlotBuggyBench.java | 2 +- .../core/inventory/SlotRocketBench.java | 2 +- .../core/items/ItemBlockEnclosed.java | 2 +- .../galacticraft/core/items/ItemFlag.java | 6 +- .../core/items/ItemTier1Rocket.java | 2 +- .../core/items/ItemUniversalWrench.java | 2 +- .../core/nei/GCNEIHighlightHandler.java | 2 +- .../core/network/NetworkUtil.java | 2 +- .../core/network/PacketDynamic.java | 2 +- .../core/network/PacketDynamicInventory.java | 2 +- .../network/PacketFluidNetworkUpdate.java | 2 +- .../core/proxy/ClientProxyCore.java | 6 +- .../core/recipe/RecipeManagerGC.java | 2 +- .../core/schematic/SchematicAdd.java | 2 +- .../core/schematic/SchematicMoonBuggy.java | 2 +- .../core/schematic/SchematicRocketT1.java | 2 +- .../core/tick/TickHandlerClient.java | 2 +- .../core/tick/TickHandlerServer.java | 2 +- .../core/tile/AirLockProtocol.java | 2 +- .../galacticraft/core/tile/FluidTankGC.java | 2 +- .../galacticraft/core/tile/IMultiBlock.java | 2 +- .../tile/TileEntityAirLockController.java | 20 ++-- .../core/tile/TileEntityArclamp.java | 22 ++-- .../core/tile/TileEntityBuggyFueler.java | 6 +- .../tile/TileEntityBuggyFuelerSingle.java | 4 +- .../core/tile/TileEntityCargoUnloader.java | 2 +- .../core/tile/TileEntityDish.java | 16 +-- .../core/tile/TileEntityDungeonSpawner.java | 10 +- .../core/tile/TileEntityFluidPipe.java | 2 +- .../core/tile/TileEntityFluidTank.java | 2 +- .../core/tile/TileEntityFluidTransmitter.java | 4 +- .../core/tile/TileEntityFuelLoader.java | 2 +- .../core/tile/TileEntityLandingPad.java | 8 +- .../core/tile/TileEntityLandingPadSingle.java | 4 +- .../core/tile/TileEntityMulti.java | 8 +- .../core/tile/TileEntityNasaWorkbench.java | 6 +- .../core/tile/TileEntityOxygenCollector.java | 2 +- .../core/tile/TileEntityOxygenDetector.java | 4 +- .../tile/TileEntityOxygenDistributor.java | 2 +- .../core/tile/TileEntityOxygenSealer.java | 2 +- .../core/tile/TileEntityParaChest.java | 4 +- .../core/tile/TileEntitySolar.java | 16 +-- .../core/tile/TileEntitySpaceStationBase.java | 2 +- .../core/tile/TileEntityTelemetry.java | 2 +- .../core/util/ConfigManagerCore.java | 2 +- .../galacticraft/core/util/FluidUtil.java | 2 +- .../mods/galacticraft/core/util/MapUtil.java | 7 +- .../galacticraft/core/util/OxygenUtil.java | 8 +- .../galacticraft/core/util/RedstoneUtil.java | 2 +- .../galacticraft/core/util/WorldUtil.java | 2 +- .../core/world/ChunkLoadingCallback.java | 2 +- .../galacticraft/core/world/IChunkLoader.java | 2 +- .../core/world/gen/BiomeDecoratorMoon.java | 2 +- .../core/world/gen/ChunkProviderMoon.java | 10 +- .../core/world/gen/ChunkProviderOrbit.java | 2 +- .../core/world/gen/MapGenCavesMoon.java | 8 +- .../core/world/gen/OreGenOtherMods.java | 2 +- .../core/world/gen/OverworldGenerator.java | 2 +- .../core/world/gen/StructureComponentGC.java | 2 +- .../world/gen/StructureComponentMoon.java | 4 +- .../world/gen/StructureComponentVillage.java | 2 +- .../gen/StructureComponentVillageField.java | 2 +- .../gen/StructureComponentVillageField2.java | 2 +- .../gen/StructureComponentVillageHouse.java | 8 +- .../gen/StructureComponentVillagePathGen.java | 4 +- .../gen/StructureComponentVillageTorch.java | 2 +- .../gen/StructureComponentVillageWell.java | 8 +- .../gen/StructureComponentVillageWoodHut.java | 8 +- .../core/world/gen/WorldGenMinableMeta.java | 2 +- .../core/world/gen/WorldGenSpaceStation.java | 2 +- .../core/world/gen/dungeon/Corridor.java | 2 +- .../core/world/gen/dungeon/RoomBoss.java | 6 +- .../core/world/gen/dungeon/RoomChest.java | 2 +- .../core/world/gen/dungeon/RoomEmpty.java | 4 +- .../core/world/gen/dungeon/RoomEntrance.java | 6 +- .../core/world/gen/dungeon/RoomSpawner.java | 2 +- .../core/world/gen/dungeon/RoomTreasure.java | 6 +- .../core/wrappers/ScheduledBlockChange.java | 2 +- .../planets/asteroids/AsteroidsModule.java | 2 +- .../asteroids/AsteroidsModuleClient.java | 2 +- .../asteroids/blocks/BlockBasicAsteroids.java | 17 ++- .../asteroids/blocks/BlockBeamReceiver.java | 27 ++--- .../asteroids/blocks/BlockBeamReflector.java | 8 +- .../asteroids/blocks/BlockIceAsteroids.java | 7 +- .../asteroids/blocks/BlockMinerBase.java | 10 +- .../asteroids/blocks/BlockMinerBaseFull.java | 12 +- .../blocks/BlockShortRangeTelepad.java | 8 +- .../asteroids/blocks/BlockTelepadFake.java | 19 +-- .../asteroids/blocks/BlockWalkway.java | 12 +- .../client/gui/GuiSchematicAstroMiner.java | 2 +- .../client/gui/GuiSchematicTier3Rocket.java | 2 +- .../dimension/TeleportTypeAsteroids.java | 2 +- .../asteroids/entities/EntityAstroMiner.java | 4 +- .../asteroids/entities/EntityEntryPod.java | 2 +- .../ContainerSchematicAstroMiner.java | 2 +- .../ContainerSchematicTier3Rocket.java | 2 +- .../inventory/SlotSchematicAstroMiner.java | 2 +- .../inventory/SlotSchematicTier3Rocket.java | 2 +- .../asteroids/items/ItemAstroMiner.java | 2 +- .../items/ItemCanisterLiquidNitrogen.java | 2 +- .../asteroids/items/ItemTier3Rocket.java | 2 +- .../network/PacketSimpleAsteroids.java | 2 +- .../schematic/SchematicAstroMiner.java | 2 +- .../schematic/SchematicTier3Rocket.java | 2 +- .../asteroids/tile/TileEntityBeamOutput.java | 2 +- .../asteroids/tile/TileEntityMinerBase.java | 8 +- .../tile/TileEntityMinerBaseSingle.java | 2 +- .../tile/TileEntityShortRangeTelepad.java | 6 +- .../asteroids/tile/TileEntityTelepadFake.java | 2 +- .../world/gen/ChunkProviderAsteroids.java | 8 +- .../planets/mars/EventHandlerMars.java | 2 +- .../galacticraft/planets/mars/MarsModule.java | 2 +- .../planets/mars/MarsModuleClient.java | 2 +- .../planets/mars/blocks/BlockBasicMars.java | 12 +- .../mars/blocks/BlockCavernousVine.java | 19 +-- .../planets/mars/blocks/BlockCreeperEgg.java | 7 +- .../planets/mars/blocks/BlockMachineMars.java | 6 +- .../mars/blocks/BlockMachineMarsT2.java | 8 +- .../mars/blocks/BlockSlimelingEgg.java | 13 ++- .../planets/mars/blocks/BlockSludge.java | 6 +- .../mars/client/fx/EntityBacterialDripFX.java | 2 +- .../client/gui/GuiSchematicCargoRocket.java | 2 +- .../client/gui/GuiSchematicTier2Rocket.java | 2 +- .../mars/entities/EntityCreeperBoss.java | 2 +- .../mars/entities/EntitySludgeling.java | 4 +- .../ContainerSchematicCargoRocket.java | 2 +- .../ContainerSchematicTier2Rocket.java | 2 +- .../inventory/SlotSchematicCargoRocket.java | 2 +- .../inventory/SlotSchematicTier2Rocket.java | 2 +- .../planets/mars/items/ItemBlockMachine.java | 2 +- .../planets/mars/items/ItemTier2Rocket.java | 2 +- .../mars/nei/GCMarsNEIHighlightHandler.java | 2 +- .../mars/network/PacketSimpleMars.java | 2 +- .../mars/schematic/SchematicCargoRocket.java | 2 +- .../mars/schematic/SchematicTier2Rocket.java | 2 +- .../mars/tile/TileEntityCryogenicChamber.java | 6 +- .../mars/tile/TileEntityLaunchController.java | 2 +- .../mars/tile/TileEntityTerraformer.java | 6 +- .../mars/world/gen/MapGenCaveMars.java | 8 +- .../mars/world/gen/MapGenCavernMars.java | 8 +- .../planets/mars/world/gen/RoomBossMars.java | 6 +- .../mars/world/gen/RoomTreasureMars.java | 6 +- .../planets/mars/world/gen/WorldGenEggs.java | 2 +- .../mars/world/gen/WorldGenTerraformTree.java | 2 +- .../planets/venus/VenusModule.java | 2 +- .../planets/venus/VenusModuleClient.java | 2 +- .../planets/venus/blocks/BlockBasicVenus.java | 12 +- .../venus/blocks/BlockCrashedProbe.java | 8 +- .../blocks/BlockGeothermalGenerator.java | 10 +- .../venus/blocks/BlockScorchedRock.java | 4 +- .../planets/venus/blocks/BlockSpout.java | 4 +- .../venus/blocks/BlockSulphuricAcid.java | 2 +- .../planets/venus/blocks/BlockTorchWeb.java | 19 +-- .../venus/client/TickHandlerClientVenus.java | 2 +- .../venus/entities/EntityEntryPodVenus.java | 4 +- .../planets/venus/entities/EntityJuicer.java | 2 +- .../venus/entities/EntitySpiderQueen.java | 2 +- .../entities/ai/PathNavigateCeiling.java | 2 +- .../entities/ai/WalkNodeProcessorCeiling.java | 2 +- .../venus/items/ItemVolcanicPickaxe.java | 4 +- .../tile/TileEntityGeothermalGenerator.java | 2 +- .../venus/world/gen/BiomeDecoratorVenus.java | 2 +- .../venus/world/gen/ChunkProviderVenus.java | 2 +- .../venus/world/gen/MapGenCaveVenus.java | 2 +- .../venus/world/gen/MapGenLavaVenus.java | 12 +- .../world/gen/WorldChunkManagerVenus.java | 2 +- .../venus/world/gen/WorldGenCrashedProbe.java | 4 +- .../venus/world/gen/WorldGenLakesVenus.java | 4 +- .../venus/world/gen/WorldGenVaporPool.java | 8 +- .../world/gen/dungeon/CorridorVenus.java | 6 +- .../world/gen/dungeon/RoomBossVenus.java | 6 +- .../world/gen/dungeon/RoomChestVenus.java | 2 +- .../world/gen/dungeon/RoomEmptyVenus.java | 4 +- .../world/gen/dungeon/RoomEntranceVenus.java | 6 +- .../world/gen/dungeon/RoomSpawnerVenus.java | 2 +- .../world/gen/dungeon/RoomTreasureVenus.java | 6 +- 286 files changed, 1017 insertions(+), 979 deletions(-) diff --git a/dependencies/main/java/codechicken/core/featurehack/GameDataManipulator.java b/dependencies/main/java/codechicken/core/featurehack/GameDataManipulator.java index 87368b695d..18dee0ce83 100644 --- a/dependencies/main/java/codechicken/core/featurehack/GameDataManipulator.java +++ b/dependencies/main/java/codechicken/core/featurehack/GameDataManipulator.java @@ -13,7 +13,7 @@ public static void replaceItem(int id, Item item) { Item.itemRegistry.registryObjects.put(name, item); Item.itemRegistry.underlyingIntegerMap.put(item, id); Block block = Block.getBlockById(id); - if (block != Blocks.air) { + if (block != Blocks.AIR) { GameData.getBlockItemMap().put(block, item); } } catch (Exception e) { diff --git a/dependencies/main/java/codechicken/lib/vec/Cuboid6.java b/dependencies/main/java/codechicken/lib/vec/Cuboid6.java index 7f83e4e3a0..0fdb2b0c03 100644 --- a/dependencies/main/java/codechicken/lib/vec/Cuboid6.java +++ b/dependencies/main/java/codechicken/lib/vec/Cuboid6.java @@ -2,7 +2,7 @@ import codechicken.lib.util.Copyable; import net.minecraft.block.Block; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import java.math.BigDecimal; import java.math.MathContext; diff --git a/dependencies/main/java/codechicken/lib/vec/CuboidCoord.java b/dependencies/main/java/codechicken/lib/vec/CuboidCoord.java index 577cb37abc..6618d013fd 100644 --- a/dependencies/main/java/codechicken/lib/vec/CuboidCoord.java +++ b/dependencies/main/java/codechicken/lib/vec/CuboidCoord.java @@ -1,7 +1,7 @@ package codechicken.lib.vec; import codechicken.lib.util.Copyable; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import java.util.Iterator; diff --git a/dependencies/main/java/codechicken/nei/ContainerCreativeInv.java b/dependencies/main/java/codechicken/nei/ContainerCreativeInv.java index c82a93e708..cc3a130fb0 100644 --- a/dependencies/main/java/codechicken/nei/ContainerCreativeInv.java +++ b/dependencies/main/java/codechicken/nei/ContainerCreativeInv.java @@ -43,7 +43,7 @@ public SlotBlockArmor(IInventory inv, int slot, int x, int y, int armor) { @Override public boolean isItemValid(ItemStack stack) { - return super.isItemValid(stack) || stack != null;// && Block.getBlockFromItem(stack.getItem()) != Blocks.air; + return super.isItemValid(stack) || stack != null;// && Block.getBlockFromItem(stack.getItem()) != Blocks.AIR; } } diff --git a/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java b/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java index 7f277ce5ef..3729aee17b 100644 --- a/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java +++ b/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java @@ -10,7 +10,7 @@ import net.minecraft.entity.EntityLiving.SpawnPlacementType; import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.passive.EntityPig; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.SpawnerAnimals; diff --git a/dependencies/main/java/codechicken/nei/api/ItemInfo.java b/dependencies/main/java/codechicken/nei/api/ItemInfo.java index 34aea1d942..e49a4dd19f 100644 --- a/dependencies/main/java/codechicken/nei/api/ItemInfo.java +++ b/dependencies/main/java/codechicken/nei/api/ItemInfo.java @@ -148,7 +148,7 @@ public String[] header() { @Override public String[] dump(Item item, int id, String name) { - return new String[] { name, Integer.toString(id), Boolean.toString(Block.getBlockFromItem(item) != Blocks.air), ItemInfo.itemOwners.get(item), item.getClass().getCanonicalName() }; + return new String[] { name, Integer.toString(id), Boolean.toString(Block.getBlockFromItem(item) != Blocks.AIR), ItemInfo.itemOwners.get(item), item.getClass().getCanonicalName() }; } @Override @@ -273,13 +273,13 @@ private static void addDefaultDropDowns() { API.addSubset("Items", new ItemFilter() { @Override public boolean matches(ItemStack item) { - return Block.getBlockFromItem(item.getItem()) == Blocks.air; + return Block.getBlockFromItem(item.getItem()) == Blocks.AIR; } }); API.addSubset("Blocks", new ItemFilter() { @Override public boolean matches(ItemStack item) { - return Block.getBlockFromItem(item.getItem()) != Blocks.air; + return Block.getBlockFromItem(item.getItem()) != Blocks.AIR; } }); API.addSubset("Blocks.MobSpawners", ItemStackSet.of(Blocks.mob_spawner)); diff --git a/dependencies/main/java/ic2/api/Direction.java b/dependencies/main/java/ic2/api/Direction.java index 7483a99a37..0465d6c82c 100644 --- a/dependencies/main/java/ic2/api/Direction.java +++ b/dependencies/main/java/ic2/api/Direction.java @@ -79,7 +79,7 @@ public TileEntity applyToTileEntity(TileEntity te) { */ public TileEntity applyTo(World world, BlockPos pos) { - if (world != null && world.getBlockState(pos).getBlock() != Blocks.air) { + if (world != null && world.getBlockState(pos).getBlock() != Blocks.AIR) { try { return world.getTileEntity(pos); } catch (Exception e) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/block/IOxygenReliantBlock.java b/src/main/java/micdoodle8/mods/galacticraft/api/block/IOxygenReliantBlock.java index f72bd1d388..28de55d158 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/block/IOxygenReliantBlock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/block/IOxygenReliantBlock.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.api.block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/block/IPartialSealableBlock.java b/src/main/java/micdoodle8/mods/galacticraft/api/block/IPartialSealableBlock.java index e32dabf147..4bf83f17db 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/block/IPartialSealableBlock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/block/IPartialSealableBlock.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.api.block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/block/ITerraformableBlock.java b/src/main/java/micdoodle8/mods/galacticraft/api/block/ITerraformableBlock.java index 865d6ca2a1..0286a5fec1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/block/ITerraformableBlock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/block/ITerraformableBlock.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.api.block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface ITerraformableBlock diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/entity/ILandable.java b/src/main/java/micdoodle8/mods/galacticraft/api/entity/ILandable.java index aecc645fc1..1334d37256 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/entity/ILandable.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/entity/ILandable.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.api.entity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; /** * An entity which requires a hook into landing pad events should implement this interface diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/event/wgen/GCCoreEventPopulate.java b/src/main/java/micdoodle8/mods/galacticraft/api/event/wgen/GCCoreEventPopulate.java index 1d7e87d11c..c343d006f0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/event/wgen/GCCoreEventPopulate.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/event/wgen/GCCoreEventPopulate.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.api.event.wgen; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.eventhandler.Event; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java index afb9f7301d..725f671853 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java @@ -24,7 +24,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java index 2e4559ef74..c9c0aec0ca 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java @@ -25,7 +25,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldServer; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/BiomeDecoratorSpace.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/BiomeDecoratorSpace.java index df4b1fe96f..7e7d6d3b0b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/BiomeDecoratorSpace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/BiomeDecoratorSpace.java @@ -1,7 +1,7 @@ package micdoodle8.mods.galacticraft.api.prefab.world.gen; import micdoodle8.mods.galacticraft.api.event.wgen.GCCoreEventPopulate; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java index e768dae7f6..7b096c14c2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java @@ -7,7 +7,7 @@ import net.minecraft.block.BlockFalling; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -176,7 +176,7 @@ public void replaceBlocksForBiome(int par1, int par2, ChunkPrimer primer, BiomeG // final Block var18 = arrayOfIDs[index]; Block var18 = primer.getBlockState(index).getBlock(); - if (Blocks.air == var18) + if (Blocks.AIR == var18) { var13 = -1; } @@ -188,7 +188,7 @@ else if (var18 == this.getStoneBlock().getBlock()) { if (var12 <= 0) { - var14 = Blocks.air; + var14 = Blocks.AIR; var14m = 0; var15 = this.getStoneBlock().getBlock(); var15m = this.getStoneBlock().getMetadata(); @@ -308,10 +308,10 @@ public void makeCrater(int craterX, int craterZ, int chunkX, int chunkZ, int siz int helper = 0; for (int y = 127; y > 0; y--) { - if (Blocks.air != primer.getBlockState(this.getIndex(x, y, z)).getBlock() && helper <= yDev) + if (Blocks.AIR != primer.getBlockState(this.getIndex(x, y, z)).getBlock() && helper <= yDev) { - primer.setBlockState(getIndex(x, y, z), Blocks.air.getDefaultState()); -// chunkArray[this.getIndex(x, y, z)] = Blocks.air; + primer.setBlockState(getIndex(x, y, z), Blocks.AIR.getDefaultState()); +// chunkArray[this.getIndex(x, y, z)] = Blocks.AIR; // metaArray[this.getIndex(x, y, z)] = 0; helper++; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldChunkManagerSpace.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldChunkManagerSpace.java index 7f29299559..b629d71a5a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldChunkManagerSpace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldChunkManagerSpace.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.api.prefab.world.gen; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.biome.BiomeCache; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManager; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldProviderSpace.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldProviderSpace.java index e2a141bd45..f625fc8c17 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldProviderSpace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldProviderSpace.java @@ -6,7 +6,7 @@ import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/recipe/ISchematicPage.java b/src/main/java/micdoodle8/mods/galacticraft/api/recipe/ISchematicPage.java index 7d3e7aad7e..28ccdf41f6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/recipe/ISchematicPage.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/recipe/ISchematicPage.java @@ -4,7 +4,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/tile/IFuelDock.java b/src/main/java/micdoodle8/mods/galacticraft/api/tile/IFuelDock.java index c6b12c3058..a8e71973e7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/tile/IFuelDock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/tile/IFuelDock.java @@ -1,7 +1,7 @@ package micdoodle8.mods.galacticraft.api.tile; import micdoodle8.mods.galacticraft.api.entity.IDockable; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import java.util.HashSet; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/tile/ILandingPadAttachable.java b/src/main/java/micdoodle8/mods/galacticraft/api/tile/ILandingPadAttachable.java index 90bef5ecdf..3a71e96075 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/tile/ILandingPadAttachable.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/tile/ILandingPadAttachable.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.api.tile; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; /** diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java index 605bb26ae3..ae284cc1c4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java @@ -8,7 +8,7 @@ import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.util.ReportedException; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3Dim.java b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3Dim.java index e75fb2addb..928e254711 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3Dim.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3Dim.java @@ -10,7 +10,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.ReportedException; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java b/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java index aae18be48f..172b930e42 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java @@ -5,7 +5,10 @@ import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import org.apache.commons.lang3.builder.EqualsBuilder; @@ -64,7 +67,7 @@ public Vector3(TileEntity par1) this(par1.getPos()); } - public Vector3(Vec3 par1) + public Vector3(Vec3d par1) { this(par1.xCoord, par1.yCoord, par1.zCoord); @@ -430,7 +433,7 @@ public Vector3 toFloor() @SuppressWarnings("unchecked") public List getEntitiesWithin(World worldObj, Class par1Class) { - return worldObj.getEntitiesWithinAABB(par1Class, AxisAlignedBB.fromBounds(this.intX(), this.intY(), this.intZ(), this.intX() + 1, this.intY() + 1, this.intZ() + 1)); + return worldObj.getEntitiesWithinAABB(par1Class, new AxisAlignedBB(this.intX(), this.intY(), this.intZ(), this.intX() + 1, this.intY() + 1, this.intZ() + 1)); } /** @@ -713,7 +716,7 @@ public MovingObjectPosition rayTraceEntities(World world, Vector3 target) Vec3 reachPoint = new Vec3(startingPosition.xCoord + look.xCoord * reachDistance, startingPosition.yCoord + look.yCoord * reachDistance, startingPosition.zCoord + look.zCoord * reachDistance); double checkBorder = 1.1 * reachDistance; - AxisAlignedBB boxToScan = AxisAlignedBB.fromBounds(-checkBorder, -checkBorder, -checkBorder, checkBorder, checkBorder, checkBorder).offset(this.x, this.y, this.z); + AxisAlignedBB boxToScan = new AxisAlignedBB(-checkBorder, -checkBorder, -checkBorder, checkBorder, checkBorder, checkBorder).offset(this.x, this.y, this.z); List entitiesHit = world.getEntitiesWithinAABBExcludingEntity(null, boxToScan); double closestEntity = reachDistance; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/world/OxygenHooks.java b/src/main/java/micdoodle8/mods/galacticraft/api/world/OxygenHooks.java index 2baba4b1fb..3168b4305c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/world/OxygenHooks.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/world/OxygenHooks.java @@ -3,7 +3,7 @@ import net.minecraft.block.Block; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/GCBlocks.java b/src/main/java/micdoodle8/mods/galacticraft/core/GCBlocks.java index 42c7df0254..df42edef57 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/GCBlocks.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/GCBlocks.java @@ -105,8 +105,8 @@ public static void initBlocks() GCBlocks.nasaWorkbench = new BlockNasaWorkbench("rocket_workbench"); GCBlocks.fallenMeteor = new BlockFallenMeteor("fallen_meteor"); GCBlocks.basicBlock = new BlockBasic("basic_block_core"); - GCBlocks.airLockFrame = new BlockAirLockFrame("air_lock_frame"); - GCBlocks.airLockSeal = new BlockAirLockWall("air_lock_seal"); + GCBlocks.AIRLockFrame = new BlockAirLockFrame("air_lock_frame"); + GCBlocks.AIRLockSeal = new BlockAirLockWall("air_lock_seal"); GCBlocks.refinery = new BlockRefinery("refinery"); GCBlocks.oxygenCompressor = new BlockOxygenCompressor(false, "oxygen_compressor"); GCBlocks.fuelLoader = new BlockFuelLoader("fuel_loader"); @@ -139,7 +139,7 @@ public static void initBlocks() GCBlocks.wallGC = new BlockWallGC("wall_gc"); // Hide certain items from NEI - GCBlocks.hiddenBlocks.add(GCBlocks.airLockSeal); + GCBlocks.hiddenBlocks.add(GCBlocks.AIRLockSeal); GCBlocks.hiddenBlocks.add(GCBlocks.breatheableAir); GCBlocks.hiddenBlocks.add(GCBlocks.brightBreatheableAir); GCBlocks.hiddenBlocks.add(GCBlocks.brightAir); @@ -346,8 +346,8 @@ public static void registerBlocks() registerBlock(GCBlocks.cargoLoader, ItemBlockCargoLoader.class); registerBlock(GCBlocks.nasaWorkbench, ItemBlockDesc.class); registerBlock(GCBlocks.basicBlock, ItemBlockBase.class); - registerBlock(GCBlocks.airLockFrame, ItemBlockAirLock.class); - registerBlock(GCBlocks.airLockSeal, ItemBlockGC.class); + registerBlock(GCBlocks.AIRLockFrame, ItemBlockAirLock.class); + registerBlock(GCBlocks.AIRLockSeal, ItemBlockGC.class); registerBlock(GCBlocks.sealableBlock, ItemBlockEnclosed.class); registerBlock(GCBlocks.spaceStationBase, ItemBlockGC.class); registerBlock(GCBlocks.fakeBlock, ItemBlockDummy.class); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java b/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java index 6d8d0ee993..918b13808d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java @@ -25,7 +25,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Vec3; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java index b91e164d34..2a3895a436 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java @@ -6,8 +6,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.lang.reflect.Method; @@ -26,7 +27,7 @@ public BlockAdvanced(Material material) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { /** * Check if the player is holding a wrench or an electric item. If so, @@ -40,14 +41,14 @@ public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, { if (this.onSneakUseWrench(worldIn, pos, playerIn, side, hitX, hitY, hitZ)) { - playerIn.swingItem(); + playerIn.swingArm(hand); return true; } } if (this.onUseWrench(worldIn, pos, playerIn, side, hitX, hitY, hitZ)) { - playerIn.swingItem(); + playerIn.swingArm(hand); return true; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvancedTile.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvancedTile.java index b339d4b2ae..2374646f49 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvancedTile.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvancedTile.java @@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.Random; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java index f53b9eba0a..468f2a5df2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java @@ -6,10 +6,10 @@ import micdoodle8.mods.galacticraft.core.tile.TileEntityAirLockController; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; -import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; @@ -17,9 +17,9 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -64,10 +64,10 @@ public String getName() public BlockAirLockFrame(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setDefaultState(this.blockState.getBaseState().withProperty(AIR_LOCK_TYPE, EnumAirLockType.AIR_LOCK_FRAME)); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -118,7 +118,7 @@ public TileEntity createTileEntity(World world, IBlockState state) } @Override - public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side) + public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) { return true; } @@ -169,9 +169,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, AIR_LOCK_TYPE); + return new BlockStateContainer(this, AIR_LOCK_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockWall.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockWall.java index 6aee4f3db7..9105dc72c3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockWall.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockWall.java @@ -5,20 +5,22 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockBreakable; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import javax.annotation.Nullable; import java.util.Random; public class BlockAirLockWall extends BlockBreakable implements IPartialSealableBlock, ISortableBlock @@ -47,43 +49,43 @@ public String getName() public BlockAirLockWall(String assetName) { - super(Material.iron, false); + super(Material.IRON, false); this.setTickRandomly(true); this.setHardness(1000.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } - @Override - public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) - { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getCollisionBoundingBox(worldIn, pos, state); - } - - @Override - public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) - { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getSelectedBoundingBox(worldIn, pos); - } - - @Override - public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) - { - switch (getConnection(worldIn, pos)) - { - case FLAT: - this.setBlockBounds(0.0F, 0.25F, 0.0F, 1.0F, 0.75F, 1.0F); - break; - case X: - this.setBlockBounds(0.25F, 0.0F, 0.0F, 0.75F, 1.0F, 1.0F); - break; - case Z: - this.setBlockBounds(0.0F, 0.0F, 0.25F, 1.0F, 1.0F, 0.75F); - break; - } - } +// @Override +// public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) +// { +// this.setBlockBoundsBasedOnState(worldIn, pos); +// return super.getCollisionBoundingBox(worldIn, pos, state); +// } +// +// @Override +// public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) +// { +// this.setBlockBoundsBasedOnState(worldIn, pos); +// return super.getSelectedBoundingBox(worldIn, pos); +// } +// +// @Override +// public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) +// { +// switch (getConnection(worldIn, pos)) +// { +// case FLAT: +// this.setBlockBounds(0.0F, 0.25F, 0.0F, 1.0F, 0.75F, 1.0F); +// break; +// case X: +// this.setBlockBounds(0.25F, 0.0F, 0.0F, 0.75F, 1.0F, 1.0F); +// break; +// case Z: +// this.setBlockBounds(0.0F, 0.0F, 0.25F, 1.0F, 1.0F, 0.75F); +// break; +// } +// } @Override public boolean isOpaqueCube() @@ -116,11 +118,11 @@ public boolean isSealed(World worldIn, BlockPos pos, EnumFacing direction) return true; } - @Override - public Item getItem(World world, BlockPos pos) - { - return null; - } +// @Override +// public Item getItem(World world, BlockPos pos) +// { +// return null; +// } @Override public EnumSortCategoryBlock getCategory(int meta) @@ -129,9 +131,9 @@ public EnumSortCategoryBlock getCategory(int meta) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, CONNECTION_TYPE); + return new BlockStateContainer(this, CONNECTION_TYPE); } @Override @@ -144,8 +146,8 @@ private EnumAirLockSealConnection getConnection(IBlockAccess worldIn, BlockPos p { EnumAirLockSealConnection connection; - Block frameID = GCBlocks.airLockFrame; - Block sealID = GCBlocks.airLockSeal; + Block frameID = GCBlocks.AIRLockFrame; + Block sealID = GCBlocks.AIRLockSeal; Block idXMin = worldIn.getBlockState(pos.offset(EnumFacing.WEST)).getBlock(); Block idXMax = worldIn.getBlockState(pos.offset(EnumFacing.WEST)).getBlock(); @@ -164,7 +166,7 @@ private EnumAirLockSealConnection getConnection(IBlockAccess worldIn, BlockPos p { Block blockID = worldIn.getBlockState(pos.offset(dir)).getBlock(); - if (blockID == GCBlocks.airLockFrame || blockID == GCBlocks.airLockSeal) + if (blockID == GCBlocks.AIRLockFrame || blockID == GCBlocks.AIRLockSeal) { adjacentCount++; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java index 3b10f4886c..ca0d20286e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java @@ -7,11 +7,11 @@ import micdoodle8.mods.galacticraft.core.tile.TileEntityAluminumWire; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; -import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; @@ -66,10 +66,10 @@ public String getName() public BlockAluminumWire(String assetName) { - super(Material.cloth); - this.setStepSound(Block.soundTypeCloth); + super(Material.CLOTH); + this.setSoundType(SoundType.CLOTH); this.setResistance(0.2F); - this.setBlockBounds(0.4F, 0.4F, 0.4F, 0.6F, 0.6F, 0.6F); +// this.setBlockBounds(0.4F, 0.4F, 0.4F, 0.6F, 0.6F, 0.6F); this.setHardness(0.075F); this.setUnlocalizedName(assetName); } @@ -179,9 +179,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, WIRE_TYPE, UP, DOWN, NORTH, EAST, SOUTH, WEST); + return new BlockStateContainer(this, WIRE_TYPE, UP, DOWN, NORTH, EAST, SOUTH, WEST); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java index d5aa6b5b51..0862d3cacd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java @@ -7,16 +7,16 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.IStringSerializable; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.Explosion; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -75,7 +75,7 @@ public String getName() public BlockBasic(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); this.blockResistance = 15F; this.setDefaultState(this.blockState.getBaseState().withProperty(BASIC_TYPE, EnumBlockBasic.ALUMINUM_DECORATION_BLOCK_0)); @@ -157,9 +157,9 @@ else if (metadata > 8) } @Override - public float getBlockHardness(World world, BlockPos pos) + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { - int metadata = getMetaFromState(world.getBlockState(pos)); + int metadata = getMetaFromState(blockState); if (metadata == 5 || metadata == 6) { @@ -204,7 +204,7 @@ public boolean isValueable(IBlockState state) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = getMetaFromState(world.getBlockState(pos)); @@ -213,7 +213,7 @@ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos return new ItemStack(Item.getItemFromBlock(this), 1, metadata); } - return super.getPickBlock(target, world, pos, player); + return super.getPickBlock(state, target, world, pos, player); } @Override @@ -229,9 +229,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, BASIC_TYPE); + return new BlockStateContainer(this, BASIC_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java index 0b5282ff46..2f525ba3c3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java @@ -20,14 +20,16 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IPlantable; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -87,7 +89,7 @@ public String getName() public BlockBasicMoon(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 1.5F; this.blockResistance = 2.5F; this.setDefaultState(this.blockState.getBaseState().withProperty(BASIC_TYPE_MOON, EnumBlockBasicMoon.ORE_COPPER_MOON)); @@ -124,7 +126,7 @@ else if (type == EnumBlockBasicMoon.ORE_COPPER_MOON || type == EnumBlockBasicMoo } @Override - public float getBlockHardness(World worldIn, BlockPos pos) + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { EnumBlockBasicMoon type = ((EnumBlockBasicMoon) worldIn.getBlockState(pos).getValue(BASIC_TYPE_MOON)); @@ -246,7 +248,7 @@ public boolean isValueable(IBlockState state) } @Override - public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) + public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) { EnumBlockBasicMoon type = ((EnumBlockBasicMoon) world.getBlockState(pos).getValue(BASIC_TYPE_MOON)); @@ -258,7 +260,6 @@ public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing dire plantable.getPlant(world, pos.offset(EnumFacing.UP)); return plantable instanceof BlockFlower; - } @Override @@ -288,7 +289,7 @@ public boolean isTerraformable(World world, BlockPos pos) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { // int metadata = getMetaFromState(world.getBlockState(pos)); // if (metadata == 2) @@ -296,7 +297,7 @@ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos // return new ItemStack(Item.getItemFromBlock(this), 1, metadata); // } - return super.getPickBlock(target, world, pos, player); + return super.getPickBlock(state, target, world, pos, player); } @Override @@ -359,9 +360,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, BASIC_TYPE_MOON); + return new BlockStateContainer(this, BASIC_TYPE_MOON); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBossSpawner.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBossSpawner.java index f80ebcd240..c907683678 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBossSpawner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBossSpawner.java @@ -11,10 +11,10 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -24,7 +24,7 @@ public class BlockBossSpawner extends Block implements ITileEntityProvider { public BlockBossSpawner(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 1000000.0F; this.blockResistance = 1000000.0F; this.setUnlocalizedName(assetName); @@ -51,7 +51,7 @@ public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFaci @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override @@ -67,7 +67,7 @@ public TileEntity createNewTileEntity(World worldIn, int meta) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBreathableAir.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBreathableAir.java index 2b5f420aa0..77b17b7a85 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBreathableAir.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBreathableAir.java @@ -4,12 +4,14 @@ import micdoodle8.mods.galacticraft.core.fluid.OxygenPressureProtocol; import net.minecraft.block.Block; import net.minecraft.block.BlockAir; +import net.minecraft.block.SoundType; +import net.minecraft.block.material.EnumPushReaction; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -22,7 +24,6 @@ public BlockBreathableAir(String assetName) this.setResistance(1000.0F); this.setHardness(0.0F); this.setUnlocalizedName(assetName); - this.setStepSound(new SoundType("sand", 0.0F, 1.0F)); } @Override @@ -38,15 +39,15 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) } @Override - public int getMobilityFlag() + public EnumPushReaction getMobilityFlag(IBlockState state) { - return 1; + return EnumPushReaction.DESTROY; } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override @@ -64,13 +65,14 @@ public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFaci } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - if (Blocks.air != neighborBlock && neighborBlock != GCBlocks.brightAir) + IBlockState neighborBlock = worldIn.getBlockState(neighborBlockPos); + if (Blocks.AIR != neighborBlock && neighborBlock != GCBlocks.brightAir) //Do nothing if an air neighbour was replaced (probably because replacing with breatheableAir) //but do a check if replacing breatheableAir as that could be dividing a sealed space { - OxygenPressureProtocol.onEdgeBlockUpdated(worldIn, pos); + OxygenPressureProtocol.onEdgeBlockUpdated((World) worldIn, pos); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightAir.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightAir.java index f5690a40d7..847d544aa3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightAir.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightAir.java @@ -1,11 +1,12 @@ package micdoodle8.mods.galacticraft.core.blocks; import net.minecraft.block.BlockAir; +import net.minecraft.block.material.EnumPushReaction; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -19,7 +20,6 @@ public BlockBrightAir(String assetName) this.setResistance(1000.0F); this.setHardness(0.0F); this.setUnlocalizedName(assetName); - this.setStepSound(new SoundType("sand", 0.0F, 1.0F)); this.setLightLevel(1.0F); } @@ -36,15 +36,15 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) } @Override - public int getMobilityFlag() + public EnumPushReaction getMobilityFlag(IBlockState state) { - return 1; + return EnumPushReaction.DESTROY; } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override @@ -54,8 +54,8 @@ public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFaci } @Override - public int getLightValue(IBlockAccess world, BlockPos pos) + public int getLightValue(IBlockState state) { - return 15 - getMetaFromState(world.getBlockState(pos)); + return 15 - getMetaFromState(state); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightBreathableAir.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightBreathableAir.java index 981b3c98e8..5357f6b53f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightBreathableAir.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightBreathableAir.java @@ -4,11 +4,12 @@ import micdoodle8.mods.galacticraft.core.fluid.OxygenPressureProtocol; import net.minecraft.block.Block; import net.minecraft.block.BlockAir; +import net.minecraft.block.material.EnumPushReaction; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -22,7 +23,6 @@ public BlockBrightBreathableAir(String assetName) this.setResistance(1000.0F); this.setHardness(0.0F); this.setUnlocalizedName(assetName); - this.setStepSound(new SoundType("sand", 0.0F, 1.0F)); this.setLightLevel(1.0F); } @@ -39,15 +39,15 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) } @Override - public int getMobilityFlag() + public EnumPushReaction getMobilityFlag(IBlockState state) { - return 1; + return EnumPushReaction.DESTROY; } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override @@ -65,13 +65,14 @@ public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFaci } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - if (Blocks.air != neighborBlock && neighborBlock != GCBlocks.brightAir) + IBlockState neighborBlock = worldIn.getBlockState(neighborBlockPos); + if (Blocks.AIR != neighborBlock && neighborBlock != GCBlocks.brightAir) //Do nothing if an air neighbour was replaced (probably because replacing with breatheableAir) //but do a check if replacing breatheableAir as that could be dividing a sealed space { - OxygenPressureProtocol.onEdgeBlockUpdated(worldIn, pos); + OxygenPressureProtocol.onEdgeBlockUpdated((World) worldIn, pos); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java index 157ccfd471..8c9bbfdd0d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java @@ -8,17 +8,20 @@ import micdoodle8.mods.galacticraft.core.util.RedstoneUtil; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyDirection; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -31,10 +34,10 @@ public class BlockBrightLamp extends BlockAdvanced implements IShiftDescription, public BlockBrightLamp(String assetName) { - super(Material.glass); + super(Material.GLASS); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.UP).withProperty(ACTIVE, true)); this.setHardness(0.1F); - this.setStepSound(Block.soundTypeWood); + this.setSoundType(SoundType.WOOD); this.setUnlocalizedName(assetName); this.setLightLevel(1.0F); } @@ -64,7 +67,7 @@ public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlock { double boundsMin = 0.2D; double boundsMax = 0.8D; - return AxisAlignedBB.fromBounds(pos.getX() + boundsMin, pos.getY() + boundsMin, pos.getZ() + boundsMin, pos.getX() + boundsMax, pos.getY() + boundsMax, pos.getZ() + boundsMax); + return new AxisAlignedBB(pos.getX() + boundsMin, pos.getY() + boundsMin, pos.getZ() + boundsMin, pos.getX() + boundsMax, pos.getY() + boundsMax, pos.getZ() + boundsMax); } @Override @@ -114,58 +117,55 @@ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, * neighbor blockID */ @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { + IBlockState state = worldIn.getBlockState(pos); EnumFacing side = (EnumFacing) state.getValue(FACING); BlockPos offsetPos = pos.offset(side); IBlockState state1 = worldIn.getBlockState(offsetPos); - if (state1.getBlock().isSideSolid(worldIn, offsetPos, EnumFacing.getFront(side.getIndex() ^ 1))) + if (state1.getBlock().isSideSolid(state1, worldIn, offsetPos, EnumFacing.getFront(side.getIndex() ^ 1))) { return; } - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); - } - - /** - * Ray traces through the blocks collision from start vector to end vector - * returning a ray trace hit. Args: world, x, y, z, startVec, endVec - */ - @Override - public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) - { - EnumFacing side = worldIn.getBlockState(pos).getValue(FACING); - float var8 = 0.3F; - - if (side == EnumFacing.WEST) - { - this.setBlockBounds(0.0F, 0.2F, 0.5F - var8, var8 * 2.0F, 0.8F, 0.5F + var8); - } - else if (side == EnumFacing.EAST) - { - this.setBlockBounds(1.0F - var8 * 2.0F, 0.2F, 0.5F - var8, 1.0F, 0.8F, 0.5F + var8); - } - else if (side == EnumFacing.NORTH) - { - this.setBlockBounds(0.5F - var8, 0.2F, 0.0F, 0.5F + var8, 0.8F, var8 * 2.0F); - } - else if (side == EnumFacing.SOUTH) - { - this.setBlockBounds(0.5F - var8, 0.2F, 1.0F - var8 * 2.0F, 0.5F + var8, 0.8F, 1.0F); - } - else if (side == EnumFacing.DOWN) - { - this.setBlockBounds(0.5F - var8, 0.0F, 0.5F - var8, 0.5F + var8, 0.6F, 0.5F + var8); - } - else - { - this.setBlockBounds(0.5F - var8, 0.4F, 0.5F - var8, 0.5F + var8, 1.0F, 0.5F + var8); - } - - return super.collisionRayTrace(worldIn, pos, start, end); - } + this.dropBlockAsItem((World) worldIn, pos, state, 0); + ((World) worldIn).setBlockToAir(pos); + } + +// @Override +// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +// { +// EnumFacing side = worldIn.getBlockState(pos).getValue(FACING); +// float var8 = 0.3F; +// +// if (side == EnumFacing.WEST) +// { +// this.setBlockBounds(0.0F, 0.2F, 0.5F - var8, var8 * 2.0F, 0.8F, 0.5F + var8); +// } +// else if (side == EnumFacing.EAST) +// { +// this.setBlockBounds(1.0F - var8 * 2.0F, 0.2F, 0.5F - var8, 1.0F, 0.8F, 0.5F + var8); +// } +// else if (side == EnumFacing.NORTH) +// { +// this.setBlockBounds(0.5F - var8, 0.2F, 0.0F, 0.5F + var8, 0.8F, var8 * 2.0F); +// } +// else if (side == EnumFacing.SOUTH) +// { +// this.setBlockBounds(0.5F - var8, 0.2F, 1.0F - var8 * 2.0F, 0.5F + var8, 0.8F, 1.0F); +// } +// else if (side == EnumFacing.DOWN) +// { +// this.setBlockBounds(0.5F - var8, 0.0F, 0.5F - var8, 0.5F + var8, 0.6F, 0.5F + var8); +// } +// else +// { +// this.setBlockBounds(0.5F - var8, 0.4F, 0.5F - var8, 0.5F + var8, 1.0F, 0.5F + var8); +// } +// +// return super.collisionRayTrace(worldIn, pos, start, end); +// } @Override public boolean onUseWrench(World world, BlockPos pos, EntityPlayer entityPlayer, EnumFacing side, float hitX, float hitY, float hitZ) @@ -225,9 +225,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, new IProperty[] { FACING, ACTIVE }); + return new BlockStateContainer(this, new IProperty[] { FACING, ACTIVE }); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCargoLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCargoLoader.java index c770927702..aac712bab6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCargoLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCargoLoader.java @@ -20,7 +20,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MathHelper; @@ -76,9 +76,9 @@ public String getName() public BlockCargoLoader(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -245,9 +245,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE); + return new BlockStateContainer(this, FACING, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java index 483cb5a0aa..6f6c65ac2d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java @@ -4,19 +4,21 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyInteger; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -30,61 +32,47 @@ public class BlockCheese extends Block implements IShiftDescription, ISortableBl public BlockCheese(String assetName) { - super(Material.cake); + super(Material.CAKE); this.setTickRandomly(true); this.disableStats(); this.setHardness(0.5F); this.setDefaultState(this.blockState.getBaseState().withProperty(BITES, Integer.valueOf(0))); - this.setStepSound(Block.soundTypeCloth); + this.setSoundType(SoundType.CLOTH); this.setUnlocalizedName(assetName); } - /** - * Updates the blocks bounds based on its current state. Args: world, x, y, - * z - */ - @Override - public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) - { - float f = 0.0625F; - float f1 = (float) (1 + ((Integer) worldIn.getBlockState(pos).getValue(BITES)).intValue() * 2) / 16.0F; - float f2 = 0.5F; - this.setBlockBounds(f1, 0.0F, f, 1.0F - f, f2, 1.0F - f); - } - - /** - * Sets the block's bounds for rendering it as an item - */ - @Override - public void setBlockBoundsForItemRender() - { - float f = 0.0625F; - float f1 = 0.5F; - this.setBlockBounds(f, 0.0F, f, 1.0F - f, f1, 1.0F - f); - } - - /** - * Returns a bounding box from the pool of bounding boxes (this means this - * box can change after the pool has been cleared to be reused) - */ - @Override - public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) - { - float f = 0.0625F; - float f1 = (float) (1 + ((Integer) state.getValue(BITES)).intValue() * 2) / 16.0F; - float f2 = 0.5F; - return new AxisAlignedBB((double) ((float) pos.getX() + f1), (double) pos.getY(), (double) ((float) pos.getZ() + f), (double) ((float) (pos.getX() + 1) - f), (double) ((float) pos.getY() + f2), (double) ((float) (pos.getZ() + 1) - f)); - } - - @Override - @SideOnly(Side.CLIENT) - /** - * Returns the bounding box of the wired rectangular prism to render. - */ - public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) - { - return this.getCollisionBoundingBox(worldIn, pos, worldIn.getBlockState(pos)); - } +// @Override +// public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) +// { +// float f = 0.0625F; +// float f1 = (float) (1 + ((Integer) worldIn.getBlockState(pos).getValue(BITES)).intValue() * 2) / 16.0F; +// float f2 = 0.5F; +// this.setBlockBounds(f1, 0.0F, f, 1.0F - f, f2, 1.0F - f); +// } +// +// @Override +// public void setBlockBoundsForItemRender() +// { +// float f = 0.0625F; +// float f1 = 0.5F; +// this.setBlockBounds(f, 0.0F, f, 1.0F - f, f1, 1.0F - f); +// } +// +// @Override +// public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) +// { +// float f = 0.0625F; +// float f1 = (float) (1 + ((Integer) state.getValue(BITES)).intValue() * 2) / 16.0F; +// float f2 = 0.5F; +// return new AxisAlignedBB((double) ((float) pos.getX() + f1), (double) pos.getY(), (double) ((float) pos.getZ() + f), (double) ((float) (pos.getX() + 1) - f), (double) ((float) pos.getY() + f2), (double) ((float) (pos.getZ() + 1) - f)); +// } +// +// @Override +// @SideOnly(Side.CLIENT) +// public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) +// { +// return this.getCollisionBoundingBox(worldIn, pos, worldIn.getBlockState(pos)); +// } @Override public boolean isFullCube() @@ -99,7 +87,7 @@ public boolean isOpaqueCube() } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { this.eatCheeseSlice(worldIn, pos, worldIn.getBlockState(pos), playerIn); return true; @@ -136,11 +124,11 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - if (!this.canBlockStay(worldIn, pos)) + if (!this.canBlockStay((World) worldIn, pos)) { - worldIn.setBlockToAir(pos); + ((World) worldIn).setBlockToAir(pos); } } @@ -158,7 +146,7 @@ public int quantityDropped(Random par1Random) @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override @@ -188,9 +176,9 @@ public Item getItem(World worldIn, BlockPos pos) @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override @@ -200,9 +188,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, new IProperty[] { BITES }); + return new BlockStateContainer(this, new IProperty[] { BITES }); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java index a8823eccd9..53229908a7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java @@ -15,7 +15,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; @@ -25,9 +25,9 @@ public class BlockDish extends BlockTileGC implements IShiftDescription, IPartia { public BlockDish(String assetName) { - super(Material.iron); + super(Material.IRON); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -133,7 +133,7 @@ public boolean onSneakMachineActivated(World world, BlockPos pos, EntityPlayer e } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = this.getDamageValue(world, pos); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDoubleSlabGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDoubleSlabGC.java index f099347f89..632e30f639 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDoubleSlabGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDoubleSlabGC.java @@ -6,7 +6,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -54,7 +54,7 @@ public int damageDropped(IBlockState state) @Override @SideOnly(Side.CLIENT) - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(this, 1, this.getMetaFromState(world.getBlockState(pos)) & 7); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java index 1d077041a7..894bc5face 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java @@ -21,9 +21,10 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -226,18 +227,20 @@ public int getDamageValue(World worldIn, BlockPos pos) } @Override - public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block block) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { + IBlockState state = worldIn.getBlockState(pos); + IBlockState neighborBlock = worldIn.getBlockState(neighborBlockPos); int metadata = state.getBlock().getMetaFromState(state); - final TileEntity tileEntity = world.getTileEntity(pos); + final TileEntity tileEntity = worldIn.getTileEntity(pos); if (metadata == EnumEnclosedBlockType.TE_CONDUIT.getMeta()) { - super.onNeighborBlockChange(world, pos, state, block); + super.onNeighborChange(worldIn, pos, neighborBlockPos); } else if (metadata == EnumEnclosedBlockType.OXYGEN_PIPE.getMeta()) { - super.onNeighborBlockChange(world, pos, state, block); + super.onNeighborChange(worldIn, pos, neighborBlockPos); if (tileEntity instanceof INetworkConnection) { @@ -246,12 +249,12 @@ else if (metadata == EnumEnclosedBlockType.OXYGEN_PIPE.getMeta()) } else if (metadata <= 6) { - super.onNeighborBlockChange(world, pos, state, block); + super.onNeighborChange(worldIn, pos, neighborBlockPos); if (CompatibilityManager.isIc2Loaded() && tileEntity != null) { try { - onBlockNeighbourChangeIC2.invoke(tileEntity, block); + onBlockNeighbourChangeIC2.invoke(tileEntity, neighborBlock.getBlock()); return; } catch (Exception e) @@ -268,7 +271,7 @@ else if (metadata <= 12) { try { - blockPipeBC.onNeighborBlockChange(world, pos, state, block); + blockPipeBC.onNeighborChange(worldIn, pos, neighborBlockPos); } catch (Exception e) { @@ -278,19 +281,19 @@ else if (metadata <= 12) } } - super.onNeighborBlockChange(world, pos, state, block); + super.onNeighborChange(worldIn, pos, neighborBlockPos); } else if (metadata <= EnumEnclosedBlockType.ME_CABLE.getMeta()) { - super.onNeighborBlockChange(world, pos, state, block); + super.onNeighborChange(worldIn, pos, neighborBlockPos); if (CompatibilityManager.isAppEngLoaded()) { - world.markBlockForUpdate(pos); +// worldIn.markBlockForUpdate(pos); TODO } } else if (metadata <= EnumEnclosedBlockType.ALUMINUM_WIRE.getMeta()) { - super.onNeighborBlockChange(world, pos, state, block); + super.onNeighborChange(worldIn, pos, neighborBlockPos); if (tileEntity instanceof IConductor) { ((IConductor) tileEntity).refresh(); @@ -298,7 +301,7 @@ else if (metadata <= EnumEnclosedBlockType.ALUMINUM_WIRE.getMeta()) } else if (metadata <= EnumEnclosedBlockType.ALUMINUM_WIRE_HEAVY.getMeta()) { - super.onNeighborBlockChange(world, pos, state, block); + super.onNeighborChange(worldIn, pos, neighborBlockPos); if (tileEntity instanceof IConductor) { ((IConductor) tileEntity).refresh(); @@ -493,9 +496,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, TYPE); + return new BlockStateContainer(this, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFallenMeteor.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFallenMeteor.java index 7f749fbfe0..d6ce03be66 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFallenMeteor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFallenMeteor.java @@ -19,7 +19,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumParticleTypes; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -30,7 +30,7 @@ public class BlockFallenMeteor extends Block implements ITileEntityProvider, ISh { public BlockFallenMeteor(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setBlockBounds(0.2F, 0.2F, 0.2F, 0.8F, 0.8F, 0.8F); this.setHardness(50.0F); this.setStepSound(Block.soundTypeStone); @@ -117,9 +117,9 @@ public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); + ((World)worldIn).scheduleUpdate(pos, this, this.tickRate((World) worldIn)); } @Override @@ -136,7 +136,7 @@ private void tryToFall(World world, BlockPos pos, IBlockState state) if (this.canFallBelow(world, pos.down()) && pos.getY() >= 0) { int prevHeatLevel = ((TileEntityFallenMeteor) world.getTileEntity(pos)).getHeatLevel(); - world.setBlockState(pos, Blocks.air.getDefaultState(), 3); + world.setBlockState(pos, Blocks.AIR.getDefaultState(), 3); BlockPos blockpos1; for (blockpos1 = pos.down(); this.canFallBelow(world, blockpos1) && blockpos1.getY() > 0; blockpos1 = blockpos1.down()) {} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidGC.java index b599c41384..ab718ca0a3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidGC.java @@ -8,7 +8,9 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -39,14 +41,14 @@ public BlockFluidGC(Fluid fluid, String assetName) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote && this.fluidName.startsWith("oil") && playerIn instanceof EntityPlayerSP) { ClientProxyCore.playerClientHandler.onBuild(7, (EntityPlayerSP) playerIn); } - return super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ); + return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidPipe.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidPipe.java index 821e7c04ba..2e726fa184 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidPipe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidPipe.java @@ -23,7 +23,10 @@ import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.NetworkRegistry; @@ -43,7 +46,7 @@ public class BlockFluidPipe extends BlockTransmitter implements ITileEntityProvi public BlockFluidPipe(String assetName, EnumPipeMode mode) { - super(Material.glass); + super(Material.GLASS); this.setHardness(0.3F); this.setStepSound(Block.soundTypeGlass); this.setDefaultState(this.blockState.getBaseState().withProperty(COLOR, EnumDyeColor.WHITE)); @@ -84,10 +87,10 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); - worldIn.notifyLightSet(pos); + super.onNeighborChange(worldIn, pos, neighborBlockPos); + ((World) worldIn).notifyLightSet(pos); } @Override @@ -114,11 +117,11 @@ public boolean onUseWrench(World world, BlockPos pos, EntityPlayer entityPlayer, } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { final TileEntityFluidPipe tileEntity = (TileEntityFluidPipe) worldIn.getTileEntity(pos); - if (super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ)) + if (super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ)) { return true; } @@ -223,9 +226,9 @@ public String getShiftDescription(int meta) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, COLOR, UP, DOWN, NORTH, EAST, SOUTH, WEST); + return new BlockStateContainer(this, COLOR, UP, DOWN, NORTH, EAST, SOUTH, WEST); } @Override @@ -236,9 +239,9 @@ public boolean showDescription(int meta) @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidTank.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidTank.java index 4d890077d5..09c4b5d340 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidTank.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidTank.java @@ -16,10 +16,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidUtil; @@ -36,7 +37,7 @@ public class BlockFluidTank extends Block implements IShiftDescription, ISortabl public BlockFluidTank(String assetName) { - super(Material.glass); + super(Material.GLASS); this.setHardness(3.0F); this.setResistance(8.0F); this.setUnlocalizedName(assetName); @@ -62,9 +63,9 @@ public CreativeTabs getCreativeTabToDisplayOn() @SideOnly(Side.CLIENT) @Override - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override @@ -98,9 +99,9 @@ public boolean showDescription(int meta) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, UP, DOWN); + return new BlockStateContainer(this, UP, DOWN); } @Override @@ -157,9 +158,9 @@ public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { - if (super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ)) + if (super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ)) { return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFuelLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFuelLoader.java index 85dde01a05..4b3a2451c6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFuelLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFuelLoader.java @@ -17,7 +17,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -28,9 +28,9 @@ public class BlockFuelLoader extends BlockAdvancedTile implements IShiftDescript public BlockFuelLoader(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -137,9 +137,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java index a0637ff776..de80b628fb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java @@ -5,14 +5,18 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyDirection; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -25,12 +29,12 @@ public class BlockGlowstoneTorch extends Block implements IShiftDescription, ISo public BlockGlowstoneTorch(String assetName) { - super(Material.circuits); + super(Material.CIRCUITS); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.UP)); this.setTickRandomly(true); this.setUnlocalizedName(assetName); this.setLightLevel(0.85F); - this.setStepSound(Block.soundTypeWood); + this.setSoundType(SoundType.WOOD); } @Override @@ -119,14 +123,16 @@ public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - this.onNeighborChangeInternal(worldIn, pos, state); + this.onNeighborChangeInternal(worldIn, pos, neighborBlockPos); } - protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state) + public boolean onNeighborChangeInternal(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - if (!this.checkForDrop(worldIn, pos, state)) + IBlockState state = worldIn.getBlockState(pos); + + if (!this.checkForDrop((World) worldIn, pos, state)) { return true; } @@ -141,15 +147,15 @@ protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockSt { flag = true; } - else if (enumfacing$axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1))) + else if (enumfacing$axis.isVertical() && !this.canPlaceOn((World) worldIn, pos.offset(enumfacing1))) { flag = true; } if (flag) { - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); + this.dropBlockAsItem((World) worldIn, pos, state, 0); + ((World) worldIn).setBlockToAir(pos); return true; } else @@ -188,36 +194,36 @@ public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random ra } } - @Override - public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) - { - int l = getMetaFromState(worldIn.getBlockState(pos)) & 7; - float f = 0.15F; - - if (l == 1) - { - this.setBlockBounds(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f); - } - else if (l == 2) - { - this.setBlockBounds(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f); - } - else if (l == 3) - { - this.setBlockBounds(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F); - } - else if (l == 4) - { - this.setBlockBounds(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F); - } - else - { - f = 0.1F; - this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f); - } - - return super.collisionRayTrace(worldIn, pos, start, end); - } +// @Override +// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +// { +// int l = getMetaFromState(worldIn.getBlockState(pos)) & 7; +// float f = 0.15F; +// +// if (l == 1) +// { +// this.setBlockBounds(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f); +// } +// else if (l == 2) +// { +// this.setBlockBounds(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f); +// } +// else if (l == 3) +// { +// this.setBlockBounds(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F); +// } +// else if (l == 4) +// { +// this.setBlockBounds(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F); +// } +// else +// { +// f = 0.1F; +// this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f); +// } +// +// return super.collisionRayTrace(worldIn, pos, start, end); +// } @Override public IBlockState getStateFromMeta(int meta) @@ -276,15 +282,15 @@ public int getMetaFromState(IBlockState state) @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, new IProperty[] { FACING }); + return new BlockStateContainer(this, new IProperty[] { FACING }); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPad.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPad.java index d8a41c7c12..37cdb9cdbf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPad.java @@ -17,7 +17,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.world.World; @@ -63,11 +63,11 @@ public String getName() public BlockLandingPad(String assetName) { - super(Material.iron); + super(Material.IRON); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 3 / 16.0F, 1.0F); this.setHardness(1.0F); this.setResistance(10.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -191,9 +191,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, PAD_TYPE); + return new BlockStateContainer(this, PAD_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPadFull.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPadFull.java index 205a642a5b..72cb5e952f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPadFull.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPadFull.java @@ -5,16 +5,17 @@ import micdoodle8.mods.galacticraft.core.tile.IMultiBlock; import micdoodle8.mods.galacticraft.core.tile.TileEntityBuggyFueler; import micdoodle8.mods.galacticraft.core.tile.TileEntityLandingPad; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -59,10 +60,10 @@ public String getName() public BlockLandingPadFull(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); this.setResistance(10.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); this.maxY = 0.25F; } @@ -104,13 +105,13 @@ public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlock switch (getMetaFromState(state)) { case 0: - return AxisAlignedBB.fromBounds(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, + return new AxisAlignedBB(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, pos.getX() + this.maxX, pos.getY() + this.maxY, pos.getZ() + this.maxZ); // case 2: -// return AxisAlignedBB.fromBounds(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, +// return new AxisAlignedBB(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, // pos.getX() + this.maxX, pos.getY() + this.maxY, pos.getZ() + this.maxZ); default: - return AxisAlignedBB.fromBounds(pos.getX() + 0.0D, pos.getY() + 0.0D, pos.getZ() + 0.0D, + return new AxisAlignedBB(pos.getX() + 0.0D, pos.getY() + 0.0D, pos.getZ() + 0.0D, pos.getX() + 1.0D, pos.getY() + 0.2D, pos.getZ() + 1.0D); } } @@ -122,13 +123,13 @@ public AxisAlignedBB getSelectedBoundingBox(World worldIn, BlockPos pos) switch (getMetaFromState(worldIn.getBlockState(pos))) { case 0: - return AxisAlignedBB.fromBounds(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, + return new AxisAlignedBB(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, pos.getX() + this.maxX, pos.getY() + this.maxY, pos.getZ() + this.maxZ); // case 2: -// return AxisAlignedBB.fromBounds(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, +// return new AxisAlignedBB(pos.getX() + this.minX, pos.getY() + this.minY, pos.getZ() + this.minZ, // pos.getX() + this.maxX, pos.getY() + this.maxY, pos.getZ() + this.maxZ); default: - return AxisAlignedBB.fromBounds(pos.getX() + 0.0D, pos.getY() + 0.0D, pos.getZ() + 0.0D, + return new AxisAlignedBB(pos.getX() + 0.0D, pos.getY() + 0.0D, pos.getZ() + 0.0D, pos.getX() + 1.0D, pos.getY() + 0.2D, pos.getZ() + 1.0D); } } @@ -174,9 +175,9 @@ public TileEntity createTileEntity(World world, IBlockState state) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - worldIn.markBlockForUpdate(pos); + ((World) worldIn).markBlockForUpdate(pos); } @Override @@ -205,7 +206,7 @@ public boolean isSealed(World worldIn, BlockPos pos, EnumFacing direction) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = getMetaFromState(world.getBlockState(pos)); return new ItemStack(Item.getItemFromBlock(GCBlocks.landingPad), 1, metadata); @@ -224,8 +225,8 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, PAD_TYPE); + return new BlockStateContainer(this, PAD_TYPE); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine.java index 2f8ca3caf9..7b1b5befc6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine.java @@ -76,7 +76,7 @@ public BlockMachine(String assetName) { super(GCBlocks.machine); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -229,7 +229,7 @@ public int damageDropped(IBlockState state) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = this.getDamageValue(world, pos); @@ -270,9 +270,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE); + return new BlockStateContainer(this, FACING, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine2.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine2.java index b00b34f5e5..a9cfd59df0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine2.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine2.java @@ -72,7 +72,7 @@ public BlockMachine2(String assetName) { super(GCBlocks.machine); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -255,7 +255,7 @@ else if (metadata >= BlockMachine2.ELECTRIC_COMPRESSOR_METADATA) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = this.getDamageValue(world, pos); @@ -298,9 +298,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE); + return new BlockStateContainer(this, FACING, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachineTiered.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachineTiered.java index 9a543a9c6b..dc89426f9c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachineTiered.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachineTiered.java @@ -72,7 +72,7 @@ public BlockMachineTiered(String assetName) { super(GCBlocks.machine); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -194,7 +194,7 @@ public int damageDropped(IBlockState state) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = this.getDamageValue(world, pos); @@ -236,9 +236,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE, FILL_VALUE); + return new BlockStateContainer(this, FACING, TYPE, FILL_VALUE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java index 2b4ebbe6e1..648c347d54 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java @@ -17,7 +17,10 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -73,7 +76,7 @@ public BlockMulti(String assetName) { super(GCBlocks.machine); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); this.setResistance(1000000000000000.0F); } @@ -158,7 +161,7 @@ public void makeFakeBlock(World worldObj, BlockPos pos, BlockPos mainBlock, int } @Override - public float getBlockHardness(World worldIn, BlockPos pos) + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { TileEntity tileEntity = worldIn.getTileEntity(pos); @@ -209,7 +212,7 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) } @Override - public boolean onMachineActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onMachineActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntityMulti tileEntity = (TileEntityMulti) worldIn.getTileEntity(pos); return tileEntity.onBlockActivated(worldIn, pos, playerIn); @@ -250,7 +253,7 @@ public TileEntity createNewTileEntity(World var1, int meta) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { TileEntity tileEntity = world.getTileEntity(pos); if (tileEntity instanceof TileEntityMulti) @@ -261,7 +264,7 @@ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos { Block mainBlockID = world.getBlockState(mainBlockPosition).getBlock(); - if (Blocks.air != mainBlockID) + if (Blocks.AIR != mainBlockID) { return mainBlockID.getPickBlock(target, world, mainBlockPosition, player); } @@ -360,9 +363,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, MULTI_TYPE, RENDER_TYPE); + return new BlockStateContainer(this, MULTI_TYPE, RENDER_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java index ac2c2d545b..4487bdc42b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java @@ -23,7 +23,9 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -35,10 +37,10 @@ public class BlockNasaWorkbench extends BlockContainer implements ITileEntityPro { public BlockNasaWorkbench(String assetName) { - super(Material.iron); + super(Material.IRON); this.setBlockBounds(-0.3F, 0.0F, -0.3F, 1.3F, 0.5F, 1.3F); this.setHardness(2.5F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -63,7 +65,7 @@ public boolean isFullCube() @Override public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) { - return AxisAlignedBB.fromBounds((double) pos.getX() + -0.0F, (double) pos.getY() + 0.0F, (double) pos.getZ() + -0.0F, (double) pos.getX() + 1.0F, (double) pos.getY() + 1.4F, (double) pos.getZ() + 1.0F); + return new AxisAlignedBB((double) pos.getX() + -0.0F, (double) pos.getY() + 0.0F, (double) pos.getZ() + -0.0F, (double) pos.getX() + 1.0F, (double) pos.getY() + 1.4F, (double) pos.getZ() + 1.0F); } @SideOnly(Side.CLIENT) @@ -214,7 +216,7 @@ else if (y != 0 && y != 3) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { playerIn.openGui(GalacticraftCore.instance, SchematicRegistry.getMatchingRecipeForID(0).getGuiID(), worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCollector.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCollector.java index 3f9ca7c39c..417f2e8954 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCollector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCollector.java @@ -17,7 +17,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -32,9 +32,9 @@ public class BlockOxygenCollector extends BlockAdvancedTile implements IShiftDes public BlockOxygenCollector(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -149,9 +149,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCompressor.java index cc56211605..6cf34d69a2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCompressor.java @@ -65,9 +65,9 @@ public String getName() public BlockOxygenCompressor(boolean isActive, String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -163,7 +163,7 @@ else if (metadata >= BlockOxygenCompressor.OXYGEN_COMPRESSOR_METADATA) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = this.getDamageValue(world, pos); return new ItemStack(this, 1, metadata); @@ -203,9 +203,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE); + return new BlockStateContainer(this, FACING, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDetector.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDetector.java index ef389ea5a3..fdaa0ac5e1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDetector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDetector.java @@ -12,7 +12,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -21,9 +21,9 @@ public class BlockOxygenDetector extends BlockContainer implements ITileEntityPr { public BlockOxygenDetector(String assetName) { - super(Material.iron); + super(Material.IRON); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDistributor.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDistributor.java index 28b1f72bba..17cb0188d1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDistributor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDistributor.java @@ -16,7 +16,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; @@ -30,9 +30,9 @@ public class BlockOxygenDistributor extends BlockAdvancedTile implements IShiftD public BlockOxygenDistributor(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } @@ -125,9 +125,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenSealer.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenSealer.java index e42a0ff974..2e1a454774 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenSealer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenSealer.java @@ -16,7 +16,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -27,9 +27,9 @@ public class BlockOxygenSealer extends BlockAdvancedTile implements IShiftDescri public BlockOxygenSealer(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -128,9 +128,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java index 219b2edebf..51a5f15e12 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java @@ -24,8 +24,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -43,7 +44,7 @@ public BlockParaChest(String assetName) { super(Material.wood); this.setHardness(3.0F); - this.setStepSound(Block.soundTypeWood); + this.setSoundType(SoundType.WOOD); this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); this.setUnlocalizedName(assetName); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); @@ -86,7 +87,7 @@ public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { @@ -112,7 +113,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { TileEntityParaChest tileentitychest = (TileEntityParaChest) worldIn.getTileEntity(pos); @@ -193,7 +194,7 @@ else if (BlockParaChest.isOcelotBlockingChest(par1World, pos)) public static boolean isOcelotBlockingChest(World par0World, BlockPos pos) { - Iterator iterator = par0World.getEntitiesWithinAABB(EntityOcelot.class, AxisAlignedBB.fromBounds(pos.getX(), pos.getY() + 1, pos.getZ(), pos.getX() + 1, pos.getY() + 2, pos.getZ() + 1)).iterator(); + Iterator iterator = par0World.getEntitiesWithinAABB(EntityOcelot.class, new AxisAlignedBB(pos.getX(), pos.getY() + 1, pos.getZ(), pos.getX() + 1, pos.getY() + 2, pos.getZ() + 1)).iterator(); EntityOcelot entityocelot; do @@ -248,9 +249,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, COLOR, FACING); + return new BlockStateContainer(this, COLOR, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockRefinery.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockRefinery.java index 7582ccab7b..05fab63e68 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockRefinery.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockRefinery.java @@ -18,7 +18,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.MathHelper; @@ -36,9 +36,9 @@ public class BlockRefinery extends BlockAdvancedTile implements IShiftDescriptio public BlockRefinery(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -188,9 +188,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java index 14e53a74c5..907fd0ee24 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java @@ -19,6 +19,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -33,7 +34,7 @@ public class BlockScreen extends BlockAdvanced implements IShiftDescription, IPa //Metadata: 0-5 = direction of screen back; bit 3 = reserved for future use public BlockScreen(String assetName) { - super(Material.circuits); + super(Material.CIRCUITS); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(LEFT, false).withProperty(RIGHT, false).withProperty(UP, false).withProperty(DOWN, false)); this.setHardness(0.1F); this.setStepSound(Block.soundTypeGlass); @@ -106,7 +107,7 @@ public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityScreen) @@ -179,9 +180,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, LEFT, RIGHT, UP, DOWN); + return new BlockStateContainer(this, FACING, LEFT, RIGHT, UP, DOWN); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java index 07869439cc..9af929b41e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java @@ -14,7 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.Explosion; @@ -96,7 +96,7 @@ public float getExplosionResistance(World world, BlockPos pos, Entity exploder, } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(this, 1, this.getMetaFromState(world.getBlockState(pos)) & 7); } @@ -152,7 +152,7 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { return this.isDouble() ? new BlockState(this, VARIANT) : new BlockState(this, HALF, VARIANT); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSolar.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSolar.java index 2d76de0aac..89a4ad5906 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSolar.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSolar.java @@ -67,9 +67,9 @@ public String getName() public BlockSolar(String assetName) { - super(Material.iron); + super(Material.IRON); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -201,7 +201,7 @@ public int damageDropped(IBlockState state) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = this.getDamageValue(world, pos); @@ -273,9 +273,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE); + return new BlockStateContainer(this, FACING, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpaceStationBase.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpaceStationBase.java index 4be2b0b942..51bbe0d189 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpaceStationBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpaceStationBase.java @@ -10,7 +10,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; @@ -19,13 +19,13 @@ public class BlockSpaceStationBase extends BlockContainer implements ITileEntity public BlockSpaceStationBase(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setHardness(-1); this.setUnlocalizedName(assetName); } @Override - public float getBlockHardness(World worldIn, BlockPos pos) + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { return -1.0F; } @@ -81,7 +81,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java index a296e40d3e..f2fa550636 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java @@ -17,6 +17,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -29,9 +31,9 @@ public class BlockSpinThruster extends BlockAdvanced implements IShiftDescriptio public BlockSpinThruster(String assetName) { - super(Material.circuits); + super(Material.CIRCUITS); this.setHardness(0.1F); - this.setStepSound(Block.soundTypeWood); + this.setSoundType(SoundType.WOOD); this.setUnlocalizedName(assetName); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } @@ -120,45 +122,46 @@ public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - if (this.dropTorchIfCantStay(worldIn, pos)) + IBlockState state = worldIn.getBlockState(pos); + if (this.dropTorchIfCantStay((World) worldIn, pos)) { final int var6 = getMetaFromState(state) & 7; boolean var7 = false; - if (!BlockSpinThruster.isBlockSolidOnSide(worldIn, pos.offset(EnumFacing.WEST), EnumFacing.EAST) && var6 == 1) + if (!BlockSpinThruster.isBlockSolidOnSide((World) worldIn, pos.offset(EnumFacing.WEST), EnumFacing.EAST) && var6 == 1) { var7 = true; } - if (!BlockSpinThruster.isBlockSolidOnSide(worldIn, pos.offset(EnumFacing.EAST), EnumFacing.WEST) && var6 == 2) + if (!BlockSpinThruster.isBlockSolidOnSide((World) worldIn, pos.offset(EnumFacing.EAST), EnumFacing.WEST) && var6 == 2) { var7 = true; } - if (!BlockSpinThruster.isBlockSolidOnSide(worldIn, pos.offset(EnumFacing.NORTH), EnumFacing.SOUTH) && var6 == 3) + if (!BlockSpinThruster.isBlockSolidOnSide((World) worldIn, pos.offset(EnumFacing.NORTH), EnumFacing.SOUTH) && var6 == 3) { var7 = true; } - if (!BlockSpinThruster.isBlockSolidOnSide(worldIn, pos.offset(EnumFacing.SOUTH), EnumFacing.NORTH) && var6 == 4) + if (!BlockSpinThruster.isBlockSolidOnSide((World) worldIn, pos.offset(EnumFacing.SOUTH), EnumFacing.NORTH) && var6 == 4) { var7 = true; } if (var7) { - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); + this.dropBlockAsItem((World) worldIn, pos, state, 0); + ((World)worldIn).setBlockToAir(pos); } } - if (!worldIn.isRemote) + if (!((World) worldIn).isRemote) { - if (worldIn.provider instanceof WorldProviderZeroGravity) + if (((World) worldIn).provider instanceof WorldProviderZeroGravity) { - ((WorldProviderZeroGravity) worldIn.provider).getSpinManager().refresh(pos, true); + ((WorldProviderZeroGravity) ((World) worldIn).provider).getSpinManager().refresh(pos, true); } } } @@ -323,9 +326,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockT1TreasureChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockT1TreasureChest.java index 6ce16be44f..8c34d32017 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockT1TreasureChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockT1TreasureChest.java @@ -21,8 +21,9 @@ import net.minecraft.inventory.InventoryHelper; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; @@ -410,9 +411,9 @@ private boolean isDoubleChest(World worldIn, BlockPos pos) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + super.onNeighborChange(worldIn, pos, neighborBlockPos); TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityTreasureChest) @@ -436,7 +437,7 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { @@ -537,9 +538,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java index ef80d15dda..c4a9472116 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java @@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; @@ -30,9 +30,9 @@ public class BlockTelemetry extends BlockAdvancedTile implements IShiftDescripti //Metadata: 0-3 = orientation; bits 2,3 = reserved for future use public BlockTelemetry(String assetName) { - super(Material.iron); + super(Material.IRON); this.setHardness(1.0F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTileGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTileGC.java index f02cbc41a3..19c9cd81b6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTileGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTileGC.java @@ -6,7 +6,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryHelper; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java index d6280eb56f..26bc1dd369 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java @@ -15,8 +15,8 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -39,16 +39,14 @@ public BlockTransmitter(Material material) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + super.onNeighborChange(worldIn, pos, neighborBlockPos); TileEntity tile = worldIn.getTileEntity(pos); this.setBlockBoundsBasedOnState(worldIn, pos); - GalacticraftCore.packetPipeline.sendToAllAround(new PacketSimple(EnumSimplePacket.C_UPDATE_WIRE_BOUNDS, worldIn.provider.getDimensionId(), new Object[] { pos }), new NetworkRegistry.TargetPoint(worldIn.provider.getDimensionId(), pos.getX(), pos.getY(), pos.getZ(), 10.0D)); - - TileEntity tileEntity = worldIn.getTileEntity(pos); + GalacticraftCore.packetPipeline.sendToAllAround(new PacketSimple(EnumSimplePacket.C_UPDATE_WIRE_BOUNDS, ((World) worldIn).provider.getDimension(), new Object[] { pos }), new NetworkRegistry.TargetPoint(((World) worldIn).provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 10.0D)); if (tile instanceof INetworkConnection) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java index cb543c4826..d890e4bc3b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java @@ -14,6 +14,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -34,12 +35,12 @@ public class BlockUnlitTorch extends Block implements IOxygenReliantBlock public BlockUnlitTorch(boolean lit, String assetName) { - super(Material.circuits); + super(Material.CIRCUITS); this.setTickRandomly(true); this.lit = lit; this.setLightLevel(lit ? 0.9375F : 0.2F); this.setHardness(0.0F); - this.setStepSound(Block.soundTypeWood); + this.setSoundType(SoundType.WOOD); this.setUnlocalizedName(assetName); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.UP)); } @@ -203,14 +204,15 @@ public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) * neighbor blockID */ @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - this.onNeighborChangeInternal(worldIn, pos, state); + this.onNeighborChangeInternal(worldIn, pos, neighborBlockPos); } - protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state) + public boolean onNeighborChangeInternal(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - if (!this.checkForDrop(worldIn, pos, state)) + IBlockState state = worldIn.getBlockState(pos); + if (!this.checkForDrop((World) worldIn, pos, state)) { return true; } @@ -225,20 +227,20 @@ protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockSt { flag = true; } - else if (enumfacingAxis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1))) + else if (enumfacingAxis.isVertical() && !this.canPlaceOn((World) worldIn, pos.offset(enumfacing1))) { flag = true; } if (flag) { - this.dropBlockAsItem(worldIn, pos, state, 0); - worldIn.setBlockToAir(pos); + this.dropBlockAsItem((World) worldIn, pos, state, 0); + ((World) worldIn).setBlockToAir(pos); return true; } else { - this.checkOxygen(worldIn, pos); + this.checkOxygen((World) worldIn, pos); return false; } } @@ -416,15 +418,15 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, new IProperty[] { FACING }); + return new BlockStateContainer(this, new IProperty[] { FACING }); } @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java index f051e2da9a..147767a3e8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java @@ -14,8 +14,8 @@ import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.world.IBlockAccess; @@ -36,7 +36,7 @@ public class BlockWallGC extends Block /* Do not extend BlockWall */ implements public BlockWallGC(String name) { - super(Material.rock); + super(Material.ROCK); this.setHardness(1.5F); this.setResistance(2.5F); this.setDefaultState(this.getDefaultState().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)).withProperty(VARIANT, BlockType.TIN_1_WALL)); @@ -174,9 +174,9 @@ public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPo } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, new IProperty[] { UP, NORTH, EAST, WEST, SOUTH, VARIANT }); + return new BlockStateContainer(this, new IProperty[] { UP, NORTH, EAST, WEST, SOUTH, VARIANT }); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/EntityFXOilDrip.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/EntityFXOilDrip.java index fc6e9f7786..199ca31cc6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/EntityFXOilDrip.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/EntityFXOilDrip.java @@ -4,7 +4,7 @@ import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.particle.EntityFX; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java index 09da1bb22e..2bf05d2629 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java @@ -21,7 +21,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenSealer.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenSealer.java index af70f03981..00df0722c0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenSealer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenSealer.java @@ -17,7 +17,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicBuggy.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicBuggy.java index 278a50ab69..f9b8e03fb5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicBuggy.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicBuggy.java @@ -7,7 +7,7 @@ import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.FMLClientHandler; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicInput.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicInput.java index 56b4c473ab..c2054a3e91 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicInput.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicInput.java @@ -11,7 +11,7 @@ import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicTier1Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicTier1Rocket.java index 783c4984c2..2daafc3728 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicTier1Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicTier1Rocket.java @@ -7,7 +7,7 @@ import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.client.gui.GuiButton; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/model/ModelBipedGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/model/ModelBipedGC.java index 057f5f7993..71209117ac 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/model/ModelBipedGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/model/ModelBipedGC.java @@ -15,7 +15,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.MathHelper; import java.util.List; @@ -118,7 +118,7 @@ public static void setRotationAngles(ModelBiped biped, float par1, float par2, f } } - final List l = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, AxisAlignedBB.fromBounds(player.posX - 20, 0, player.posZ - 20, player.posX + 20, 200, player.posZ + 20)); + final List l = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, new AxisAlignedBB(player.posX - 20, 0, player.posZ - 20, player.posX + 20, 200, player.posZ + 20)); for (int i = 0; i < l.size(); i++) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java index 1d8dcfcbb9..5f4f3baa60 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java @@ -9,7 +9,7 @@ import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import java.util.List; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCInv.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCInv.java index a298d1b1cf..52fcc8b31a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCInv.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCInv.java @@ -12,7 +12,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.*; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandPlanetTeleport.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandPlanetTeleport.java index 8ab07e7e49..2fbeb36a93 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandPlanetTeleport.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandPlanetTeleport.java @@ -14,7 +14,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.WorldServer; public class CommandPlanetTeleport extends CommandBase diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java index 7857b6d315..51673e3bbf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java @@ -10,7 +10,7 @@ import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import java.util.List; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java index 818778f703..ecac19f3a6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java @@ -11,7 +11,7 @@ import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import java.util.*; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java index 77ed398793..c2a99555b8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java @@ -23,7 +23,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraftforge.client.IRenderHandler; import net.minecraftforge.common.MinecraftForge; @@ -576,7 +576,7 @@ else if (this.thrustersFiring) for (int z = zm; z <= zz; z++) { BlockPos pos = new BlockPos(x, y, z); - if (this.worldProvider.worldObj.isBlockLoaded(pos) && Blocks.air != this.worldProvider.worldObj.getBlockState(pos).getBlock()) + if (this.worldProvider.worldObj.isBlockLoaded(pos) && Blocks.AIR != this.worldProvider.worldObj.getBlockState(pos).getBlock()) { freefall = false; break BLOCKCHECK; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/energy/grid/NetworkFinder.java b/src/main/java/micdoodle8/mods/galacticraft/core/energy/grid/NetworkFinder.java index 8c0719394f..e04b9707a0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/energy/grid/NetworkFinder.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/energy/grid/NetworkFinder.java @@ -3,7 +3,7 @@ import micdoodle8.mods.galacticraft.api.transmission.tile.IConductor; import micdoodle8.mods.galacticraft.api.vector.BlockVec3; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.HashSet; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseConductor.java b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseConductor.java index 559dffc618..f15c091127 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseConductor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseConductor.java @@ -10,7 +10,7 @@ import micdoodle8.mods.galacticraft.core.energy.grid.EnergyNetwork; import micdoodle8.mods.galacticraft.core.tick.TickHandlerServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -144,7 +144,7 @@ public boolean canConnect(EnumFacing direction, NetworkType type) @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getPos().getX() + 1, this.getPos().getY() + 1, this.getPos().getZ() + 1); + return new AxisAlignedBB(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getPos().getX() + 1, this.getPos().getY() + 1, this.getPos().getZ() + 1); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java index c1d32a4472..2a13237df2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java @@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java index 0c105fac13..8e3dde45f9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java @@ -14,7 +14,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.WeightedRandomChestContent; @@ -163,7 +163,7 @@ public void onLivingUpdate() if (this.roomCoords != null && this.roomSize != null) { List playersWithin = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, - AxisAlignedBB.fromBounds( + new AxisAlignedBB( this.roomCoords.intX(), this.roomCoords.intY(), this.roomCoords.intZ(), @@ -175,7 +175,7 @@ public void onLivingUpdate() if (this.entitiesWithin == 0 && this.entitiesWithinLast != 0) { - List entitiesWithin2 = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.fromBounds(this.roomCoords.intX() - 11, this.roomCoords.intY() - 11, this.roomCoords.intZ() - 11, this.roomCoords.intX() + this.roomSize.intX() + 10, this.roomCoords.intY() + this.roomSize.intY() + 10, this.roomCoords.intZ() + this.roomSize.intZ() + 10)); + List entitiesWithin2 = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(this.roomCoords.intX() - 11, this.roomCoords.intY() - 11, this.roomCoords.intZ() - 11, this.roomCoords.intX() + this.roomSize.intX() + 10, this.roomCoords.intY() + this.roomSize.intY() + 10, this.roomCoords.intZ() + this.roomSize.intZ() + 10)); for (EntityPlayer p : entitiesWithin2) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityCelestialFake.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityCelestialFake.java index 9b79fa62a6..9a5ca53b7d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityCelestialFake.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityCelestialFake.java @@ -11,7 +11,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityFlag.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityFlag.java index 0a913148af..48b058be44 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityFlag.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityFlag.java @@ -11,8 +11,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLander.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLander.java index 70cd12d3cc..fbdc45d5ae 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLander.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLander.java @@ -11,7 +11,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLanderBase.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLanderBase.java index d2cbfcfac4..5841cb3ff8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLanderBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLanderBase.java @@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java index 29645c5967..0d1abcd0a3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java @@ -15,7 +15,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidRegistry; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java index 1330fb2629..0482df7939 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java @@ -14,8 +14,8 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; @@ -148,9 +148,9 @@ private boolean testFreefall(EntityPlayerSP p, boolean flag) { for (int z = zm; z <= zz; z++) { - //Blocks.air is hard vacuum - we want to check for that, here + //Blocks.AIR is hard vacuum - we want to check for that, here Block b = world.getBlockState(new BlockPos(x, y, z)).getBlock(); - if (Blocks.air != b && GCBlocks.brightAir != b) + if (Blocks.AIR != b && GCBlocks.brightAir != b) { return false; } @@ -220,7 +220,7 @@ private boolean testFreefall(EntityPlayerSP p, boolean flag) for(int x = xmin; x <= xmax; x++) for (int z = zmin; z <= zmax; z++) for (int y = ymin; y <= ymax; y++) - if (Blocks.air != this.worldProvider.worldObj.getBlock(x, y, z)) + if (Blocks.AIR != this.worldProvider.worldObj.getBlock(x, y, z)) { freefall = false; break BLOCKCHECK0; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java index 319ff442bc..3e343693b5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java @@ -44,7 +44,7 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.MathHelper; import net.minecraft.world.ChunkCoordIntPair; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java index 3102ae6285..851548efb9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java @@ -4,7 +4,7 @@ import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.common.IExtendedEntityProperties; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java index 156d95351b..719819bada 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java @@ -15,7 +15,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java index 04a641b9c6..9a0dd5520f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java @@ -265,7 +265,7 @@ else if (event.action.equals(PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)) { if (!worldObj.isRemote && event.action.equals(PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)) { - if (idClicked != Blocks.tnt && OxygenUtil.noAtmosphericCombustion(event.entityPlayer.worldObj.provider) && !OxygenUtil.isAABBInBreathableAirBlock(event.entityLiving.worldObj, AxisAlignedBB.fromBounds(event.pos.getX(), event.pos.getY(), event.pos.getZ(), event.pos.getX() + 1, event.pos.getY() + 2, event.pos.getZ() + 1))) + if (idClicked != Blocks.tnt && OxygenUtil.noAtmosphericCombustion(event.entityPlayer.worldObj.provider) && !OxygenUtil.isAABBInBreathableAirBlock(event.entityLiving.worldObj, new AxisAlignedBB(event.pos.getX(), event.pos.getY(), event.pos.getZ(), event.pos.getX() + 1, event.pos.getY() + 2, event.pos.getZ() + 1))) { event.setCanceled(true); } @@ -873,7 +873,7 @@ public void onSoundPlayed(PlaySoundEvent event) { // If the player doesn't have a frequency module, and the player isn't in an oxygenated environment // Note: this is a very simplistic approach, and nowhere near realistic, but required for performance reasons - AxisAlignedBB bb = AxisAlignedBB.fromBounds(x - 0.0015D, y - 0.0015D, z - 0.0015D, x + 0.0015D, y + 0.0015D, z + 0.0015D); + AxisAlignedBB bb = new AxisAlignedBB(x - 0.0015D, y - 0.0015D, z - 0.0015D, x + 0.0015D, y + 0.0015D, z + 0.0015D); boolean playerInAtmosphere = OxygenUtil.isAABBInBreathableAirBlock(player); boolean soundInAtmosphere = OxygenUtil.isAABBInBreathableAirBlock(player.worldObj, bb); if ((!playerInAtmosphere || !soundInAtmosphere)) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventLandingPadRemoval.java b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventLandingPadRemoval.java index 21c9c68b78..9298aaa1ce 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventLandingPadRemoval.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventLandingPadRemoval.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.event; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.eventhandler.Event; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventWakePlayer.java b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventWakePlayer.java index c7d114bdef..c795454b1d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventWakePlayer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventWakePlayer.java @@ -2,7 +2,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer.EnumStatus; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.fml.common.eventhandler.Cancelable; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/FluidNetwork.java b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/FluidNetwork.java index 92e5e85f02..764ca1b472 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/FluidNetwork.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/FluidNetwork.java @@ -18,7 +18,7 @@ import micdoodle8.mods.galacticraft.core.network.PacketFluidNetworkUpdate; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/OxygenPressureProtocol.java b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/OxygenPressureProtocol.java index dec7e0e358..80948e50d4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/OxygenPressureProtocol.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/OxygenPressureProtocol.java @@ -9,7 +9,7 @@ import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; @@ -77,7 +77,7 @@ public static void onEdgeBlockUpdated(World world, BlockPos vec) { if (ConfigManagerCore.enableSealerEdgeChecks) { - TickHandlerServer.scheduleNewEdgeCheck(world.provider.getDimensionId(), vec); + TickHandlerServer.scheduleNewEdgeCheck(world.provider.getDimension(), vec); } } @@ -97,7 +97,7 @@ public static boolean canBlockPassAir(World world, Block block, BlockPos pos, En if (block.isOpaqueCube()) { - return block instanceof BlockGravel || block.getMaterial() == Material.cloth || block instanceof BlockSponge; + return block instanceof BlockGravel || block.getMaterial() == Material.CLOTH || block instanceof BlockSponge; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java index daafed420a..ee883ab5f9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java @@ -14,7 +14,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; @@ -140,7 +140,7 @@ public void check() if (this.head.x < -29990000 || this.head.z < -29990000 || this.head.x >= 29990000 || this.head.z >= 29990000) { Block b = this.head.getBlockID_noChunkLoad(this.world); - if (Blocks.air == b) + if (Blocks.AIR == b) { this.airToReplace.add(this.head.clone()); } @@ -153,7 +153,7 @@ else if (b == GCBlocks.brightAir) else { Block headblock = this.head.getBlockIDsafe_noChunkLoad(this.world); - if (Blocks.air == headblock) + if (Blocks.AIR == headblock) { this.airToReplace.add(this.head.clone()); } @@ -407,7 +407,7 @@ private void makeSealBad() List changeList = new LinkedList(); for (BlockVec3 checkedVec : this.breatheableToReplace) { - changeList.add(new ScheduledBlockChange(checkedVec.clone(), Blocks.air, 0, 2)); + changeList.add(new ScheduledBlockChange(checkedVec.clone(), Blocks.AIR, 0, 2)); } for (BlockVec3 checkedVec : this.breatheableToReplaceBright) { @@ -489,7 +489,7 @@ else if (id == oxygenSealerID) else { checkedLocal.add(sideVec); - if (id != null && Blocks.air != id && id != GCBlocks.brightAir && this.canBlockPassAirCheck(id, sideVec, EnumFacing.getFront(side))) + if (id != null && Blocks.AIR != id && id != GCBlocks.brightAir && this.canBlockPassAirCheck(id, sideVec, EnumFacing.getFront(side))) { //Look outbound through partially sealable blocks in case there is breatheableAir to clear beyond nextLayer.add(sideVec); @@ -576,7 +576,7 @@ else if (id == oxygenSealerID) else { checkedLocal.add(sideVec); - if (id != null && Blocks.air != id && id != GCBlocks.brightAir && this.canBlockPassAirCheck(id, sideVec, EnumFacing.getFront(side))) + if (id != null && Blocks.AIR != id && id != GCBlocks.brightAir && this.canBlockPassAirCheck(id, sideVec, EnumFacing.getFront(side))) { //Look outbound through partially sealable blocks in case there is breatheableAir to clear beyond nextLayer.add(sideVec); @@ -596,7 +596,7 @@ private void doLayer() { //Local variables are fractionally faster than statics Block breatheableAirID = GCBlocks.breatheableAir; - Block airID = Blocks.air; + Block airID = Blocks.AIR; Block breatheableAirIDBright = GCBlocks.brightBreatheableAir; Block airIDBright = GCBlocks.brightAir; Block oxygenSealerID = GCBlocks.oxygenSealer; @@ -724,7 +724,7 @@ private void doLayerNearMapEdge() { //Local variables are fractionally faster than statics Block breatheableAirID = GCBlocks.breatheableAir; - Block airID = Blocks.air; + Block airID = Blocks.AIR; Block breatheableAirIDBright = GCBlocks.brightBreatheableAir; Block airIDBright = GCBlocks.brightAir; Block oxygenSealerID = GCBlocks.oxygenSealer; @@ -914,7 +914,7 @@ private boolean canBlockPassAirCheck(Block block, BlockVec3 vec, EnumFacing side if (block.isOpaqueCube()) { //Gravel, wool and sponge are porous - return block instanceof BlockGravel || block.getMaterial() == Material.cloth || block instanceof BlockSponge; + return block instanceof BlockGravel || block.getMaterial() == Material.CLOTH || block instanceof BlockSponge; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggyBench.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggyBench.java index 4488038566..5962bbae01 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggyBench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggyBench.java @@ -10,7 +10,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerBuggyBench extends Container diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematic.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematic.java index cba2ecfd0a..5161380718 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematic.java @@ -8,7 +8,7 @@ import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerSchematic extends Container diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java index af079a01e1..bf62db4f99 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java @@ -11,7 +11,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerSchematicTier1Rocket extends Container diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotBuggyBench.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotBuggyBench.java index d89ca971d5..94fef295f6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotBuggyBench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotBuggyBench.java @@ -9,7 +9,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public class SlotBuggyBench extends Slot { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotRocketBench.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotRocketBench.java index 6083fd83ed..9ff32d21d7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotRocketBench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotRocketBench.java @@ -9,7 +9,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.client.FMLClientHandler; public class SlotRocketBench extends Slot diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java index 57a2661a9a..b5c2d42eb3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java @@ -9,7 +9,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java index c22e259481..e010ffc37f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java @@ -14,8 +14,8 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition.MovingObjectType; @@ -67,7 +67,7 @@ public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, Entit { final EntityFlag flag = new EntityFlag(par2World, pos.getX() + 0.5F, pos.getY() + 1.0F, pos.getZ() + 0.5F, (int) (par3EntityPlayer.rotationYaw - 90)); - if (par2World.getEntitiesWithinAABB(EntityFlag.class, AxisAlignedBB.fromBounds(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 3, pos.getZ() + 1)).isEmpty()) + if (par2World.getEntitiesWithinAABB(EntityFlag.class, new AxisAlignedBB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 3, pos.getZ() + 1)).isEmpty()) { par2World.spawnEntityInWorld(flag); flag.setType(par1ItemStack.getItemDamage()); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java index b8068c0ffc..429ac823e8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java @@ -20,7 +20,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java index efeb0a736f..d98fe5a9d9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java @@ -13,7 +13,7 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/nei/GCNEIHighlightHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/nei/GCNEIHighlightHandler.java index 44280568de..f65fcbb359 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/nei/GCNEIHighlightHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/nei/GCNEIHighlightHandler.java @@ -13,7 +13,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/NetworkUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/NetworkUtil.java index 78f4d2a5c4..6bc2b86520 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/NetworkUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/NetworkUtil.java @@ -16,7 +16,7 @@ import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java index 7f7fbdb766..8c67e33984 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java @@ -7,7 +7,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.FMLLog; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamicInventory.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamicInventory.java index 757fd15a3e..9c299367f1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamicInventory.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamicInventory.java @@ -9,7 +9,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import java.io.IOException; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketFluidNetworkUpdate.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketFluidNetworkUpdate.java index 4809cbb8ea..09cfcbe7e3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketFluidNetworkUpdate.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketFluidNetworkUpdate.java @@ -6,7 +6,7 @@ import micdoodle8.mods.galacticraft.core.fluid.FluidNetwork; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java index eff998cf65..0f4551e165 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java @@ -535,9 +535,9 @@ private static void registerInventoryJsons() ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.basicBlock, 10, "block_tin_gc"); ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.basicBlock, 11, "block_aluminum_gc"); ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.basicBlock, 12, "block_meteoric_iron_gc"); - ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.airLockFrame, 0, "air_lock_frame"); - ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.airLockFrame, 1, "air_lock_controller"); - ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.airLockSeal, 0, "air_lock_seal"); + ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.AIRLockFrame, 0, "air_lock_frame"); + ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.AIRLockFrame, 1, "air_lock_controller"); + ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.AIRLockSeal, 0, "air_lock_seal"); ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.refinery); ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.fuelLoader); ClientUtil.registerBlockJson(Constants.TEXTURE_PREFIX, GCBlocks.landingPadFull, 0, "landing_pad_full"); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java index 6ab2e43c01..9f182f3f97 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java @@ -384,7 +384,7 @@ private static void addUniversalRecipes() CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(GCItems.oxygenVent, 1), new Object[] { "compressedTin", "compressedTin", "compressedTin", "compressedSteel" })); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.airLockFrame, 4, 0), new Object[] { "XXX", "YZY", "XXX", 'X', "compressedAluminum", 'Y', "compressedSteel", 'Z', GCItems.oxygenConcentrator }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.AIRLockFrame, 4, 0), new Object[] { "XXX", "YZY", "XXX", 'X', "compressedAluminum", 'Y', "compressedSteel", 'Z', GCItems.oxygenConcentrator }); RecipeUtil.addRecipe(new ItemStack(GCBlocks.airLockFrame, 1, 1), new Object[] { "YYY", "WZW", "YYY", 'W', meteoricIronPlate, 'Y', "compressedSteel", 'Z', new ItemStack(GCItems.basicItem, 1, 13) }); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicAdd.java b/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicAdd.java index a751baa88c..126652e857 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicAdd.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicAdd.java @@ -9,7 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicMoonBuggy.java b/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicMoonBuggy.java index 995026af23..48ae5973cf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicMoonBuggy.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicMoonBuggy.java @@ -10,7 +10,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicRocketT1.java b/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicRocketT1.java index b8decff867..8e8cd04469 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicRocketT1.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/schematic/SchematicRocketT1.java @@ -9,7 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java index ea0dc76a22..d9f69e611a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java @@ -48,7 +48,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.world.WorldProviderSurface; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java index 1f1a265df1..4de1117393 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java @@ -34,7 +34,7 @@ import net.minecraft.init.Blocks; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/AirLockProtocol.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/AirLockProtocol.java index 83300698fb..d70bcb075f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/AirLockProtocol.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/AirLockProtocol.java @@ -1,7 +1,7 @@ package micdoodle8.mods.galacticraft.core.tile; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.ArrayList; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/FluidTankGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/FluidTankGC.java index 69e0b84b11..85fb820377 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/FluidTankGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/FluidTankGC.java @@ -1,7 +1,7 @@ package micdoodle8.mods.galacticraft.core.tile; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/IMultiBlock.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/IMultiBlock.java index 0dab276c56..d634f4d2f0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/IMultiBlock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/IMultiBlock.java @@ -2,7 +2,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IMultiBlock diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAirLockController.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAirLockController.java index 9e8d960d10..0829646bbc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAirLockController.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAirLockController.java @@ -8,8 +8,8 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import java.util.ArrayList; @@ -86,7 +86,7 @@ public void update() Vector3 thisPos = new Vector3(this).translate(0.5F); Vector3 minPos = new Vector3(thisPos).translate(-distance); Vector3 maxPos = new Vector3(thisPos).translate(distance); - AxisAlignedBB matchingRegion = AxisAlignedBB.fromBounds(minPos.x, minPos.y, minPos.z, maxPos.x, maxPos.y, maxPos.z); + AxisAlignedBB matchingRegion = new AxisAlignedBB(minPos.x, minPos.y, minPos.z, maxPos.x, maxPos.y, maxPos.z); List playersWithin = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, matchingRegion); boolean foundPlayer = false; @@ -167,7 +167,7 @@ public void sealAirLock() int y = this.lastProtocol.minY + (this.lastProtocol.maxY - this.lastProtocol.minY) / 2; int z = this.lastProtocol.minZ + (this.lastProtocol.maxZ - this.lastProtocol.minZ) / 2; - if (this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock() != GCBlocks.airLockSeal) + if (this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock() != GCBlocks.AIRLockSeal) { this.worldObj.playSoundEffect(x, y, z, Constants.TEXTURE_PREFIX + "player.openairlock", 1.0F, 1.0F); } @@ -184,7 +184,7 @@ public void sealAirLock() if (blockAt.isAir(this.worldObj, new BlockPos(x, y, z))) { - this.worldObj.setBlockState(new BlockPos(x, this.protocol.minY, z), GCBlocks.airLockSeal.getDefaultState(), 3); + this.worldObj.setBlockState(new BlockPos(x, this.protocol.minY, z), GCBlocks.AIRLockSeal.getDefaultState(), 3); } } } @@ -202,7 +202,7 @@ public void sealAirLock() if (blockAt.isAir(this.worldObj, new BlockPos(x, y, z))) { - this.worldObj.setBlockState(new BlockPos(x, y, this.protocol.minZ), GCBlocks.airLockSeal.getDefaultState(), 3); + this.worldObj.setBlockState(new BlockPos(x, y, this.protocol.minZ), GCBlocks.AIRLockSeal.getDefaultState(), 3); } } } @@ -217,7 +217,7 @@ else if (this.protocol.minZ != this.protocol.maxZ) if (blockAt.isAir(this.worldObj, new BlockPos(x, y, z))) { - this.worldObj.setBlockState(new BlockPos(this.protocol.minX, y, z), GCBlocks.airLockSeal.getDefaultState(), 3); + this.worldObj.setBlockState(new BlockPos(this.protocol.minX, y, z), GCBlocks.AIRLockSeal.getDefaultState(), 3); } } } @@ -251,7 +251,7 @@ public void unsealAirLock() { Block blockAt = this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock(); - if (blockAt == GCBlocks.airLockSeal) + if (blockAt == GCBlocks.AIRLockSeal) { this.worldObj.setBlockToAir(new BlockPos(x, this.protocol.minY, z)); } @@ -269,7 +269,7 @@ public void unsealAirLock() { Block blockAt = this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock(); - if (blockAt == GCBlocks.airLockSeal) + if (blockAt == GCBlocks.AIRLockSeal) { this.worldObj.setBlockToAir(new BlockPos(x, y, this.lastProtocol.minZ)); } @@ -284,7 +284,7 @@ else if (this.lastProtocol.minZ != this.lastProtocol.maxZ) { Block blockAt = this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock(); - if (blockAt == GCBlocks.airLockSeal) + if (blockAt == GCBlocks.AIRLockSeal) { this.worldObj.setBlockToAir(new BlockPos(this.lastProtocol.minX, y, z)); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java index 0e4fe0a0d8..d7db819fc7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java @@ -17,8 +17,8 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.pathfinding.PathNavigate; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ITickable; import net.minecraft.util.Vec3; import net.minecraft.world.World; @@ -81,12 +81,12 @@ else if (!this.isActive) case 0: this.sideRear = side; //Down this.facingSide = this.facing + 2; - this.thisAABB = AxisAlignedBB.fromBounds(this.getPos().getX() - 20, this.getPos().getY() - 8, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 20); + this.thisAABB = new AxisAlignedBB(this.getPos().getX() - 20, this.getPos().getY() - 8, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 20); break; case 1: this.sideRear = side; //Up this.facingSide = this.facing + 2; - this.thisAABB = AxisAlignedBB.fromBounds(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 8, this.getPos().getZ() + 20); + this.thisAABB = new AxisAlignedBB(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 8, this.getPos().getZ() + 20); break; case 2: this.sideRear = side; //North @@ -95,7 +95,7 @@ else if (!this.isActive) { this.facingSide = 7 - this.facing; } - this.thisAABB = AxisAlignedBB.fromBounds(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 8, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 20); + this.thisAABB = new AxisAlignedBB(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 8, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 20); break; case 3: this.sideRear = side; //South @@ -104,12 +104,12 @@ else if (!this.isActive) { this.facingSide += 2; } - this.thisAABB = AxisAlignedBB.fromBounds(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 8); + this.thisAABB = new AxisAlignedBB(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 8); break; case 4: this.sideRear = side; //West this.facingSide = this.facing; - this.thisAABB = AxisAlignedBB.fromBounds(this.getPos().getX() - 8, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 20); + this.thisAABB = new AxisAlignedBB(this.getPos().getX() - 8, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 20, this.getPos().getY() + 20, this.getPos().getZ() + 20); break; case 5: this.sideRear = side; //East @@ -118,7 +118,7 @@ else if (!this.isActive) { this.facingSide = 5 - this.facing; } - this.thisAABB = AxisAlignedBB.fromBounds(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 8, this.getPos().getY() + 20, this.getPos().getZ() + 20); + this.thisAABB = new AxisAlignedBB(this.getPos().getX() - 20, this.getPos().getY() - 20, this.getPos().getZ() - 20, this.getPos().getX() + 8, this.getPos().getY() + 20, this.getPos().getZ() + 20); break; default: return; @@ -209,7 +209,7 @@ public void invalidate() public void lightArea() { - Block air = Blocks.air; + Block air = Blocks.AIR; Block breatheableAirID = GCBlocks.breatheableAir; Block brightAir = GCBlocks.brightAir; Block brightBreatheableAir = GCBlocks.brightBreatheableAir; @@ -296,7 +296,7 @@ public void lightArea() Block id = vec.getBlockIDsafe_noChunkLoad(world); if (id.isAir(world, vec.toBlockPos())) { - if (Blocks.air == id) + if (Blocks.AIR == id) { world.setBlockState(vec.toBlockPos(), brightAir.getDefaultState(), 2); this.airToRestore.add(vec); @@ -385,7 +385,7 @@ private void revertAir() Block b = vec.getBlock(this.worldObj); if (b == brightAir) { - this.worldObj.setBlockState(vec.toBlockPos(), Blocks.air.getDefaultState(), 2); + this.worldObj.setBlockState(vec.toBlockPos(), Blocks.AIR.getDefaultState(), 2); } else if (b == brightBreatheableAir) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFueler.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFueler.java index 7fc8f13e09..04c0ef7727 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFueler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFueler.java @@ -13,8 +13,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ITickable; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -40,7 +40,7 @@ public void update() if (!this.worldObj.isRemote) { - final List list = this.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.fromBounds(this.getPos().getX() - 1.5D, this.getPos().getY() - 2.0, this.getPos().getZ() - 1.5D, + final List list = this.worldObj.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(this.getPos().getX() - 1.5D, this.getPos().getY() - 2.0, this.getPos().getZ() - 1.5D, this.getPos().getX() + 1.5D, this.getPos().getY() + 4.0, this.getPos().getZ() + 1.5D), new Predicate() { @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFuelerSingle.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFuelerSingle.java index 5118083c6f..789289f722 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFuelerSingle.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityBuggyFuelerSingle.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.core.blocks.BlockLandingPadFull; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ITickable; import java.util.ArrayList; @@ -36,7 +36,7 @@ public void update() for (final TileEntity tile : attachedLaunchPads) { tile.invalidate(); - tile.getWorld().setBlockState(tile.getPos(), Blocks.air.getDefaultState(), 3); + tile.getWorld().setBlockState(tile.getPos(), Blocks.AIR.getDefaultState(), 3); } this.worldObj.setBlockState(this.getPos(), GCBlocks.landingPadFull.getStateFromMeta(BlockLandingPadFull.EnumLandingPadFullType.BUGGY_PAD.getMeta()), 3); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java index 374727b0c0..3161089900 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java @@ -14,7 +14,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.world.IBlockAccess; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java index a6279fc73b..62d76b5e0f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java @@ -15,8 +15,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.world.World; @@ -94,11 +94,11 @@ else if (celestialAngle > 150) this.currentAngle += difference / 20.0F; } - @Override - public boolean onActivated(EntityPlayer entityPlayer) - { - return this.getBlockType().onBlockActivated(this.worldObj, this.getPos(), this.worldObj.getBlockState(this.getPos()), entityPlayer, EnumFacing.DOWN, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); - } +// @Override TODO +// public boolean onActivated(EntityPlayer entityPlayer) +// { +// return this.getBlockType().onBlockActivated(this.worldObj, this.getPos(), this.worldObj.getBlockState(this.getPos()), entityPlayer, EnumFacing.DOWN, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); +// } @Override public void onCreate(World world, BlockPos placedPosition) @@ -216,7 +216,7 @@ public EnumSet getElectricalInputDirections() @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); + return new AxisAlignedBB(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); } // @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java index 68ad058238..f03f98e83f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java @@ -8,8 +8,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.lang.reflect.Constructor; @@ -59,7 +59,7 @@ public void update() } final Vector3 thisVec = new Vector3(this); - final List l = this.worldObj.getEntitiesWithinAABB(bossClass, AxisAlignedBB.fromBounds(thisVec.x - 15, thisVec.y - 15, thisVec.z - 15, thisVec.x + 15, thisVec.y + 15, thisVec.z + 15)); + final List l = this.worldObj.getEntitiesWithinAABB(bossClass, new AxisAlignedBB(thisVec.x - 15, thisVec.y - 15, thisVec.z - 15, thisVec.x + 15, thisVec.y + 15, thisVec.z + 15)); for (final Entity e : l) { @@ -72,7 +72,7 @@ public void update() } } - List entitiesWithin = this.worldObj.getEntitiesWithinAABB(EntityMob.class, AxisAlignedBB.fromBounds(this.roomCoords.intX() - 3, this.roomCoords.intY() - 3, this.roomCoords.intZ() - 3, this.roomCoords.intX() + this.roomSize.intX() + 3, this.roomCoords.intY() + this.roomSize.intY() + 3, this.roomCoords.intZ() + this.roomSize.intZ() + 3)); + List entitiesWithin = this.worldObj.getEntitiesWithinAABB(EntityMob.class, new AxisAlignedBB(this.roomCoords.intX() - 3, this.roomCoords.intY() - 3, this.roomCoords.intZ() - 3, this.roomCoords.intX() + this.roomSize.intX() + 3, this.roomCoords.intY() + this.roomSize.intY() + 3, this.roomCoords.intZ() + this.roomSize.intZ() + 3)); for (Entity mob : entitiesWithin) { @@ -82,7 +82,7 @@ public void update() } } - List playersWithin = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.fromBounds(this.roomCoords.intX(), this.roomCoords.intY(), this.roomCoords.intZ(), this.roomCoords.intX() + this.roomSize.intX(), this.roomCoords.intY() + this.roomSize.intY(), this.roomCoords.intZ() + this.roomSize.intZ())); + List playersWithin = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(this.roomCoords.intX(), this.roomCoords.intY(), this.roomCoords.intZ(), this.roomCoords.intX() + this.roomSize.intX(), this.roomCoords.intY() + this.roomSize.intY(), this.roomCoords.intZ() + this.roomSize.intZ())); if (this.boss == null && !this.isBossDefeated && !playersWithin.isEmpty()) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidPipe.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidPipe.java index c9750a780f..cbef784ea5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidPipe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidPipe.java @@ -14,7 +14,7 @@ import net.minecraft.item.EnumDyeColor; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java index 703e5a15c0..598d5f2cdc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java @@ -10,7 +10,7 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraftforge.fluids.*; import net.minecraftforge.fml.client.FMLClientHandler; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTransmitter.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTransmitter.java index 9459a4432a..2e6eb2e67b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTransmitter.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTransmitter.java @@ -16,7 +16,7 @@ import micdoodle8.mods.miccore.Annotations; import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.EnumFacing; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; @@ -225,7 +225,7 @@ public boolean canConnect(EnumFacing direction, NetworkType type) @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getPos().getX() + 1, this.getPos().getY() + 1, this.getPos().getZ() + 1); + return new AxisAlignedBB(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getPos().getX() + 1, this.getPos().getY() + 1, this.getPos().getZ() + 1); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java index 1d5127b452..164e16a1b7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java @@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.world.IBlockAccess; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPad.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPad.java index f20ecade07..19f01eecfb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPad.java @@ -14,8 +14,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; @@ -42,7 +42,7 @@ public void update() if (!this.worldObj.isRemote) { - final List list = this.worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.fromBounds(this.getPos().getX() - 0.5D, this.getPos().getY(), this.getPos().getZ() - 0.5D, this.getPos().getX() + 0.5D, this.getPos().getY() + 1.0D, this.getPos().getZ() + 0.5D)); + final List list = this.worldObj.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(this.getPos().getX() - 0.5D, this.getPos().getY(), this.getPos().getZ() - 0.5D, this.getPos().getX() + 0.5D, this.getPos().getY() + 1.0D, this.getPos().getZ() + 0.5D)); boolean docked = false; @@ -240,7 +240,7 @@ public RemovalResult removeCargo(boolean doRemove) @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 0.4D, getPos().getZ() + 2); + return new AxisAlignedBB(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 0.4D, getPos().getZ() + 2); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPadSingle.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPadSingle.java index 26a75ce0f9..65a55213df 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPadSingle.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityLandingPadSingle.java @@ -3,7 +3,7 @@ import micdoodle8.mods.galacticraft.core.GCBlocks; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ITickable; import java.util.ArrayList; @@ -35,7 +35,7 @@ public void update() for (final TileEntity tile : attachedLaunchPads) { tile.invalidate(); - tile.getWorld().setBlockState(tile.getPos(), Blocks.air.getDefaultState(), 3); + tile.getWorld().setBlockState(tile.getPos(), Blocks.AIR.getDefaultState(), 3); // ((GCCoreBlockLandingPadFull)GCCoreBlocks.landingPadFull).onBlockAdded(worldObj, // tile.xCoord, tile.yCoord, tile.zCoord); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityMulti.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityMulti.java index 55945ccc3c..d16dea56a2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityMulti.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityMulti.java @@ -5,9 +5,11 @@ import micdoodle8.mods.miccore.Annotations.NetworkedField; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -67,7 +69,7 @@ public boolean onBlockActivated(World worldIn, BlockPos pos, EntityPlayer player return false; } - public boolean onBlockWrenched(World world, BlockPos pos, EntityPlayer entityPlayer, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockWrenched(World world, BlockPos pos, EntityPlayer entityPlayer, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (this.mainBlockPosition != null) { @@ -75,7 +77,7 @@ public boolean onBlockWrenched(World world, BlockPos pos, EntityPlayer entityPla if (state.getBlock() instanceof BlockAdvanced) { - return ((BlockAdvanced) state.getBlock()).onBlockActivated(world, this.mainBlockPosition, state, entityPlayer, side, hitX, hitY, hitZ); + return ((BlockAdvanced) state.getBlock()).onBlockActivated(world, this.mainBlockPosition, state, entityPlayer, hand, heldItem, side, hitX, hitY, hitZ); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityNasaWorkbench.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityNasaWorkbench.java index 2764f40b1c..eb8aa6c92c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityNasaWorkbench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityNasaWorkbench.java @@ -7,8 +7,8 @@ import micdoodle8.mods.galacticraft.core.client.gui.GuiIdsCore; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; @@ -110,6 +110,6 @@ else if (y != 0 && y != 3) @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); + return new AxisAlignedBB(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java index c2c845bb31..5cd2b347e7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java @@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.world.chunk.Chunk; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDetector.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDetector.java index b13ad876bf..cf24dd7c95 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDetector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDetector.java @@ -2,7 +2,7 @@ import micdoodle8.mods.galacticraft.core.blocks.BlockOxygenDetector; import micdoodle8.mods.galacticraft.core.util.OxygenUtil; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; public class TileEntityOxygenDetector extends TileEntityAdvanced { @@ -17,7 +17,7 @@ public void update() if (this.blockType != null && this.blockType instanceof BlockOxygenDetector) { - ((BlockOxygenDetector) this.blockType).updateOxygenState(this.worldObj, this.getPos(), OxygenUtil.isAABBInBreathableAirBlock(this.worldObj, AxisAlignedBB.fromBounds(this.getPos().getX() - 1, this.getPos().getY() - 1, this.getPos().getZ() - 1, this.getPos().getX() + 2, this.getPos().getY() + 2, this.getPos().getZ() + 2))); + ((BlockOxygenDetector) this.blockType).updateOxygenState(this.worldObj, this.getPos(), OxygenUtil.isAABBInBreathableAirBlock(this.worldObj, new AxisAlignedBB(this.getPos().getX() - 1, this.getPos().getY() - 1, this.getPos().getZ() - 1, this.getPos().getX() + 2, this.getPos().getY() + 2, this.getPos().getZ() + 2))); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java index 44ec0991ea..eef5a408b1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java @@ -138,7 +138,7 @@ public void addExtraNetworkedData(List networkedList) @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(this.getPos().getX() - this.bubbleSize, this.getPos().getY() - this.bubbleSize, this.getPos().getZ() - this.bubbleSize, this.getPos().getX() + this.bubbleSize, this.getPos().getY() + this.bubbleSize, this.getPos().getZ() + this.bubbleSize); + return new AxisAlignedBB(this.getPos().getX() - this.bubbleSize, this.getPos().getY() - this.bubbleSize, this.getPos().getZ() - this.bubbleSize, this.getPos().getX() + this.bubbleSize, this.getPos().getY() + this.bubbleSize, this.getPos().getZ() + this.bubbleSize); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java index 2c1aefc64d..89f9d1c693 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java @@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java index 83d416bb66..4ac67c4c33 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java @@ -16,7 +16,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.IChatComponent; import net.minecraftforge.fluids.FluidTank; import net.minecraftforge.fml.relauncher.Side; @@ -248,7 +248,7 @@ public void update() { this.numUsingPlayers = 0; f = 5.0F; - List list = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.fromBounds(this.getPos().getX() - f, this.getPos().getY() - f, this.getPos().getZ() - f, this.getPos().getX() + 1 + f, this.getPos().getY() + 1 + f, this.getPos().getZ() + 1 + f)); + List list = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(this.getPos().getX() - f, this.getPos().getY() - f, this.getPos().getZ() - f, this.getPos().getX() + 1 + f, this.getPos().getY() + 1 + f, this.getPos().getZ() + 1 + f)); Iterator iterator = list.iterator(); while (iterator.hasNext()) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java index b92e93b37f..5edc450aa1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java @@ -23,7 +23,9 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; @@ -256,11 +258,11 @@ public float getSolarBoost() return (float) (this.worldObj.provider instanceof ISolarLevel ? ((ISolarLevel) this.worldObj.provider).getSolarEnergyMultiplier() : 1.0F); } - @Override - public boolean onActivated(EntityPlayer entityPlayer) - { - return this.getBlockType().onBlockActivated(this.worldObj, this.getPos(), this.worldObj.getBlockState(getPos()), entityPlayer, EnumFacing.DOWN, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); - } +// @Override TODO +// public boolean onActivated(EntityPlayer entityPlayer) +// { +// return this.getBlockType().onBlockActivated(this.worldObj, this.getPos(), this.worldObj.getBlockState(getPos()), entityPlayer, EnumFacing.DOWN, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); +// } // @Override // public boolean canUpdate() @@ -416,7 +418,7 @@ public EnumFacing getElectricalOutputDirectionMain() @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); + return new AxisAlignedBB(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySpaceStationBase.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySpaceStationBase.java index 539405889a..274cbaea6f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySpaceStationBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySpaceStationBase.java @@ -5,7 +5,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class TileEntitySpaceStationBase extends TileEntityMulti implements IMultiBlock diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTelemetry.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTelemetry.java index 26f5f08955..a6e8feb0c8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTelemetry.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTelemetry.java @@ -21,7 +21,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ITickable; import net.minecraft.util.MathHelper; import net.minecraft.world.WorldProvider; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/ConfigManagerCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/ConfigManagerCore.java index 42ae3c5038..26b842befc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/ConfigManagerCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/ConfigManagerCore.java @@ -818,7 +818,7 @@ public static BlockTuple stringToBlock(String s, String caller, boolean logging) catch (NumberFormatException ex) { } - if (Blocks.air == block) + if (Blocks.AIR == block) { if (logging) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java index 51578834c2..d9d2508c16 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java @@ -9,7 +9,7 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraftforge.fluids.*; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java index c63c116ae1..6bbfb0fa51 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java @@ -18,7 +18,8 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -141,7 +142,7 @@ public static void getLocalMap(World world, int chunkXPos, int chunkZPos, Buffer for (int x = 0; x < 16; x++) { int l4 = chunk.getHeight(new BlockPos(x, 0, z)) + 1; - Block block = Blocks.air; + Block block = Blocks.AIR; IBlockState i5 = null; if (l4 > 1) @@ -1071,7 +1072,7 @@ public static void makeVanillaMap(int dim, int chunkXPos, int chunkZPos, File ba for (int x = 0; x < 16; x++) { int l4 = chunk.getHeightValue(x, z) + 1; - Block block = Blocks.air; + Block block = Blocks.AIR; IBlockState i5 = block.getDefaultState(); if (l4 > 1) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java index 1974f8bcbb..74edf7fa16 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java @@ -28,8 +28,8 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -86,7 +86,7 @@ public static boolean isAABBInBreathableAirBlock(EntityLivingBase entity, boolea //A good first estimate of head size is that it's the smallest of the entity's 3 dimensions (e.g. front to back, for Steve) double smin = Math.min(sx, Math.min(sy, sz)) / 2; - return OxygenUtil.isAABBInBreathableAirBlock(entity.worldObj, AxisAlignedBB.fromBounds(x - smin, y - smin, z - smin, x + smin, y + smin, z + smin)); + return OxygenUtil.isAABBInBreathableAirBlock(entity.worldObj, new AxisAlignedBB(x - smin, y - smin, z - smin, x + smin, y + smin, z + smin)); } public static boolean isAABBInBreathableAirBlock(World world, AxisAlignedBB bb) @@ -230,7 +230,7 @@ private static int testContactWithBreathableAir(World world, Block block, BlockP { if (block.isOpaqueCube()) { - if (block instanceof BlockGravel || block.getMaterial() == Material.cloth || block instanceof BlockSponge) + if (block instanceof BlockGravel || block.getMaterial() == Material.CLOTH || block instanceof BlockSponge) { permeableFlag = true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/RedstoneUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/RedstoneUtil.java index f4ecb2c03c..e1a6dfd7c0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/RedstoneUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/RedstoneUtil.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.util; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java index a90b786f43..595f934c6b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java @@ -42,7 +42,7 @@ import net.minecraft.network.play.server.S1FPacketSetExperience; import net.minecraft.potion.PotionEffect; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.*; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/ChunkLoadingCallback.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/ChunkLoadingCallback.java index d7c5cf4d51..d192b56e98 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/ChunkLoadingCallback.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/ChunkLoadingCallback.java @@ -5,7 +5,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; import net.minecraft.world.WorldServer; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/IChunkLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/IChunkLoader.java index c9a114d109..4d10953589 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/IChunkLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/IChunkLoader.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.world; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.ForgeChunkManager.Ticket; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java index de852211a5..bfa634c3b8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java @@ -7,7 +7,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.pattern.BlockHelper; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java index 3fb2c23341..094c9f2349 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java @@ -14,7 +14,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; @@ -135,7 +135,7 @@ public void replaceBlocksForBiome(int par1, int par2, ChunkPrimer primer, BiomeG else { IBlockState var18 = primer.getBlockState(index); - if (Blocks.air == var18) + if (Blocks.AIR == var18) { var13 = -1; } @@ -145,7 +145,7 @@ else if (var18 == BLOCK_LOWER) { if (var12 <= 0) { - state0 = Blocks.air.getDefaultState(); + state0 = Blocks.AIR.getDefaultState(); state1 = BLOCK_LOWER; } else if (var16 >= var5 - -16 && var16 <= var5 + 1) @@ -244,9 +244,9 @@ private void makeCrater(int craterX, int craterZ, int chunkX, int chunkZ, int si int helper = 0; for (int y = 127; y > 0; y--) { - if (Blocks.air != primer.getBlockState(this.getIndex(x, y, z)).getBlock() && helper <= yDev) + if (Blocks.AIR != primer.getBlockState(this.getIndex(x, y, z)).getBlock() && helper <= yDev) { - primer.setBlockState(this.getIndex(x, y, z), Blocks.air.getDefaultState()); + primer.setBlockState(this.getIndex(x, y, z), Blocks.AIR.getDefaultState()); helper++; } if (helper > yDev) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderOrbit.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderOrbit.java index ae55d186aa..d528906ac6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderOrbit.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderOrbit.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.core.tile.IMultiBlock; import net.minecraft.block.BlockFalling; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java index 119d4a7d0d..8b5062d4f6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java @@ -175,13 +175,13 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime { if (state.getBlock().getMetaFromState(state) == 3 || state.getBlock().getMetaFromState(state) == 4) { - primer.setBlockState(coords, Blocks.air.getDefaultState()); -// blockIdArray[coords] = Blocks.air; + primer.setBlockState(coords, Blocks.AIR.getDefaultState()); +// blockIdArray[coords] = Blocks.AIR; } else if (state.getBlock().getMetaFromState(state) == 5) { - primer.setBlockState(coords, Blocks.air.getDefaultState()); -// blockIdArray[coords] = Blocks.air; + primer.setBlockState(coords, Blocks.AIR.getDefaultState()); +// blockIdArray[coords] = Blocks.AIR; } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OreGenOtherMods.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OreGenOtherMods.java index 9da76fffaa..5a95ccdcde 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OreGenOtherMods.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OreGenOtherMods.java @@ -12,7 +12,7 @@ import micdoodle8.mods.galacticraft.planets.mars.blocks.MarsBlocks; import micdoodle8.mods.galacticraft.planets.mars.dimension.WorldProviderMars; import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraft.world.gen.feature.WorldGenerator; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java index d48881203b..9c93b2bcc5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java @@ -4,7 +4,7 @@ import net.minecraft.block.Block; import net.minecraft.block.state.pattern.BlockHelper; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentGC.java index cc8d39cec8..ffe2ce8e41 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentGC.java @@ -2,7 +2,7 @@ import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntityMobSpawner; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java index 6e6c148c14..f82f930358 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java @@ -3,7 +3,7 @@ import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntityMobSpawner; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -224,7 +224,7 @@ protected void fillBlocksRotated(World var1, StructureBoundingBox var2, int var3 protected void fillAirRotated(World var1, StructureBoundingBox var2, int var3, int var4, int var5, int var6, int var7, int var8, int var9) { - this.fillBlocksRotated(var1, var2, var3, var4, var5, var6, var7, var8, Blocks.air, 0, var9); + this.fillBlocksRotated(var1, var2, var3, var4, var5, var6, var7, var8, Blocks.AIR, 0, var9); } protected int getStairMeta(int var1) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java index 3801633b02..a46c106976 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java @@ -2,7 +2,7 @@ import micdoodle8.mods.galacticraft.core.entities.EntityAlienVillager; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField.java index f4d336c58e..0565764f48 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField.java @@ -64,7 +64,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 7 - 1, 0); } - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 12, 4, 8, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 12, 4, 8, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 2, 0, 7, Blocks.dirt.getDefaultState(), Blocks.dirt.getDefaultState(), false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 1, 5, 0, 7, Blocks.dirt.getDefaultState(), Blocks.dirt.getDefaultState(), false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 0, 1, 8, 0, 7, Blocks.dirt.getDefaultState(), Blocks.dirt.getDefaultState(), false); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField2.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField2.java index 4baebdbbfe..be7acc6b20 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField2.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField2.java @@ -99,7 +99,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 4 - 1, 0); } - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 12, 4, 8, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 12, 4, 8, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 2, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 1, 5, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 0, 1, 8, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java index 3cbb7a12ec..5a203204f1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java @@ -109,7 +109,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 5, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 6, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 7, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 1, yLevel, 8, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 1, yLevel, 8, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 9, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 10, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 11, par3StructureBoundingBox); @@ -122,7 +122,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 5, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 6, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 7, yLevel, 15, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 8, yLevel, 15, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 8, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 9, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 10, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 11, yLevel, 15, par3StructureBoundingBox); @@ -135,7 +135,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 11, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 10, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 9, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 15, yLevel, 8, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 15, yLevel, 8, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 7, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 6, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 5, par3StructureBoundingBox); @@ -148,7 +148,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 11, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 10, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 9, yLevel, 1, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 8, yLevel, 1, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 8, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 7, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 6, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 5, yLevel, 1, par3StructureBoundingBox); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java index 900dee46ff..21c1913d89 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java @@ -5,7 +5,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.World; @@ -145,7 +145,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo { BlockPos pos = new BlockPos(var5, par1World.getTopSolidOrLiquidBlock(new BlockPos(var5, 0, var6)).getY() - 1, var6); IBlockState state = par1World.getBlockState(pos); - if (par3StructureBoundingBox.isVecInside(new BlockPos(var5, 64, var6)) && (state.getBlock() == GCBlocks.blockMoon && state.getBlock().getMetaFromState(state) == 5 || Blocks.air == state.getBlock())) + if (par3StructureBoundingBox.isVecInside(new BlockPos(var5, 64, var6)) && (state.getBlock() == GCBlocks.blockMoon && state.getBlock().getMetaFromState(state) == 5 || Blocks.AIR == state.getBlock())) { final int var7 = par1World.getTopSolidOrLiquidBlock(new BlockPos(var5, 0, var6)).getY() - 1; par1World.setBlockState(new BlockPos(var5, var7, var6), var4.getStateFromMeta(1), 2); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java index 64a7cb75a5..8ce2a6dfbf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java @@ -69,7 +69,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 4 - 1, 0); } - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 2, 3, 1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 2, 3, 1, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 0, 0, par3StructureBoundingBox); this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 1, 0, par3StructureBoundingBox); this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 2, 0, par3StructureBoundingBox); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java index 34685fd268..5b107aa0ab 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java @@ -78,10 +78,10 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo } this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 4, 12, 4, GCBlocks.basicBlock.getStateFromMeta(4), Blocks.flowing_water.getDefaultState(), false); - this.setBlockState(par1World, Blocks.air.getDefaultState(), 2, 12, 2, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.air.getDefaultState(), 3, 12, 2, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.air.getDefaultState(), 2, 12, 3, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.air.getDefaultState(), 3, 12, 3, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.AIR.getDefaultState(), 2, 12, 2, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.AIR.getDefaultState(), 3, 12, 2, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.AIR.getDefaultState(), 2, 12, 3, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.AIR.getDefaultState(), 3, 12, 3, par3StructureBoundingBox); this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 13, 1, par3StructureBoundingBox); this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 14, 1, par3StructureBoundingBox); this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 4, 13, 1, par3StructureBoundingBox); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java index a78de34b40..46d6f14639 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java @@ -108,7 +108,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 5, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 6, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 7, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 1, yLevel, 8, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 1, yLevel, 8, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 9, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 10, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 1, yLevel, 11, par3StructureBoundingBox); @@ -121,7 +121,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 5, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 6, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 7, yLevel, 15, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 8, yLevel, 15, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 8, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 9, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 10, yLevel, 15, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 11, yLevel, 15, par3StructureBoundingBox); @@ -134,7 +134,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 11, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 10, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 9, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 15, yLevel, 8, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 15, yLevel, 8, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 7, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 6, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 15, yLevel, 5, par3StructureBoundingBox); @@ -147,7 +147,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 11, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 10, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 9, yLevel, 1, par3StructureBoundingBox); - this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.air.getDefaultState(), 8, yLevel, 1, par3StructureBoundingBox); + this.setBlockState(par1World, yLevel <= 1 ? GCBlocks.basicBlock.getStateFromMeta(4) : Blocks.AIR.getDefaultState(), 8, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 7, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 6, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 5, yLevel, 1, par3StructureBoundingBox); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java index d5eb41debf..97ab6c3a3f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java @@ -3,7 +3,7 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.pattern.BlockHelper; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenMinable; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenSpaceStation.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenSpaceStation.java index 984d3de7a7..a4f7098da9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenSpaceStation.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenSpaceStation.java @@ -2,7 +2,7 @@ import micdoodle8.mods.galacticraft.core.GCBlocks; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/Corridor.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/Corridor.java index 0dadd88853..c70e29afbd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/Corridor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/Corridor.java @@ -54,7 +54,7 @@ else if (this.getDirection().getAxis() == EnumFacing.Axis.X && (i + 1) % 4 == 0 } } - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, this.boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, this.boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomBoss.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomBoss.java index 24c7884ee4..0a1257151f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomBoss.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomBoss.java @@ -6,7 +6,7 @@ import micdoodle8.mods.galacticraft.core.tile.TileEntityDungeonSpawner; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -88,7 +88,7 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } else if ((i == 1 && k == 1) || (i == 1 && k == this.sizeZ - 1) || (i == this.sizeX - 1 && k == 1) || (i == this.sizeX - 1 && k == this.sizeZ - 1)) @@ -110,7 +110,7 @@ else if ((i == 1 && k == 2) || (i == 2 && k == 1) || } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java index 277f93e012..41b63d6f89 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java @@ -4,7 +4,7 @@ import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEmpty.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEmpty.java index 65906f64fd..05e02c57d6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEmpty.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEmpty.java @@ -75,12 +75,12 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEntrance.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEntrance.java index ec49be774a..94d06f3fb7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEntrance.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEntrance.java @@ -45,7 +45,7 @@ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundi Block block = getBlockStateFromPos(worldIn, i + range, j, k + range, boundingBox).getBlock(); - if (Blocks.air != block && block != null) + if (Blocks.AIR != block && block != null) { break; } @@ -72,7 +72,7 @@ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundi } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } @@ -92,7 +92,7 @@ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundi block1 = this.getBlockStateFromPos(worldIn, i + range, j, k + range, boundingBox); if (block1 == this.configuration.getBrickBlock() || j != this.sizeY) { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i + range, j, k + range, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i + range, j, k + range, boundingBox); helper++; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java index 98625e3d2e..dc8b350e04 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java @@ -3,7 +3,7 @@ import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityMobSpawner; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java index 460efb6e19..05bef75036 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.core.blocks.BlockT1TreasureChest; import micdoodle8.mods.galacticraft.core.tile.TileEntityTreasureChest; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -82,7 +82,7 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } else if ((i == 1 && k == 1) || (i == 1 && k == this.sizeZ - 1) || (i == this.sizeX - 1 && k == 1) || (i == this.sizeX - 1 && k == this.sizeZ - 1)) @@ -100,7 +100,7 @@ else if (i == this.sizeX / 2 && j == 1 && k == this.sizeZ / 2) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ScheduledBlockChange.java b/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ScheduledBlockChange.java index af0fa3c56d..11ead514aa 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ScheduledBlockChange.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ScheduledBlockChange.java @@ -2,7 +2,7 @@ import micdoodle8.mods.galacticraft.api.vector.BlockVec3; import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public class ScheduledBlockChange { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java index 213b75c090..826b1ab6b8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java @@ -38,7 +38,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java index 175822c76a..d6d4bf47bb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java @@ -37,7 +37,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.event.ModelBakeEvent; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBasicAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBasicAsteroids.java index ae371b9069..b587b394c0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBasicAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBasicAsteroids.java @@ -10,16 +10,16 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.IPlantable; @@ -71,7 +71,7 @@ public String getName() public BlockBasicAsteroids(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 3.0F; this.setUnlocalizedName(assetName); } @@ -186,15 +186,14 @@ public boolean isTerraformable(World world, BlockPos pos) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { - IBlockState state = world.getBlockState(pos); if (getMetaFromState(state) == 4) { return new ItemStack(Item.getItemFromBlock(this), 1, getMetaFromState(state)); } - return super.getPickBlock(target, world, pos, player); + return super.getPickBlock(state, target, world, pos, player); } @Override @@ -210,9 +209,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, BASIC_TYPE); + return new BlockStateContainer(this, BASIC_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java index 8132fc3f9d..26d204e9e0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java @@ -11,10 +11,9 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.planets.asteroids.tile.TileEntityBeamReceiver; -import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyDirection; -import net.minecraft.block.state.BlockState; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -23,10 +22,10 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; @@ -41,9 +40,9 @@ public class BlockBeamReceiver extends BlockTileGC implements IShiftDescription, public BlockBeamReceiver(String assetName) { - super(Material.iron); + super(Material.IRON); this.setUnlocalizedName(assetName); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); } @SideOnly(Side.CLIENT) @@ -54,19 +53,21 @@ public CreativeTabs getCreativeTabToDisplayOn() } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { + IBlockState state = worldIn.getBlockState(pos); + IBlockState neighborBlock = worldIn.getBlockState(neighborBlockPos); int oldMeta = getMetaFromState(worldIn.getBlockState(pos)); - int meta = this.getMetadataFromAngle(worldIn, pos, EnumFacing.getFront(oldMeta).getOpposite()); + int meta = this.getMetadataFromAngle((World) worldIn, pos, EnumFacing.getFront(oldMeta).getOpposite()); if (meta == -1) { - worldIn.destroyBlock(pos, true); + ((World) worldIn).destroyBlock(pos, true); } if (meta != oldMeta) { - worldIn.setBlockState(pos, getStateFromMeta(meta), 3); + ((World) worldIn).setBlockState(pos, getStateFromMeta(meta), 3); TileEntity thisTile = worldIn.getTileEntity(pos); if (thisTile instanceof TileEntityBeamReceiver) { @@ -77,7 +78,7 @@ public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state } } - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + super.onNeighborChange(worldIn, pos, neighborBlockPos); } @Override @@ -288,9 +289,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING); + return new BlockStateContainer(this, FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java index b62dc88f0d..6d87d04a91 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java @@ -16,8 +16,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -30,9 +30,9 @@ public class BlockBeamReflector extends BlockTileGC implements IShiftDescription { public BlockBeamReflector(String assetName) { - super(Material.iron); + super(Material.IRON); this.setUnlocalizedName(assetName); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockIceAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockIceAsteroids.java index 359d8e086e..86df12ff07 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockIceAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockIceAsteroids.java @@ -6,6 +6,7 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockBreakable; +import net.minecraft.block.material.EnumPushReaction; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; @@ -15,7 +16,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.EnumSkyBlock; @@ -127,9 +128,9 @@ public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random ra } @Override - public int getMobilityFlag() + public EnumPushReaction getMobilityFlag(IBlockState state) { - return 0; + return EnumPushReaction.NORMAL; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java index 854f88dea6..bfae7d8224 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java @@ -13,9 +13,9 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -26,7 +26,7 @@ public class BlockMinerBase extends BlockTileGC implements IShiftDescription, IS { public BlockMinerBase(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 3.0F; this.setUnlocalizedName(assetName); this.setCreativeTab(CreativeTabs.tabBlock); @@ -96,9 +96,9 @@ public boolean showDescription(int meta) @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java index 2339bbc639..33e733d720 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java @@ -9,9 +9,9 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -26,7 +26,7 @@ public class BlockMinerBaseFull extends BlockTileGC { public BlockMinerBaseFull(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 3.0F; this.setUnlocalizedName(assetName); this.setStepSound(soundTypeMetal); @@ -126,7 +126,7 @@ public List getDrops(IBlockAccess world, BlockPos pos, IBlockState st } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(Item.getItemFromBlock(AsteroidBlocks.blockMinerBase), 1, 0); } @@ -144,8 +144,8 @@ public boolean onUseWrench(World world, BlockPos pos, EntityPlayer entityPlayer, @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java index 5f95df4d84..bb25223f5b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java @@ -22,8 +22,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; @@ -38,10 +38,10 @@ public class BlockShortRangeTelepad extends BlockTileGC implements IShiftDescrip { protected BlockShortRangeTelepad(String assetName) { - super(Material.iron); + super(Material.IRON); this.blockHardness = 3.0F; this.setUnlocalizedName(assetName); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java index 59081fb078..cf88dc5998 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java @@ -15,8 +15,9 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.Explosion; @@ -36,7 +37,7 @@ public class BlockTelepadFake extends BlockAdvancedTile implements ITileEntityPr public BlockTelepadFake(String assetName) { super(GCBlocks.machine); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); // this.setBlockTextureName(Constants.TEXTURE_PREFIX + assetName); this.setUnlocalizedName(assetName); // this.setBlockTextureName(Constants.TEXTURE_PREFIX + "launch_pad"); @@ -111,7 +112,7 @@ public void makeFakeBlock(World worldObj, BlockPos pos, BlockPos mainBlock, IBlo } @Override - public float getBlockHardness(World worldIn, BlockPos pos) + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { TileEntity tileEntity = worldIn.getTileEntity(pos); @@ -142,7 +143,7 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntityTelepadFake tileEntity = (TileEntityTelepadFake) worldIn.getTileEntity(pos); return tileEntity.onActivated(playerIn); @@ -178,7 +179,7 @@ public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Ra } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { TileEntity tileEntity = world.getTileEntity(pos); BlockPos mainBlockPosition = ((TileEntityTelepadFake) tileEntity).mainBlockPosition; @@ -187,7 +188,7 @@ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos { Block mainBlockID = world.getBlockState(mainBlockPosition).getBlock(); - if (Blocks.air != mainBlockID) + if (Blocks.AIR != mainBlockID) { return mainBlockID.getPickBlock(target, world, mainBlockPosition, player); } @@ -267,9 +268,9 @@ public boolean addDestroyEffects(World world, BlockPos pos, EffectRenderer effec } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, TOP, CONNECTABLE); + return new BlockStateContainer(this, TOP, CONNECTABLE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java index 1e41aad312..b24946c57d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java @@ -71,10 +71,10 @@ public String getName() protected BlockWalkway(String assetName) { - super(Material.iron); + super(Material.IRON); this.setHardness(1.0F); this.setUnlocalizedName(assetName); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.isBlockContainer = true; this.setDefaultState(this.blockState.getBaseState().withProperty(WALKWAY_TYPE, EnumWalkwayType.WALKWAY)); } @@ -297,9 +297,9 @@ public boolean showDescription(int meta) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, WALKWAY_TYPE, NORTH, EAST, SOUTH, WEST, DOWN); + return new BlockStateContainer(this, WALKWAY_TYPE, NORTH, EAST, SOUTH, WEST, DOWN); } @Override @@ -364,9 +364,9 @@ public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicAstroMiner.java index 53b6a5c9c0..4bb29fe80a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicAstroMiner.java @@ -10,7 +10,7 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicTier3Rocket.java index 1048589949..eb22d44092 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiSchematicTier3Rocket.java @@ -10,7 +10,7 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java index 4714c79378..c5717c9763 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java @@ -21,7 +21,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.WorldServer; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java index 85b13b2c55..fa8f9a9629 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java @@ -150,7 +150,7 @@ public class EntityAstroMiner extends Entity implements IInventory, IPacketRecei public boolean stopForTurn; private static ArrayList noMineList = new ArrayList(); - public static BlockTuple blockingBlock = new BlockTuple(Blocks.air, 0); + public static BlockTuple blockingBlock = new BlockTuple(Blocks.AIR, 0); private int givenFailMessage = 0; private BlockVec3 mineLast = null; private int mineCountDown = 0; @@ -1491,7 +1491,7 @@ private boolean tryMineBlock(BlockPos pos) dropStack(pos, drops); } - this.worldObj.setBlockState(pos, Blocks.air.getDefaultState(), 3); + this.worldObj.setBlockState(pos, Blocks.AIR.getDefaultState(), 3); return false; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java index e5be4971e4..6c168d1801 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java @@ -10,7 +10,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; import java.util.Map; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicAstroMiner.java index 2d2891ad16..0e4930bb60 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicAstroMiner.java @@ -9,7 +9,7 @@ import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerSchematicAstroMiner extends Container diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicTier3Rocket.java index 8c44e53d04..18845b8bfb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicTier3Rocket.java @@ -11,7 +11,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerSchematicTier3Rocket extends Container diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java index 7dde2dce7f..f980c33d2d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java @@ -12,7 +12,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public class SlotSchematicAstroMiner extends Slot { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicTier3Rocket.java index ae77f5a906..2ba154e530 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicTier3Rocket.java @@ -10,7 +10,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public class SlotSchematicTier3Rocket extends Slot { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java index 9736a842f3..4b725b9bb3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java @@ -22,7 +22,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemCanisterLiquidNitrogen.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemCanisterLiquidNitrogen.java index 83b08992bf..d0a3f7f1e6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemCanisterLiquidNitrogen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemCanisterLiquidNitrogen.java @@ -10,7 +10,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java index 39e5723df0..95e6ccd2cb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java @@ -20,7 +20,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/network/PacketSimpleAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/network/PacketSimpleAsteroids.java index f21f2797c1..e272052683 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/network/PacketSimpleAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/network/PacketSimpleAsteroids.java @@ -16,7 +16,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicAstroMiner.java index 5645f97fa4..ff8ac2682e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicAstroMiner.java @@ -11,7 +11,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicTier3Rocket.java index 6cf6e758c4..fa9aeb815f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/schematic/SchematicTier3Rocket.java @@ -11,7 +11,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamOutput.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamOutput.java index 4265b5ed49..50fdd308cf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamOutput.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamOutput.java @@ -9,7 +9,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java index 561242614a..eb8e390deb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java @@ -22,8 +22,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.world.World; @@ -539,7 +539,7 @@ public void onDestroy(TileEntity callingBlock) @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX() + 2, getPos().getY() + 2, getPos().getZ() + 2); + return new AxisAlignedBB(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX() + 2, getPos().getY() + 2, getPos().getZ() + 2); } @Override @@ -587,7 +587,7 @@ public void updateFacing() if (tileOffset != null && !(tileOffset instanceof TileEntityMinerBase)) { IBlockState state = this.worldObj.getBlockState(offset); - state.getBlock().onNeighborBlockChange(worldObj, offset, state, state.getBlock()); + state.getBlock().onNeighborChange(worldObj, this.getPos(), offset); worldObj.markBlockRangeForRenderUpdate(offset, offset); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBaseSingle.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBaseSingle.java index 77d2d50da9..ce149df8dc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBaseSingle.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBaseSingle.java @@ -2,7 +2,7 @@ import micdoodle8.mods.galacticraft.planets.asteroids.blocks.AsteroidBlocks; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ITickable; import java.util.ArrayList; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java index bd4f525e56..0d83fb4308 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java @@ -106,7 +106,7 @@ public void update() { if (this.targetAddressResult == EnumTelepadSearchResult.VALID && (this.ticks % 5 == 0 || teleporting)) { - List containedEntities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.fromBounds(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), + List containedEntities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getPos().getX() + 1, this.getPos().getY() + 2, this.getPos().getZ() + 1)); if (containedEntities.size() > 0 && this.getEnergyStoredGC() >= ENERGY_USE_ON_TELEPORT) @@ -137,7 +137,7 @@ public void update() if (finalPos != null) { TileEntity tileAt = finalPos.getTileEntity(this.worldObj); - List containedEntities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.fromBounds(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), + List containedEntities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getPos().getX() + 1, this.getPos().getY() + 2, this.getPos().getZ() + 1)); if (tileAt != null && tileAt instanceof TileEntityShortRangeTelepad) @@ -330,7 +330,7 @@ public void onDestroy(TileEntity callingBlock) @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); + return new AxisAlignedBB(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 4, getPos().getZ() + 2); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityTelepadFake.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityTelepadFake.java index 4c97a125b3..65796ab5e1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityTelepadFake.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityTelepadFake.java @@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java index 0480340d11..ea6898e8f3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java @@ -13,7 +13,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; @@ -383,8 +383,8 @@ else if (y < terrainY) } else { - primer.setBlockState(index, Blocks.air.getDefaultState()); -// blockArray[index] = Blocks.air; + primer.setBlockState(index, Blocks.AIR.getDefaultState()); +// blockArray[index] = Blocks.AIR; // metaArray[index] = 0; } } @@ -461,7 +461,7 @@ else if (shell != null && distance >= shellThickness) int indexAbove = indexBase | (y + 1); IBlockState state = primer.getBlockState(index); IBlockState stateAbove = primer.getBlockState(indexAbove); - if (Blocks.air == stateAbove.getBlock() && (state.getBlock() == ASTEROID_STONE || state.getBlock() == GRASS)) + if (Blocks.AIR == stateAbove.getBlock() && (state.getBlock() == ASTEROID_STONE || state.getBlock() == GRASS)) { if (this.rand.nextInt(GLOWSTONE_CHANCE) == 0) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java index a33b673990..6307952799 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java @@ -32,7 +32,7 @@ import net.minecraft.potion.Potion; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EntityDamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.WorldServer; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java index c21c5b1e5f..6095a12f5d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java @@ -42,7 +42,7 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java index 9aa1f9e082..8384db2774 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java @@ -37,7 +37,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.event.ModelBakeEvent; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockBasicMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockBasicMars.java index 1acbf0e90f..f45bc48cbf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockBasicMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockBasicMars.java @@ -22,7 +22,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MovingObjectPosition; @@ -81,7 +81,7 @@ public String getName() public BlockBasicMars(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setUnlocalizedName(assetName); } @@ -121,7 +121,7 @@ public CreativeTabs getCreativeTabToDisplayOn() } @Override - public float getBlockHardness(World worldIn, BlockPos pos) + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { IBlockState state = worldIn.getBlockState(pos); @@ -243,7 +243,7 @@ public boolean isTerraformable(World world, BlockPos pos) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { IBlockState state = world.getBlockState(pos); int metadata = state.getBlock().getMetaFromState(state); @@ -285,9 +285,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, BASIC_TYPE); + return new BlockStateContainer(this, BASIC_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java index 5a059ace68..754085cf5a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java @@ -20,6 +20,7 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.IShearable; @@ -100,13 +101,13 @@ public boolean canBlockStay(World worldIn, BlockPos pos) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + super.onNeighborChange(worldIn, pos, neighborBlockPos); - if (!this.canBlockStay(worldIn, pos)) + if (!this.canBlockStay((World) worldIn, pos)) { - worldIn.setBlockToAir(pos); + ((World) worldIn).setBlockToAir(pos); } } @@ -236,7 +237,7 @@ public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random ra @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override @@ -279,9 +280,9 @@ public boolean showDescription(int meta) @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override @@ -297,9 +298,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, VINE_TYPE); + return new BlockStateContainer(this, VINE_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java index 353b0be08e..ba443e4365 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java @@ -12,7 +12,8 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.Explosion; @@ -49,7 +50,7 @@ public boolean isFullCube() } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { return false; } @@ -62,7 +63,7 @@ public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn) @Override @SideOnly(Side.CLIENT) - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java index d979acc1ab..6e5edd6601 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java @@ -29,7 +29,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MathHelper; @@ -362,9 +362,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE); + return new BlockStateContainer(this, FACING, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java index 92a18ff373..fa43d7ac2e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java @@ -87,7 +87,7 @@ public String getName() public BlockMachineMarsT2(String assetName) { super(GCBlocks.machine); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -263,7 +263,7 @@ public int damageDropped(IBlockState state) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { int metadata = this.getDamageValue(world, pos); @@ -345,9 +345,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, TYPE); + return new BlockStateContainer(this, FACING, TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java index 1eb433329a..905bb58bd3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java @@ -23,7 +23,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MovingObjectPosition; @@ -68,7 +69,7 @@ public String getName() public BlockSlimelingEgg(String assetName) { - super(Material.rock); + super(Material.ROCK); this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.625F, 0.75F); this.setUnlocalizedName(assetName); this.setDefaultState(this.blockState.getBaseState().withProperty(EGG_COLOR, EnumEggColor.RED).withProperty(BROKEN, false)); @@ -156,7 +157,7 @@ else if (player.capabilities.isCreativeMode) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { return beginHatch(worldIn, pos, playerIn); } @@ -238,7 +239,7 @@ public TileEntity createNewTileEntity(World world, int meta) } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { IBlockState state = world.getBlockState(pos); int metadata = state.getBlock().getMetaFromState(state); @@ -283,9 +284,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, EGG_COLOR, BROKEN); + return new BlockStateContainer(this, EGG_COLOR, BROKEN); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSludge.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSludge.java index 858b0f1f0b..8b6a608f39 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSludge.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSludge.java @@ -7,8 +7,8 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; @@ -36,7 +36,7 @@ public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState s } int range = 5; - List l = worldIn.getEntitiesWithinAABB(EntitySludgeling.class, AxisAlignedBB.fromBounds(pos.getX() - range, pos.getY() - range, pos.getZ() - range, pos.getX() + range, pos.getY() + range, pos.getZ() + range)); + List l = worldIn.getEntitiesWithinAABB(EntitySludgeling.class, new AxisAlignedBB(pos.getX() - range, pos.getY() - range, pos.getZ() - range, pos.getX() + range, pos.getY() + range, pos.getZ() + range)); if (l.size() < 3) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/EntityBacterialDripFX.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/EntityBacterialDripFX.java index 5c548b47cb..3a4ded7afd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/EntityBacterialDripFX.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/EntityBacterialDripFX.java @@ -4,7 +4,7 @@ import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.particle.EntityFX; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicCargoRocket.java index 43db9dcf57..50c13be3f4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicCargoRocket.java @@ -8,7 +8,7 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicTier2Rocket.java index 6a5c9ff7a9..41e52d8615 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSchematicTier2Rocket.java @@ -10,7 +10,7 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java index b04b542b38..56968131f1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java @@ -29,7 +29,7 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java index 7f9e036e68..bfbd1bdae8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java @@ -14,7 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class EntitySludgeling extends EntityMob implements IEntityBreathable @@ -102,7 +102,7 @@ protected void playStepSound(BlockPos pos, Block block) @Override protected Item getDropItem() { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicCargoRocket.java index dc1b028a10..ccc007c391 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicCargoRocket.java @@ -11,7 +11,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerSchematicCargoRocket extends Container diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicTier2Rocket.java index 7f3ef6e871..202e1ba730 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicTier2Rocket.java @@ -11,7 +11,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ContainerSchematicTier2Rocket extends Container diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicCargoRocket.java index 49334924bb..6b713a125b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicCargoRocket.java @@ -10,7 +10,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public class SlotSchematicCargoRocket extends Slot { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicTier2Rocket.java index e6059e56c1..10ee39ed5c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/SlotSchematicTier2Rocket.java @@ -10,7 +10,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public class SlotSchematicTier2Rocket extends Slot { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java index 12a91d6e97..92b71677ff 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java @@ -12,7 +12,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java index 1703597a03..19fea866db 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java @@ -24,7 +24,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GCMarsNEIHighlightHandler.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GCMarsNEIHighlightHandler.java index d90644beb9..f3582971de 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GCMarsNEIHighlightHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GCMarsNEIHighlightHandler.java @@ -10,7 +10,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/network/PacketSimpleMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/network/PacketSimpleMars.java index 192dfd7900..7f2aa85b37 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/network/PacketSimpleMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/network/PacketSimpleMars.java @@ -19,7 +19,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicCargoRocket.java index 96906d5b99..2eb2a4309f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicCargoRocket.java @@ -11,7 +11,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicTier2Rocket.java index 60a285d9dc..979c7a525d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/schematic/SchematicTier2Rocket.java @@ -11,7 +11,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java index 14db63458f..337c534223 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java @@ -16,8 +16,8 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -38,7 +38,7 @@ public TileEntityCryogenicChamber() @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 3, getPos().getZ() + 2); + return new AxisAlignedBB(getPos().getX() - 1, getPos().getY(), getPos().getZ() - 1, getPos().getX() + 2, getPos().getY() + 3, getPos().getZ() + 2); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java index ad051cd1d2..3fd4eb6089 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java @@ -25,7 +25,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraft.world.ChunkCoordIntPair; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java index 82a35d04ba..2fcbc85d5a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java @@ -20,8 +20,8 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraftforge.fluids.*; @@ -680,7 +680,7 @@ public IChatComponent getDisplayName() @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { - return AxisAlignedBB.fromBounds(this.getPos().getX() - this.bubbleSize, this.getPos().getY() - this.bubbleSize, this.getPos().getZ() - this.bubbleSize, this.getPos().getX() + this.bubbleSize, this.getPos().getY() + this.bubbleSize, this.getPos().getZ() + this.bubbleSize); + return new AxisAlignedBB(this.getPos().getX() - this.bubbleSize, this.getPos().getY() - this.bubbleSize, this.getPos().getZ() - this.bubbleSize, this.getPos().getX() + this.bubbleSize, this.getPos().getY() + this.bubbleSize, this.getPos().getZ() + this.bubbleSize); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java index ded1f563c5..fba5c10b8f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java @@ -178,13 +178,13 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime { if (metadata == 6 || metadata == 9) { - primer.setBlockState(coords, Blocks.air.getDefaultState()); -// blockIdArray[coords] = Blocks.air; + primer.setBlockState(coords, Blocks.AIR.getDefaultState()); +// blockIdArray[coords] = Blocks.AIR; } else if (metadata == 5 && random.nextInt(MapGenCaveMars.BREAK_THROUGH_CHANCE) == 0) { - primer.setBlockState(coords, Blocks.air.getDefaultState()); -// blockIdArray[coords] = Blocks.air; + primer.setBlockState(coords, Blocks.AIR.getDefaultState()); +// blockIdArray[coords] = Blocks.AIR; } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java index c3b3317211..8c3be5da2f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java @@ -199,8 +199,8 @@ protected void generateCaveNode(long par1, int origXChunkCoord, int origZChunkCo if (block == MarsBlocks.marsBlock || block == MarsBlocks.blockSludge || block == MarsBlocks.vine) { - primer.setBlockState(coords, Blocks.air.getDefaultState()); -// arrayOfIDs[coords] = Blocks.air; + primer.setBlockState(coords, Blocks.AIR.getDefaultState()); +// arrayOfIDs[coords] = Blocks.AIR; } } } @@ -231,13 +231,13 @@ protected void generateCaveNode(long par1, int origXChunkCoord, int origZChunkCo Block blockAbove = primer.getBlockState(var42, var50 + 1, var45).getBlock(); Block blockBelow = primer.getBlockState(var42, var50 - 1, var45).getBlock(); - if (Blocks.air == block) + if (Blocks.AIR == block) { if (blockAbove == MarsBlocks.marsBlock && this.rand.nextInt(200) == 0) { int modifier = 0; - while (Blocks.air == block && var50 + modifier > 0) + while (Blocks.AIR == block && var50 + modifier > 0) { primer.setBlockState(var42, var50 + modifier, var45, MarsBlocks.vine.getStateFromMeta(Math.abs(modifier) % 3)); // arrayOfIDs[coordsBelow] = MarsBlocks.vine; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomBossMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomBossMars.java index 4df23150de..5767331744 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomBossMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomBossMars.java @@ -6,7 +6,7 @@ import micdoodle8.mods.galacticraft.planets.mars.blocks.MarsBlocks; import micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityDungeonSpawnerMars; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -79,7 +79,7 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } else if (j == this.sizeY) @@ -99,7 +99,7 @@ else if (j == 1 && (i <= 2 || k <= 2 || i >= this.sizeX - 2 || k >= this.sizeZ - } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomTreasureMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomTreasureMars.java index 75d5860a4d..50e225bbac 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomTreasureMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomTreasureMars.java @@ -6,7 +6,7 @@ import micdoodle8.mods.galacticraft.planets.mars.blocks.MarsBlocks; import micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityTreasureChestMars; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -79,7 +79,7 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } else if ((i == 1 && k == 1) || (i == 1 && k == this.sizeZ - 1) || (i == this.sizeX - 1 && k == 1) || (i == this.sizeX - 1 && k == this.sizeZ - 1)) @@ -97,7 +97,7 @@ else if (i == this.sizeX / 2 && j == 1 && k == this.sizeZ / 2) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenEggs.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenEggs.java index 86794f7c5a..9ca40eb39d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenEggs.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenEggs.java @@ -1,7 +1,7 @@ package micdoodle8.mods.galacticraft.planets.mars.world.gen; import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenTerraformTree.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenTerraformTree.java index 9fd5757238..4619ee9774 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenTerraformTree.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenTerraformTree.java @@ -8,7 +8,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java index f032f147a3..ebafc4376d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java @@ -37,7 +37,7 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java index 90d813db2a..567751ef94 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java @@ -35,7 +35,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.event.ModelBakeEvent; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockBasicVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockBasicVenus.java index 8c4776f014..3dfd30a1e9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockBasicVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockBasicVenus.java @@ -18,7 +18,7 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; import net.minecraft.util.MathHelper; @@ -78,7 +78,7 @@ public String getName() public BlockBasicVenus(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 2.2F; this.blockResistance = 2.5F; this.setDefaultState(this.blockState.getBaseState().withProperty(BASIC_TYPE_VENUS, EnumBlockBasicVenus.ROCK_SOFT)); @@ -128,7 +128,7 @@ else if (type == EnumBlockBasicVenus.ORE_ALUMINUM || type == EnumBlockBasicVenus } @Override - public float getBlockHardness(World worldIn, BlockPos pos) + public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos pos) { EnumBlockBasicVenus type = ((EnumBlockBasicVenus) worldIn.getBlockState(pos).getValue(BASIC_TYPE_VENUS)); @@ -270,7 +270,7 @@ public boolean isValueable(IBlockState state) } @Override - public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable) + public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) { return false; } @@ -313,9 +313,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, BASIC_TYPE_VENUS); + return new BlockStateContainer(this, BASIC_TYPE_VENUS); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java index b28267e2ae..69cd73b7d4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java @@ -17,8 +17,10 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.WeightedRandomChestContent; @@ -46,7 +48,7 @@ public class BlockCrashedProbe extends BlockTileGC implements ISortableBlock, IT public BlockCrashedProbe(String assetName) { - super(Material.iron); + super(Material.IRON); this.blockHardness = 4.5F; this.blockResistance = 2.5F; this.setTickRandomly(true); @@ -81,7 +83,7 @@ public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Ra } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { playerIn.openGui(GalacticraftPlanets.instance, GuiIdsPlanets.MACHINE_VENUS, worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java index 7626b5f126..58b7bf5a47 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java @@ -22,7 +22,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; @@ -35,9 +35,9 @@ public class BlockGeothermalGenerator extends BlockTileGC implements ITileEntity public BlockGeothermalGenerator(String assetName) { - super(Material.iron); + super(Material.IRON); this.setHardness(2.5F); - this.setStepSound(Block.soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -126,9 +126,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, FACING, ACTIVE); + return new BlockStateContainer(this, FACING, ACTIVE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockScorchedRock.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockScorchedRock.java index fa703c8031..921091631b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockScorchedRock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockScorchedRock.java @@ -7,7 +7,7 @@ import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumParticleTypes; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -19,7 +19,7 @@ public class BlockScorchedRock extends Block implements ISortableBlock { public BlockScorchedRock(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 0.9F; this.blockResistance = 2.5F; this.setTickRandomly(true); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSpout.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSpout.java index 387f4a71c4..9bcb07a60a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSpout.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSpout.java @@ -13,7 +13,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -26,7 +26,7 @@ public class BlockSpout extends Block implements ISortableBlock, ITileEntityProv { public BlockSpout(String assetName) { - super(Material.rock); + super(Material.ROCK); this.blockHardness = 4.5F; this.blockResistance = 2.5F; this.setUnlocalizedName(assetName); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSulphuricAcid.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSulphuricAcid.java index 18c6ccae1c..76df9fcc63 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSulphuricAcid.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSulphuricAcid.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import micdoodle8.mods.galacticraft.planets.venus.VenusModule; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java index d0c894ffd6..0d29de049d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java @@ -16,6 +16,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.IShearable; @@ -118,13 +119,13 @@ public boolean canBlockStay(World worldIn, BlockPos pos) } @Override - public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) + public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighborBlockPos) { - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + super.onNeighborChange(worldIn, pos, neighborBlockPos); - if (!this.canBlockStay(worldIn, pos)) + if (!this.canBlockStay((World) worldIn, pos)) { - worldIn.setBlockToAir(pos); + ((World) worldIn).setBlockToAir(pos); } } @@ -183,7 +184,7 @@ public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing facing) @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override @@ -221,9 +222,9 @@ public boolean showDescription(int meta) @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer()() { - return EnumWorldBlockLayer.CUTOUT; + return BlockRenderLayer.CUTOUT; } @Override @@ -239,9 +240,9 @@ public int getMetaFromState(IBlockState state) } @Override - protected BlockState createBlockState() + protected BlockStateContainer createBlockState() { - return new BlockState(this, WEB_TYPE); + return new BlockStateContainer(this, WEB_TYPE); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/TickHandlerClientVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/TickHandlerClientVenus.java index 514af4441a..45ecc9e730 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/TickHandlerClientVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/TickHandlerClientVenus.java @@ -10,7 +10,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java index 5f20628f97..dfe52fae0e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java @@ -10,8 +10,8 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.Map; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java index ddbd53c72c..6ae60886e8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java @@ -118,7 +118,7 @@ protected float getSoundPitch() @Override protected Item getDropItem() { - return Item.getItemFromBlock(Blocks.air); + return Item.getItemFromBlock(Blocks.AIR); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java index 9a49d1ecdb..d0dc23c413 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java @@ -22,7 +22,7 @@ import net.minecraft.pathfinding.PathNavigateGround; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java index 097efc7d98..7b37d9084e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java @@ -7,7 +7,7 @@ import net.minecraft.entity.passive.EntityChicken; import net.minecraft.pathfinding.PathFinder; import net.minecraft.pathfinding.PathNavigate; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java index 3d8846caa2..e554c86f6b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java @@ -5,7 +5,7 @@ import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.pathfinding.PathPoint; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.pathfinder.NodeProcessor; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemVolcanicPickaxe.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemVolcanicPickaxe.java index fec8e8300d..e5bb48d9b3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemVolcanicPickaxe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemVolcanicPickaxe.java @@ -17,7 +17,7 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; @@ -117,7 +117,7 @@ else if (facing.getAxis() == EnumFacing.Axis.X) IBlockState state = worldIn.getBlockState(pos1); if (worldIn.getBlockState(pos).equals(state)) { - worldIn.setBlockState(pos1, Blocks.air.getDefaultState()); + worldIn.setBlockState(pos1, Blocks.AIR.getDefaultState()); state.getBlock().harvestBlock(worldIn, (EntityPlayer) playerIn, pos1, state, worldIn.getTileEntity(pos1)); stack.damageItem(1, playerIn); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java index d6e6544ff6..0b6770d946 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java @@ -21,7 +21,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IChatComponent; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java index 9020eee914..0bcc22370d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java @@ -3,7 +3,7 @@ import micdoodle8.mods.galacticraft.api.event.wgen.GCCoreEventPopulate; import micdoodle8.mods.galacticraft.core.world.gen.WorldGenMinableMeta; import micdoodle8.mods.galacticraft.planets.venus.VenusBlocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.BiomeGenBase; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java index 2b13dee4eb..ae896fe890 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java @@ -11,7 +11,7 @@ import net.minecraft.block.BlockFalling; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EnumCreatureType; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.util.MathHelper; import net.minecraft.world.ChunkCoordIntPair; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java index fb2c976bc7..51e9116ef2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java @@ -177,7 +177,7 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime { if (metadata == 1) { - primer.setBlockState(coords, Blocks.air.getDefaultState()); + primer.setBlockState(coords, Blocks.AIR.getDefaultState()); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java index 279a56a7b3..c5b9537e5b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java @@ -169,12 +169,12 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime BlockBasicVenus.EnumBlockBasicVenus type = (BlockBasicVenus.EnumBlockBasicVenus)toReplace.getValue(BlockBasicVenus.BASIC_TYPE_VENUS); if (type == BlockBasicVenus.EnumBlockBasicVenus.ROCK_HARD || type == BlockBasicVenus.EnumBlockBasicVenus.ROCK_SOFT) { - IBlockState north = localZ == 0 ? Blocks.air.getDefaultState() : primer.getBlockState((localX * 16 + localZ - 1) * 256 + localY); - IBlockState south = localZ == 15 ? Blocks.air.getDefaultState() : primer.getBlockState((localX * 16 + localZ + 1) * 256 + localY); - IBlockState east = localX == 15 ? Blocks.air.getDefaultState() : primer.getBlockState(((localX + 1) * 16 + localZ) * 256 + localY); - IBlockState west = localX == 0 ? Blocks.air.getDefaultState() : primer.getBlockState(((localX - 1) * 16 + localZ) * 256 + localY); - IBlockState below = localY == 0 ? Blocks.air.getDefaultState() : primer.getBlockState((localX * 16 + localZ) * 256 + localY - 1); - if (north.getBlock() == Blocks.air || south.getBlock() == Blocks.air || east.getBlock() == Blocks.air || west.getBlock() == Blocks.air || below.getBlock() == Blocks.air) + IBlockState north = localZ == 0 ? Blocks.AIR.getDefaultState() : primer.getBlockState((localX * 16 + localZ - 1) * 256 + localY); + IBlockState south = localZ == 15 ? Blocks.AIR.getDefaultState() : primer.getBlockState((localX * 16 + localZ + 1) * 256 + localY); + IBlockState east = localX == 15 ? Blocks.AIR.getDefaultState() : primer.getBlockState(((localX + 1) * 16 + localZ) * 256 + localY); + IBlockState west = localX == 0 ? Blocks.AIR.getDefaultState() : primer.getBlockState(((localX - 1) * 16 + localZ) * 256 + localY); + IBlockState below = localY == 0 ? Blocks.AIR.getDefaultState() : primer.getBlockState((localX * 16 + localZ) * 256 + localY - 1); + if (north.getBlock() == Blocks.AIR || south.getBlock() == Blocks.AIR || east.getBlock() == Blocks.AIR || west.getBlock() == Blocks.AIR || below.getBlock() == Blocks.AIR) { primer.setBlockState(coords, VenusBlocks.venusBlock.getDefaultState().withProperty(BlockBasicVenus.BASIC_TYPE_VENUS, BlockBasicVenus.EnumBlockBasicVenus.ROCK_MAGMA)); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldChunkManagerVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldChunkManagerVenus.java index 6295710a52..bae3ae16a4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldChunkManagerVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldChunkManagerVenus.java @@ -1,7 +1,7 @@ package micdoodle8.mods.galacticraft.planets.venus.world.gen; import micdoodle8.mods.galacticraft.planets.venus.world.gen.layer.GenLayerVenus; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeCache; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenCrashedProbe.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenCrashedProbe.java index 1441da86ce..d3db2733bd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenCrashedProbe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenCrashedProbe.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.planets.venus.blocks.BlockCrashedProbe; import micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityCrashedProbe; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; @@ -61,7 +61,7 @@ public boolean generate(World worldIn, Random rand, BlockPos position) BlockPos pos = new BlockPos(poolX + position.getX(), poolY + position.getY(), poolZ + position.getZ()); if (distance <= radiusSq) { - worldIn.setBlockState(pos, Blocks.air.getDefaultState(), 2); + worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); } else if (worldIn.getBlockState(pos).getBlock() == VenusBlocks.venusBlock && poolY < 0 && rand.nextInt(5) == 0) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java index 013b1ab607..3686d0ba14 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.planets.venus.blocks.BlockBasicVenus; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -99,7 +99,7 @@ public boolean generate(World worldIn, Random rand, BlockPos position) { if (aboolean[(l1 * 16 + i3) * 8 + i4]) { - worldIn.setBlockState(position.add(l1, i4, i3), i4 >= 4 ? Blocks.air.getDefaultState() : Blocks.lava.getDefaultState(), 2); + worldIn.setBlockState(position.add(l1, i4, i3), i4 >= 4 ? Blocks.AIR.getDefaultState() : Blocks.lava.getDefaultState(), 2); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenVaporPool.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenVaporPool.java index 600570e42d..f7fdd5efd3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenVaporPool.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenVaporPool.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.planets.venus.blocks.BlockBasicVenus; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; @@ -39,7 +39,7 @@ public boolean generate(World worldIn, Random rand, BlockPos position) if (distance <= radiusSq) { BlockPos pos = new BlockPos(poolX + position.getX(), poolY + position.getY(), poolZ + position.getZ()); - worldIn.setBlockState(pos, distance >= radiusSq - 16 ? venusSoft : (poolY <= 0 ? VenusBlocks.sulphuricAcid.getDefaultState() : Blocks.air.getDefaultState()), distance == radiusSq ? 3 : 2); + worldIn.setBlockState(pos, distance >= radiusSq - 16 ? venusSoft : (poolY <= 0 ? VenusBlocks.sulphuricAcid.getDefaultState() : Blocks.AIR.getDefaultState()), distance == radiusSq ? 3 : 2); } } } @@ -49,7 +49,7 @@ public boolean generate(World worldIn, Random rand, BlockPos position) for (int i = 255; i >= position.getY() + 1; --i) { BlockPos pos = new BlockPos(position.getX(), i, position.getZ()); - if (worldIn.getBlockState(pos).getBlock() != Blocks.air) + if (worldIn.getBlockState(pos).getBlock() != Blocks.AIR) { if (!firstSet) { @@ -58,7 +58,7 @@ public boolean generate(World worldIn, Random rand, BlockPos position) } else { - worldIn.setBlockState(pos, Blocks.air.getDefaultState(), 2); + worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/CorridorVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/CorridorVenus.java index af1e60774c..a783ea47ab 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/CorridorVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/CorridorVenus.java @@ -42,7 +42,7 @@ else if (i == 1 || i == this.boundingBox.getXSize() - 2) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, this.boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, this.boundingBox); } } else if (j == 2 && this.getDirection().getAxis() == EnumFacing.Axis.X && (i + 1) % 4 == 0 && i != this.boundingBox.getXSize() - 1) @@ -57,7 +57,7 @@ else if (k == 1 || k == this.boundingBox.getZSize() - 2) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, this.boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, this.boundingBox); } } else if ((this.getDirection().getAxis() == EnumFacing.Axis.Z && (i == 1 || i == this.boundingBox.getXSize() - 2)) || @@ -75,7 +75,7 @@ else if ((this.getDirection().getAxis() == EnumFacing.Axis.Z && (i == 0 || i == } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, this.boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, this.boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomBossVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomBossVenus.java index 35ed9be62e..c95367007d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomBossVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomBossVenus.java @@ -8,7 +8,7 @@ import micdoodle8.mods.galacticraft.planets.venus.entities.EntitySpiderQueen; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -104,7 +104,7 @@ public boolean addComponentParts(World worldIn, Random random, StructureBounding } else if (j < f) { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); if (j + 1 >= f && (dXZ > 5) && random.nextInt(12) == 0) { @@ -187,7 +187,7 @@ else if (j < f) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java index 24cb726e65..e80672ecc8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java @@ -3,7 +3,7 @@ import micdoodle8.mods.galacticraft.core.blocks.BlockT1TreasureChest; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEmptyVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEmptyVenus.java index d95e94e3d4..71406bcb02 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEmptyVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEmptyVenus.java @@ -76,12 +76,12 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEntranceVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEntranceVenus.java index 3470ac9fac..0eb95b8eac 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEntranceVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEntranceVenus.java @@ -45,7 +45,7 @@ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundi Block block = getBlockStateFromPos(worldIn, i + range, j, k + range, boundingBox).getBlock(); - if (Blocks.air != block && block != null) + if (Blocks.AIR != block && block != null) { break; } @@ -72,7 +72,7 @@ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundi } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } @@ -92,7 +92,7 @@ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundi block1 = this.getBlockStateFromPos(worldIn, i + range, j, k + range, boundingBox); if (block1 == this.configuration.getBrickBlockFloor() || j != this.sizeY) { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i + range, j, k + range, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i + range, j, k + range, boundingBox); helper++; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java index 0978337718..18b638d252 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java @@ -2,7 +2,7 @@ import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntityMobSpawner; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java index aa56ebec0a..2547d2f5d6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java @@ -4,7 +4,7 @@ import micdoodle8.mods.galacticraft.planets.venus.VenusBlocks; import micdoodle8.mods.galacticraft.planets.venus.blocks.BlockTier3TreasureChest; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -83,7 +83,7 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } else if ((i == 1 && k == 1) || (i == 1 && k == this.sizeZ - 1) || (i == this.sizeX - 1 && k == 1) || (i == this.sizeX - 1 && k == this.sizeZ - 1)) @@ -101,7 +101,7 @@ else if (i == this.sizeX / 2 && j == 1 && k == this.sizeZ / 2) } else { - this.setBlockState(worldIn, Blocks.air.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.AIR.getDefaultState(), i, j, k, boundingBox); } } } From a3a45101f1304fffc1c2fcc400a2df6e7805d4b0 Mon Sep 17 00:00:00 2001 From: Mitch Date: Sun, 5 Mar 2017 16:26:07 -0500 Subject: [PATCH 003/535] More 1.10.2 error fixing --- .../java/codechicken/core/ClientUtils.java | 20 +- .../java/codechicken/core/ServerUtils.java | 4 +- .../core/inventory/MappedInventoryAccess.java | 4 +- .../lib/inventory/InventoryCopy.java | 4 +- .../lib/inventory/InventoryNBT.java | 4 +- .../lib/inventory/InventorySimple.java | 4 +- .../codechicken/lib/packet/PacketCustom.java | 2 +- .../codechicken/nei/ExtendedCreativeInv.java | 4 +- .../java/codechicken/nei/NEIClientUtils.java | 4 +- .../java/codechicken/nei/NEIModContainer.java | 8 +- .../java/codechicken/nei/NEIServerUtils.java | 12 +- .../java/codechicken/nei/SearchField.java | 4 +- .../java/codechicken/nei/SubsetWidget.java | 4 +- .../java/codechicken/nei/api/ItemInfo.java | 4 +- .../codechicken/nei/config/DataDumper.java | 4 +- .../nei/config/GuiHighlightTips.java | 4 +- .../nei/config/GuiItemIconDumper.java | 8 +- .../nei/config/ItemPanelDumper.java | 4 +- .../codechicken/nei/config/OptionKeyBind.java | 6 +- .../nei/guihook/GuiContainerManager.java | 4 +- .../nei/recipe/ContainerRecipe.java | 4 +- ...agerSpace.java => BiomeProviderSpace.java} | 51 +- .../prefab/world/gen/ChunkProviderSpace.java | 12 +- .../api/prefab/world/gen/MapGenBaseMeta.java | 2 +- .../prefab/world/gen/WorldProviderSpace.java | 47 +- .../core/client/EventHandlerClient.java | 6 +- .../core/client/GalacticraftStateMapper.java | 2 +- .../client/gui/screen/GuiMissingCore.java | 4 +- .../entities/RenderEvolvedSkeleton.java | 7 +- .../entities/RenderEvolvedSkeletonBoss.java | 4 +- .../render/entities/RenderEvolvedZombie.java | 9 +- .../render/entities/RenderPlayerGC.java | 4 +- .../render/item/ItemLiquidCanisterModel.java | 45 +- .../client/render/item/ItemModelBuggy.java | 6 +- .../client/render/item/ItemModelFlag.java | 32 +- .../client/render/item/ItemModelRocket.java | 6 +- .../render/item/ItemModelWorkbench.java | 2 +- .../tile/TileEntityFluidPipeRenderer.java | 4 +- .../core/command/GCInvSaveData.java | 2 + .../core/dimension/GCDimensions.java | 10 + .../core/dimension/OrbitSpinSaveData.java | 2 + .../core/dimension/SpaceRaceManager.java | 42 +- .../core/dimension/SpaceStationWorldData.java | 6 +- .../core/dimension/SpinManager.java | 12 +- .../dimension/TeleportTypeSpaceStation.java | 2 +- .../core/dimension/WorldDataSpaceRaces.java | 2 +- .../core/dimension/WorldProviderMoon.java | 27 +- .../core/dimension/WorldProviderOrbit.java | 35 +- .../core/energy/EnergyDisplayHelper.java | 6 +- .../core/energy/grid/ChunkPowerHandler.java | 6 +- .../core/energy/tile/EnergyStorageTile.java | 2 +- .../player/CapabilityProviderStats.java | 50 + .../player/CapabilityStatsHandler.java | 38 + .../entities/player/GCEntityPlayerMP.java | 12 +- .../core/entities/player/GCPlayerHandler.java | 697 +++++------ .../core/entities/player/GCPlayerStats.java | 516 ++------ .../entities/player/GCPlayerStatsClient.java | 5 +- .../entities/player/IStatsCapability.java | 302 +++++ .../core/entities/player/PlayerClient.java | 8 +- .../core/entities/player/PlayerServer.java | 8 +- .../core/entities/player/StatsCapability.java | 1075 +++++++++++++++++ .../core/event/EventHandlerGC.java | 6 +- .../core/event/EventWakePlayer.java | 3 +- .../core/fluid/OxygenPressureProtocol.java | 15 +- .../core/fluid/ThreadFindSeal.java | 26 +- .../inventory/ContainerCircuitFabricator.java | 6 +- .../inventory/ContainerCoalGenerator.java | 4 +- .../core/inventory/InventoryBuggyBench.java | 2 +- .../core/inventory/InventoryExtended.java | 4 +- .../core/inventory/InventoryRocketBench.java | 2 +- .../core/inventory/InventorySchematic.java | 2 +- .../inventory/InventoryTreasureChest.java | 34 +- .../PersistantInventoryCrafting.java | 2 +- .../core/inventory/SlotArmorGC.java | 4 +- .../galacticraft/core/items/ItemArmorGC.java | 5 +- .../galacticraft/core/items/ItemBasic.java | 46 +- .../core/items/ItemBlockDesc.java | 6 +- .../core/items/ItemBlockEnclosed.java | 30 +- .../galacticraft/core/items/ItemBucketGC.java | 2 +- .../galacticraft/core/items/ItemFlag.java | 65 +- .../core/items/ItemMeteorChunk.java | 15 +- .../core/items/ItemOxygenGear.java | 17 +- .../core/items/ItemOxygenMask.java | 17 +- .../core/items/ItemOxygenTank.java | 20 +- .../core/items/ItemParaChute.java | 17 +- .../core/items/ItemPreLaunchChecklist.java | 8 +- .../core/items/ItemSensorGlasses.java | 5 +- .../core/items/ItemTier1Rocket.java | 14 +- .../core/items/ItemUniversalWrench.java | 19 +- .../core/network/PacketSimple.java | 101 +- .../core/proxy/ClientProxyCore.java | 4 +- .../core/tile/TileEntityCargoLoader.java | 2 +- .../core/tile/TileEntityCargoUnloader.java | 2 +- .../tile/TileEntityCircuitFabricator.java | 2 +- .../core/tile/TileEntityCoalGenerator.java | 2 +- .../core/tile/TileEntityDish.java | 2 +- .../core/tile/TileEntityElectricFurnace.java | 2 +- .../TileEntityElectricIngotCompressor.java | 2 +- .../tile/TileEntityEnergyStorageModule.java | 2 +- .../core/tile/TileEntityFuelLoader.java | 2 +- .../core/tile/TileEntityIngotCompressor.java | 2 +- .../core/tile/TileEntityOxygenCollector.java | 2 +- .../core/tile/TileEntityOxygenCompressor.java | 2 +- .../tile/TileEntityOxygenDecompressor.java | 2 +- .../tile/TileEntityOxygenDistributor.java | 2 +- .../core/tile/TileEntityOxygenSealer.java | 2 +- .../tile/TileEntityOxygenStorageModule.java | 2 +- .../core/tile/TileEntityParaChest.java | 2 +- .../core/tile/TileEntityRefinery.java | 2 +- .../core/tile/TileEntitySolar.java | 2 +- .../core/tile/TileEntityTreasureChest.java | 4 +- .../mods/galacticraft/core/util/MapGen.java | 18 +- .../mods/galacticraft/core/util/MapUtil.java | 8 +- .../galacticraft/core/util/WorldUtil.java | 35 +- .../core/world/gen/BiomeDecoratorMoon.java | 4 +- .../core/world/gen/BiomeGenBaseMoon.java | 12 +- .../core/world/gen/BiomeGenBaseOrbit.java | 12 +- .../core/world/gen/BiomeGenFlatMoon.java | 2 +- .../core/world/gen/BiomeProviderMoon.java | 13 + .../core/world/gen/BiomeProviderOrbit.java | 13 + .../core/world/gen/ChunkProviderMoon.java | 94 +- .../core/world/gen/ChunkProviderOrbit.java | 53 +- .../core/world/gen/MapGenVillageMoon.java | 4 +- .../core/world/gen/WorldChunkManagerMoon.java | 13 - .../world/gen/WorldChunkManagerOrbit.java | 13 - .../GenLayerAddMushroomIsland.java | 4 +- .../gen/layer_mapping/GenLayerBiome.java | 32 +- .../gen/layer_mapping/GenLayerBiomeEdge.java | 30 +- .../gen/layer_mapping/GenLayerDeepOcean.java | 4 +- .../gen/layer_mapping/GenLayerGCMap.java | 12 +- .../gen/layer_mapping/GenLayerHills.java | 70 +- .../gen/layer_mapping/GenLayerRareBiome.java | 6 +- .../gen/layer_mapping/GenLayerRiver.java | 4 +- .../gen/layer_mapping/GenLayerRiverMix.java | 14 +- .../gen/layer_mapping/GenLayerShore.java | 32 +- .../core/wrappers/ModelTransformWrapper.java | 47 +- .../dimension/WorldProviderAsteroids.java | 6 +- .../InventorySchematicAstroMiner.java | 2 +- .../InventorySchematicTier3Rocket.java | 2 +- .../asteroids/tile/TileEntityMinerBase.java | 2 +- .../tile/TileEntityShortRangeTelepad.java | 2 +- .../world/gen/BiomeGenBaseAsteroids.java | 12 +- .../world/gen/BiomeProviderAsteroids.java | 13 + .../world/gen/ChunkProviderAsteroids.java | 8 +- .../world/gen/WorldChunkManagerAsteroids.java | 13 - .../mars/dimension/WorldProviderMars.java | 6 +- .../InventorySchematicCargoRocket.java | 2 +- .../InventorySchematicTier2Rocket.java | 2 +- .../mars/inventory/InventorySlimeling.java | 2 +- .../planets/mars/items/ItemBlockMachine.java | 4 +- .../mars/tile/TileEntityCryogenicChamber.java | 4 +- .../mars/tile/TileEntityElectrolyzer.java | 2 +- .../mars/tile/TileEntityGasLiquefier.java | 2 +- .../mars/tile/TileEntityLaunchController.java | 2 +- .../mars/tile/TileEntityTerraformer.java | 2 +- .../mars/world/gen/BiomeGenBaseMars.java | 20 +- .../mars/world/gen/BiomeGenFlatMars.java | 2 +- .../mars/world/gen/BiomeProviderMars.java | 13 + .../mars/world/gen/ChunkProviderMars.java | 6 +- .../mars/world/gen/WorldChunkManagerMars.java | 13 - .../venus/dimension/WorldProviderVenus.java | 2 +- .../planets/venus/entities/EntityWebShot.java | 6 +- .../venus/tile/TileEntityCrashedProbe.java | 2 +- .../tile/TileEntityGeothermalGenerator.java | 2 +- .../venus/world/gen/BiomeDecoratorVenus.java | 4 +- .../venus/world/gen/BiomeGenBaseVenus.java | 12 +- .../venus/world/gen/BiomeGenFlatVenus.java | 2 +- .../world/gen/BiomeGenVenusMountain.java | 2 +- .../venus/world/gen/BiomeGenVenusValley.java | 2 +- .../venus/world/gen/ChunkProviderVenus.java | 18 +- .../world/gen/WorldChunkManagerVenus.java | 38 +- .../venus/world/gen/WorldGenLakesVenus.java | 4 +- .../world/gen/layer/GenLayerVenusBiomes.java | 6 +- .../gen/layer/GenLayerVenusSurround.java | 4 +- 174 files changed, 2841 insertions(+), 1721 deletions(-) rename src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/{WorldChunkManagerSpace.java => BiomeProviderSpace.java} (59%) create mode 100644 src/main/java/micdoodle8/mods/galacticraft/core/dimension/GCDimensions.java create mode 100644 src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityProviderStats.java create mode 100644 src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityStatsHandler.java create mode 100644 src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IStatsCapability.java create mode 100644 src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsCapability.java create mode 100644 src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeProviderMoon.java create mode 100644 src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeProviderOrbit.java delete mode 100644 src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldChunkManagerMoon.java delete mode 100644 src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldChunkManagerOrbit.java create mode 100644 src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/BiomeProviderAsteroids.java delete mode 100644 src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/WorldChunkManagerAsteroids.java create mode 100644 src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeProviderMars.java delete mode 100644 src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldChunkManagerMars.java diff --git a/dependencies/main/java/codechicken/core/ClientUtils.java b/dependencies/main/java/codechicken/core/ClientUtils.java index 2982236c26..4bc652638a 100644 --- a/dependencies/main/java/codechicken/core/ClientUtils.java +++ b/dependencies/main/java/codechicken/core/ClientUtils.java @@ -4,8 +4,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.network.NetworkManager; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.ModContainer; @@ -21,10 +20,10 @@ public static World getWorld() { return mc().theWorld; } - public static boolean inWorld()//TODO unused - { - return mc().getNetHandler() != null; - } +// public static boolean inWorld()//TODO unused +// { +// return mc().getNetHandler() != null; +// } public static void openSMPGui(int windowId, GuiScreen gui) { mc().displayGuiScreen(gui); @@ -43,7 +42,7 @@ public static double getRenderTime() { public static String getServerIP() { try { - NetworkManager networkManager = mc().getNetHandler().getNetworkManager(); + NetworkManager networkManager = mc().getConnection().getNetworkManager(); String s = networkManager.getRemoteAddress().toString(); s = s.substring(s.indexOf("/") + 1); return s; @@ -55,13 +54,14 @@ public static String getServerIP() { } @SideOnly(Side.CLIENT) - public static String getWorldSaveName() { - return mc().isSingleplayer() ? MinecraftServer.getServer().getFolderName() : null; + public static String getWorldSaveName() + { + return mc().isSingleplayer() ? getWorld().getMinecraftServer().getFolderName() : null; } public static void enhanceSupportersList(Object mod) { ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod); - mc.getMetadata().description = mc.getMetadata().description.replace("Supporters:", EnumChatFormatting.AQUA + "Supporters:"); + mc.getMetadata().description = mc.getMetadata().description.replace("Supporters:", TextFormatting.AQUA + "Supporters:"); GuiModListScroll.register(mod); } } diff --git a/dependencies/main/java/codechicken/core/ServerUtils.java b/dependencies/main/java/codechicken/core/ServerUtils.java index d1fc4a08c6..44399253cb 100644 --- a/dependencies/main/java/codechicken/core/ServerUtils.java +++ b/dependencies/main/java/codechicken/core/ServerUtils.java @@ -5,8 +5,6 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.Container; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.management.PlayerProfileCache.ProfileEntry; -import net.minecraft.util.IChatComponent; import java.util.ArrayList; import java.util.List; @@ -71,7 +69,7 @@ public static boolean isPlayerOwner(String username) { return mc().isSinglePlayer() && mc().getServerOwner().equalsIgnoreCase(username); } - public static void sendChatToAll(IChatComponent msg) { + public static void sendChatToAll(ITextComponent msg) { for (EntityPlayer p : getPlayers()) { p.addChatComponentMessage(msg); } diff --git a/dependencies/main/java/codechicken/core/inventory/MappedInventoryAccess.java b/dependencies/main/java/codechicken/core/inventory/MappedInventoryAccess.java index ff8f1dd4ee..1cf5a1e7bc 100644 --- a/dependencies/main/java/codechicken/core/inventory/MappedInventoryAccess.java +++ b/dependencies/main/java/codechicken/core/inventory/MappedInventoryAccess.java @@ -3,7 +3,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.ITextComponent; import java.util.ArrayList; import java.util.Collections; @@ -135,7 +135,7 @@ public boolean hasCustomName() { } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return inv.getDisplayName(); } diff --git a/dependencies/main/java/codechicken/lib/inventory/InventoryCopy.java b/dependencies/main/java/codechicken/lib/inventory/InventoryCopy.java index df12f61b4e..31eea1dfed 100644 --- a/dependencies/main/java/codechicken/lib/inventory/InventoryCopy.java +++ b/dependencies/main/java/codechicken/lib/inventory/InventoryCopy.java @@ -4,7 +4,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.ITextComponent; /** * Creates a copy of an IInventory for extended simulation @@ -128,7 +128,7 @@ public boolean hasCustomName() { } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return new ChatComponentText(getName()); } } diff --git a/dependencies/main/java/codechicken/lib/inventory/InventoryNBT.java b/dependencies/main/java/codechicken/lib/inventory/InventoryNBT.java index b82a009826..7b5732a3cd 100644 --- a/dependencies/main/java/codechicken/lib/inventory/InventoryNBT.java +++ b/dependencies/main/java/codechicken/lib/inventory/InventoryNBT.java @@ -5,7 +5,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.ITextComponent; /** * IInventory implementation which saves and loads from an NBT tag @@ -117,7 +117,7 @@ public boolean hasCustomName() { } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return new ChatComponentText(getName()); } } diff --git a/dependencies/main/java/codechicken/lib/inventory/InventorySimple.java b/dependencies/main/java/codechicken/lib/inventory/InventorySimple.java index c593ebf1df..f21e421f02 100644 --- a/dependencies/main/java/codechicken/lib/inventory/InventorySimple.java +++ b/dependencies/main/java/codechicken/lib/inventory/InventorySimple.java @@ -4,7 +4,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.ITextComponent; /** * Simple IInventory implementation with an array of items, name and maximum stack size @@ -130,7 +130,7 @@ public boolean hasCustomName() { } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return new ChatComponentText(getName()); } } diff --git a/dependencies/main/java/codechicken/lib/packet/PacketCustom.java b/dependencies/main/java/codechicken/lib/packet/PacketCustom.java index d46ea22745..2357bc6f64 100644 --- a/dependencies/main/java/codechicken/lib/packet/PacketCustom.java +++ b/dependencies/main/java/codechicken/lib/packet/PacketCustom.java @@ -474,7 +474,7 @@ public void sendToChunk(World world, int chunkX, int chunkZ) { } public static void sendToChunk(Packet packet, World world, int chunkX, int chunkZ) { - PlayerInstance p = ((WorldServer) world).getPlayerManager().getPlayerInstance(chunkX, chunkZ, false); + PlayerInstance p = ((WorldServer) world).getPlayerChunkMap().getPlayerInstance(chunkX, chunkZ, false); if (p != null) { p.sendToAllPlayersWatchingChunk(packet); } diff --git a/dependencies/main/java/codechicken/nei/ExtendedCreativeInv.java b/dependencies/main/java/codechicken/nei/ExtendedCreativeInv.java index 474caa750f..5712c56cec 100644 --- a/dependencies/main/java/codechicken/nei/ExtendedCreativeInv.java +++ b/dependencies/main/java/codechicken/nei/ExtendedCreativeInv.java @@ -3,7 +3,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.ITextComponent; import net.minecraftforge.fml.relauncher.Side; public class ExtendedCreativeInv implements IInventory { @@ -128,7 +128,7 @@ public boolean hasCustomName() { } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return null; } } diff --git a/dependencies/main/java/codechicken/nei/NEIClientUtils.java b/dependencies/main/java/codechicken/nei/NEIClientUtils.java index adb758726e..8a3995aa5d 100644 --- a/dependencies/main/java/codechicken/nei/NEIClientUtils.java +++ b/dependencies/main/java/codechicken/nei/NEIClientUtils.java @@ -16,7 +16,7 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.ITextComponent; import net.minecraft.util.ResourceLocation; import org.lwjgl.input.Keyboard; @@ -37,7 +37,7 @@ public static String translate(String key, Object... params) { return lang.format(key, params); } - public static void printChatMessage(IChatComponent msg) { + public static void printChatMessage(ITextComponent msg) { if (mc().ingameGUI != null) { mc().ingameGUI.getChatGUI().printChatMessage(msg); } diff --git a/dependencies/main/java/codechicken/nei/NEIModContainer.java b/dependencies/main/java/codechicken/nei/NEIModContainer.java index 43d934e7c7..0b70680b5e 100644 --- a/dependencies/main/java/codechicken/nei/NEIModContainer.java +++ b/dependencies/main/java/codechicken/nei/NEIModContainer.java @@ -6,7 +6,7 @@ import codechicken.nei.asm.NEICorePlugin; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.TextFormatting; import net.minecraftforge.fml.client.FMLFileResourcePack; import net.minecraftforge.fml.client.FMLFolderResourcePack; import net.minecraftforge.fml.common.*; @@ -46,16 +46,16 @@ public List getDependencies() { private String description; private void loadMetadata() { - description = super.getMetadata().description.replace("Supporters:", EnumChatFormatting.AQUA + "Supporters:"); + description = super.getMetadata().description.replace("Supporters:", TextFormatting.AQUA + "Supporters:"); } @Override public ModMetadata getMetadata() { String s_plugins = ""; if (plugins.size() == 0) { - s_plugins += EnumChatFormatting.RED + "No installed plugins."; + s_plugins += TextFormatting.RED + "No installed plugins."; } else { - s_plugins += EnumChatFormatting.GREEN + "Installed plugins: "; + s_plugins += TextFormatting.GREEN + "Installed plugins: "; for (int i = 0; i < plugins.size(); i++) { if (i > 0) { s_plugins += ", "; diff --git a/dependencies/main/java/codechicken/nei/NEIServerUtils.java b/dependencies/main/java/codechicken/nei/NEIServerUtils.java index 552c8d463e..fa16594cc8 100644 --- a/dependencies/main/java/codechicken/nei/NEIServerUtils.java +++ b/dependencies/main/java/codechicken/nei/NEIServerUtils.java @@ -18,8 +18,8 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.server.MinecraftServer; import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.TextFormatting; +import net.minecraft.util.ITextComponent; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.WorldSettings.GameType; @@ -120,9 +120,9 @@ public static boolean canItemFitInInventory(EntityPlayer player, ItemStack items return InventoryUtils.insertItem(new InventoryRange(player.inventory, 0, 36), itemstack, true) == 0; } - public static void sendNotice(ICommandSender sender, IChatComponent msg, String permission) { + public static void sendNotice(ICommandSender sender, ITextComponent msg, String permission) { ChatComponentTranslation notice = new ChatComponentTranslation("chat.type.admin", sender.getName(), msg.createCopy()); - notice.getChatStyle().setColor(EnumChatFormatting.GRAY).setItalic(true); + notice.getChatStyle().setColor(TextFormatting.GRAY).setItalic(true); if (NEIServerConfig.canPlayerPerformAction("CONSOLE", permission)) { MinecraftServer.getServer().addChatMessage(notice); @@ -189,14 +189,14 @@ public static boolean areStacksIdentical(ItemStack stack1, ItemStack stack2) { return compareStacks(stack1, stack2) == 0; } - public static IChatComponent setColour(IChatComponent msg, EnumChatFormatting colour) { + public static ITextComponent setColour(ITextComponent msg, TextFormatting colour) { msg.getChatStyle().setColor(colour); return msg; } public static void givePlayerItem(EntityPlayerMP player, ItemStack stack, boolean infinite, boolean doGive) { if (stack.getItem() == null) { - player.addChatComponentMessage(setColour(new ChatComponentTranslation("nei.chat.give.noitem"), EnumChatFormatting.WHITE)); + player.addChatComponentMessage(setColour(new ChatComponentTranslation("nei.chat.give.noitem"), TextFormatting.WHITE)); return; } diff --git a/dependencies/main/java/codechicken/nei/SearchField.java b/dependencies/main/java/codechicken/nei/SearchField.java index 640d7acedc..0ad88b668f 100644 --- a/dependencies/main/java/codechicken/nei/SearchField.java +++ b/dependencies/main/java/codechicken/nei/SearchField.java @@ -6,7 +6,7 @@ import codechicken.nei.api.API; import codechicken.nei.api.ItemFilter; import codechicken.nei.api.ItemFilter.ItemFilterProvider; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.TextFormatting; import java.util.LinkedList; import java.util.List; @@ -97,7 +97,7 @@ public void lastKeyTyped(int keyID, char keyChar) { @Override public String filterText(String s) { - return EnumChatFormatting.getTextWithoutFormattingCodes(s); + return TextFormatting.getTextWithoutFormattingCodes(s); } public static Pattern getPattern(String search) { diff --git a/dependencies/main/java/codechicken/nei/SubsetWidget.java b/dependencies/main/java/codechicken/nei/SubsetWidget.java index 6cf9b39442..d213a5c30a 100644 --- a/dependencies/main/java/codechicken/nei/SubsetWidget.java +++ b/dependencies/main/java/codechicken/nei/SubsetWidget.java @@ -16,7 +16,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.TextFormatting; import java.awt.*; import java.util.*; @@ -136,7 +136,7 @@ public SubsetTag(String fullname) { public SubsetTag(String fullname, ItemFilter filter) { assert filter != null : "Filter cannot be null"; - this.fullname = EnumChatFormatting.getTextWithoutFormattingCodes(fullname); + this.fullname = TextFormatting.getTextWithoutFormattingCodes(fullname); this.filter = filter; if (fullname != null) { diff --git a/dependencies/main/java/codechicken/nei/api/ItemInfo.java b/dependencies/main/java/codechicken/nei/api/ItemInfo.java index e49a4dd19f..461f861085 100644 --- a/dependencies/main/java/codechicken/nei/api/ItemInfo.java +++ b/dependencies/main/java/codechicken/nei/api/ItemInfo.java @@ -26,7 +26,7 @@ import net.minecraft.item.*; import net.minecraft.potion.Potion; import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.TextFormatting; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.RegistryNamespaced; import net.minecraft.world.World; @@ -484,7 +484,7 @@ public static List getText(ItemStack itemStack, World world, EntityPlaye public static String getSearchName(ItemStack stack) { String s = itemSearchNames.get(stack); if (s == null) { - s = EnumChatFormatting.getTextWithoutFormattingCodes(GuiContainerManager.concatenatedDisplayName(stack, true).toLowerCase()); + s = TextFormatting.getTextWithoutFormattingCodes(GuiContainerManager.concatenatedDisplayName(stack, true).toLowerCase()); itemSearchNames.put(stack, s); } return s; diff --git a/dependencies/main/java/codechicken/nei/config/DataDumper.java b/dependencies/main/java/codechicken/nei/config/DataDumper.java index b6aac753fb..fc66034faa 100644 --- a/dependencies/main/java/codechicken/nei/config/DataDumper.java +++ b/dependencies/main/java/codechicken/nei/config/DataDumper.java @@ -7,7 +7,7 @@ import codechicken.nei.NEIClientUtils; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.ITextComponent; import java.io.File; import java.io.IOException; @@ -55,7 +55,7 @@ public String getFileExtension() { return ".csv"; } - public IChatComponent dumpMessage(File file) { + public ITextComponent dumpMessage(File file) { return new ChatComponentTranslation("nei.options.tools.dump.dumped", translateN(name), "dumps/" + file.getName()); } diff --git a/dependencies/main/java/codechicken/nei/config/GuiHighlightTips.java b/dependencies/main/java/codechicken/nei/config/GuiHighlightTips.java index 862dd50b8d..461fc5bae0 100644 --- a/dependencies/main/java/codechicken/nei/config/GuiHighlightTips.java +++ b/dependencies/main/java/codechicken/nei/config/GuiHighlightTips.java @@ -9,7 +9,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.TextFormatting; import org.lwjgl.input.Keyboard; import java.awt.*; @@ -70,7 +70,7 @@ public void keyTyped(char c, int keycode) throws IOException { public void drawScreen(int mousex, int mousey, float f) { super.drawScreen(mousex, mousey, f); if (show()) { - HUDRenderer.renderOverlay(new ItemStack(Blocks.redstone_block), Arrays.asList("RedstoneBlock", EnumChatFormatting.RED + "Sample"), renderPos()); + HUDRenderer.renderOverlay(new ItemStack(Blocks.redstone_block), Arrays.asList("RedstoneBlock", TextFormatting.RED + "Sample"), renderPos()); } } diff --git a/dependencies/main/java/codechicken/nei/config/GuiItemIconDumper.java b/dependencies/main/java/codechicken/nei/config/GuiItemIconDumper.java index b2f735f63c..9f3553860f 100644 --- a/dependencies/main/java/codechicken/nei/config/GuiItemIconDumper.java +++ b/dependencies/main/java/codechicken/nei/config/GuiItemIconDumper.java @@ -15,8 +15,8 @@ import net.minecraft.client.shader.Framebuffer; import net.minecraft.item.ItemStack; import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.TextFormatting; +import net.minecraft.util.ITextComponent; import org.lwjgl.BufferUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; @@ -63,7 +63,7 @@ public GuiItemIconDumper(Option opt, int iconSize) { } - private void returnScreen(IChatComponent msg) { + private void returnScreen(ITextComponent msg) { Minecraft.getMinecraft().displayGuiScreen(opt.slot.getGui()); NEIClientUtils.printChatMessage(msg); } @@ -144,7 +144,7 @@ public static String cleanFileName(String name) { } private void exportImage(File dir, BufferedImage img, ItemStack stack) throws IOException { - String name = EnumChatFormatting.getTextWithoutFormattingCodes(GuiContainerManager.itemDisplayNameShort(stack)); + String name = TextFormatting.getTextWithoutFormattingCodes(GuiContainerManager.itemDisplayNameShort(stack)); name = cleanFileName(name); File file = new File(dir, name + ".png"); for (int i = 2; file.exists(); i++) { diff --git a/dependencies/main/java/codechicken/nei/config/ItemPanelDumper.java b/dependencies/main/java/codechicken/nei/config/ItemPanelDumper.java index 502bfec900..be0ed0bc30 100644 --- a/dependencies/main/java/codechicken/nei/config/ItemPanelDumper.java +++ b/dependencies/main/java/codechicken/nei/config/ItemPanelDumper.java @@ -12,7 +12,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.TextFormatting; import java.io.File; import java.io.FileOutputStream; @@ -36,7 +36,7 @@ public String[] header() { public Iterable dump(int mode) { LinkedList list = new LinkedList(); for (ItemStack stack : ItemPanel.items) { - list.add(new String[] { Item.itemRegistry.getNameForObject(stack.getItem()).toString(), Integer.toString(Item.getIdFromItem(stack.getItem())), Integer.toString(InventoryUtils.actualDamage(stack)), stack.getTagCompound() == null ? "false" : "true", EnumChatFormatting.getTextWithoutFormattingCodes(GuiContainerManager.itemDisplayNameShort(stack)) }); + list.add(new String[] { Item.itemRegistry.getNameForObject(stack.getItem()).toString(), Integer.toString(Item.getIdFromItem(stack.getItem())), Integer.toString(InventoryUtils.actualDamage(stack)), stack.getTagCompound() == null ? "false" : "true", TextFormatting.getTextWithoutFormattingCodes(GuiContainerManager.itemDisplayNameShort(stack)) }); } return list; diff --git a/dependencies/main/java/codechicken/nei/config/OptionKeyBind.java b/dependencies/main/java/codechicken/nei/config/OptionKeyBind.java index f8a7480067..474aed51d4 100644 --- a/dependencies/main/java/codechicken/nei/config/OptionKeyBind.java +++ b/dependencies/main/java/codechicken/nei/config/OptionKeyBind.java @@ -1,6 +1,6 @@ package codechicken.nei.config; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.TextFormatting; import org.lwjgl.input.Keyboard; public class OptionKeyBind extends OptionButton { @@ -66,11 +66,11 @@ public String getPrefix() { @Override public String getButtonText() { if (hasFocus) { - return EnumChatFormatting.WHITE + "> " + EnumChatFormatting.YELLOW + "??? " + EnumChatFormatting.WHITE + "<"; + return TextFormatting.WHITE + "> " + TextFormatting.YELLOW + "??? " + TextFormatting.WHITE + "<"; } if (conflicted()) { - return EnumChatFormatting.RED + Keyboard.getKeyName(getValue()); + return TextFormatting.RED + Keyboard.getKeyName(getValue()); } return Keyboard.getKeyName(getValue()); diff --git a/dependencies/main/java/codechicken/nei/guihook/GuiContainerManager.java b/dependencies/main/java/codechicken/nei/guihook/GuiContainerManager.java index 289a6e76c0..7e249cfc1a 100644 --- a/dependencies/main/java/codechicken/nei/guihook/GuiContainerManager.java +++ b/dependencies/main/java/codechicken/nei/guihook/GuiContainerManager.java @@ -11,7 +11,7 @@ import net.minecraft.init.Blocks; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.TextFormatting; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @@ -176,7 +176,7 @@ public static String concatenatedDisplayName(ItemStack itemstack, boolean includ } sb.append(name); } - return EnumChatFormatting.getTextWithoutFormattingCodes(sb.toString()); + return TextFormatting.getTextWithoutFormattingCodes(sb.toString()); } public static void drawItem(int i, int j, ItemStack itemstack) { diff --git a/dependencies/main/java/codechicken/nei/recipe/ContainerRecipe.java b/dependencies/main/java/codechicken/nei/recipe/ContainerRecipe.java index da10f33ab5..e3e061e127 100644 --- a/dependencies/main/java/codechicken/nei/recipe/ContainerRecipe.java +++ b/dependencies/main/java/codechicken/nei/recipe/ContainerRecipe.java @@ -6,7 +6,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.ITextComponent; public class ContainerRecipe extends Container { private class RecipeInventory implements IInventory { @@ -98,7 +98,7 @@ public boolean hasCustomName() { } @Override - public IChatComponent getDisplayName() { + public ITextComponent getDisplayName() { return null; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldChunkManagerSpace.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/BiomeProviderSpace.java similarity index 59% rename from src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldChunkManagerSpace.java rename to src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/BiomeProviderSpace.java index b629d71a5a..63f5791650 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldChunkManagerSpace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/BiomeProviderSpace.java @@ -1,9 +1,9 @@ package micdoodle8.mods.galacticraft.api.prefab.world.gen; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.BiomeCache; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.biome.BiomeProvider; import net.minecraft.world.gen.layer.IntCache; import java.util.ArrayList; @@ -16,15 +16,15 @@ *

* This chunk manager is used for single-biome dimensions, which is common on basic planets. */ -public abstract class WorldChunkManagerSpace extends WorldChunkManager +public abstract class BiomeProviderSpace extends BiomeProvider { private final BiomeCache biomeCache; - private final List biomesToSpawnIn; + private final List biomesToSpawnIn; - public WorldChunkManagerSpace() + public BiomeProviderSpace() { this.biomeCache = new BiomeCache(this); - this.biomesToSpawnIn = new ArrayList(); + this.biomesToSpawnIn = new ArrayList(); this.biomesToSpawnIn.add(this.getBiome()); } @@ -34,21 +34,10 @@ public List getBiomesToSpawnIn() return this.biomesToSpawnIn; } - public BiomeGenBase func_180300_a(BlockPos p_180300_1_, BiomeGenBase p_180300_2_) - { - return this.getBiome(); - } - @Override - public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) + public Biome getBiome(BlockPos pos, Biome defaultBiome) { - if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) - { - par1ArrayOfFloat = new float[par4 * par5]; - } - - Arrays.fill(par1ArrayOfFloat, 0, par4 * par5, 0.0F); - return par1ArrayOfFloat; + return this.getBiome(); } @Override @@ -58,42 +47,44 @@ public float getTemperatureAtHeight(float par1, int par2) } @Override - public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) + public Biome[] getBiomesForGeneration(Biome[] par1ArrayOfBiome, int par2, int par3, int par4, int par5) { IntCache.resetIntCache(); - if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) + if (par1ArrayOfBiome == null || par1ArrayOfBiome.length < par4 * par5) { - par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; + par1ArrayOfBiome = new Biome[par4 * par5]; } for (int var7 = 0; var7 < par4 * par5; ++var7) { - par1ArrayOfBiomeGenBase[var7] = this.getBiome(); + par1ArrayOfBiome[var7] = this.getBiome(); } - return par1ArrayOfBiomeGenBase; + return par1ArrayOfBiome; } + + @Override - public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) + public Biome[] getBiomes(Biome[] par1ArrayOfBiome, int par2, int par3, int par4, int par5) { - return this.getBiomeGenAt(par1ArrayOfBiomeGenBase, par2, par3, par4, par5, true); + return this.getBiomes(par1ArrayOfBiome, par2, par3, par4, par5, true); } @Override - public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] listToReuse, int x, int z, int width, int length, boolean cacheFlag) + public Biome[] getBiomes(Biome[] listToReuse, int x, int z, int width, int length, boolean cacheFlag) { IntCache.resetIntCache(); if (listToReuse == null || listToReuse.length < width * length) { - listToReuse = new BiomeGenBase[width * length]; + listToReuse = new Biome[width * length]; } if (cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (z & 15) == 0) { - final BiomeGenBase[] var9 = this.biomeCache.getCachedBiomes(x, z); + final Biome[] var9 = this.biomeCache.getCachedBiomes(x, z); System.arraycopy(var9, 0, listToReuse, 0, width * length); return listToReuse; } @@ -136,5 +127,5 @@ public void cleanupCache() this.biomeCache.cleanupCache(); } - public abstract BiomeGenBase getBiome(); + public abstract Biome getBiome(); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java index 7b096c14c2..eabfbe8a20 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java @@ -10,7 +10,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.IProgressUpdate; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.chunk.IChunkProvider; @@ -36,7 +36,7 @@ public abstract class ChunkProviderSpace extends ChunkProviderGenerate protected final World worldObj; - private BiomeGenBase[] biomesForGeneration = this.getBiomesForGeneration(); + private Biome[] biomesForGeneration = this.getBiomesForGeneration(); private final double TERRAIN_HEIGHT_MOD = this.getHeightModifier(); private final double SMALL_FEATURE_HEIGHT_MOD = this.getSmallFeatureHeightModifier(); @@ -146,7 +146,7 @@ private double clamp(double x, double min, double max) } @Override - public void replaceBlocksForBiome(int par1, int par2, ChunkPrimer primer, BiomeGenBase[] par4ArrayOfBiomeGenBase) + public void replaceBlocksForBiome(int par1, int par2, ChunkPrimer primer, Biome[] par4ArrayOfBiome) { final int var5 = 20; final float var6 = 0.03125F; @@ -386,9 +386,9 @@ public String makeString() } @Override - public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) + public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { - BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos); + Biome biomegenbase = this.worldObj.getBiomeGenForCoords(pos); return biomegenbase.getSpawnableList(creatureType); } @@ -405,7 +405,7 @@ public List getPossibleCreatures(EnumCreatureType c * * @return Biome instance for generation */ - protected abstract BiomeGenBase[] getBiomesForGeneration(); + protected abstract Biome[] getBiomesForGeneration(); /** * @return The average terrain level. Default is 64. diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/MapGenBaseMeta.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/MapGenBaseMeta.java index 7503766b57..d0bb45c5c1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/MapGenBaseMeta.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/MapGenBaseMeta.java @@ -28,7 +28,7 @@ public abstract class MapGenBaseMeta */ protected World worldObj; - public void generate(IChunkProvider par1IChunkProvider, World world, int chunkX, int chunkZ, ChunkPrimer primer) + public void generate(World world, int chunkX, int chunkZ, ChunkPrimer primer) { this.worldObj = world; this.rand.setSeed(world.getSeed()); diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldProviderSpace.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldProviderSpace.java index c45a180530..93cd5d1fcf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldProviderSpace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/WorldProviderSpace.java @@ -8,12 +8,12 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; -import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.biome.BiomeProvider; import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -55,23 +55,16 @@ public boolean canRainOrSnow() */ public abstract long getDayLength(); - public abstract Class getChunkProviderClass(); + public abstract Class getChunkProviderClass(); - public abstract Class getWorldChunkManagerClass(); + public abstract Class getBiomeProviderClass(); @Override public void setDimension(int var1) { - this.dimensionId = var1; super.setDimension(var1); } - @Override - public String getDimensionName() - { - return this.getCelestialBody().getLocalizedName(); - } - @Override public boolean isGasPresent(IAtmosphericGas gas) { @@ -161,17 +154,17 @@ public float calculateCelestialAngle(long par1, float par3) @SideOnly(Side.CLIENT) @Override - public Vec3 getFogColor(float var1, float var2) + public Vec3d getFogColor(float var1, float var2) { Vector3 fogColor = this.getFogColor(); - return new Vec3(fogColor.floatX(), fogColor.floatY(), fogColor.floatZ()); + return new Vec3d(fogColor.floatX(), fogColor.floatY(), fogColor.floatZ()); } @Override - public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) + public Vec3d getSkyColor(Entity cameraEntity, float partialTicks) { Vector3 skyColor = this.getSkyColor(); - return new Vec3(skyColor.floatX(), skyColor.floatY(), skyColor.floatZ()); + return new Vec3d(skyColor.floatX(), skyColor.floatY(), skyColor.floatZ()); } @Override @@ -216,7 +209,7 @@ public boolean canRespawnHere() @Override public int getRespawnDimension(EntityPlayerMP player) { - return this.shouldForceRespawn() ? this.dimensionId : 0; + return this.shouldForceRespawn() ? this.getDimension() : 0; } /** @@ -251,11 +244,11 @@ public boolean netherPortalsOperational() } @Override - public IChunkProvider createChunkGenerator() + public IChunkGenerator createChunkGenerator() { try { - Class chunkProviderClass = this.getChunkProviderClass(); + Class chunkProviderClass = this.getChunkProviderClass(); Constructor[] constructors = chunkProviderClass.getConstructors(); for (int i = 0; i < constructors.length; i++) @@ -263,11 +256,11 @@ public IChunkProvider createChunkGenerator() Constructor constr = constructors[i]; if (Arrays.equals(constr.getParameterTypes(), new Object[] { World.class, long.class, boolean.class })) { - return (IChunkProvider) constr.newInstance(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled()); + return (IChunkGenerator) constr.newInstance(this.worldObj, this.worldObj.getSeed(), this.worldObj.getWorldInfo().isMapFeaturesEnabled()); } else if (constr.getParameterTypes().length == 0) { - return (IChunkProvider) constr.newInstance(); + return (IChunkGenerator) constr.newInstance(); } } } @@ -280,28 +273,28 @@ else if (constr.getParameterTypes().length == 0) } @Override - public void registerWorldChunkManager() + protected void createBiomeProvider() { - if (this.getWorldChunkManagerClass() == null) + if (this.getBiomeProviderClass() == null) { - super.registerWorldChunkManager(); + super.createBiomeProvider(); } else { try { - Class chunkManagerClass = this.getWorldChunkManagerClass(); + Class chunkManagerClass = this.getBiomeProviderClass(); Constructor[] constructors = chunkManagerClass.getConstructors(); for (Constructor constr : constructors) { if (Arrays.equals(constr.getParameterTypes(), new Object[] { World.class })) { - this.worldChunkMgr = (WorldChunkManager) constr.newInstance(this.worldObj); + this.biomeProvider = (BiomeProvider) constr.newInstance(this.worldObj); } else if (constr.getParameterTypes().length == 0) { - this.worldChunkMgr = (WorldChunkManager) constr.newInstance(); + this.biomeProvider = (BiomeProvider) constr.newInstance(); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/EventHandlerClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/EventHandlerClient.java index e1c25c7a86..58b32b7479 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/EventHandlerClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/EventHandlerClient.java @@ -22,15 +22,15 @@ public void onRenderPlayerPre(RenderPlayerEvent.Pre event) { GL11.glPushMatrix(); - final EntityPlayer player = event.entityPlayer; + final EntityPlayer player = event.getEntityPlayer(); if (player.getRidingEntity() instanceof EntityTieredRocket && player == Minecraft.getMinecraft().thePlayer && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) { EntityTieredRocket entity = (EntityTieredRocket) player.getRidingEntity(); GL11.glTranslatef(0, -entity.getRotateOffset() - ClientProxyCore.PLAYER_Y_OFFSET, 0); - float anglePitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * event.partialRenderTick; - float angleYaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * event.partialRenderTick; + float anglePitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * event.getPartialRenderTick(); + float angleYaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * event.getPartialRenderTick(); GL11.glRotatef(-angleYaw, 0.0F, 1.0F, 0.0F); GL11.glRotatef(anglePitch, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0, entity.getRotateOffset() + ClientProxyCore.PLAYER_Y_OFFSET, 0); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/GalacticraftStateMapper.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/GalacticraftStateMapper.java index 85dd3ddd93..b1d248a2bd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/GalacticraftStateMapper.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/GalacticraftStateMapper.java @@ -2,8 +2,8 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.StateMapperBase; -import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.util.ResourceLocation; public class GalacticraftStateMapper extends StateMapperBase diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiMissingCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiMissingCore.java index e60f1d241e..548aeac67e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiMissingCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiMissingCore.java @@ -5,7 +5,7 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.TextFormatting; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -37,7 +37,7 @@ public void drawScreen(int par1, int par2, float par3) offset += 20; this.drawCenteredString(this.fontRendererObj, GCCoreUtil.translate("gui.missing_core.name.2"), this.width / 2, offset, 0x999999); offset += 20; - String s = EnumChatFormatting.UNDERLINE + GCCoreUtil.translate("gui.missing_core.name.3"); + String s = TextFormatting.UNDERLINE + GCCoreUtil.translate("gui.missing_core.name.3"); this.urlX = this.width / 2 - this.fontRendererObj.getStringWidth(s) / 2 - 10; this.urlY = offset - 2; this.urlWidth = this.fontRendererObj.getStringWidth(s) + 20; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderEvolvedSkeleton.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderEvolvedSkeleton.java index 945d658a8e..1605245619 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderEvolvedSkeleton.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderEvolvedSkeleton.java @@ -28,10 +28,11 @@ public RenderEvolvedSkeleton(RenderManager manager) this.addLayer(new LayerHeldItem(this)); this.addLayer(new LayerBipedArmor(this) { - protected void func_177177_a() + @Override + protected void initArmor() { - this.field_177189_c = new ModelSkeleton(0.5F, true); - this.field_177186_d = new ModelSkeleton(1.0F, true); + this.modelLeggings = new ModelSkeleton(0.5F, true); + this.modelArmor = new ModelSkeleton(1.0F, true); } }); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderEvolvedSkeletonBoss.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderEvolvedSkeletonBoss.java index c902ab6a11..dd0ded542b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderEvolvedSkeletonBoss.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderEvolvedSkeletonBoss.java @@ -5,8 +5,6 @@ import micdoodle8.mods.galacticraft.core.entities.EntitySkeletonBoss; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.entity.boss.BossStatus; -import net.minecraft.entity.boss.IBossDisplayData; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -41,7 +39,7 @@ protected void preRenderCallback(EntitySkeletonBoss par1EntityLiving, float par2 @Override public void doRender(EntitySkeletonBoss par1EntityLiving, double par2, double par4, double par6, float par8, float par9) { - BossStatus.setBossStatus((IBossDisplayData) par1EntityLiving, false); +// BossStatus.setBossStatus((IBossDisplayData) par1EntityLiving, false); TODO super.doRender(par1EntityLiving, par2, par4, par6, par8, par9); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderEvolvedZombie.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderEvolvedZombie.java index a6903ae1ef..1ae89b163e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderEvolvedZombie.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderEvolvedZombie.java @@ -30,12 +30,11 @@ public RenderEvolvedZombie(RenderManager manager) this.addLayer(new LayerHeldItem(this)); LayerBipedArmor layerbipedarmor = new LayerBipedArmor(this) { - private static final String __OBFID = "CL_00002429"; - - protected void func_177177_a() + @Override + protected void initArmor() { - this.field_177189_c = new ModelZombie(0.5F, true); - this.field_177186_d = new ModelZombie(1.0F, true); + this.modelLeggings = new ModelZombie(0.5F, true); + this.modelArmor = new ModelZombie(1.0F, true); } }; this.addLayer(layerbipedarmor); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderPlayerGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderPlayerGC.java index 57b5ad05ca..64227af6ce 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderPlayerGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderPlayerGC.java @@ -72,8 +72,8 @@ public RenderPlayerGC(boolean smallArms) @Override protected void initArmor() { - this.field_177189_c = new ModelBipedGC(0.5F); - this.field_177186_d = new ModelBipedGC(1.0F); + this.modelLeggings = new ModelBipedGC(0.5F); + this.modelArmor = new ModelBipedGC(1.0F); } }; this.addLayer(playerArmor); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemLiquidCanisterModel.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemLiquidCanisterModel.java index e041919b55..f8fa16665c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemLiquidCanisterModel.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemLiquidCanisterModel.java @@ -1,18 +1,19 @@ package micdoodle8.mods.galacticraft.core.client.render.item; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import com.google.common.collect.ImmutableList; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.*; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.model.ISmartItemModel; +import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; import java.util.List; -@SuppressWarnings({ "deprecation", "unchecked" }) -public class ItemLiquidCanisterModel implements ISmartItemModel +public class ItemLiquidCanisterModel implements IBakedModel { private final IBakedModel iBakedModel; @@ -22,15 +23,15 @@ public ItemLiquidCanisterModel(IBakedModel i_modelToWrap) } @Override - public List getFaceQuads(EnumFacing enumFacing) + public List getQuads(IBlockState state, EnumFacing side, long rand) { - return iBakedModel.getFaceQuads(enumFacing); + return iBakedModel.getQuads(state, side, rand); } @Override - public List getGeneralQuads() + public ItemOverrideList getOverrides() { - return iBakedModel.getGeneralQuads(); + return BakedLiquidCanisterOverrideHandler.INSTANCE; } @Override @@ -63,16 +64,26 @@ public ItemCameraTransforms getItemCameraTransforms() return ItemCameraTransforms.DEFAULT; } - @Override - public IBakedModel handleItemState(ItemStack stack) + private static final class BakedLiquidCanisterOverrideHandler extends ItemOverrideList { - if (stack.getTagCompound() == null) + public static final BakedLiquidCanisterOverrideHandler INSTANCE = new BakedLiquidCanisterOverrideHandler(); + + private BakedLiquidCanisterOverrideHandler() + { + super(ImmutableList.of()); + } + + @Override + public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) { - ItemStack copy = stack.copy(); - copy.setTagCompound(new NBTTagCompound()); - copy.getTagCompound().setBoolean("Unbreakable", true); - return FMLClientHandler.instance().getClient().getRenderItem().getItemModelMesher().getItemModel(copy); + if (stack.getTagCompound() == null) + { + ItemStack copy = stack.copy(); + copy.setTagCompound(new NBTTagCompound()); + copy.getTagCompound().setBoolean("Unbreakable", true); + return FMLClientHandler.instance().getClient().getRenderItem().getItemModelMesher().getItemModel(copy); + } + return originalModel; } - return iBakedModel; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java index 7c35430ce9..caf7d837d6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java @@ -1,8 +1,8 @@ package micdoodle8.mods.galacticraft.core.client.render.item; import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.resources.model.IBakedModel; import javax.vecmath.Matrix4f; import javax.vecmath.Vector3f; @@ -37,7 +37,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.FIRST_PERSON) + if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) { Vector3f trans = new Vector3f(0.0F, -0.4F, -0.3F); Matrix4f ret = new Matrix4f(); @@ -52,7 +52,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.THIRD_PERSON) + if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) { Vector3f trans = new Vector3f(0.0F, 0.0F, 0.6F); Matrix4f ret = new Matrix4f(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java index b33a3fd075..e6594a9b1d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java @@ -2,8 +2,9 @@ import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.Timer; import javax.vecmath.Matrix4f; @@ -37,7 +38,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.FIRST_PERSON) + if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) { Matrix4f ret = new Matrix4f(); ret.setIdentity(); @@ -46,23 +47,24 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) mul.rotY((float) -(Math.PI / 3.0F)); ret.mul(mul); mul.setIdentity(); - if (Minecraft.getMinecraft().thePlayer.getItemInUseDuration() > 0) + EntityLivingBase player = Minecraft.getMinecraft().thePlayer; + if (player.isHandActive() && player.getActiveItemStack() != null) { - final int useTime = Minecraft.getMinecraft().thePlayer.getItemInUseDuration(); - float var7 = useTime / 20.0F; - var7 = (var7 * var7 + var7 * 2.0F) / 3.0F; + final int useTime = Minecraft.getMinecraft().thePlayer.getItemInUseMaxCount(); + float interpolate0 = useTime / 20.0F; + interpolate0 = (interpolate0 * interpolate0 + interpolate0 * 2.0F) / 3.0F; - if (var7 > 1.0F) + if (interpolate0 > 1.0F) { - var7 = 1.0F; + interpolate0 = 1.0F; } - final int useTimeFuture = Minecraft.getMinecraft().thePlayer.getItemInUseDuration() + 1; - float var72 = useTimeFuture / 20.0F; - var72 = (var72 * var72 + var72 * 2.0F) / 3.0F; + final int useTimeFuture = Minecraft.getMinecraft().thePlayer.getItemInUseMaxCount() + 1; + float interpolate1 = useTimeFuture / 20.0F; + interpolate1 = (interpolate1 * interpolate1 + interpolate1 * 2.0F) / 3.0F; - if (var72 > 1.0F) + if (interpolate1 > 1.0F) { - var72 = 1.0F; + interpolate1 = 1.0F; } try @@ -71,7 +73,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) Field f = c.getDeclaredField("timer"); f.setAccessible(true); Timer t = (Timer) f.get(Minecraft.getMinecraft()); - mul.rotX(((var7 + (var72 - var7) * t.renderPartialTicks) * 75.0F) * (float) (Math.PI / 180.0F)); + mul.rotX(((interpolate0 + (interpolate1 - interpolate0) * t.renderPartialTicks) * 75.0F) * (float) (Math.PI / 180.0F)); } catch (Exception e) { @@ -82,7 +84,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.THIRD_PERSON) + if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) { Matrix4f ret = new Matrix4f(); ret.setIdentity(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java index 971cc0aae7..ddbca6f692 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java @@ -2,8 +2,8 @@ import micdoodle8.mods.galacticraft.core.util.ClientUtil; import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.resources.model.IBakedModel; import javax.vecmath.Matrix4f; import javax.vecmath.Vector3f; @@ -52,7 +52,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.FIRST_PERSON) + if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) { Vector3f trans = new Vector3f(0.5F, -1.2F, -0.8F); Matrix4f ret = new Matrix4f(); @@ -73,7 +73,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.THIRD_PERSON) + if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) { Vector3f trans = new Vector3f(0.4F, -1.8F, 0.8F); Matrix4f ret = new Matrix4f(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelWorkbench.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelWorkbench.java index c130b21232..65e9e7d921 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelWorkbench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelWorkbench.java @@ -1,8 +1,8 @@ package micdoodle8.mods.galacticraft.core.client.render.item; import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.resources.model.IBakedModel; import javax.vecmath.Matrix4f; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/tile/TileEntityFluidPipeRenderer.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/tile/TileEntityFluidPipeRenderer.java index aec6ec048d..bb6ebf495b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/tile/TileEntityFluidPipeRenderer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/tile/TileEntityFluidPipeRenderer.java @@ -11,6 +11,7 @@ import micdoodle8.mods.galacticraft.core.util.OxygenUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.*; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; @@ -18,7 +19,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.IFlexibleBakedModel; import net.minecraftforge.client.model.IModel; import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.fluids.Fluid; @@ -29,7 +29,7 @@ public class TileEntityFluidPipeRenderer extends TileEntitySpecialRenderer { private static HashMap> cache = new HashMap<>(); - private static IFlexibleBakedModel[] pullConnectorModel = new IFlexibleBakedModel[6]; + private static IBakedModel[] pullConnectorModel = new IBakedModel[6]; private final int stages = 100; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/GCInvSaveData.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/GCInvSaveData.java index 3bf70fa7a6..1edd6234f5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/GCInvSaveData.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/GCInvSaveData.java @@ -72,5 +72,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound toSave) } toSave.setTag(name, par1NBTTagList); } + + return toSave; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/GCDimensions.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/GCDimensions.java new file mode 100644 index 0000000000..9d7321cf93 --- /dev/null +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/GCDimensions.java @@ -0,0 +1,10 @@ +package micdoodle8.mods.galacticraft.core.dimension; + +import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; +import net.minecraft.world.DimensionType; + +public class GCDimensions +{ + public static DimensionType MOON = DimensionType.register("Moon", "moon", ConfigManagerCore.idDimensionMoon, WorldProviderMoon.class, false); + public static DimensionType ORBIT = DimensionType.register("Space Station", "orbit", ConfigManagerCore.idDimensionOverworldOrbit, WorldProviderOrbit.class, false); +} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/OrbitSpinSaveData.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/OrbitSpinSaveData.java index d19a96ca87..327ad1270f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/OrbitSpinSaveData.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/OrbitSpinSaveData.java @@ -31,6 +31,8 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) { nbt.setTag("" + this.dim, this.datacompound); } + + return nbt; } public static OrbitSpinSaveData initWorldData(World world) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceRaceManager.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceRaceManager.java index e2fe6ed2d4..23d0175fa5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceRaceManager.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceRaceManager.java @@ -16,11 +16,12 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.TextComponentString; -import net.minecraft.util.ChatStyle; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.server.management.PlayerList; +import net.minecraft.util.text.Style; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.WorldServer; +import net.minecraftforge.fml.common.FMLCommonHandler; import java.util.ArrayList; import java.util.HashSet; @@ -49,28 +50,24 @@ public static void tick() { boolean playerOnline = false; - for (int j = 0; j < MinecraftServer.getServer().getConfigurationManager().playerEntityList.size(); j++) + PlayerList playerList = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList(); + for (int j = 0; j < playerList.getPlayerList().size(); j++) { - Object o = MinecraftServer.getServer().getConfigurationManager().playerEntityList.get(j); + EntityPlayer player = playerList.getPlayerList().get(j); - if (o instanceof EntityPlayer) + if (race.getPlayerNames().contains(player.getGameProfile().getName())) { - EntityPlayer player = (EntityPlayer) o; + CelestialBody body = GalaxyRegistry.getCelestialBodyFromDimensionID(player.worldObj.provider.getDimension()); - if (race.getPlayerNames().contains(player.getGameProfile().getName())) + if (body != null) { - CelestialBody body = GalaxyRegistry.getCelestialBodyFromDimensionID(player.worldObj.provider.getDimension()); - - if (body != null) + if (!race.getCelestialBodyStatusList().containsKey(body)) { - if (!race.getCelestialBodyStatusList().containsKey(body)) - { - race.setCelestialBodyReached(body); - } + race.setCelestialBodyReached(body); } - - playerOnline = true; } + + playerOnline = true; } } @@ -94,7 +91,7 @@ public static void loadSpaceRaces(NBTTagCompound nbt) } } - public static void saveSpaceRaces(NBTTagCompound nbt) + public static NBTTagCompound saveSpaceRaces(NBTTagCompound nbt) { NBTTagList tagList = new NBTTagList(); @@ -106,6 +103,7 @@ public static void saveSpaceRaces(NBTTagCompound nbt) } nbt.setTag("SpaceRaceList", tagList); + return nbt; } public static SpaceRace getSpaceRaceFromPlayer(String username) @@ -151,7 +149,7 @@ public static void sendSpaceRaceData(EntityPlayerMP toPlayer, SpaceRace spaceRac } else { - for (WorldServer server : MinecraftServer.getServer().worldServers) + for (WorldServer server : toPlayer.worldObj.getMinecraftServer().worldServers) { GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(EnumSimplePacket.C_UPDATE_SPACE_RACE_DATA, server.provider.getDimension(), objList), server.provider.getDimension()); } @@ -168,11 +166,11 @@ public static void onPlayerRemoval(String player, SpaceRace race) { for (String member : race.getPlayerNames()) { - EntityPlayerMP memberObj = PlayerUtil.getPlayerForUsernameVanilla(MinecraftServer.getServer(), member); + EntityPlayerMP memberObj = PlayerUtil.getPlayerForUsernameVanilla(FMLCommonHandler.instance().getMinecraftServerInstance(), member); if (memberObj != null) { - memberObj.addChatMessage(new TextComponentString(EnumColor.DARK_AQUA + GCCoreUtil.translateWithFormat("gui.space_race.chat.remove_success", EnumColor.RED + player + EnumColor.DARK_AQUA)).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_AQUA))); + memberObj.addChatMessage(new TextComponentString(EnumColor.DARK_AQUA + GCCoreUtil.translateWithFormat("gui.space_race.chat.remove_success", EnumColor.RED + player + EnumColor.DARK_AQUA)).setStyle(new Style().setColor(TextFormatting.DARK_AQUA))); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceStationWorldData.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceStationWorldData.java index 8324b7f847..f41deae89f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceStationWorldData.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceStationWorldData.java @@ -10,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.world.DimensionType; import net.minecraft.world.World; import net.minecraft.world.WorldSavedData; import net.minecraftforge.common.DimensionManager; @@ -205,6 +206,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) } nbttagcompound.setTag("allowedPlayers", var2); + return nbttagcompound; } /** @@ -220,7 +222,7 @@ public static SpaceStationWorldData getStationData(World world, int stationID, E */ public static SpaceStationWorldData getStationData(World world, int stationID, int homeID, int providerIdDynamic, int providerIdStatic, EntityPlayer owner) { - int providerType = DimensionManager.getProviderType(stationID); + DimensionType providerType = DimensionManager.getProviderType(stationID); boolean foundMatch = false; @@ -228,7 +230,7 @@ public static SpaceStationWorldData getStationData(World world, int stationID, i // being called on an incorrect for (Satellite satellite : GalaxyRegistry.getRegisteredSatellites().values()) { - if (satellite.getDimensionIdStatic() == providerType || satellite.getDimensionID() == providerType) + if (satellite.getDimensionIdStatic() == providerType.getId() || satellite.getDimensionID() == providerType.getId()) { foundMatch = true; break; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java index 1aa3b80cac..5a4d8ca8d1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java @@ -398,7 +398,7 @@ else if (m > 30F) List objList = new ArrayList(); objList.add(Double.valueOf(this.spinCentreX)); objList.add(Double.valueOf(this.spinCentreZ)); - GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(PacketSimple.EnumSimplePacket.C_UPDATE_STATION_DATA, this.worldProvider.getDimensionId(), objList), this.worldProvider.getDimensionId()); + GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(PacketSimple.EnumSimplePacket.C_UPDATE_STATION_DATA, this.worldProvider.getDimension(), objList), this.worldProvider.getDimension()); objList = new ArrayList(); objList.add(Integer.valueOf(this.ssBoundsMinX)); @@ -407,7 +407,7 @@ else if (m > 30F) objList.add(Integer.valueOf(this.ssBoundsMaxY)); objList.add(Integer.valueOf(this.ssBoundsMinZ)); objList.add(Integer.valueOf(this.ssBoundsMaxZ)); - GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(PacketSimple.EnumSimplePacket.C_UPDATE_STATION_BOX, this.worldProvider.getDimensionId(), objList), this.worldProvider.getDimensionId()); + GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(PacketSimple.EnumSimplePacket.C_UPDATE_STATION_BOX, this.worldProvider.getDimension(), objList), this.worldProvider.getDimension()); this.updateSpinSpeed(); @@ -544,7 +544,7 @@ else if (this.thrustersFiring) List objList = new ArrayList(); objList.add(Float.valueOf(this.angularVelocityRadians)); objList.add(Boolean.valueOf(this.thrustersFiring)); - GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(PacketSimple.EnumSimplePacket.C_UPDATE_STATION_SPIN, this.worldProvider.getDimensionId(), objList), this.worldProvider.getDimensionId()); + GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(PacketSimple.EnumSimplePacket.C_UPDATE_STATION_SPIN, this.worldProvider.getDimension(), objList), this.worldProvider.getDimension()); } //Update entity positions if in freefall @@ -681,7 +681,7 @@ public void sendPackets(EntityPlayerMP player) objList.add(this.thrustersFiring); if (player == null) { - GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(PacketSimple.EnumSimplePacket.C_UPDATE_STATION_SPIN, this.worldProvider.getDimensionId(), objList), this.worldProvider.getDimensionId()); + GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(PacketSimple.EnumSimplePacket.C_UPDATE_STATION_SPIN, this.worldProvider.getDimension(), objList), this.worldProvider.getDimension()); } else { @@ -693,7 +693,7 @@ public void sendPackets(EntityPlayerMP player) objList.add(this.spinCentreZ); if (player == null) { - GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(PacketSimple.EnumSimplePacket.C_UPDATE_STATION_DATA, this.worldProvider.getDimensionId(), objList), this.worldProvider.getDimensionId()); + GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(PacketSimple.EnumSimplePacket.C_UPDATE_STATION_DATA, this.worldProvider.getDimension(), objList), this.worldProvider.getDimension()); } else { @@ -709,7 +709,7 @@ public void sendPackets(EntityPlayerMP player) objList.add(this.ssBoundsMaxZ); if (player == null) { - GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(PacketSimple.EnumSimplePacket.C_UPDATE_STATION_BOX, this.worldProvider.getDimensionId(), objList), this.worldProvider.getDimensionId()); + GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(PacketSimple.EnumSimplePacket.C_UPDATE_STATION_BOX, this.worldProvider.getDimension(), objList), this.worldProvider.getDimension()); } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeSpaceStation.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeSpaceStation.java index bba24ba253..327df9587e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeSpaceStation.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeSpaceStation.java @@ -7,7 +7,7 @@ import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.TextComponentString; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraft.world.WorldServer; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldDataSpaceRaces.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldDataSpaceRaces.java index abbb20e4a4..baf22e847e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldDataSpaceRaces.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldDataSpaceRaces.java @@ -23,7 +23,7 @@ public void readFromNBT(NBTTagCompound nbt) @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - SpaceRaceManager.saveSpaceRaces(nbt); + return SpaceRaceManager.saveSpaceRaces(nbt); } public static WorldDataSpaceRaces initWorldData(World world) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldProviderMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldProviderMoon.java index 77a4ab772b..a45ac497b8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldProviderMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldProviderMoon.java @@ -8,17 +8,24 @@ import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.event.EventHandlerGC; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; +import micdoodle8.mods.galacticraft.core.world.gen.BiomeProviderMoon; import micdoodle8.mods.galacticraft.core.world.gen.ChunkProviderMoon; -import micdoodle8.mods.galacticraft.core.world.gen.WorldChunkManagerMoon; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.WorldChunkManager; -import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.DimensionType; +import net.minecraft.world.biome.BiomeProvider; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class WorldProviderMoon extends WorldProviderSpace implements IGalacticraftWorldProvider, ISolarLevel { + @Override + public DimensionType getDimensionType() + { + return GCDimensions.MOON; + } + @Override public Vector3 getFogColor() { @@ -50,15 +57,15 @@ public boolean shouldForceRespawn() } @Override - public Class getChunkProviderClass() + public Class getChunkProviderClass() { return ChunkProviderMoon.class; } @Override - public Class getWorldChunkManagerClass() + public Class getBiomeProviderClass() { - return WorldChunkManagerMoon.class; + return BiomeProviderMoon.class; } // @Override @@ -213,7 +220,7 @@ public boolean canRespawnHere() @Override public int getRespawnDimension(EntityPlayerMP player) { - return this.shouldForceRespawn() ? this.dimensionId : 0; + return this.shouldForceRespawn() ? this.getDimension() : 0; } // @Override @@ -330,12 +337,6 @@ public float getWindLevel() return 0; } - @Override - public String getInternalNameSuffix() - { - return "_moon"; - } - @Override public boolean shouldDisablePrecipitation() { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldProviderOrbit.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldProviderOrbit.java index d0b16fc55d..1ea7f2c235 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldProviderOrbit.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldProviderOrbit.java @@ -7,17 +7,24 @@ import micdoodle8.mods.galacticraft.api.world.ISolarLevel; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; +import micdoodle8.mods.galacticraft.core.world.gen.BiomeProviderOrbit; import micdoodle8.mods.galacticraft.core.world.gen.ChunkProviderOrbit; -import micdoodle8.mods.galacticraft.core.world.gen.WorldChunkManagerOrbit; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.WorldChunkManager; -import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.DimensionType; +import net.minecraft.world.biome.BiomeProvider; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class WorldProviderOrbit extends WorldProviderZeroGravity implements IOrbitDimension, ISolarLevel, IExitHeight { + @Override + public DimensionType getDimensionType() + { + return GCDimensions.ORBIT; + } + @Override public void setDimension(int var1) { @@ -61,15 +68,15 @@ public boolean shouldForceRespawn() } @Override - public Class getChunkProviderClass() + public Class getChunkProviderClass() { return ChunkProviderOrbit.class; } @Override - public Class getWorldChunkManagerClass() + public Class getBiomeProviderClass() { - return WorldChunkManagerOrbit.class; + return BiomeProviderOrbit.class; } @Override @@ -151,7 +158,7 @@ public boolean canRespawnHere() @Override public int getRespawnDimension(EntityPlayerMP player) { - return this.shouldForceRespawn() ? this.dimensionId : 0; + return this.shouldForceRespawn() ? this.getDimension() : 0; } // @Override @@ -166,12 +173,6 @@ public int getRespawnDimension(EntityPlayerMP player) // return "Leaving Earth Orbit"; // } - @Override - public String getDimensionName() - { - return "Space Station " + this.dimensionId; - } - @Override public float getGravity() { @@ -211,7 +212,7 @@ public int getYCoordToTeleportToPlanet() @Override public String getSaveFolder() { - return "DIM_SPACESTATION" + this.dimensionId; + return "DIM_SPACESTATION" + this.getDimension(); } @Override @@ -256,12 +257,6 @@ public float getWindLevel() return 0.1F; } - @Override - public String getInternalNameSuffix() - { - return "_orbit"; - } - @Override public boolean shouldDisablePrecipitation() { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/energy/EnergyDisplayHelper.java b/src/main/java/micdoodle8/mods/galacticraft/core/energy/EnergyDisplayHelper.java index 9b89bcb57e..1aff5e7940 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/energy/EnergyDisplayHelper.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/energy/EnergyDisplayHelper.java @@ -1,8 +1,8 @@ package micdoodle8.mods.galacticraft.core.energy; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.TextFormatting; import java.util.List; @@ -10,8 +10,8 @@ public class EnergyDisplayHelper { public static void getEnergyDisplayTooltip(float energyVal, float maxEnergy, List strList) { - strList.add(EnumChatFormatting.GREEN + GCCoreUtil.translate("gui.message.energy") + ": " + getEnergyDisplayS(energyVal)); - strList.add(EnumChatFormatting.RED + GCCoreUtil.translate("gui.message.max_energy") + ": " + getEnergyDisplayS(maxEnergy)); + strList.add(TextFormatting.GREEN + GCCoreUtil.translate("gui.message.energy") + ": " + getEnergyDisplayS(energyVal)); + strList.add(TextFormatting.RED + GCCoreUtil.translate("gui.message.max_energy") + ": " + getEnergyDisplayS(maxEnergy)); } public static String getEnergyDisplayS(float energyVal) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/energy/grid/ChunkPowerHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/energy/grid/ChunkPowerHandler.java index 43e19eebe5..c0fa7fc2c8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/energy/grid/ChunkPowerHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/energy/grid/ChunkPowerHandler.java @@ -28,7 +28,7 @@ public static void initiate() @SubscribeEvent public void onChunkLoad(ChunkEvent.Load event) { - if (!event.world.isRemote && event.getChunk() != null) + if (!event.getWorld().isRemote && event.getChunk() != null) { try { @@ -53,9 +53,9 @@ public void onChunkLoad(ChunkEvent.Load event) e.printStackTrace(); } - if (ConfigManagerCore.retrogenOil && event.world.provider.getDimension() == 0) + if (ConfigManagerCore.retrogenOil && event.getWorld().provider.getDimension() == 0) { - EventHandlerGC.retrogenOil(event.world, event.getChunk()); + EventHandlerGC.retrogenOil(event.getWorld(), event.getChunk()); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/EnergyStorageTile.java b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/EnergyStorageTile.java index 272459a154..a68236e069 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/EnergyStorageTile.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/EnergyStorageTile.java @@ -32,9 +32,9 @@ public void readFromNBT(NBTTagCompound nbt) @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(nbt); this.storage.writeToNBT(nbt); + return nbt; } public abstract ReceiverMode getModeFromDirection(EnumFacing direction); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityProviderStats.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityProviderStats.java new file mode 100644 index 0000000000..104d6b8f32 --- /dev/null +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityProviderStats.java @@ -0,0 +1,50 @@ +package micdoodle8.mods.galacticraft.core.entities.player; + +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ICapabilitySerializable; + +public class CapabilityProviderStats implements ICapabilitySerializable +{ + private EntityPlayerMP owner; + private IStatsCapability statsCapability; + + public CapabilityProviderStats(EntityPlayerMP owner) + { + this.owner = owner; + this.statsCapability = CapabilityStatsHandler.GC_STATS_CAPABILITY.getDefaultInstance(); + } + + @Override + public boolean hasCapability(Capability capability, EnumFacing facing) + { + return capability == CapabilityStatsHandler.GC_STATS_CAPABILITY; + } + + @Override + public T getCapability(Capability capability, EnumFacing facing) + { + if (CapabilityStatsHandler.GC_STATS_CAPABILITY != null && capability == CapabilityStatsHandler.GC_STATS_CAPABILITY) + { + return CapabilityStatsHandler.GC_STATS_CAPABILITY.cast(statsCapability); + } + + return null; + } + + @Override + public NBTTagCompound serializeNBT() + { + NBTTagCompound nbt = new NBTTagCompound(); + statsCapability.saveNBTData(nbt); + return nbt; + } + + @Override + public void deserializeNBT(NBTTagCompound nbt) + { + statsCapability.loadNBTData(nbt); + } +} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityStatsHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityStatsHandler.java new file mode 100644 index 0000000000..8354d1f739 --- /dev/null +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityStatsHandler.java @@ -0,0 +1,38 @@ +package micdoodle8.mods.galacticraft.core.entities.player; + +import micdoodle8.mods.galacticraft.core.Constants; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityInject; +import net.minecraftforge.common.capabilities.CapabilityManager; + +public class CapabilityStatsHandler +{ + @CapabilityInject(IStatsCapability.class) + public static Capability GC_STATS_CAPABILITY = null; + + public static final ResourceLocation GC_PLAYER_PROP = new ResourceLocation(Constants.ASSET_PREFIX, "player_stats"); + + public static void register() + { + CapabilityManager.INSTANCE.register(IStatsCapability.class, new Capability.IStorage() + { + @Override + public NBTBase writeNBT(Capability capability, IStatsCapability instance, EnumFacing side) + { + NBTTagCompound nbt = new NBTTagCompound(); + instance.saveNBTData(nbt); + return nbt; + } + + @Override + public void readNBT(Capability capability, IStatsCapability instance, EnumFacing side, NBTBase nbt) + { + instance.loadNBTData((NBTTagCompound) nbt); + } + }, StatsCapability::new); + } +} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityPlayerMP.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityPlayerMP.java index d0007e2d5d..cdae4ea00a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityPlayerMP.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityPlayerMP.java @@ -8,7 +8,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.management.ItemInWorldManager; +import net.minecraft.server.management.PlayerInteractionManager; import net.minecraft.util.DamageSource; import net.minecraft.world.WorldServer; @@ -18,7 +18,7 @@ */ public class GCEntityPlayerMP extends EntityPlayerMP { - public GCEntityPlayerMP(MinecraftServer server, WorldServer world, GameProfile profile, ItemInWorldManager itemInWorldManager) + public GCEntityPlayerMP(MinecraftServer server, WorldServer world, GameProfile profile, PlayerInteractionManager itemInWorldManager) { super(server, WorldUtil.getStartWorld(world), profile, itemInWorldManager); if (this.worldObj != world) @@ -45,12 +45,14 @@ public void updateRidden() } @Override - public void mountEntity(Entity par1Entity) + public boolean startRiding(Entity entityIn, boolean force) { - if (!GalacticraftCore.proxy.player.mountEntity(this, par1Entity)) + if (!GalacticraftCore.proxy.player.mountEntity(this, entityIn)) { - super.mountEntity(par1Entity); + return super.startRiding(entityIn, force); } + + return false; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java index 8546a26e73..5c0e1cb097 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java @@ -33,52 +33,49 @@ import micdoodle8.mods.galacticraft.planets.venus.VenusItems; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.MobEffects; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; +import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; -import net.minecraft.network.play.server.S07PacketRespawn; -import net.minecraft.potion.Potion; +import net.minecraft.network.play.server.SPacketRespawn; import net.minecraft.potion.PotionEffect; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.TextComponentString; +import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.EntityEvent; +import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; -import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent; -import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent; import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import java.lang.ref.WeakReference; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; import java.util.Map.Entry; -import java.util.concurrent.ConcurrentHashMap; public class GCPlayerHandler { private static final int OXYGENHEIGHTLIMIT = 450; private boolean isClient = FMLCommonHandler.instance().getEffectiveSide().isClient(); - private ConcurrentHashMap playerStatsMap = new ConcurrentHashMap(); +// private ConcurrentHashMap playerStatsMap = new ConcurrentHashMap(); private HashMap torchItems = new HashMap(); - public ConcurrentHashMap getServerStatList() - { - return this.playerStatsMap; - } +// public ConcurrentHashMap getServerStatList() +// { +// return this.playerStatsMap; +// } @SubscribeEvent public void onPlayerLogin(PlayerLoggedInEvent event) @@ -89,138 +86,147 @@ public void onPlayerLogin(PlayerLoggedInEvent event) } } - @SubscribeEvent - public void onPlayerLogout(PlayerLoggedOutEvent event) - { - if (event.player instanceof EntityPlayerMP) - { - this.onPlayerLogout((EntityPlayerMP) event.player); - } - } +// @SubscribeEvent +// public void onPlayerLogout(PlayerLoggedOutEvent event) +// { +// if (event.player instanceof EntityPlayerMP) +// { +// this.onPlayerLogout((EntityPlayerMP) event.player); +// } +// } +// +// @SubscribeEvent +// public void onPlayerRespawn(PlayerRespawnEvent event) +// { +// if (event.player instanceof EntityPlayerMP) +// { +// this.onPlayerRespawn((EntityPlayerMP) event.player); +// } +// } @SubscribeEvent - public void onPlayerRespawn(PlayerRespawnEvent event) + public void onAttachCapability(AttachCapabilitiesEvent event) { - if (event.player instanceof EntityPlayerMP) + if (event.getObject() instanceof EntityPlayerMP) { - this.onPlayerRespawn((EntityPlayerMP) event.player); + event.addCapability(CapabilityStatsHandler.GC_PLAYER_PROP, new CapabilityProviderStats((EntityPlayerMP) event.getObject())); } } - @SubscribeEvent - public void onEntityConstructing(EntityEvent.EntityConstructing event) - { - if (event.entity instanceof EntityPlayerMP && GCPlayerStats.get((EntityPlayerMP) event.entity) == null) - { - GCPlayerStats.register((EntityPlayerMP) event.entity); - } - - if (isClient) - { - this.onEntityConstructingClient(event); - } - } - - @SideOnly(Side.CLIENT) - public void onEntityConstructingClient(EntityEvent.EntityConstructing event) - { - if (event.entity instanceof EntityPlayerSP) - { - if (GCPlayerStatsClient.get((EntityPlayerSP) event.entity) == null) - { - GCPlayerStatsClient.register((EntityPlayerSP) event.entity); - } - - Minecraft.getMinecraft().gameSettings.sendSettingsToServer(); - } - } +// @SubscribeEvent +// public void onEntityConstructing(EntityEvent.EntityConstructing event) +// { +// if (event.getEntity() instanceof EntityPlayerMP && GCPlayerStats.get((EntityPlayerMP) event.getEntity()) == null) +// { +// GCPlayerStats.register((EntityPlayerMP) event.getEntity()); +// } +// +// if (isClient) +// { +// this.onEntityConstructingClient(event); +// } +// } +// +// @SideOnly(Side.CLIENT) +// public void onEntityConstructingClient(EntityEvent.EntityConstructing event) +// { +// if (event.getEntity() instanceof EntityPlayerSP) +// { +// if (GCPlayerStatsClient.get((EntityPlayerSP) event.getEntity()) == null) +// { +// GCPlayerStatsClient.register((EntityPlayerSP) event.getEntity()); +// } +// +// Minecraft.getMinecraft().gameSettings.sendSettingsToServer(); +// } +// } private void onPlayerLogin(EntityPlayerMP player) { - GCPlayerStats oldData = this.playerStatsMap.remove(player.getPersistentID()); - if (oldData != null) - { - oldData.saveNBTData(player.getEntityData()); - } +// GCPlayerStats oldData = this.playerStatsMap.remove(player.getPersistentID()); +// if (oldData != null) +// { +// oldData.saveNBTData(player.getEntityData()); +// } - GCPlayerStats stats = GCPlayerStats.get(player); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_GET_CELESTIAL_BODY_LIST, player.worldObj.provider.getDimension(), new Object[] {}), player); - int repeatCount = stats.buildFlags >> 9; + int repeatCount = stats.getBuildFlags() >> 9; if (repeatCount < 3) { - stats.buildFlags &= 1536; + stats.setBuildFlags(stats.getBuildFlags() & 1536); } - GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_STATS, player.worldObj.provider.getDimension(), new Object[] { stats.buildFlags }), player); - } - - private void onPlayerLogout(EntityPlayerMP player) - { + GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_STATS, player.worldObj.provider.getDimension(), new Object[] { stats.getBuildFlags() }), player); } - private void onPlayerRespawn(EntityPlayerMP player) +// private void onPlayerLogout(EntityPlayerMP player) +// { +// } +// +// private void onPlayerRespawn(EntityPlayerMP player) +// { +// GCPlayerStats oldData = this.playerStatsMap.remove(player.getPersistentID()); +// GCPlayerStats stats = GCPlayerStats.get(player); +// +// if (oldData != null) +// { +// stats.copyFrom(oldData, false); +// } +// +// stats.player = new WeakReference(player); +// } + + public static void checkGear(EntityPlayerMP player, IStatsCapability stats, boolean forceSend) { - GCPlayerStats oldData = this.playerStatsMap.remove(player.getPersistentID()); - GCPlayerStats stats = GCPlayerStats.get(player); - - if (oldData != null) - { - stats.copyFrom(oldData, false); - } - - stats.player = new WeakReference(player); - } - - public static void checkGear(EntityPlayerMP player, GCPlayerStats GCPlayer, boolean forceSend) - { - GCPlayer.maskInSlot = GCPlayer.extendedInventory.getStackInSlot(0); - GCPlayer.gearInSlot = GCPlayer.extendedInventory.getStackInSlot(1); - GCPlayer.tankInSlot1 = GCPlayer.extendedInventory.getStackInSlot(2); - GCPlayer.tankInSlot2 = GCPlayer.extendedInventory.getStackInSlot(3); - GCPlayer.parachuteInSlot = GCPlayer.extendedInventory.getStackInSlot(4); - GCPlayer.frequencyModuleInSlot = GCPlayer.extendedInventory.getStackInSlot(5); - GCPlayer.thermalHelmetInSlot = GCPlayer.extendedInventory.getStackInSlot(6); - GCPlayer.thermalChestplateInSlot = GCPlayer.extendedInventory.getStackInSlot(7); - GCPlayer.thermalLeggingsInSlot = GCPlayer.extendedInventory.getStackInSlot(8); - GCPlayer.thermalBootsInSlot = GCPlayer.extendedInventory.getStackInSlot(9); - GCPlayer.shieldControllerInSlot = GCPlayer.extendedInventory.getStackInSlot(10); + stats.setMaskInSlot(stats.getExtendedInventory().getStackInSlot(0)); + stats.setGearInSlot(stats.getExtendedInventory().getStackInSlot(1)); + stats.setTankInSlot1(stats.getExtendedInventory().getStackInSlot(2)); + stats.setTankInSlot2(stats.getExtendedInventory().getStackInSlot(3)); + stats.setParachuteInSlot(stats.getExtendedInventory().getStackInSlot(4)); + stats.setFrequencyModuleInSlot(stats.getExtendedInventory().getStackInSlot(5)); + stats.setThermalHelmetInSlot(stats.getExtendedInventory().getStackInSlot(6)); + stats.setThermalChestplateInSlot(stats.getExtendedInventory().getStackInSlot(7)); + stats.setThermalLeggingsInSlot(stats.getExtendedInventory().getStackInSlot(8)); + stats.setThermalBootsInSlot(stats.getExtendedInventory().getStackInSlot(9)); + stats.setShieldControllerInSlot(stats.getExtendedInventory().getStackInSlot(10)); // - if (GCPlayer.frequencyModuleInSlot != GCPlayer.lastFrequencyModuleInSlot || forceSend) + if (stats.getFrequencyModuleInSlot() != stats.getLastFrequencyModuleInSlot() || forceSend) { if (FMLCommonHandler.instance().getMinecraftServerInstance() != null) { - if (GCPlayer.frequencyModuleInSlot == null) + if (stats.getFrequencyModuleInSlot() == null) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.REMOVE, EnumExtendedInventorySlot.FREQUENCY_MODULE); - TileEntityTelemetry.frequencyModulePlayer(GCPlayer.lastFrequencyModuleInSlot, null); + TileEntityTelemetry.frequencyModulePlayer(stats.getLastFrequencyModuleInSlot(), null); } - else if (GCPlayer.lastFrequencyModuleInSlot == null) + else if (stats.getLastFrequencyModuleInSlot() == null) { - int gearID = GalacticraftRegistry.findMatchingGearID(GCPlayer.frequencyModuleInSlot, EnumExtendedInventorySlot.FREQUENCY_MODULE); + int gearID = GalacticraftRegistry.findMatchingGearID(stats.getFrequencyModuleInSlot(), EnumExtendedInventorySlot.FREQUENCY_MODULE); if (gearID >= 0) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.ADD, EnumExtendedInventorySlot.FREQUENCY_MODULE, gearID); - TileEntityTelemetry.frequencyModulePlayer(GCPlayer.frequencyModuleInSlot, player); + TileEntityTelemetry.frequencyModulePlayer(stats.getFrequencyModuleInSlot(), player); } } } - GCPlayer.lastFrequencyModuleInSlot = GCPlayer.frequencyModuleInSlot; + stats.setLastFrequencyModuleInSlot(stats.getFrequencyModuleInSlot()); } // - if (GCPlayer.maskInSlot != GCPlayer.lastMaskInSlot || forceSend) + if (stats.getMaskInSlot() != stats.getLastMaskInSlot() || forceSend) { - if (GCPlayer.maskInSlot == null) + if (stats.getMaskInSlot() == null) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.REMOVE, EnumExtendedInventorySlot.MASK); } - else if (GCPlayer.lastMaskInSlot == null || forceSend) + else if (stats.getLastMaskInSlot() == null || forceSend) { - int gearID = GalacticraftRegistry.findMatchingGearID(GCPlayer.maskInSlot, EnumExtendedInventorySlot.MASK); + int gearID = GalacticraftRegistry.findMatchingGearID(stats.getMaskInSlot(), EnumExtendedInventorySlot.MASK); if (gearID >= 0) { @@ -228,20 +234,20 @@ else if (GCPlayer.lastMaskInSlot == null || forceSend) } } - GCPlayer.lastMaskInSlot = GCPlayer.maskInSlot; + stats.setLastMaskInSlot(stats.getMaskInSlot()); } // - if (GCPlayer.gearInSlot != GCPlayer.lastGearInSlot || forceSend) + if (stats.getGearInSlot() != stats.getLastGearInSlot() || forceSend) { - if (GCPlayer.gearInSlot == null) + if (stats.getGearInSlot() == null) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.REMOVE, EnumExtendedInventorySlot.GEAR); } - else if (GCPlayer.gearInSlot.getItem() == GCItems.oxygenGear && (GCPlayer.lastGearInSlot == null || forceSend)) + else if (stats.getGearInSlot().getItem() == GCItems.oxygenGear && (stats.getLastGearInSlot() == null || forceSend)) { - int gearID = GalacticraftRegistry.findMatchingGearID(GCPlayer.gearInSlot, EnumExtendedInventorySlot.GEAR); + int gearID = GalacticraftRegistry.findMatchingGearID(stats.getGearInSlot(), EnumExtendedInventorySlot.GEAR); if (gearID >= 0) { @@ -249,135 +255,135 @@ else if (GCPlayer.gearInSlot.getItem() == GCItems.oxygenGear && (GCPlayer.lastGe } } - GCPlayer.lastGearInSlot = GCPlayer.gearInSlot; + stats.setLastGearInSlot(stats.getGearInSlot()); } // - if (GCPlayer.tankInSlot1 != GCPlayer.lastTankInSlot1 || forceSend) + if (stats.getTankInSlot1() != stats.getLastTankInSlot1() || forceSend) { - if (GCPlayer.tankInSlot1 == null) + if (stats.getTankInSlot1() == null) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.REMOVE, EnumExtendedInventorySlot.LEFT_TANK); - GCPlayer.airRemaining = 0; - GCPlayerHandler.sendAirRemainingPacket(player, GCPlayer); + stats.setAirRemaining(0); + GCPlayerHandler.sendAirRemainingPacket(player, stats); } - else if (GCPlayer.lastTankInSlot1 == null || forceSend) + else if (stats.getLastTankInSlot1() == null || forceSend) { - int gearID = GalacticraftRegistry.findMatchingGearID(GCPlayer.tankInSlot1, EnumExtendedInventorySlot.LEFT_TANK); + int gearID = GalacticraftRegistry.findMatchingGearID(stats.getTankInSlot1(), EnumExtendedInventorySlot.LEFT_TANK); if (gearID >= 0) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.ADD, EnumExtendedInventorySlot.LEFT_TANK, gearID); } - GCPlayer.airRemaining = GCPlayer.tankInSlot1.getMaxDamage() - GCPlayer.tankInSlot1.getItemDamage(); - GCPlayerHandler.sendAirRemainingPacket(player, GCPlayer); + stats.setAirRemaining(stats.getLastTankInSlot1().getMaxDamage() - stats.getTankInSlot1().getItemDamage()); + GCPlayerHandler.sendAirRemainingPacket(player, stats); } //if the else is reached then both tankInSlot and lastTankInSlot are non-null - else if (GCPlayer.tankInSlot1.getItem() != GCPlayer.lastTankInSlot1.getItem()) + else if (stats.getTankInSlot1().getItem() != stats.getLastTankInSlot1().getItem()) { - int gearID = GalacticraftRegistry.findMatchingGearID(GCPlayer.tankInSlot1, EnumExtendedInventorySlot.LEFT_TANK); + int gearID = GalacticraftRegistry.findMatchingGearID(stats.getTankInSlot1(), EnumExtendedInventorySlot.LEFT_TANK); if (gearID >= 0) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.ADD, EnumExtendedInventorySlot.LEFT_TANK, gearID); } - GCPlayer.airRemaining = GCPlayer.tankInSlot1.getMaxDamage() - GCPlayer.tankInSlot1.getItemDamage(); - GCPlayerHandler.sendAirRemainingPacket(player, GCPlayer); + stats.setAirRemaining(stats.getTankInSlot1().getMaxDamage() - stats.getTankInSlot1().getItemDamage()); + GCPlayerHandler.sendAirRemainingPacket(player, stats); } - GCPlayer.lastTankInSlot1 = GCPlayer.tankInSlot1; + stats.setLastTankInSlot1(stats.getTankInSlot1()); } // - if (GCPlayer.tankInSlot2 != GCPlayer.lastTankInSlot2 || forceSend) + if (stats.getTankInSlot2() != stats.getLastTankInSlot2() || forceSend) { - if (GCPlayer.tankInSlot2 == null) + if (stats.getTankInSlot2() == null) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.REMOVE, EnumExtendedInventorySlot.RIGHT_TANK); - GCPlayer.airRemaining2 = 0; - GCPlayerHandler.sendAirRemainingPacket(player, GCPlayer); + stats.setAirRemaining2(0); + GCPlayerHandler.sendAirRemainingPacket(player, stats); } - else if (GCPlayer.lastTankInSlot2 == null || forceSend) + else if (stats.getLastTankInSlot2() == null || forceSend) { - int gearID = GalacticraftRegistry.findMatchingGearID(GCPlayer.tankInSlot2, EnumExtendedInventorySlot.RIGHT_TANK); + int gearID = GalacticraftRegistry.findMatchingGearID(stats.getTankInSlot2(), EnumExtendedInventorySlot.RIGHT_TANK); if (gearID >= 0) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.ADD, EnumExtendedInventorySlot.RIGHT_TANK, gearID); } - GCPlayer.airRemaining2 = GCPlayer.tankInSlot2.getMaxDamage() - GCPlayer.tankInSlot2.getItemDamage(); - GCPlayerHandler.sendAirRemainingPacket(player, GCPlayer); + stats.setAirRemaining2(stats.getTankInSlot2().getMaxDamage() - stats.getTankInSlot2().getItemDamage()); + GCPlayerHandler.sendAirRemainingPacket(player, stats); } //if the else is reached then both tankInSlot and lastTankInSlot are non-null - else if (GCPlayer.tankInSlot2.getItem() != GCPlayer.lastTankInSlot2.getItem()) + else if (stats.getTankInSlot2().getItem() != stats.getLastTankInSlot2().getItem()) { - int gearID = GalacticraftRegistry.findMatchingGearID(GCPlayer.tankInSlot2, EnumExtendedInventorySlot.RIGHT_TANK); + int gearID = GalacticraftRegistry.findMatchingGearID(stats.getTankInSlot2(), EnumExtendedInventorySlot.RIGHT_TANK); if (gearID >= 0) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.ADD, EnumExtendedInventorySlot.RIGHT_TANK, gearID); } - GCPlayer.airRemaining2 = GCPlayer.tankInSlot2.getMaxDamage() - GCPlayer.tankInSlot2.getItemDamage(); - GCPlayerHandler.sendAirRemainingPacket(player, GCPlayer); + stats.setAirRemaining2(stats.getTankInSlot2().getMaxDamage() - stats.getTankInSlot2().getItemDamage()); + GCPlayerHandler.sendAirRemainingPacket(player, stats); } - GCPlayer.lastTankInSlot2 = GCPlayer.tankInSlot2; + stats.setLastTankInSlot2(stats.getTankInSlot2()); } // - if (GCPlayer.parachuteInSlot != GCPlayer.lastParachuteInSlot || forceSend) + if (stats.getParachuteInSlot() != stats.getLastParachuteInSlot() || forceSend) { - if (GCPlayer.parachuteInSlot == null) + if (stats.getParachuteInSlot() == null) { - if (GCPlayer.usingParachute) + if (stats.isUsingParachute()) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.REMOVE, EnumExtendedInventorySlot.PARACHUTE); } } - else if (GCPlayer.lastParachuteInSlot == null || forceSend) + else if (stats.getLastParachuteInSlot() == null || forceSend) { - if (GCPlayer.usingParachute) + if (stats.isUsingParachute()) { - int gearID = GalacticraftRegistry.findMatchingGearID(GCPlayer.parachuteInSlot, EnumExtendedInventorySlot.PARACHUTE); + int gearID = GalacticraftRegistry.findMatchingGearID(stats.getParachuteInSlot(), EnumExtendedInventorySlot.PARACHUTE); if (gearID >= 0) { - GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.ADD, EnumExtendedInventorySlot.PARACHUTE, GCPlayer.parachuteInSlot.getItemDamage()); + GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.ADD, EnumExtendedInventorySlot.PARACHUTE, stats.getParachuteInSlot().getItemDamage()); } } } - else if (GCPlayer.parachuteInSlot.getItemDamage() != GCPlayer.lastParachuteInSlot.getItemDamage()) + else if (stats.getParachuteInSlot().getItemDamage() != stats.getLastParachuteInSlot().getItemDamage()) { - int gearID = GalacticraftRegistry.findMatchingGearID(GCPlayer.parachuteInSlot, EnumExtendedInventorySlot.PARACHUTE); + int gearID = GalacticraftRegistry.findMatchingGearID(stats.getParachuteInSlot(), EnumExtendedInventorySlot.PARACHUTE); if (gearID >= 0) { - GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.ADD, EnumExtendedInventorySlot.PARACHUTE, GCPlayer.parachuteInSlot.getItemDamage()); + GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.ADD, EnumExtendedInventorySlot.PARACHUTE, stats.getParachuteInSlot().getItemDamage()); } } - GCPlayer.lastParachuteInSlot = GCPlayer.parachuteInSlot; + stats.setLastParachuteInSlot(stats.getParachuteInSlot()); } // - if (GCPlayer.thermalHelmetInSlot != GCPlayer.lastThermalHelmetInSlot || forceSend) + if (stats.getThermalHelmetInSlot() != stats.getLastThermalHelmetInSlot() || forceSend) { - ThermalArmorEvent armorEvent = new ThermalArmorEvent(0, GCPlayer.thermalHelmetInSlot); + ThermalArmorEvent armorEvent = new ThermalArmorEvent(0, stats.getThermalHelmetInSlot()); MinecraftForge.EVENT_BUS.post(armorEvent); if (armorEvent.armorResult != ThermalArmorEvent.ArmorAddResult.NOTHING) { - if (GCPlayer.thermalHelmetInSlot == null || armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.REMOVE) + if (stats.getThermalHelmetInSlot() == null || armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.REMOVE) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.REMOVE, EnumExtendedInventorySlot.THERMAL_HELMET); } - else if (armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.ADD && (GCPlayer.lastThermalHelmetInSlot == null || forceSend)) + else if (armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.ADD && (stats.getLastThermalHelmetInSlot() == null || forceSend)) { - int gearID = GalacticraftRegistry.findMatchingGearID(GCPlayer.thermalHelmetInSlot, EnumExtendedInventorySlot.THERMAL_HELMET); + int gearID = GalacticraftRegistry.findMatchingGearID(stats.getThermalHelmetInSlot(), EnumExtendedInventorySlot.THERMAL_HELMET); if (gearID >= 0) { @@ -386,23 +392,23 @@ else if (armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.ADD && (GCPl } } - GCPlayer.lastThermalHelmetInSlot = GCPlayer.thermalHelmetInSlot; + stats.setLastThermalHelmetInSlot(stats.getThermalHelmetInSlot()); } - if (GCPlayer.thermalChestplateInSlot != GCPlayer.lastThermalChestplateInSlot || forceSend) + if (stats.getThermalChestplateInSlot() != stats.getLastThermalHelmetInSlot() || forceSend) { - ThermalArmorEvent armorEvent = new ThermalArmorEvent(1, GCPlayer.thermalChestplateInSlot); + ThermalArmorEvent armorEvent = new ThermalArmorEvent(1, stats.getThermalChestplateInSlot()); MinecraftForge.EVENT_BUS.post(armorEvent); if (armorEvent.armorResult != ThermalArmorEvent.ArmorAddResult.NOTHING) { - if (GCPlayer.thermalChestplateInSlot == null || armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.REMOVE) + if (stats.getThermalChestplateInSlot() == null || armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.REMOVE) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.REMOVE, EnumExtendedInventorySlot.THERMAL_CHESTPLATE); } - else if (armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.ADD && (GCPlayer.lastThermalChestplateInSlot == null || forceSend)) + else if (armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.ADD && (stats.getLastThermalHelmetInSlot() == null || forceSend)) { - int gearID = GalacticraftRegistry.findMatchingGearID(GCPlayer.thermalChestplateInSlot, EnumExtendedInventorySlot.THERMAL_CHESTPLATE); + int gearID = GalacticraftRegistry.findMatchingGearID(stats.getThermalChestplateInSlot(), EnumExtendedInventorySlot.THERMAL_CHESTPLATE); if (gearID >= 0) { @@ -411,23 +417,23 @@ else if (armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.ADD && (GCPl } } - GCPlayer.lastThermalChestplateInSlot = GCPlayer.thermalChestplateInSlot; + stats.setLastThermalChestplateInSlot(stats.getThermalChestplateInSlot()); } - if (GCPlayer.thermalLeggingsInSlot != GCPlayer.lastThermalLeggingsInSlot || forceSend) + if (stats.getThermalLeggingsInSlot() != stats.getLastThermalLeggingsInSlot() || forceSend) { - ThermalArmorEvent armorEvent = new ThermalArmorEvent(2, GCPlayer.thermalLeggingsInSlot); + ThermalArmorEvent armorEvent = new ThermalArmorEvent(2, stats.getThermalLeggingsInSlot()); MinecraftForge.EVENT_BUS.post(armorEvent); if (armorEvent.armorResult != ThermalArmorEvent.ArmorAddResult.NOTHING) { - if (GCPlayer.thermalLeggingsInSlot == null || armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.REMOVE) + if (stats.getThermalLeggingsInSlot() == null || armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.REMOVE) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.REMOVE, EnumExtendedInventorySlot.THERMAL_LEGGINGS); } - else if (armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.ADD && (GCPlayer.lastThermalLeggingsInSlot == null || forceSend)) + else if (armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.ADD && (stats.getLastThermalLeggingsInSlot() == null || forceSend)) { - int gearID = GalacticraftRegistry.findMatchingGearID(GCPlayer.thermalLeggingsInSlot, EnumExtendedInventorySlot.THERMAL_LEGGINGS); + int gearID = GalacticraftRegistry.findMatchingGearID(stats.getThermalLeggingsInSlot(), EnumExtendedInventorySlot.THERMAL_LEGGINGS); if (gearID >= 0) { @@ -436,23 +442,23 @@ else if (armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.ADD && (GCPl } } - GCPlayer.lastThermalLeggingsInSlot = GCPlayer.thermalLeggingsInSlot; + stats.setLastThermalLeggingsInSlot(stats.getThermalLeggingsInSlot()); } - if (GCPlayer.thermalBootsInSlot != GCPlayer.lastThermalBootsInSlot || forceSend) + if (stats.getThermalBootsInSlot() != stats.getLastThermalBootsInSlot() || forceSend) { - ThermalArmorEvent armorEvent = new ThermalArmorEvent(3, GCPlayer.thermalBootsInSlot); + ThermalArmorEvent armorEvent = new ThermalArmorEvent(3, stats.getThermalBootsInSlot()); MinecraftForge.EVENT_BUS.post(armorEvent); if (armorEvent.armorResult != ThermalArmorEvent.ArmorAddResult.NOTHING) { - if (GCPlayer.thermalBootsInSlot == null || armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.REMOVE) + if (stats.getThermalBootsInSlot() == null || armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.REMOVE) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.REMOVE, EnumExtendedInventorySlot.THERMAL_BOOTS); } - else if (armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.ADD && (GCPlayer.lastThermalBootsInSlot == null || forceSend)) + else if (armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.ADD && (stats.getLastThermalBootsInSlot() == null || forceSend)) { - int gearID = GalacticraftRegistry.findMatchingGearID(GCPlayer.thermalBootsInSlot, EnumExtendedInventorySlot.THERMAL_BOOTS); + int gearID = GalacticraftRegistry.findMatchingGearID(stats.getThermalBootsInSlot(), EnumExtendedInventorySlot.THERMAL_BOOTS); if (gearID >= 0) { @@ -461,18 +467,18 @@ else if (armorEvent.armorResult == ThermalArmorEvent.ArmorAddResult.ADD && (GCPl } } - GCPlayer.lastThermalBootsInSlot = GCPlayer.thermalBootsInSlot; + stats.setLastThermalBootsInSlot(stats.getThermalBootsInSlot()); } - if ((GCPlayer.shieldControllerInSlot != GCPlayer.lastShieldControllerInSlot || forceSend) && GalacticraftCore.isPlanetsLoaded) + if ((stats.getShieldControllerInSlot() != stats.getLastShieldControllerInSlot() || forceSend) && GalacticraftCore.isPlanetsLoaded) { - if (GCPlayer.shieldControllerInSlot == null) + if (stats.getShieldControllerInSlot() == null) { GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.REMOVE, EnumExtendedInventorySlot.SHIELD_CONTROLLER); } - else if (GCPlayer.shieldControllerInSlot.getItem() == VenusItems.basicItem && (GCPlayer.lastShieldControllerInSlot == null || forceSend)) + else if (stats.getShieldControllerInSlot().getItem() == VenusItems.basicItem && (stats.getLastShieldControllerInSlot() == null || forceSend)) { - int gearID = GalacticraftRegistry.findMatchingGearID(GCPlayer.shieldControllerInSlot, EnumExtendedInventorySlot.SHIELD_CONTROLLER); + int gearID = GalacticraftRegistry.findMatchingGearID(stats.getShieldControllerInSlot(), EnumExtendedInventorySlot.SHIELD_CONTROLLER); if (gearID >= 0) { @@ -480,18 +486,18 @@ else if (GCPlayer.shieldControllerInSlot.getItem() == VenusItems.basicItem && (G } } - GCPlayer.lastShieldControllerInSlot = GCPlayer.shieldControllerInSlot; + stats.setLastShieldControllerInSlot(stats.getShieldControllerInSlot()); } } - protected void checkThermalStatus(EntityPlayerMP player, GCPlayerStats playerStats) + protected void checkThermalStatus(EntityPlayerMP player, IStatsCapability playerStats) { if (player.worldObj.provider instanceof IGalacticraftWorldProvider && !player.capabilities.isCreativeMode) { - final ItemStack thermalPaddingHelm = playerStats.extendedInventory.getStackInSlot(6); - final ItemStack thermalPaddingChestplate = playerStats.extendedInventory.getStackInSlot(7); - final ItemStack thermalPaddingLeggings = playerStats.extendedInventory.getStackInSlot(8); - final ItemStack thermalPaddingBoots = playerStats.extendedInventory.getStackInSlot(9); + final ItemStack thermalPaddingHelm = playerStats.getExtendedInventory().getStackInSlot(6); + final ItemStack thermalPaddingChestplate = playerStats.getExtendedInventory().getStackInSlot(7); + final ItemStack thermalPaddingLeggings = playerStats.getExtendedInventory().getStackInSlot(8); + final ItemStack thermalPaddingBoots = playerStats.getExtendedInventory().getStackInSlot(9); float lowestThermalStrength = 0.0F; if (thermalPaddingHelm != null && thermalPaddingChestplate != null && thermalPaddingLeggings != null && thermalPaddingBoots != null) { @@ -546,7 +552,7 @@ protected void checkThermalStatus(EntityPlayerMP player, GCPlayerStats playerSta if (OxygenUtil.isAABBInBreathableAirBlock(player, true)) { - playerStats.thermalLevelNormalising = true; + playerStats.setThermalLevelNormalising(true); this.normaliseThermalLevel(player, playerStats, 1); // If player is in ambient thermal area, slowly reset to normal return; @@ -580,84 +586,84 @@ protected void checkThermalStatus(EntityPlayerMP player, GCPlayerStats playerSta if ((player.ticksExisted - 1) % thermalLevelTickCooldownSingle == 0) { - int last = playerStats.thermalLevel; - playerStats.thermalLevel = (int) Math.min(Math.max(playerStats.thermalLevel + (thermalLevelMod < 0 ? -1 : 1), -22), 22); + int last = playerStats.getThermalLevel(); + playerStats.setThermalLevel((int) Math.min(Math.max(last + (thermalLevelMod < 0 ? -1 : 1), -22), 22)); - if (playerStats.thermalLevel != last) + if (playerStats.getThermalLevel() != last) { this.sendThermalLevelPacket(player, playerStats); } } // If the normalisation is outpacing the freeze/overheat - playerStats.thermalLevelNormalising = thermalLevelTickCooldownSingle > normaliseCooldown && + playerStats.setThermalLevelNormalising(thermalLevelTickCooldownSingle > normaliseCooldown && thermalPaddingHelm != null && thermalPaddingChestplate != null && thermalPaddingLeggings != null && - thermalPaddingBoots != null; + thermalPaddingBoots != null); - if (!playerStats.thermalLevelNormalising) + if (!playerStats.isThermalLevelNormalising()) { if ((player.ticksExisted - 1) % thermalLevelTickCooldown == 0) { - if (Math.abs(playerStats.thermalLevel) >= 22) + if (Math.abs(playerStats.getThermalLevel()) >= 22) { player.attackEntityFrom(DamageSourceGC.thermal, 1.5F); } } - if (playerStats.thermalLevel < -15) + if (playerStats.getThermalLevel() < -15) { - player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 5, 2, true, true)); + player.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 5, 2, true, true)); } - if (playerStats.thermalLevel > 15) + if (playerStats.getThermalLevel() > 15) { - player.addPotionEffect(new PotionEffect(Potion.confusion.id, 5, 2, true, true)); + player.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 5, 2, true, true)); } } } else //Normalise thermal level if on Space Station or non-modifier planet { - playerStats.thermalLevelNormalising = true; + playerStats.setThermalLevelNormalising(true); this.normaliseThermalLevel(player, playerStats, 2); } } else //Normalise thermal level if on Overworld or any non-GC dimension { - playerStats.thermalLevelNormalising = true; + playerStats.setThermalLevelNormalising(true); this.normaliseThermalLevel(player, playerStats, 3); } } - public void normaliseThermalLevel(EntityPlayerMP player, GCPlayerStats playerStats, int increment) + public void normaliseThermalLevel(EntityPlayerMP player, IStatsCapability playerStats, int increment) { - final int last = playerStats.thermalLevel; + final int last = playerStats.getThermalLevel(); - if (playerStats.thermalLevel < 0) + if (playerStats.getThermalLevel() < 0) { - playerStats.thermalLevel += Math.min(increment, -playerStats.thermalLevel); + playerStats.setThermalLevel(playerStats.getThermalLevel() + Math.min(increment, -playerStats.getThermalLevel())); } - else if (playerStats.thermalLevel > 0) + else if (playerStats.getThermalLevel() > 0) { - playerStats.thermalLevel -= Math.min(increment, playerStats.thermalLevel); + playerStats.setThermalLevel(playerStats.getThermalLevel() - Math.min(increment, playerStats.getThermalLevel())); } - if (playerStats.thermalLevel != last) + if (playerStats.getThermalLevel() != last) { this.sendThermalLevelPacket(player, playerStats); } } - protected void checkShield(EntityPlayerMP playerMP, GCPlayerStats playerStats) + protected void checkShield(EntityPlayerMP playerMP, IStatsCapability playerStats) { if (playerMP.ticksExisted % 20 == 0 && playerMP.worldObj.provider instanceof IGalacticraftWorldProvider) { if (((IGalacticraftWorldProvider) playerMP.worldObj.provider).shouldCorrodeArmor()) { - ItemStack shieldController = playerStats.extendedInventory.getStackInSlot(10); + ItemStack shieldController = playerStats.getExtendedInventory().getStackInSlot(10); boolean valid = false; if (shieldController != null) @@ -672,61 +678,66 @@ protected void checkShield(EntityPlayerMP playerMP, GCPlayerStats playerStats) if (!valid) { - ItemStack armor = playerMP.getCurrentArmor((int) (Math.random() * 4)); - if (armor != null) + for (ItemStack armor : playerMP.getArmorInventoryList()) { - armor.damageItem(1, playerMP); + if (armor.getItem() instanceof ItemArmor) + { + if (armor != null) + { + armor.damageItem(1, playerMP); + } + } } } } } } - protected void checkOxygen(EntityPlayerMP player, GCPlayerStats playerStats) + protected void checkOxygen(EntityPlayerMP player, IStatsCapability playerStats) { if ((player.dimension == 0 || player.worldObj.provider instanceof IGalacticraftWorldProvider) && (!(player.dimension == 0 || ((IGalacticraftWorldProvider) player.worldObj.provider).hasBreathableAtmosphere()) || player.posY > GCPlayerHandler.OXYGENHEIGHTLIMIT) && !player.capabilities.isCreativeMode && !(player.getRidingEntity() instanceof EntityLanderBase) && !(player.getRidingEntity() instanceof EntityAutoRocket) && !(player.getRidingEntity() instanceof EntityCelestialFake)) { - final ItemStack tankInSlot = playerStats.extendedInventory.getStackInSlot(2); - final ItemStack tankInSlot2 = playerStats.extendedInventory.getStackInSlot(3); + final ItemStack tankInSlot = playerStats.getExtendedInventory().getStackInSlot(2); + final ItemStack tankInSlot2 = playerStats.getExtendedInventory().getStackInSlot(3); final int drainSpacing = OxygenUtil.getDrainSpacing(tankInSlot, tankInSlot2); if (tankInSlot == null) { - playerStats.airRemaining = 0; + playerStats.setAirRemaining(0); } else { - playerStats.airRemaining = tankInSlot.getMaxDamage() - tankInSlot.getItemDamage(); + playerStats.setAirRemaining(tankInSlot.getMaxDamage() - tankInSlot.getItemDamage()); } if (tankInSlot2 == null) { - playerStats.airRemaining2 = 0; + playerStats.setAirRemaining2(0); } else { - playerStats.airRemaining2 = tankInSlot2.getMaxDamage() - tankInSlot2.getItemDamage(); + playerStats.setAirRemaining2(tankInSlot2.getMaxDamage() - tankInSlot2.getItemDamage()); } if (drainSpacing > 0) { - if ((player.ticksExisted - 1) % drainSpacing == 0 && !OxygenUtil.isAABBInBreathableAirBlock(player) && !playerStats.usingPlanetSelectionGui) + if ((player.ticksExisted - 1) % drainSpacing == 0 && !OxygenUtil.isAABBInBreathableAirBlock(player) && !playerStats.isUsingPlanetSelectionGui()) { int toTake = 1; //Take 1 oxygen from Tank 1 - if (playerStats.airRemaining > 0) + if (playerStats.getAirRemaining() > 0) { tankInSlot.damageItem(1, player); - playerStats.airRemaining--; + playerStats.setAirRemaining(playerStats.getAirRemaining() - 1); toTake = 0; } //Alternatively, take 1 oxygen from Tank 2 - if (toTake > 0 && playerStats.airRemaining2 > 0) + if (toTake > 0 && playerStats.getAirRemaining2() > 0) { tankInSlot2.damageItem(1, player); - playerStats.airRemaining2--; + playerStats.setAirRemaining2(playerStats.getAirRemaining2() - 1); toTake = 0; } } @@ -737,82 +748,83 @@ protected void checkOxygen(EntityPlayerMP player, GCPlayerStats playerStats) { if (OxygenUtil.isAABBInBreathableAirBlock(player)) { - if (playerStats.airRemaining < 90 && tankInSlot != null) + if (playerStats.getAirRemaining() < 90 && tankInSlot != null) { - playerStats.airRemaining = Math.min(playerStats.airRemaining + 1, tankInSlot.getMaxDamage() - tankInSlot.getItemDamage()); + playerStats.setAirRemaining(Math.min(playerStats.getAirRemaining() + 1, tankInSlot.getMaxDamage() - tankInSlot.getItemDamage())); } - if (playerStats.airRemaining2 < 90 && tankInSlot2 != null) + if (playerStats.getAirRemaining2() < 90 && tankInSlot2 != null) { - playerStats.airRemaining2 = Math.min(playerStats.airRemaining2 + 1, tankInSlot2.getMaxDamage() - tankInSlot2.getItemDamage()); + playerStats.setAirRemaining2(Math.min(playerStats.getAirRemaining2() + 1, tankInSlot2.getMaxDamage() - tankInSlot2.getItemDamage())); } } else { - if (playerStats.airRemaining > 0) + if (playerStats.getAirRemaining() > 0) { - playerStats.airRemaining--; + playerStats.setAirRemaining(playerStats.getAirRemaining() - 1); } - if (playerStats.airRemaining2 > 0) + if (playerStats.getAirRemaining2() > 0) { - playerStats.airRemaining2--; + playerStats.setAirRemaining2(playerStats.getAirRemaining2() - 1); } } } } - final boolean airEmpty = playerStats.airRemaining <= 0 && playerStats.airRemaining2 <= 0; + final boolean airEmpty = playerStats.getAirRemaining() <= 0 && playerStats.getAirRemaining2() <= 0; if (player.isOnLadder()) { - playerStats.oxygenSetupValid = playerStats.lastOxygenSetupValid; + playerStats.setOxygenSetupValid(playerStats.isLastOxygenSetupValid()); } else { - playerStats.oxygenSetupValid = !((!OxygenUtil.hasValidOxygenSetup(player) || airEmpty) && !OxygenUtil.isAABBInBreathableAirBlock(player)); + playerStats.setOxygenSetupValid(!((!OxygenUtil.hasValidOxygenSetup(player) || airEmpty) && !OxygenUtil.isAABBInBreathableAirBlock(player))); } if (!player.worldObj.isRemote && player.isEntityAlive()) { - if (!playerStats.oxygenSetupValid) + if (!playerStats.isOxygenSetupValid()) { GCCoreOxygenSuffocationEvent suffocationEvent = new GCCoreOxygenSuffocationEvent.Pre(player); MinecraftForge.EVENT_BUS.post(suffocationEvent); if (!suffocationEvent.isCanceled()) { - if (playerStats.damageCounter == 0) + if (playerStats.getDamageCounter() == 0) { - playerStats.damageCounter = ConfigManagerCore.suffocationCooldown; + playerStats.setDamageCounter(ConfigManagerCore.suffocationCooldown); - player.attackEntityFrom(DamageSourceGC.oxygenSuffocation, ConfigManagerCore.suffocationDamage * (2 + playerStats.incrementalDamage) / 2); - if (ConfigManagerCore.hardMode) playerStats.incrementalDamage++; + player.attackEntityFrom(DamageSourceGC.oxygenSuffocation, ConfigManagerCore.suffocationDamage * (2 + playerStats.getIncrementalDamage()) / 2); + if (ConfigManagerCore.hardMode) + playerStats.setIncrementalDamage(playerStats.getIncrementalDamage() + 1); GCCoreOxygenSuffocationEvent suffocationEventPost = new GCCoreOxygenSuffocationEvent.Post(player); MinecraftForge.EVENT_BUS.post(suffocationEventPost); } } else - playerStats.oxygenSetupValid = true; + playerStats.setOxygenSetupValid(true); } else - playerStats.incrementalDamage = 0; + playerStats.setIncrementalDamage(0); } } - else if ((player.ticksExisted - 1) % 20 == 0 && !player.capabilities.isCreativeMode && playerStats.airRemaining < 90) + else if ((player.ticksExisted - 1) % 20 == 0 && !player.capabilities.isCreativeMode && playerStats.getAirRemaining() < 90) { - playerStats.airRemaining += 1; - playerStats.airRemaining2 += 1; + playerStats.setAirRemaining(playerStats.getAirRemaining() + 1); + playerStats.setAirRemaining2(playerStats.getAirRemaining2() + 1); } else if (player.capabilities.isCreativeMode) { - playerStats.airRemaining = 90; - playerStats.airRemaining2 = 90; + playerStats.setAirRemaining(90); + playerStats.setAirRemaining2(90); } else { - playerStats.oxygenSetupValid = true; + playerStats.setOxygenSetupValid(true); } } @@ -924,17 +936,17 @@ public void registerTorchType(BlockUnlitTorch spaceTorch, Block vanillaTorch) torchItems.put(itemSpaceTorch, itemVanillaTorch); } - public static void setUsingParachute(EntityPlayerMP player, GCPlayerStats playerStats, boolean tf) + public static void setUsingParachute(EntityPlayerMP player, IStatsCapability playerStats, boolean tf) { - playerStats.usingParachute = tf; + playerStats.setUsingParachute(tf); if (tf) { int subtype = -1; - if (playerStats.parachuteInSlot != null) + if (playerStats.getParachuteInSlot() != null) { - subtype = playerStats.parachuteInSlot.getItemDamage(); + subtype = playerStats.getParachuteInSlot().getItemDamage(); } GCPlayerHandler.sendGearUpdatePacket(player, EnumModelPacketType.ADD, EnumExtendedInventorySlot.PARACHUTE, subtype); @@ -961,16 +973,16 @@ protected static void updateFeet(EntityPlayerMP player, double motionX, double m // And is the correct metadata (moon turf) if (state.getBlock().getMetaFromState(state) == 5) { - GCPlayerStats playerStats = GCPlayerStats.get(player); + IStatsCapability playerStats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); // If it has been long enough since the last step - if (playerStats.distanceSinceLastStep > 0.35D) + if (playerStats.getDistanceSinceLastStep() > 0.35D) { Vector3 pos = new Vector3(player); // Set the footprint position to the block below and add random number to stop z-fighting pos.y = MathHelper.floor_double(player.posY - 1D) + player.worldObj.rand.nextFloat() / 100.0F; // Adjust footprint to left or right depending on step count - switch (playerStats.lastStep) + switch (playerStats.getLastStep()) { case 0: float a = (-player.rotationYaw + 90F) / 57.295779513F; @@ -989,33 +1001,32 @@ protected static void updateFeet(EntityPlayerMP player, double motionX, double m TickHandlerServer.addFootprint(chunkKey, new Footprint(player.worldObj.provider.getDimension(), pos, rotation, player.getName()), player.worldObj.provider.getDimension()); // Increment and cap step counter at 1 - playerStats.lastStep++; - playerStats.lastStep %= 2; - playerStats.distanceSinceLastStep = 0; + playerStats.setLastStep((playerStats.getLastStep() + 1) % 2); + playerStats.setDistanceSinceLastStep(0); } else { - playerStats.distanceSinceLastStep += motionSqrd; + playerStats.setDistanceSinceLastStep(playerStats.getDistanceSinceLastStep() + motionSqrd); } } } } } - protected void updateSchematics(EntityPlayerMP player, GCPlayerStats playerStats) + protected void updateSchematics(EntityPlayerMP player, IStatsCapability playerStats) { SchematicRegistry.addUnlockedPage(player, SchematicRegistry.getMatchingRecipeForID(0)); SchematicRegistry.addUnlockedPage(player, SchematicRegistry.getMatchingRecipeForID(Integer.MAX_VALUE)); - Collections.sort(playerStats.unlockedSchematics); + Collections.sort(playerStats.getUnlockedSchematics()); - if (player.playerNetServerHandler != null && (playerStats.unlockedSchematics.size() != playerStats.lastUnlockedSchematics.size() || (player.ticksExisted - 1) % 100 == 0)) + if (player.connection != null && (playerStats.getUnlockedSchematics().size() != playerStats.getLastUnlockedSchematics().size() || (player.ticksExisted - 1) % 100 == 0)) { - Integer[] iArray = new Integer[playerStats.unlockedSchematics.size()]; + Integer[] iArray = new Integer[playerStats.getUnlockedSchematics().size()]; for (int i = 0; i < iArray.length; i++) { - ISchematicPage page = playerStats.unlockedSchematics.get(i); + ISchematicPage page = playerStats.getUnlockedSchematics().get(i); iArray[i] = page == null ? -2 : page.getPageID(); } @@ -1052,18 +1063,18 @@ public enum ArmorAddResult } - protected void sendPlanetList(EntityPlayerMP player, GCPlayerStats playerStats) + protected void sendPlanetList(EntityPlayerMP player, IStatsCapability playerStats) { HashMap map; if (player.ticksExisted % 50 == 0) //Check for genuine update - e.g. maybe some other player created a space station or changed permissions //CAUTION: possible server load due to dimension loading, if any planets or moons were (contrary to GC default) set to hotload { - map = WorldUtil.getArrayOfPossibleDimensions(playerStats.spaceshipTier, player); + map = WorldUtil.getArrayOfPossibleDimensions(playerStats.getSpaceshipTier(), player); } else { - map = WorldUtil.getArrayOfPossibleDimensionsAgain(playerStats.spaceshipTier, player); + map = WorldUtil.getArrayOfPossibleDimensionsAgain(playerStats.getSpaceshipTier(), player); } String temp = ""; @@ -1075,24 +1086,24 @@ protected void sendPlanetList(EntityPlayerMP player, GCPlayerStats playerStats) count++; } - if (!temp.equals(playerStats.savedPlanetList) || (player.ticksExisted % 100 == 0)) + if (!temp.equals(playerStats.getSavedPlanetList()) || (player.ticksExisted % 100 == 0)) { GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_DIMENSION_LIST, player.worldObj.provider.getDimension(), new Object[] { player.getGameProfile().getName(), temp }), player); - playerStats.savedPlanetList = temp; + playerStats.setSavedPlanetList(temp); //GCLog.debug("Sending to " + player.getGameProfile().getName() + ": " + temp); } } - protected static void sendAirRemainingPacket(EntityPlayerMP player, GCPlayerStats playerStats) + protected static void sendAirRemainingPacket(EntityPlayerMP player, IStatsCapability playerStats) { - final float f1 = playerStats.tankInSlot1 == null ? 0.0F : playerStats.tankInSlot1.getMaxDamage() / 90.0F; - final float f2 = playerStats.tankInSlot2 == null ? 0.0F : playerStats.tankInSlot2.getMaxDamage() / 90.0F; - GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_AIR_REMAINING, player.worldObj.provider.getDimension(), new Object[] { MathHelper.floor_float(playerStats.airRemaining / f1), MathHelper.floor_float(playerStats.airRemaining2 / f2), player.getGameProfile().getName() }), player); + final float f1 = playerStats.getTankInSlot1() == null ? 0.0F : playerStats.getTankInSlot1().getMaxDamage() / 90.0F; + final float f2 = playerStats.getTankInSlot2() == null ? 0.0F : playerStats.getTankInSlot2().getMaxDamage() / 90.0F; + GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_AIR_REMAINING, player.worldObj.provider.getDimension(), new Object[] { MathHelper.floor_float(playerStats.getAirRemaining() / f1), MathHelper.floor_float(playerStats.getAirRemaining2() / f2), player.getGameProfile().getName() }), player); } - protected void sendThermalLevelPacket(EntityPlayerMP player, GCPlayerStats playerStats) + protected void sendThermalLevelPacket(EntityPlayerMP player, IStatsCapability playerStats) { - GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_THERMAL_LEVEL, player.worldObj.provider.getDimension(), new Object[] { playerStats.thermalLevel, playerStats.thermalLevelNormalising }), player); + GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_THERMAL_LEVEL, player.worldObj.provider.getDimension(), new Object[] { playerStats.getThermalLevel(), playerStats.isThermalLevelNormalising() }), player); } public static void sendGearUpdatePacket(EntityPlayerMP player, EnumModelPacketType packetType, EnumExtendedInventorySlot gearType) @@ -1120,13 +1131,13 @@ public void onPlayerUpdate(EntityPlayerMP player) int tick = player.ticksExisted - 1; //This will speed things up a little - final GCPlayerStats GCPlayer = GCPlayerStats.get(player); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); - if ((ConfigManagerCore.challengeMode || ConfigManagerCore.challengeSpawnHandling) && GCPlayer.unlockedSchematics.size() == 0) + if ((ConfigManagerCore.challengeMode || ConfigManagerCore.challengeSpawnHandling) && stats.getUnlockedSchematics().size() == 0) { - if (GCPlayer.startDimension.length() > 0) + if (stats.getStartDimension().length() > 0) { - GCPlayer.startDimension = ""; + stats.setStartDimension(""); } else { @@ -1134,7 +1145,7 @@ public void onPlayerUpdate(EntityPlayerMP player) WorldServer worldOld = (WorldServer) player.worldObj; try { - worldOld.getPlayerManager().removePlayer(player); + worldOld.getPlayerChunkMap().removePlayer(player); } catch (Exception e) { @@ -1154,7 +1165,7 @@ public void onPlayerUpdate(EntityPlayerMP player) int dimID = worldNew.provider.getDimension(); player.dimension = dimID; GCLog.debug("DEBUG: Sending respawn packet to player for dim " + dimID); - player.playerNetServerHandler.sendPacket(new S07PacketRespawn(dimID, player.worldObj.getDifficulty(), player.worldObj.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType())); + player.connection.sendPacket(new SPacketRespawn(dimID, player.worldObj.getDifficulty(), player.worldObj.getWorldInfo().getTerrainType(), player.interactionManager.getGameType())); if (worldNew.provider instanceof WorldProviderZeroGravity) { @@ -1167,20 +1178,20 @@ public void onPlayerUpdate(EntityPlayerMP player) //This is a mini version of the code at WorldUtil.teleportEntity final ITeleportType type = GalacticraftRegistry.getTeleportTypeForDimension(player.worldObj.provider.getClass()); Vector3 spawnPos = type.getPlayerSpawnLocation((WorldServer) player.worldObj, player); - ChunkCoordIntPair pair = player.worldObj.getChunkFromChunkCoords(spawnPos.intX(), spawnPos.intZ()).getChunkCoordIntPair(); + ChunkPos pair = player.worldObj.getChunkFromChunkCoords(spawnPos.intX(), spawnPos.intZ()).getChunkCoordIntPair(); GCLog.debug("Loading first chunk in new dimension."); - ((WorldServer) player.worldObj).theChunkProviderServer.loadChunk(pair.chunkXPos, pair.chunkZPos); + ((WorldServer) player.worldObj).getChunkProvider().loadChunk(pair.chunkXPos, pair.chunkZPos); player.setLocationAndAngles(spawnPos.x, spawnPos.y, spawnPos.z, player.rotationYaw, player.rotationPitch); type.setupAdventureSpawn(player); type.onSpaceDimensionChanged(player.worldObj, player, false); player.setSpawnChunk(new BlockPos(spawnPos.intX(), spawnPos.intY(), spawnPos.intZ()), true, player.worldObj.provider.getDimension()); - GCPlayer.newAdventureSpawn = true; + stats.setNewAdventureSpawn(true); } final boolean isInGCDimension = player.worldObj.provider instanceof IGalacticraftWorldProvider; if (tick >= 25) { - if (ConfigManagerCore.enableSpaceRaceManagerPopup && !GCPlayer.openedSpaceRaceManager) + if (ConfigManagerCore.enableSpaceRaceManagerPopup && !stats.hasOpenedSpaceRaceManager()) { SpaceRace race = SpaceRaceManager.getSpaceRaceFromPlayer(player.getGameProfile().getName()); @@ -1189,65 +1200,65 @@ public void onPlayerUpdate(EntityPlayerMP player) GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_OPEN_SPACE_RACE_GUI, player.worldObj.provider.getDimension(), new Object[] {}), player); } - GCPlayer.openedSpaceRaceManager = true; + stats.setOpenedSpaceRaceManager(true); } - if (!GCPlayer.sentFlags) + if (!stats.isSentFlags()) { - GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_STATS, player.worldObj.provider.getDimension(), new Object[] { GCPlayer.buildFlags }), player); - GCPlayer.sentFlags = true; + GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_STATS, player.worldObj.provider.getDimension(), new Object[] { stats.getBuildFlags() }), player); + stats.setSentFlags(true); } } - if (GCPlayer.cryogenicChamberCooldown > 0) + if (stats.getCryogenicChamberCooldown() > 0) { - GCPlayer.cryogenicChamberCooldown--; + stats.setCryogenicChamberCooldown(stats.getCryogenicChamberCooldown() - 1); } - if (!player.onGround && GCPlayer.lastOnGround) + if (!player.onGround && stats.isLastOnGround()) { - GCPlayer.touchedGround = true; + stats.setTouchedGround(true); } - if (GCPlayer.teleportCooldown > 0) + if (stats.getTeleportCooldown() > 0) { - GCPlayer.teleportCooldown--; + stats.setTeleportCooldown(stats.getTeleportCooldown() - 1); } - if (GCPlayer.chatCooldown > 0) + if (stats.getChatCooldown() > 0) { - GCPlayer.chatCooldown--; + stats.setChatCooldown(stats.getChatCooldown() - 1); } - if (GCPlayer.openPlanetSelectionGuiCooldown > 0) + if (stats.getOpenPlanetSelectionGuiCooldown() > 0) { - GCPlayer.openPlanetSelectionGuiCooldown--; + stats.setOpenPlanetSelectionGuiCooldown(stats.getOpenPlanetSelectionGuiCooldown() - 1); - if (GCPlayer.openPlanetSelectionGuiCooldown == 1 && !GCPlayer.hasOpenedPlanetSelectionGui) + if (stats.getOpenPlanetSelectionGuiCooldown() == 1 && !stats.hasOpenedPlanetSelectionGui()) { - WorldUtil.toCelestialSelection(player, GCPlayer, GCPlayer.spaceshipTier); - GCPlayer.hasOpenedPlanetSelectionGui = true; + WorldUtil.toCelestialSelection(player, stats, stats.getSpaceshipTier()); + stats.setHasOpenedPlanetSelectionGui(true); } } - if (GCPlayer.usingParachute) + if (stats.isUsingParachute()) { - if (GCPlayer.lastParachuteInSlot != null) + if (stats.getLastParachuteInSlot() != null) { player.fallDistance = 0.0F; } if (player.onGround) { - GCPlayerHandler.setUsingParachute(player, GCPlayer, false); + GCPlayerHandler.setUsingParachute(player, stats, false); } } this.checkCurrentItem(player); - if (GCPlayer.usingPlanetSelectionGui) + if (stats.isUsingPlanetSelectionGui()) { //This sends the planets list again periodically (forcing the Celestial Selection screen to open) in case of server/client lag //#PACKETSPAM - this.sendPlanetList(player, GCPlayer); + this.sendPlanetList(player, stats); } /* if (isInGCDimension || player.usingPlanetSelectionGui) @@ -1255,39 +1266,39 @@ public void onPlayerUpdate(EntityPlayerMP player) player.playerNetServerHandler.ticksForFloatKick = 0; } */ - if (GCPlayer.damageCounter > 0) + if (stats.getDamageCounter() > 0) { - GCPlayer.damageCounter--; + stats.setDamageCounter(stats.getDamageCounter() - 1); } if (isInGCDimension) { if (tick % 30 == 0) { - GCPlayerHandler.sendAirRemainingPacket(player, GCPlayer); - this.sendThermalLevelPacket(player, GCPlayer); + GCPlayerHandler.sendAirRemainingPacket(player, stats); + this.sendThermalLevelPacket(player, stats); } if (player.getRidingEntity() instanceof EntityLanderBase) { - GCPlayer.inLander = true; - GCPlayer.justLanded = false; + stats.setInLander(true); + stats.setJustLanded(false); } else { - if (GCPlayer.inLander) + if (stats.isInLander()) { - GCPlayer.justLanded = true; + stats.setJustLanded(true); } - GCPlayer.inLander = false; + stats.setInLander(false); } - if (player.onGround && GCPlayer.justLanded) + if (player.onGround && stats.hasJustLanded()) { - GCPlayer.justLanded = false; + stats.setJustLanded(false); //Set spawn point here if just descended from a lander for the first time - if (player.getBedLocation(player.worldObj.provider.getDimension()) == null || GCPlayer.newAdventureSpawn) + if (player.getBedLocation(player.worldObj.provider.getDimension()) == null || stats.isNewAdventureSpawn()) { int i = 30000000; int j = Math.min(i, Math.max(-i, MathHelper.floor_double(player.posX + 0.5D))); @@ -1295,7 +1306,7 @@ public void onPlayerUpdate(EntityPlayerMP player) int l = Math.min(i, Math.max(-i, MathHelper.floor_double(player.posZ + 0.5D))); BlockPos coords = new BlockPos(j, k, l); player.setSpawnChunk(coords, true, player.worldObj.provider.getDimension()); - GCPlayer.newAdventureSpawn = false; + stats.setNewAdventureSpawn(false); } GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_RESET_THIRD_PERSON, player.worldObj.provider.getDimension(), new Object[] {}), player); @@ -1304,15 +1315,15 @@ public void onPlayerUpdate(EntityPlayerMP player) if (player.worldObj.provider instanceof WorldProviderZeroGravity) { this.preventFlyingKicks(player); - if (GCPlayer.newInOrbit) + if (stats.isNewInOrbit()) { ((WorldProviderZeroGravity) player.worldObj.provider).getSpinManager().sendPackets(player); - GCPlayer.newInOrbit = false; + stats.setNewInOrbit(false); } } else { - GCPlayer.newInOrbit = true; + stats.setNewInOrbit(true); if (GalacticraftCore.isPlanetsLoaded && player.worldObj.provider instanceof WorldProviderAsteroids) { @@ -1322,23 +1333,23 @@ public void onPlayerUpdate(EntityPlayerMP player) } else { - GCPlayer.newInOrbit = true; + stats.setNewInOrbit(true); } - checkGear(player, GCPlayer, false); + checkGear(player, stats, false); - if (GCPlayer.chestSpawnCooldown > 0) + if (stats.getChestSpawnCooldown() > 0) { - GCPlayer.chestSpawnCooldown--; + stats.setChestSpawnCooldown(stats.getChestSpawnCooldown() - 1); - if (GCPlayer.chestSpawnCooldown == 180) + if (stats.getChestSpawnCooldown() == 180) { - if (GCPlayer.chestSpawnVector != null) + if (stats.getChestSpawnVector() != null) { - EntityParachest chest = new EntityParachest(player.worldObj, GCPlayer.rocketStacks, GCPlayer.fuelLevel); + EntityParachest chest = new EntityParachest(player.worldObj, stats.getRocketStacks(), stats.getFuelLevel()); - chest.setPosition(GCPlayer.chestSpawnVector.x, GCPlayer.chestSpawnVector.y, GCPlayer.chestSpawnVector.z); - chest.color = GCPlayer.parachuteInSlot == null ? EnumDyeColor.WHITE : ItemParaChute.getDyeEnumFromParachuteDamage(GCPlayer.parachuteInSlot.getItemDamage()); + chest.setPosition(stats.getChestSpawnVector().x, stats.getChestSpawnVector().y, stats.getChestSpawnVector().z); + chest.color = stats.getParachuteInSlot() == null ? EnumDyeColor.WHITE : ItemParaChute.getDyeEnumFromParachuteDamage(stats.getParachuteInSlot().getItemDamage()); if (!player.worldObj.isRemote) { @@ -1350,25 +1361,25 @@ public void onPlayerUpdate(EntityPlayerMP player) // - if (GCPlayer.launchAttempts > 0 && player.getRidingEntity() == null) + if (stats.getLaunchAttempts() > 0 && player.getRidingEntity() == null) { - GCPlayer.launchAttempts = 0; + stats.setLaunchAttempts(0); } - this.checkThermalStatus(player, GCPlayer); - this.checkOxygen(player, GCPlayer); - this.checkShield(player, GCPlayer); + this.checkThermalStatus(player, stats); + this.checkOxygen(player, stats); + this.checkShield(player, stats); - if (isInGCDimension && (GCPlayer.oxygenSetupValid != GCPlayer.lastOxygenSetupValid || tick % 100 == 0)) + if (isInGCDimension && (stats.isOxygenSetupValid() != stats.isLastOxygenSetupValid() || tick % 100 == 0)) { - GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_OXYGEN_VALIDITY, player.worldObj.provider.getDimension(), new Object[] { GCPlayer.oxygenSetupValid }), player); + GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_OXYGEN_VALIDITY, player.worldObj.provider.getDimension(), new Object[] { stats.isOxygenSetupValid() }), player); } this.throwMeteors(player); - this.updateSchematics(player, GCPlayer); + this.updateSchematics(player, stats); - if (tick % 250 == 0 && GCPlayer.frequencyModuleInSlot == null && !GCPlayer.receivedSoundWarning && isInGCDimension && player.onGround && tick > 0 && ((IGalacticraftWorldProvider) player.worldObj.provider).getSoundVolReductionAmount() > 1.0F) + if (tick % 250 == 0 && stats.getFrequencyModuleInSlot() == null && !stats.hasReceivedSoundWarning() && isInGCDimension && player.onGround && tick > 0 && ((IGalacticraftWorldProvider) player.worldObj.provider).getSoundVolReductionAmount() > 1.0F) { String[] string2 = GCCoreUtil.translate("gui.frequencymodule.warning1").split(" "); StringBuilder sb = new StringBuilder(); @@ -1377,17 +1388,17 @@ public void onPlayerUpdate(EntityPlayerMP player) sb.append(" ").append(EnumColor.YELLOW).append(aString2); } player.addChatMessage(new TextComponentString(EnumColor.YELLOW + GCCoreUtil.translate("gui.frequencymodule.warning0") + " " + EnumColor.AQUA + GCItems.basicItem.getItemStackDisplayName(new ItemStack(GCItems.basicItem, 1, 19)) + sb.toString())); - GCPlayer.receivedSoundWarning = true; + stats.setReceivedSoundWarning(true); } - GCPlayer.lastOxygenSetupValid = GCPlayer.oxygenSetupValid; - GCPlayer.lastUnlockedSchematics = GCPlayer.unlockedSchematics; - GCPlayer.lastOnGround = player.onGround; + stats.setLastOxygenSetupValid(stats.isOxygenSetupValid()); + stats.setLastUnlockedSchematics(stats.getUnlockedSchematics()); + stats.setLastOnGround(player.onGround); } public void preventFlyingKicks(EntityPlayerMP player) { player.fallDistance = 0.0F; - player.playerNetServerHandler.floatingTickCount = 0; + player.connection.floatingTickCount = 0; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStats.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStats.java index 63d666ba6f..31b5b9698e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStats.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStats.java @@ -1,416 +1,100 @@ -package micdoodle8.mods.galacticraft.core.entities.player; - -import com.google.common.collect.Maps; -import micdoodle8.mods.galacticraft.api.recipe.ISchematicPage; -import micdoodle8.mods.galacticraft.api.recipe.SchematicRegistry; -import micdoodle8.mods.galacticraft.core.GCBlocks; -import micdoodle8.mods.galacticraft.core.command.CommandGCInv; -import micdoodle8.mods.galacticraft.core.inventory.InventoryExtended; -import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; -import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; -import micdoodle8.mods.galacticraft.core.util.GCLog; -import micdoodle8.mods.galacticraft.core.util.WorldUtil; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.TextComponentString; -import net.minecraft.world.World; -import net.minecraftforge.common.IExtendedEntityProperties; - -import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; - -public class GCPlayerStats implements IExtendedEntityProperties -{ - public static final String GC_PLAYER_PROP = "GCPlayerStats"; - - public WeakReference player; - - public InventoryExtended extendedInventory = new InventoryExtended(); - - public int airRemaining; - public int airRemaining2; - - public int thermalLevel; - public boolean thermalLevelNormalising; - - public int damageCounter; - - // temporary data while player is in planet selection GUI - public int spaceshipTier = 1; - public ItemStack[] rocketStacks = new ItemStack[2]; - public int rocketType; - public int fuelLevel; - public Item rocketItem; - public ItemStack launchpadStack; - public int astroMinerCount = 0; - - public boolean usingParachute; - - public ItemStack parachuteInSlot; - public ItemStack lastParachuteInSlot; - - public ItemStack frequencyModuleInSlot; - public ItemStack lastFrequencyModuleInSlot; - - public ItemStack maskInSlot; - public ItemStack lastMaskInSlot; - - public ItemStack gearInSlot; - public ItemStack lastGearInSlot; - - public ItemStack tankInSlot1; - public ItemStack lastTankInSlot1; - - public ItemStack tankInSlot2; - public ItemStack lastTankInSlot2; - - public ItemStack thermalHelmetInSlot; - public ItemStack lastThermalHelmetInSlot; - - public ItemStack thermalChestplateInSlot; - public ItemStack lastThermalChestplateInSlot; - - public ItemStack thermalLeggingsInSlot; - public ItemStack lastThermalLeggingsInSlot; - - public ItemStack thermalBootsInSlot; - public ItemStack lastThermalBootsInSlot; - - public ItemStack shieldControllerInSlot; - public ItemStack lastShieldControllerInSlot; - - public int launchAttempts = 0; - - public int spaceRaceInviteTeamID; - - public boolean usingPlanetSelectionGui; - public String savedPlanetList = ""; - public int openPlanetSelectionGuiCooldown; - public boolean hasOpenedPlanetSelectionGui = false; - - public int chestSpawnCooldown; - public micdoodle8.mods.galacticraft.api.vector.Vector3 chestSpawnVector; - - public int teleportCooldown; - - public int chatCooldown; - - public double distanceSinceLastStep; - public int lastStep; - - public double coordsTeleportedFromX; - public double coordsTeleportedFromZ; - - public HashMap spaceStationDimensionData = Maps.newHashMap(); - - public boolean oxygenSetupValid; - public boolean lastOxygenSetupValid; - - public boolean touchedGround; - public boolean lastOnGround; - public boolean inLander; - public boolean justLanded; - - public ArrayList unlockedSchematics = new ArrayList(); - public ArrayList lastUnlockedSchematics = new ArrayList(); - - public int cryogenicChamberCooldown; - - public boolean receivedSoundWarning; - public boolean receivedBedWarning; - public boolean openedSpaceRaceManager = false; - public boolean sentFlags = false; - public boolean newInOrbit = true; - public boolean newAdventureSpawn; - public int buildFlags = 0; - - public int incrementalDamage = 0; - - public String startDimension = ""; - - public GCPlayerStats(EntityPlayerMP player) - { - this.player = new WeakReference(player); - } - - @Override - public void saveNBTData(NBTTagCompound nbt) - { - nbt.setTag("ExtendedInventoryGC", this.extendedInventory.writeToNBT(new NBTTagList())); - nbt.setInteger("playerAirRemaining", this.airRemaining); - nbt.setInteger("damageCounter", this.damageCounter); - nbt.setBoolean("OxygenSetupValid", this.oxygenSetupValid); - nbt.setBoolean("usingParachute2", this.usingParachute); - nbt.setBoolean("usingPlanetSelectionGui", this.usingPlanetSelectionGui); - nbt.setInteger("teleportCooldown", this.teleportCooldown); - nbt.setDouble("coordsTeleportedFromX", this.coordsTeleportedFromX); - nbt.setDouble("coordsTeleportedFromZ", this.coordsTeleportedFromZ); - nbt.setString("startDimension", this.startDimension); - nbt.setString("spaceStationDimensionInfo", WorldUtil.spaceStationDataToString(this.spaceStationDimensionData)); - nbt.setInteger("thermalLevel", this.thermalLevel); - - Collections.sort(this.unlockedSchematics); - - NBTTagList tagList = new NBTTagList(); - - for (ISchematicPage page : this.unlockedSchematics) - { - if (page != null) - { - final NBTTagCompound nbttagcompound = new NBTTagCompound(); - nbttagcompound.setInteger("UnlockedPage", page.getPageID()); - tagList.appendTag(nbttagcompound); - } - } - - nbt.setTag("Schematics", tagList); - - nbt.setInteger("rocketStacksLength", this.rocketStacks.length); - nbt.setInteger("SpaceshipTier", this.spaceshipTier); - nbt.setInteger("FuelLevel", this.fuelLevel); - if (this.rocketItem != null) - { - ItemStack returnRocket = new ItemStack(this.rocketItem, 1, this.rocketType); - nbt.setTag("ReturnRocket", returnRocket.writeToNBT(new NBTTagCompound())); - } - - final NBTTagList var2 = new NBTTagList(); - - for (int var3 = 0; var3 < this.rocketStacks.length; ++var3) - { - if (this.rocketStacks[var3] != null) - { - final NBTTagCompound var4 = new NBTTagCompound(); - var4.setByte("Slot", (byte) var3); - this.rocketStacks[var3].writeToNBT(var4); - var2.appendTag(var4); - } - } - - nbt.setTag("RocketItems", var2); - final NBTTagCompound var4 = new NBTTagCompound(); - if (this.launchpadStack != null) - { - nbt.setTag("LaunchpadStack", this.launchpadStack.writeToNBT(var4)); - } - else - { - nbt.setTag("LaunchpadStack", var4); - } - - nbt.setInteger("CryogenicChamberCooldown", this.cryogenicChamberCooldown); - nbt.setBoolean("ReceivedSoundWarning", this.receivedSoundWarning); - nbt.setBoolean("ReceivedBedWarning", this.receivedBedWarning); - nbt.setInteger("BuildFlags", this.buildFlags); - nbt.setBoolean("ShownSpaceRace", this.openedSpaceRaceManager); - nbt.setInteger("AstroMinerCount", this.astroMinerCount); - } - - @Override - public void loadNBTData(NBTTagCompound nbt) - { - this.airRemaining = nbt.getInteger("playerAirRemaining"); - this.damageCounter = nbt.getInteger("damageCounter"); - this.oxygenSetupValid = this.lastOxygenSetupValid = nbt.getBoolean("OxygenSetupValid"); - this.thermalLevel = nbt.getInteger("thermalLevel"); - - // Backwards compatibility - NBTTagList nbttaglist = nbt.getTagList("Inventory", 10); - this.extendedInventory.readFromNBTOld(nbttaglist); - - if (nbt.hasKey("ExtendedInventoryGC")) - { - this.extendedInventory.readFromNBT(nbt.getTagList("ExtendedInventoryGC", 10)); - } - - // Added for GCInv command - if tried to load an offline player's - // inventory, load it now - // (if there was no offline load, then the dontload flag in doLoad() - // will make sure nothing happens) - EntityPlayerMP p = this.player.get(); - if (p != null) - { - ItemStack[] saveinv = CommandGCInv.getSaveData(p.getGameProfile().getName().toLowerCase()); - if (saveinv != null) - { - CommandGCInv.doLoad(p); - } - } - - if (nbt.hasKey("SpaceshipTier")) - { - this.spaceshipTier = nbt.getInteger("SpaceshipTier"); - } - - //New keys in version 3.0.5.220 - if (nbt.hasKey("FuelLevel")) - { - this.fuelLevel = nbt.getInteger("FuelLevel"); - } - if (nbt.hasKey("ReturnRocket")) - { - ItemStack returnRocket = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("ReturnRocket")); - if (returnRocket != null) - { - this.rocketItem = returnRocket.getItem(); - this.rocketType = returnRocket.getItemDamage(); - } - } - - this.usingParachute = nbt.getBoolean("usingParachute2"); - this.usingPlanetSelectionGui = nbt.getBoolean("usingPlanetSelectionGui"); - this.teleportCooldown = nbt.getInteger("teleportCooldown"); - this.coordsTeleportedFromX = nbt.getDouble("coordsTeleportedFromX"); - this.coordsTeleportedFromZ = nbt.getDouble("coordsTeleportedFromZ"); - this.startDimension = nbt.hasKey("startDimension") ? nbt.getString("startDimension") : ""; - if (nbt.hasKey("spaceStationDimensionID")) - { - // If loading from an old save file, the home space station is always the overworld, so use 0 as home planet - this.spaceStationDimensionData = WorldUtil.stringToSpaceStationData("0$" + nbt.getInteger("spaceStationDimensionID")); - } - else - { - this.spaceStationDimensionData = WorldUtil.stringToSpaceStationData(nbt.getString("spaceStationDimensionInfo")); - } - - if (nbt.getBoolean("usingPlanetSelectionGui")) - { - this.openPlanetSelectionGuiCooldown = 20; - } - - if (nbt.hasKey("RocketItems") && nbt.hasKey("rocketStacksLength")) - { - final NBTTagList var23 = nbt.getTagList("RocketItems", 10); - int length = nbt.getInteger("rocketStacksLength"); - - this.rocketStacks = new ItemStack[length]; - - for (int var3 = 0; var3 < var23.tagCount(); ++var3) - { - final NBTTagCompound var4 = var23.getCompoundTagAt(var3); - final int var5 = var4.getByte("Slot") & 255; - - if (var5 < this.rocketStacks.length) - { - this.rocketStacks[var5] = ItemStack.loadItemStackFromNBT(var4); - } - } - } - - this.unlockedSchematics = new ArrayList(); - - if (p != null) - { - for (int i = 0; i < nbt.getTagList("Schematics", 10).tagCount(); ++i) - { - final NBTTagCompound nbttagcompound = nbt.getTagList("Schematics", 10).getCompoundTagAt(i); - - final int j = nbttagcompound.getInteger("UnlockedPage"); - - SchematicRegistry.addUnlockedPage(p, SchematicRegistry.getMatchingRecipeForID(j)); - } - } - - Collections.sort(this.unlockedSchematics); - - this.cryogenicChamberCooldown = nbt.getInteger("CryogenicChamberCooldown"); - - if (nbt.hasKey("ReceivedSoundWarning")) - { - this.receivedSoundWarning = nbt.getBoolean("ReceivedSoundWarning"); - } - if (nbt.hasKey("ReceivedBedWarning")) - { - this.receivedBedWarning = nbt.getBoolean("ReceivedBedWarning"); - } - - if (nbt.hasKey("LaunchpadStack")) - { - this.launchpadStack = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("LaunchpadStack")); - if (this.launchpadStack != null && this.launchpadStack.stackSize == 0) - { - this.launchpadStack = null; - } - } - else - { - // for backwards compatibility with saves which don't have this tag - players can't lose launchpads - this.launchpadStack = new ItemStack(GCBlocks.landingPad, 9, 0); - } - - if (nbt.hasKey("BuildFlags")) - { - this.buildFlags = nbt.getInteger("BuildFlags"); - } - - if (nbt.hasKey("ShownSpaceRace")) - { - this.openedSpaceRaceManager = nbt.getBoolean("ShownSpaceRace"); - } - - if (nbt.hasKey("AstroMinerCount")) - { - this.astroMinerCount = nbt.getInteger("AstroMinerCount"); - } - - this.sentFlags = false; - if (ConfigManagerCore.enableDebug) - { - GCLog.info("Loading GC player data for " + player.get().getGameProfile().getName() + " : " + this.buildFlags); - } - } - - @Override - public void init(Entity entity, World world) - { - } - - public static void register(EntityPlayerMP player) - { - player.registerExtendedProperties(GCPlayerStats.GC_PLAYER_PROP, new GCPlayerStats(player)); - } - - public static GCPlayerStats get(EntityPlayerMP player) - { - return (GCPlayerStats) player.getExtendedProperties(GCPlayerStats.GC_PLAYER_PROP); - } - - public static void tryBedWarning(EntityPlayerMP player) - { - final GCPlayerStats GCPlayer = GCPlayerStats.get(player); - if (!GCPlayer.receivedBedWarning) - { - player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.bed_fail.message"))); - GCPlayer.receivedBedWarning = true; - } - } - - public void copyFrom(GCPlayerStats oldData, boolean keepInv) - { - if (keepInv) - { - this.extendedInventory.copyInventory(oldData.extendedInventory); - } - - this.spaceStationDimensionData = oldData.spaceStationDimensionData; - this.unlockedSchematics = oldData.unlockedSchematics; - this.receivedSoundWarning = oldData.receivedSoundWarning; - this.receivedBedWarning = oldData.receivedBedWarning; - this.openedSpaceRaceManager = oldData.openedSpaceRaceManager; - this.spaceRaceInviteTeamID = oldData.spaceRaceInviteTeamID; - this.buildFlags = oldData.buildFlags; - this.astroMinerCount = oldData.astroMinerCount; - this.sentFlags = false; - } - - public void startAdventure(String worldName) - { - this.startDimension = worldName; - } -} +//package micdoodle8.mods.galacticraft.core.entities.player; +// +//import micdoodle8.mods.galacticraft.api.recipe.ISchematicPage; +//import micdoodle8.mods.galacticraft.api.recipe.SchematicRegistry; +//import micdoodle8.mods.galacticraft.core.Constants; +//import micdoodle8.mods.galacticraft.core.GCBlocks; +//import micdoodle8.mods.galacticraft.core.command.CommandGCInv; +//import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; +//import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; +//import micdoodle8.mods.galacticraft.core.util.GCLog; +//import micdoodle8.mods.galacticraft.core.util.WorldUtil; +//import net.minecraft.entity.Entity; +//import net.minecraft.entity.player.EntityPlayerMP; +//import net.minecraft.item.ItemStack; +//import net.minecraft.nbt.NBTBase; +//import net.minecraft.nbt.NBTTagCompound; +//import net.minecraft.nbt.NBTTagList; +//import net.minecraft.util.EnumFacing; +//import net.minecraft.util.ResourceLocation; +//import net.minecraft.util.TextComponentString; +//import net.minecraft.world.World; +//import net.minecraftforge.common.IExtendedEntityProperties; +//import net.minecraftforge.common.capabilities.Capability; +// +//import java.lang.ref.WeakReference; +//import java.util.ArrayList; +//import java.util.Collections; +// +//public class GCPlayerStats implements Capability.IStorage +//{ +// public static final ResourceLocation GC_PLAYER_PROP = new ResourceLocation(Constants.ASSET_PREFIX, "player_stats"); +// +// +// public GCPlayerStats(EntityPlayerMP player) +// { +// this.player = new WeakReference(player); +// } +// +// @Override +// public NBTBase writeNBT(Capability capability, IStatsCapability instance, EnumFacing side) +// { +// NBTTagCompound nbt = new NBTTagCompound(); +// instance.saveNBTData(nbt); +// return nbt; +// } +// +// @Override +// public void readNBT(Capability capability, IStatsCapability instance, EnumFacing side, NBTBase nbt) +// { +// instance.loadNBTData((NBTTagCompound) nbt); +// } +// +// @Override +// public void init(Entity entity, World world) +// { +// } +// +// public static void register(EntityPlayerMP player) +// { +// player.registerExtendedProperties(GCPlayerStats.GC_PLAYER_PROP, new GCPlayerStats(player)); +// } +// +// public static GCPlayerStats get(EntityPlayerMP player) +// { +// return (GCPlayerStats) player.getExtendedProperties(GCPlayerStats.GC_PLAYER_PROP); +// } +// +// public static void tryBedWarning(EntityPlayerMP player) +// { +// final GCPlayerStats GCPlayer = GCPlayerStats.get(player); +// if (!GCPlayer.receivedBedWarning) +// { +// player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.bed_fail.message"))); +// GCPlayer.receivedBedWarning = true; +// } +// } +//// +//// public void copyFrom(GCPlayerStats oldData, boolean keepInv) +//// { +//// if (keepInv) +//// { +//// this.extendedInventory.copyInventory(oldData.extendedInventory); +//// } +//// +//// this.spaceStationDimensionData = oldData.spaceStationDimensionData; +//// this.unlockedSchematics = oldData.unlockedSchematics; +//// this.receivedSoundWarning = oldData.receivedSoundWarning; +//// this.receivedBedWarning = oldData.receivedBedWarning; +//// this.openedSpaceRaceManager = oldData.openedSpaceRaceManager; +//// this.spaceRaceInviteTeamID = oldData.spaceRaceInviteTeamID; +//// this.buildFlags = oldData.buildFlags; +//// this.astroMinerCount = oldData.astroMinerCount; +//// this.sentFlags = false; +//// } +// +// public void startAdventure(String worldName) +// { +// this.startDimension = worldName; +// } +//} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java index 851548efb9..90ec63f471 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java @@ -1,19 +1,20 @@ package micdoodle8.mods.galacticraft.core.entities.player; import micdoodle8.mods.galacticraft.api.recipe.ISchematicPage; +import micdoodle8.mods.galacticraft.core.Constants; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; -import net.minecraftforge.common.IExtendedEntityProperties; import java.lang.ref.WeakReference; import java.util.ArrayList; public class GCPlayerStatsClient implements IExtendedEntityProperties { - public static final String GC_PLAYER_PROP = "GCPlayerStatsClient"; + public static final ResourceLocation GC_PLAYER_PROP = new ResourceLocation(Constants.ASSET_PREFIX, "player_stats_client"); public WeakReference player; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IStatsCapability.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IStatsCapability.java new file mode 100644 index 0000000000..6cfc49091f --- /dev/null +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IStatsCapability.java @@ -0,0 +1,302 @@ +package micdoodle8.mods.galacticraft.core.entities.player; + +import micdoodle8.mods.galacticraft.api.recipe.ISchematicPage; +import micdoodle8.mods.galacticraft.api.vector.Vector3; +import micdoodle8.mods.galacticraft.core.inventory.InventoryExtended; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import java.lang.ref.WeakReference; +import java.util.ArrayList; +import java.util.HashMap; + +public interface IStatsCapability +{ + void saveNBTData(NBTTagCompound nbt); + + void loadNBTData(NBTTagCompound nbt); + + void copyFrom(IStatsCapability oldData, boolean keepInv); + + WeakReference getPlayer(); + + void setPlayer(WeakReference player); + + InventoryExtended getExtendedInventory(); + + void setExtendedInventory(InventoryExtended extendedInventory); + + int getAirRemaining(); + + void setAirRemaining(int airRemaining); + + int getAirRemaining2(); + + void setAirRemaining2(int airRemaining2); + + int getThermalLevel(); + + void setThermalLevel(int thermalLevel); + + boolean isThermalLevelNormalising(); + + void setThermalLevelNormalising(boolean thermalLevelNormalising); + + int getDamageCounter(); + + void setDamageCounter(int damageCounter); + + int getSpaceshipTier(); + + void setSpaceshipTier(int spaceshipTier); + + ItemStack[] getRocketStacks(); + + void setRocketStacks(ItemStack[] rocketStacks); + + int getRocketType(); + + void setRocketType(int rocketType); + + int getFuelLevel(); + + void setFuelLevel(int fuelLevel); + + Item getRocketItem(); + + void setRocketItem(Item rocketItem); + + ItemStack getLaunchpadStack(); + + void setLaunchpadStack(ItemStack launchpadStack); + + int getAstroMinerCount(); + + void setAstroMinerCount(int astroMinerCount); + + boolean isUsingParachute(); + + void setUsingParachute(boolean usingParachute); + + ItemStack getParachuteInSlot(); + + void setParachuteInSlot(ItemStack parachuteInSlot); + + ItemStack getLastParachuteInSlot(); + + void setLastParachuteInSlot(ItemStack lastParachuteInSlot); + + ItemStack getFrequencyModuleInSlot(); + + void setFrequencyModuleInSlot(ItemStack frequencyModuleInSlot); + + ItemStack getLastFrequencyModuleInSlot(); + + void setLastFrequencyModuleInSlot(ItemStack lastFrequencyModuleInSlot); + + ItemStack getMaskInSlot(); + + void setMaskInSlot(ItemStack maskInSlot); + + ItemStack getLastMaskInSlot(); + + void setLastMaskInSlot(ItemStack lastMaskInSlot); + + ItemStack getGearInSlot(); + + void setGearInSlot(ItemStack gearInSlot); + + ItemStack getLastGearInSlot(); + + void setLastGearInSlot(ItemStack lastGearInSlot); + + ItemStack getTankInSlot1(); + + void setTankInSlot1(ItemStack tankInSlot1); + + ItemStack getLastTankInSlot1(); + + void setLastTankInSlot1(ItemStack lastTankInSlot1); + + ItemStack getTankInSlot2(); + + void setTankInSlot2(ItemStack tankInSlot2); + + ItemStack getLastTankInSlot2(); + + void setLastTankInSlot2(ItemStack lastTankInSlot2); + + ItemStack getThermalHelmetInSlot(); + + void setThermalHelmetInSlot(ItemStack thermalHelmetInSlot); + + ItemStack getLastThermalHelmetInSlot(); + + void setLastThermalHelmetInSlot(ItemStack lastThermalHelmetInSlot); + + ItemStack getThermalChestplateInSlot(); + + void setThermalChestplateInSlot(ItemStack thermalChestplateInSlot); + + ItemStack getLastThermalChestplateInSlot(); + + void setLastThermalChestplateInSlot(ItemStack lastThermalChestplateInSlot); + + ItemStack getThermalLeggingsInSlot(); + + void setThermalLeggingsInSlot(ItemStack thermalLeggingsInSlot); + + ItemStack getLastThermalLeggingsInSlot(); + + void setLastThermalLeggingsInSlot(ItemStack lastThermalLeggingsInSlot); + + ItemStack getThermalBootsInSlot(); + + void setThermalBootsInSlot(ItemStack thermalBootsInSlot); + + ItemStack getLastThermalBootsInSlot(); + + void setLastThermalBootsInSlot(ItemStack lastThermalBootsInSlot); + + ItemStack getShieldControllerInSlot(); + + void setShieldControllerInSlot(ItemStack shieldControllerInSlot); + + ItemStack getLastShieldControllerInSlot(); + + void setLastShieldControllerInSlot(ItemStack lastShieldControllerInSlot); + + int getLaunchAttempts(); + + void setLaunchAttempts(int launchAttempts); + + int getSpaceRaceInviteTeamID(); + + void setSpaceRaceInviteTeamID(int spaceRaceInviteTeamID); + + boolean isUsingPlanetSelectionGui(); + + void setUsingPlanetSelectionGui(boolean usingPlanetSelectionGui); + + String getSavedPlanetList(); + + void setSavedPlanetList(String savedPlanetList); + + int getOpenPlanetSelectionGuiCooldown(); + + void setOpenPlanetSelectionGuiCooldown(int openPlanetSelectionGuiCooldown); + + boolean hasOpenedPlanetSelectionGui(); + + void setHasOpenedPlanetSelectionGui(boolean hasOpenedPlanetSelectionGui); + + int getChestSpawnCooldown(); + + void setChestSpawnCooldown(int chestSpawnCooldown); + + Vector3 getChestSpawnVector(); + + void setChestSpawnVector(Vector3 chestSpawnVector); + + int getTeleportCooldown(); + + void setTeleportCooldown(int teleportCooldown); + + int getChatCooldown(); + + void setChatCooldown(int chatCooldown); + + double getDistanceSinceLastStep(); + + void setDistanceSinceLastStep(double distanceSinceLastStep); + + int getLastStep(); + + void setLastStep(int lastStep); + + double getCoordsTeleportedFromX(); + + void setCoordsTeleportedFromX(double coordsTeleportedFromX); + + double getCoordsTeleportedFromZ(); + + void setCoordsTeleportedFromZ(double coordsTeleportedFromZ); + + HashMap getSpaceStationDimensionData(); + + void setSpaceStationDimensionData(HashMap spaceStationDimensionData); + + boolean isOxygenSetupValid(); + + void setOxygenSetupValid(boolean oxygenSetupValid); + + boolean isLastOxygenSetupValid(); + + void setLastOxygenSetupValid(boolean lastOxygenSetupValid); + + boolean isTouchedGround(); + + void setTouchedGround(boolean touchedGround); + + boolean isLastOnGround(); + + void setLastOnGround(boolean lastOnGround); + + boolean isInLander(); + + void setInLander(boolean inLander); + + boolean hasJustLanded(); + + void setJustLanded(boolean justLanded); + + ArrayList getUnlockedSchematics(); + + void setUnlockedSchematics(ArrayList unlockedSchematics); + + ArrayList getLastUnlockedSchematics(); + + void setLastUnlockedSchematics(ArrayList lastUnlockedSchematics); + + int getCryogenicChamberCooldown(); + + void setCryogenicChamberCooldown(int cryogenicChamberCooldown); + + boolean hasReceivedSoundWarning(); + + void setReceivedSoundWarning(boolean receivedSoundWarning); + + boolean hasReceivedBedWarning(); + + void setReceivedBedWarning(boolean receivedBedWarning); + + boolean hasOpenedSpaceRaceManager(); + + void setOpenedSpaceRaceManager(boolean openedSpaceRaceManager); + + boolean isSentFlags(); + + void setSentFlags(boolean sentFlags); + + boolean isNewInOrbit(); + + void setNewInOrbit(boolean newInOrbit); + + boolean isNewAdventureSpawn(); + + void setNewAdventureSpawn(boolean newAdventureSpawn); + + int getBuildFlags(); + + void setBuildFlags(int buildFlags); + + int getIncrementalDamage(); + + void setIncrementalDamage(int incrementalDamage); + + String getStartDimension(); + + void setStartDimension(String startDimension); +} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java index 5d3b1aff3c..db80d6b21d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java @@ -369,19 +369,19 @@ public void onBuild(int i, EntityPlayerSP player) case 1: case 2: case 3: - player.addChatMessage(IChatComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.help1") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/1" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/1" + "\"}}]")); + player.addChatMessage(ITextComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.help1") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/1" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/1" + "\"}}]")); player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.help1a") + EnumColor.AQUA + " /gchelp")); break; case 4: case 5: case 6: - player.addChatMessage(IChatComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.help2") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/2" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/2" + "\"}}]")); + player.addChatMessage(ITextComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.help2") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/2" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/2" + "\"}}]")); break; case 7: - player.addChatMessage(IChatComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.help3") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/oil" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/oil" + "\"}}]")); + player.addChatMessage(ITextComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.help3") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/oil" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/oil" + "\"}}]")); break; case 8: - player.addChatMessage(IChatComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.prelaunch") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/pre" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/pre" + "\"}}]")); + player.addChatMessage(ITextComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.prelaunch") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/pre" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/pre" + "\"}}]")); break; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java index 565a922a1a..ad3fa42463 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java @@ -29,7 +29,9 @@ public void clonePlayer(EntityPlayerMP player, EntityPlayer oldPlayer, boolean k { if (oldPlayer instanceof EntityPlayerMP) { - GCPlayerStats.get(player).copyFrom(GCPlayerStats.get((EntityPlayerMP) oldPlayer), keepInv || player.worldObj.getGameRules().getBoolean("keepInventory")); + IStatsCapability oldCapability = oldPlayer.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + IStatsCapability newCapability = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + newCapability.copyFrom(oldCapability, keepInv || player.worldObj.getGameRules().getBoolean("keepInventory")); TileEntityTelemetry.updateLinkedPlayer((EntityPlayerMP) oldPlayer, player); } } @@ -139,7 +141,7 @@ public void knockBack(EntityPlayerMP player, Entity p_70653_1_, float p_70653_2_ } } - if (player.getRNG().nextDouble() >= player.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).getAttributeValue()) + if (player.getRNG().nextDouble() >= player.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).getAttributeValue()) { player.isAirBorne = deshCount < 2; float f1 = MathHelper.sqrt_double(impulseX * impulseX + impulseZ * impulseZ); @@ -159,6 +161,8 @@ public void knockBack(EntityPlayerMP player, Entity p_70653_1_, float p_70653_2_ } } + + public boolean wakeUpPlayer(EntityPlayerMP player, boolean par1, boolean par2, boolean par3, boolean bypass) { BlockPos c = player.playerLocation; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsCapability.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsCapability.java new file mode 100644 index 0000000000..4a4a4bd5b6 --- /dev/null +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsCapability.java @@ -0,0 +1,1075 @@ +package micdoodle8.mods.galacticraft.core.entities.player; + +import com.google.common.collect.Maps; +import micdoodle8.mods.galacticraft.api.recipe.ISchematicPage; +import micdoodle8.mods.galacticraft.api.recipe.SchematicRegistry; +import micdoodle8.mods.galacticraft.api.vector.Vector3; +import micdoodle8.mods.galacticraft.core.GCBlocks; +import micdoodle8.mods.galacticraft.core.command.CommandGCInv; +import micdoodle8.mods.galacticraft.core.inventory.InventoryExtended; +import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; +import micdoodle8.mods.galacticraft.core.util.GCLog; +import micdoodle8.mods.galacticraft.core.util.WorldUtil; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +import java.lang.ref.WeakReference; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; + +public class StatsCapability implements IStatsCapability +{ + public WeakReference player; + + public InventoryExtended extendedInventory = new InventoryExtended(); + + public int airRemaining; + public int airRemaining2; + + public int thermalLevel; + public boolean thermalLevelNormalising; + + public int damageCounter; + + // temporary data while player is in planet selection GUI + public int spaceshipTier = 1; + public ItemStack[] rocketStacks = new ItemStack[2]; + public int rocketType; + public int fuelLevel; + public Item rocketItem; + public ItemStack launchpadStack; + public int astroMinerCount = 0; + + public boolean usingParachute; + + public ItemStack parachuteInSlot; + public ItemStack lastParachuteInSlot; + + public ItemStack frequencyModuleInSlot; + public ItemStack lastFrequencyModuleInSlot; + + public ItemStack maskInSlot; + public ItemStack lastMaskInSlot; + + public ItemStack gearInSlot; + public ItemStack lastGearInSlot; + + public ItemStack tankInSlot1; + public ItemStack lastTankInSlot1; + + public ItemStack tankInSlot2; + public ItemStack lastTankInSlot2; + + public ItemStack thermalHelmetInSlot; + public ItemStack lastThermalHelmetInSlot; + + public ItemStack thermalChestplateInSlot; + public ItemStack lastThermalChestplateInSlot; + + public ItemStack thermalLeggingsInSlot; + public ItemStack lastThermalLeggingsInSlot; + + public ItemStack thermalBootsInSlot; + public ItemStack lastThermalBootsInSlot; + + public ItemStack shieldControllerInSlot; + public ItemStack lastShieldControllerInSlot; + + public int launchAttempts = 0; + + public int spaceRaceInviteTeamID; + + public boolean usingPlanetSelectionGui; + public String savedPlanetList = ""; + public int openPlanetSelectionGuiCooldown; + public boolean hasOpenedPlanetSelectionGui = false; + + public int chestSpawnCooldown; + public micdoodle8.mods.galacticraft.api.vector.Vector3 chestSpawnVector; + + public int teleportCooldown; + + public int chatCooldown; + + public double distanceSinceLastStep; + public int lastStep; + + public double coordsTeleportedFromX; + public double coordsTeleportedFromZ; + + public HashMap spaceStationDimensionData = Maps.newHashMap(); + + public boolean oxygenSetupValid; + public boolean lastOxygenSetupValid; + + public boolean touchedGround; + public boolean lastOnGround; + public boolean inLander; + public boolean justLanded; + + public ArrayList unlockedSchematics = new ArrayList(); + public ArrayList lastUnlockedSchematics = new ArrayList(); + + public int cryogenicChamberCooldown; + + public boolean receivedSoundWarning; + public boolean receivedBedWarning; + public boolean openedSpaceRaceManager = false; + public boolean sentFlags = false; + public boolean newInOrbit = true; + public boolean newAdventureSpawn; + public int buildFlags = 0; + + public int incrementalDamage = 0; + + public String startDimension = ""; + + public WeakReference getPlayer() + { + return player; + } + + public void setPlayer(WeakReference player) + { + this.player = player; + } + + public InventoryExtended getExtendedInventory() + { + return extendedInventory; + } + + public void setExtendedInventory(InventoryExtended extendedInventory) + { + this.extendedInventory = extendedInventory; + } + + public int getAirRemaining() + { + return airRemaining; + } + + public void setAirRemaining(int airRemaining) + { + this.airRemaining = airRemaining; + } + + public int getAirRemaining2() + { + return airRemaining2; + } + + public void setAirRemaining2(int airRemaining2) + { + this.airRemaining2 = airRemaining2; + } + + public int getThermalLevel() + { + return thermalLevel; + } + + public void setThermalLevel(int thermalLevel) + { + this.thermalLevel = thermalLevel; + } + + public boolean isThermalLevelNormalising() + { + return thermalLevelNormalising; + } + + public void setThermalLevelNormalising(boolean thermalLevelNormalising) + { + this.thermalLevelNormalising = thermalLevelNormalising; + } + + public int getDamageCounter() + { + return damageCounter; + } + + public void setDamageCounter(int damageCounter) + { + this.damageCounter = damageCounter; + } + + public int getSpaceshipTier() + { + return spaceshipTier; + } + + public void setSpaceshipTier(int spaceshipTier) + { + this.spaceshipTier = spaceshipTier; + } + + public ItemStack[] getRocketStacks() + { + return rocketStacks; + } + + public void setRocketStacks(ItemStack[] rocketStacks) + { + this.rocketStacks = rocketStacks; + } + + public int getRocketType() + { + return rocketType; + } + + public void setRocketType(int rocketType) + { + this.rocketType = rocketType; + } + + public int getFuelLevel() + { + return fuelLevel; + } + + public void setFuelLevel(int fuelLevel) + { + this.fuelLevel = fuelLevel; + } + + public Item getRocketItem() + { + return rocketItem; + } + + public void setRocketItem(Item rocketItem) + { + this.rocketItem = rocketItem; + } + + public ItemStack getLaunchpadStack() + { + return launchpadStack; + } + + public void setLaunchpadStack(ItemStack launchpadStack) + { + this.launchpadStack = launchpadStack; + } + + public int getAstroMinerCount() + { + return astroMinerCount; + } + + public void setAstroMinerCount(int astroMinerCount) + { + this.astroMinerCount = astroMinerCount; + } + + public boolean isUsingParachute() + { + return usingParachute; + } + + public void setUsingParachute(boolean usingParachute) + { + this.usingParachute = usingParachute; + } + + public ItemStack getParachuteInSlot() + { + return parachuteInSlot; + } + + public void setParachuteInSlot(ItemStack parachuteInSlot) + { + this.parachuteInSlot = parachuteInSlot; + } + + public ItemStack getLastParachuteInSlot() + { + return lastParachuteInSlot; + } + + public void setLastParachuteInSlot(ItemStack lastParachuteInSlot) + { + this.lastParachuteInSlot = lastParachuteInSlot; + } + + public ItemStack getFrequencyModuleInSlot() + { + return frequencyModuleInSlot; + } + + public void setFrequencyModuleInSlot(ItemStack frequencyModuleInSlot) + { + this.frequencyModuleInSlot = frequencyModuleInSlot; + } + + public ItemStack getLastFrequencyModuleInSlot() + { + return lastFrequencyModuleInSlot; + } + + public void setLastFrequencyModuleInSlot(ItemStack lastFrequencyModuleInSlot) + { + this.lastFrequencyModuleInSlot = lastFrequencyModuleInSlot; + } + + public ItemStack getMaskInSlot() + { + return maskInSlot; + } + + public void setMaskInSlot(ItemStack maskInSlot) + { + this.maskInSlot = maskInSlot; + } + + public ItemStack getLastMaskInSlot() + { + return lastMaskInSlot; + } + + public void setLastMaskInSlot(ItemStack lastMaskInSlot) + { + this.lastMaskInSlot = lastMaskInSlot; + } + + public ItemStack getGearInSlot() + { + return gearInSlot; + } + + public void setGearInSlot(ItemStack gearInSlot) + { + this.gearInSlot = gearInSlot; + } + + public ItemStack getLastGearInSlot() + { + return lastGearInSlot; + } + + public void setLastGearInSlot(ItemStack lastGearInSlot) + { + this.lastGearInSlot = lastGearInSlot; + } + + public ItemStack getTankInSlot1() + { + return tankInSlot1; + } + + public void setTankInSlot1(ItemStack tankInSlot1) + { + this.tankInSlot1 = tankInSlot1; + } + + public ItemStack getLastTankInSlot1() + { + return lastTankInSlot1; + } + + public void setLastTankInSlot1(ItemStack lastTankInSlot1) + { + this.lastTankInSlot1 = lastTankInSlot1; + } + + public ItemStack getTankInSlot2() + { + return tankInSlot2; + } + + public void setTankInSlot2(ItemStack tankInSlot2) + { + this.tankInSlot2 = tankInSlot2; + } + + public ItemStack getLastTankInSlot2() + { + return lastTankInSlot2; + } + + public void setLastTankInSlot2(ItemStack lastTankInSlot2) + { + this.lastTankInSlot2 = lastTankInSlot2; + } + + public ItemStack getThermalHelmetInSlot() + { + return thermalHelmetInSlot; + } + + public void setThermalHelmetInSlot(ItemStack thermalHelmetInSlot) + { + this.thermalHelmetInSlot = thermalHelmetInSlot; + } + + public ItemStack getLastThermalHelmetInSlot() + { + return lastThermalHelmetInSlot; + } + + public void setLastThermalHelmetInSlot(ItemStack lastThermalHelmetInSlot) + { + this.lastThermalHelmetInSlot = lastThermalHelmetInSlot; + } + + public ItemStack getThermalChestplateInSlot() + { + return thermalChestplateInSlot; + } + + public void setThermalChestplateInSlot(ItemStack thermalChestplateInSlot) + { + this.thermalChestplateInSlot = thermalChestplateInSlot; + } + + public ItemStack getLastThermalChestplateInSlot() + { + return lastThermalChestplateInSlot; + } + + public void setLastThermalChestplateInSlot(ItemStack lastThermalChestplateInSlot) + { + this.lastThermalChestplateInSlot = lastThermalChestplateInSlot; + } + + public ItemStack getThermalLeggingsInSlot() + { + return thermalLeggingsInSlot; + } + + public void setThermalLeggingsInSlot(ItemStack thermalLeggingsInSlot) + { + this.thermalLeggingsInSlot = thermalLeggingsInSlot; + } + + public ItemStack getLastThermalLeggingsInSlot() + { + return lastThermalLeggingsInSlot; + } + + public void setLastThermalLeggingsInSlot(ItemStack lastThermalLeggingsInSlot) + { + this.lastThermalLeggingsInSlot = lastThermalLeggingsInSlot; + } + + public ItemStack getThermalBootsInSlot() + { + return thermalBootsInSlot; + } + + public void setThermalBootsInSlot(ItemStack thermalBootsInSlot) + { + this.thermalBootsInSlot = thermalBootsInSlot; + } + + public ItemStack getLastThermalBootsInSlot() + { + return lastThermalBootsInSlot; + } + + public void setLastThermalBootsInSlot(ItemStack lastThermalBootsInSlot) + { + this.lastThermalBootsInSlot = lastThermalBootsInSlot; + } + + public ItemStack getShieldControllerInSlot() + { + return shieldControllerInSlot; + } + + public void setShieldControllerInSlot(ItemStack shieldControllerInSlot) + { + this.shieldControllerInSlot = shieldControllerInSlot; + } + + public ItemStack getLastShieldControllerInSlot() + { + return lastShieldControllerInSlot; + } + + public void setLastShieldControllerInSlot(ItemStack lastShieldControllerInSlot) + { + this.lastShieldControllerInSlot = lastShieldControllerInSlot; + } + + public int getLaunchAttempts() + { + return launchAttempts; + } + + public void setLaunchAttempts(int launchAttempts) + { + this.launchAttempts = launchAttempts; + } + + public int getSpaceRaceInviteTeamID() + { + return spaceRaceInviteTeamID; + } + + public void setSpaceRaceInviteTeamID(int spaceRaceInviteTeamID) + { + this.spaceRaceInviteTeamID = spaceRaceInviteTeamID; + } + + public boolean isUsingPlanetSelectionGui() + { + return usingPlanetSelectionGui; + } + + public void setUsingPlanetSelectionGui(boolean usingPlanetSelectionGui) + { + this.usingPlanetSelectionGui = usingPlanetSelectionGui; + } + + public String getSavedPlanetList() + { + return savedPlanetList; + } + + public void setSavedPlanetList(String savedPlanetList) + { + this.savedPlanetList = savedPlanetList; + } + + public int getOpenPlanetSelectionGuiCooldown() + { + return openPlanetSelectionGuiCooldown; + } + + public void setOpenPlanetSelectionGuiCooldown(int openPlanetSelectionGuiCooldown) + { + this.openPlanetSelectionGuiCooldown = openPlanetSelectionGuiCooldown; + } + + public boolean hasOpenedPlanetSelectionGui() + { + return hasOpenedPlanetSelectionGui; + } + + public void setHasOpenedPlanetSelectionGui(boolean hasOpenedPlanetSelectionGui) + { + this.hasOpenedPlanetSelectionGui = hasOpenedPlanetSelectionGui; + } + + public int getChestSpawnCooldown() + { + return chestSpawnCooldown; + } + + public void setChestSpawnCooldown(int chestSpawnCooldown) + { + this.chestSpawnCooldown = chestSpawnCooldown; + } + + public Vector3 getChestSpawnVector() + { + return chestSpawnVector; + } + + public void setChestSpawnVector(Vector3 chestSpawnVector) + { + this.chestSpawnVector = chestSpawnVector; + } + + public int getTeleportCooldown() + { + return teleportCooldown; + } + + public void setTeleportCooldown(int teleportCooldown) + { + this.teleportCooldown = teleportCooldown; + } + + public int getChatCooldown() + { + return chatCooldown; + } + + public void setChatCooldown(int chatCooldown) + { + this.chatCooldown = chatCooldown; + } + + public double getDistanceSinceLastStep() + { + return distanceSinceLastStep; + } + + public void setDistanceSinceLastStep(double distanceSinceLastStep) + { + this.distanceSinceLastStep = distanceSinceLastStep; + } + + public int getLastStep() + { + return lastStep; + } + + public void setLastStep(int lastStep) + { + this.lastStep = lastStep; + } + + public double getCoordsTeleportedFromX() + { + return coordsTeleportedFromX; + } + + public void setCoordsTeleportedFromX(double coordsTeleportedFromX) + { + this.coordsTeleportedFromX = coordsTeleportedFromX; + } + + public double getCoordsTeleportedFromZ() + { + return coordsTeleportedFromZ; + } + + public void setCoordsTeleportedFromZ(double coordsTeleportedFromZ) + { + this.coordsTeleportedFromZ = coordsTeleportedFromZ; + } + + public HashMap getSpaceStationDimensionData() + { + return spaceStationDimensionData; + } + + public void setSpaceStationDimensionData(HashMap spaceStationDimensionData) + { + this.spaceStationDimensionData = spaceStationDimensionData; + } + + public boolean isOxygenSetupValid() + { + return oxygenSetupValid; + } + + public void setOxygenSetupValid(boolean oxygenSetupValid) + { + this.oxygenSetupValid = oxygenSetupValid; + } + + public boolean isLastOxygenSetupValid() + { + return lastOxygenSetupValid; + } + + public void setLastOxygenSetupValid(boolean lastOxygenSetupValid) + { + this.lastOxygenSetupValid = lastOxygenSetupValid; + } + + public boolean isTouchedGround() + { + return touchedGround; + } + + public void setTouchedGround(boolean touchedGround) + { + this.touchedGround = touchedGround; + } + + public boolean isLastOnGround() + { + return lastOnGround; + } + + public void setLastOnGround(boolean lastOnGround) + { + this.lastOnGround = lastOnGround; + } + + public boolean isInLander() + { + return inLander; + } + + public void setInLander(boolean inLander) + { + this.inLander = inLander; + } + + public boolean hasJustLanded() + { + return justLanded; + } + + public void setJustLanded(boolean justLanded) + { + this.justLanded = justLanded; + } + + public ArrayList getUnlockedSchematics() + { + return unlockedSchematics; + } + + public void setUnlockedSchematics(ArrayList unlockedSchematics) + { + this.unlockedSchematics = unlockedSchematics; + } + + public ArrayList getLastUnlockedSchematics() + { + return lastUnlockedSchematics; + } + + public void setLastUnlockedSchematics(ArrayList lastUnlockedSchematics) + { + this.lastUnlockedSchematics = lastUnlockedSchematics; + } + + public int getCryogenicChamberCooldown() + { + return cryogenicChamberCooldown; + } + + public void setCryogenicChamberCooldown(int cryogenicChamberCooldown) + { + this.cryogenicChamberCooldown = cryogenicChamberCooldown; + } + + public boolean hasReceivedSoundWarning() + { + return receivedSoundWarning; + } + + public void setReceivedSoundWarning(boolean receivedSoundWarning) + { + this.receivedSoundWarning = receivedSoundWarning; + } + + public boolean hasReceivedBedWarning() + { + return receivedBedWarning; + } + + public void setReceivedBedWarning(boolean receivedBedWarning) + { + this.receivedBedWarning = receivedBedWarning; + } + + public boolean hasOpenedSpaceRaceManager() + { + return openedSpaceRaceManager; + } + + public void setOpenedSpaceRaceManager(boolean openedSpaceRaceManager) + { + this.openedSpaceRaceManager = openedSpaceRaceManager; + } + + public boolean isSentFlags() + { + return sentFlags; + } + + public void setSentFlags(boolean sentFlags) + { + this.sentFlags = sentFlags; + } + + public boolean isNewInOrbit() + { + return newInOrbit; + } + + public void setNewInOrbit(boolean newInOrbit) + { + this.newInOrbit = newInOrbit; + } + + public boolean isNewAdventureSpawn() + { + return newAdventureSpawn; + } + + public void setNewAdventureSpawn(boolean newAdventureSpawn) + { + this.newAdventureSpawn = newAdventureSpawn; + } + + public int getBuildFlags() + { + return buildFlags; + } + + public void setBuildFlags(int buildFlags) + { + this.buildFlags = buildFlags; + } + + public int getIncrementalDamage() + { + return incrementalDamage; + } + + public void setIncrementalDamage(int incrementalDamage) + { + this.incrementalDamage = incrementalDamage; + } + + public String getStartDimension() + { + return startDimension; + } + + public void setStartDimension(String startDimension) + { + this.startDimension = startDimension; + } + + @Override + public void saveNBTData(NBTTagCompound nbt) + { + nbt.setTag("ExtendedInventoryGC", this.extendedInventory.writeToNBT(new NBTTagList())); + nbt.setInteger("playerAirRemaining", this.airRemaining); + nbt.setInteger("damageCounter", this.damageCounter); + nbt.setBoolean("OxygenSetupValid", this.oxygenSetupValid); + nbt.setBoolean("usingParachute2", this.usingParachute); + nbt.setBoolean("usingPlanetSelectionGui", this.usingPlanetSelectionGui); + nbt.setInteger("teleportCooldown", this.teleportCooldown); + nbt.setDouble("coordsTeleportedFromX", this.coordsTeleportedFromX); + nbt.setDouble("coordsTeleportedFromZ", this.coordsTeleportedFromZ); + nbt.setString("startDimension", this.startDimension); + nbt.setString("spaceStationDimensionInfo", WorldUtil.spaceStationDataToString(this.spaceStationDimensionData)); + nbt.setInteger("thermalLevel", this.thermalLevel); + + Collections.sort(this.unlockedSchematics); + + NBTTagList tagList = new NBTTagList(); + + for (ISchematicPage page : this.unlockedSchematics) + { + if (page != null) + { + final NBTTagCompound nbttagcompound = new NBTTagCompound(); + nbttagcompound.setInteger("UnlockedPage", page.getPageID()); + tagList.appendTag(nbttagcompound); + } + } + + nbt.setTag("Schematics", tagList); + + nbt.setInteger("rocketStacksLength", this.rocketStacks.length); + nbt.setInteger("SpaceshipTier", this.spaceshipTier); + nbt.setInteger("FuelLevel", this.fuelLevel); + if (this.rocketItem != null) + { + ItemStack returnRocket = new ItemStack(this.rocketItem, 1, this.rocketType); + nbt.setTag("ReturnRocket", returnRocket.writeToNBT(new NBTTagCompound())); + } + + final NBTTagList var2 = new NBTTagList(); + + for (int var3 = 0; var3 < this.rocketStacks.length; ++var3) + { + if (this.rocketStacks[var3] != null) + { + final NBTTagCompound var4 = new NBTTagCompound(); + var4.setByte("Slot", (byte) var3); + this.rocketStacks[var3].writeToNBT(var4); + var2.appendTag(var4); + } + } + + nbt.setTag("RocketItems", var2); + final NBTTagCompound var4 = new NBTTagCompound(); + if (this.launchpadStack != null) + { + nbt.setTag("LaunchpadStack", this.launchpadStack.writeToNBT(var4)); + } + else + { + nbt.setTag("LaunchpadStack", var4); + } + + nbt.setInteger("CryogenicChamberCooldown", this.cryogenicChamberCooldown); + nbt.setBoolean("ReceivedSoundWarning", this.receivedSoundWarning); + nbt.setBoolean("ReceivedBedWarning", this.receivedBedWarning); + nbt.setInteger("BuildFlags", this.buildFlags); + nbt.setBoolean("ShownSpaceRace", this.openedSpaceRaceManager); + nbt.setInteger("AstroMinerCount", this.astroMinerCount); + } + + @Override + public void loadNBTData(NBTTagCompound nbt) + { + this.airRemaining = nbt.getInteger("playerAirRemaining"); + this.damageCounter = nbt.getInteger("damageCounter"); + this.oxygenSetupValid = this.lastOxygenSetupValid = nbt.getBoolean("OxygenSetupValid"); + this.thermalLevel = nbt.getInteger("thermalLevel"); + + // Backwards compatibility + NBTTagList nbttaglist = nbt.getTagList("Inventory", 10); + this.extendedInventory.readFromNBTOld(nbttaglist); + + if (nbt.hasKey("ExtendedInventoryGC")) + { + this.extendedInventory.readFromNBT(nbt.getTagList("ExtendedInventoryGC", 10)); + } + + // Added for GCInv command - if tried to load an offline player's + // inventory, load it now + // (if there was no offline load, then the dontload flag in doLoad() + // will make sure nothing happens) + EntityPlayerMP p = this.player.get(); + if (p != null) + { + ItemStack[] saveinv = CommandGCInv.getSaveData(p.getGameProfile().getName().toLowerCase()); + if (saveinv != null) + { + CommandGCInv.doLoad(p); + } + } + + if (nbt.hasKey("SpaceshipTier")) + { + this.spaceshipTier = nbt.getInteger("SpaceshipTier"); + } + + //New keys in version 3.0.5.220 + if (nbt.hasKey("FuelLevel")) + { + this.fuelLevel = nbt.getInteger("FuelLevel"); + } + if (nbt.hasKey("ReturnRocket")) + { + ItemStack returnRocket = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("ReturnRocket")); + if (returnRocket != null) + { + this.rocketItem = returnRocket.getItem(); + this.rocketType = returnRocket.getItemDamage(); + } + } + + this.usingParachute = nbt.getBoolean("usingParachute2"); + this.usingPlanetSelectionGui = nbt.getBoolean("usingPlanetSelectionGui"); + this.teleportCooldown = nbt.getInteger("teleportCooldown"); + this.coordsTeleportedFromX = nbt.getDouble("coordsTeleportedFromX"); + this.coordsTeleportedFromZ = nbt.getDouble("coordsTeleportedFromZ"); + this.startDimension = nbt.hasKey("startDimension") ? nbt.getString("startDimension") : ""; + if (nbt.hasKey("spaceStationDimensionID")) + { + // If loading from an old save file, the home space station is always the overworld, so use 0 as home planet + this.spaceStationDimensionData = WorldUtil.stringToSpaceStationData("0$" + nbt.getInteger("spaceStationDimensionID")); + } + else + { + this.spaceStationDimensionData = WorldUtil.stringToSpaceStationData(nbt.getString("spaceStationDimensionInfo")); + } + + if (nbt.getBoolean("usingPlanetSelectionGui")) + { + this.openPlanetSelectionGuiCooldown = 20; + } + + if (nbt.hasKey("RocketItems") && nbt.hasKey("rocketStacksLength")) + { + final NBTTagList var23 = nbt.getTagList("RocketItems", 10); + int length = nbt.getInteger("rocketStacksLength"); + + this.rocketStacks = new ItemStack[length]; + + for (int var3 = 0; var3 < var23.tagCount(); ++var3) + { + final NBTTagCompound var4 = var23.getCompoundTagAt(var3); + final int var5 = var4.getByte("Slot") & 255; + + if (var5 < this.rocketStacks.length) + { + this.rocketStacks[var5] = ItemStack.loadItemStackFromNBT(var4); + } + } + } + + this.unlockedSchematics = new ArrayList(); + + if (p != null) + { + for (int i = 0; i < nbt.getTagList("Schematics", 10).tagCount(); ++i) + { + final NBTTagCompound nbttagcompound = nbt.getTagList("Schematics", 10).getCompoundTagAt(i); + + final int j = nbttagcompound.getInteger("UnlockedPage"); + + SchematicRegistry.addUnlockedPage(p, SchematicRegistry.getMatchingRecipeForID(j)); + } + } + + Collections.sort(this.unlockedSchematics); + + this.cryogenicChamberCooldown = nbt.getInteger("CryogenicChamberCooldown"); + + if (nbt.hasKey("ReceivedSoundWarning")) + { + this.receivedSoundWarning = nbt.getBoolean("ReceivedSoundWarning"); + } + if (nbt.hasKey("ReceivedBedWarning")) + { + this.receivedBedWarning = nbt.getBoolean("ReceivedBedWarning"); + } + + if (nbt.hasKey("LaunchpadStack")) + { + this.launchpadStack = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("LaunchpadStack")); + if (this.launchpadStack != null && this.launchpadStack.stackSize == 0) + { + this.launchpadStack = null; + } + } + else + { + // for backwards compatibility with saves which don't have this tag - players can't lose launchpads + this.launchpadStack = new ItemStack(GCBlocks.landingPad, 9, 0); + } + + if (nbt.hasKey("BuildFlags")) + { + this.buildFlags = nbt.getInteger("BuildFlags"); + } + + if (nbt.hasKey("ShownSpaceRace")) + { + this.openedSpaceRaceManager = nbt.getBoolean("ShownSpaceRace"); + } + + if (nbt.hasKey("AstroMinerCount")) + { + this.astroMinerCount = nbt.getInteger("AstroMinerCount"); + } + + this.sentFlags = false; + if (ConfigManagerCore.enableDebug) + { + GCLog.info("Loading GC player data for " + player.get().getGameProfile().getName() + " : " + this.buildFlags); + } + } + + public void copyFrom(IStatsCapability oldData, boolean keepInv) + { + if (keepInv) + { + this.extendedInventory.copyInventory(oldData.getExtendedInventory()); + } + + this.spaceStationDimensionData = oldData.getSpaceStationDimensionData(); + this.unlockedSchematics = oldData.getUnlockedSchematics(); + this.receivedSoundWarning = oldData.hasReceivedSoundWarning(); + this.receivedBedWarning = oldData.hasReceivedBedWarning(); + this.openedSpaceRaceManager = oldData.hasOpenedSpaceRaceManager(); + this.spaceRaceInviteTeamID = oldData.getSpaceRaceInviteTeamID(); + this.buildFlags = oldData.getBuildFlags(); + this.astroMinerCount = oldData.getAstroMinerCount(); + this.sentFlags = false; + } +} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java index 8bc2b2d469..f6388b060c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java @@ -58,7 +58,7 @@ import net.minecraft.util.*; import net.minecraft.world.World; import net.minecraft.world.WorldServer; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.BiomeGenDesert; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.client.event.EntityViewRenderEvent.FogColors; @@ -394,9 +394,9 @@ public static boolean oilPresent(World world, Random rand, int x, int z, BlockVe return false; } - final BiomeGenBase biomegenbase = world.getBiomeGenForCoords(new BlockPos(x + 8, 0, z + 8)); + final Biome biomegenbase = world.getBiomeGenForCoords(new BlockPos(x + 8, 0, z + 8)); - if (biomegenbase.biomeID == BiomeGenBase.sky.biomeID || biomegenbase.biomeID == BiomeGenBase.hell.biomeID) + if (biomegenbase.biomeID == Biome.sky.biomeID || biomegenbase.biomeID == Biome.hell.biomeID) { return false; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventWakePlayer.java b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventWakePlayer.java index c795454b1d..bd017df4dc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventWakePlayer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventWakePlayer.java @@ -1,7 +1,6 @@ package micdoodle8.mods.galacticraft.core.event; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayer.EnumStatus; import net.minecraft.util.math.BlockPos; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.fml.common.eventhandler.Cancelable; @@ -9,7 +8,7 @@ @Cancelable public class EventWakePlayer extends PlayerEvent { - public EnumStatus result = null; + public EntityPlayer.SleepResult result = null; public final BlockPos pos; public final boolean flag1; public final boolean flag2; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/OxygenPressureProtocol.java b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/OxygenPressureProtocol.java index 80948e50d4..1b8c44d541 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/OxygenPressureProtocol.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/OxygenPressureProtocol.java @@ -90,14 +90,15 @@ public static boolean canBlockPassAir(World world, Block block, BlockPos pos, En //Check leaves first, because their isOpaqueCube() test depends on graphics settings //(See net.minecraft.block.BlockLeaves.isOpaqueCube()!) - if (block instanceof BlockLeavesBase) + if (block instanceof BlockLeaves) { return true; } - if (block.isOpaqueCube()) + IBlockState state = world.getBlockState(pos); + if (block.isOpaqueCube(state)) { - return block instanceof BlockGravel || block.getMaterial() == Material.CLOTH || block instanceof BlockSponge; + return block instanceof BlockGravel || block.getMaterial(state) == Material.CLOTH || block instanceof BlockSponge; } @@ -115,7 +116,6 @@ public static boolean canBlockPassAir(World world, Block block, BlockPos pos, En if (OxygenPressureProtocol.nonPermeableBlocks.containsKey(block)) { ArrayList metaList = OxygenPressureProtocol.nonPermeableBlocks.get(block); - IBlockState state = world.getBlockState(pos); if (metaList.contains(Integer.valueOf(-1)) || metaList.contains(state.getBlock().getMetaFromState(state))) { return false; @@ -125,7 +125,6 @@ public static boolean canBlockPassAir(World world, Block block, BlockPos pos, En //Half slab seals on the top side or the bottom side according to its metadata if (block instanceof BlockSlab) { - IBlockState state = world.getBlockState(pos); int meta = state.getBlock().getMetaFromState(state); return !(side == EnumFacing.DOWN && (meta & 8) == 8 || side == EnumFacing.UP && (meta & 8) == 0); } @@ -138,11 +137,9 @@ public static boolean canBlockPassAir(World world, Block block, BlockPos pos, En if (block instanceof BlockPistonBase) { - BlockPistonBase piston = (BlockPistonBase) block; - IBlockState state = world.getBlockState(pos); if (((Boolean) state.getValue(BlockPistonBase.EXTENDED)).booleanValue()) { - EnumFacing facing = (EnumFacing) state.getValue(BlockPistonBase.FACING); + EnumFacing facing = state.getValue(BlockPistonBase.FACING); return side != facing; } return false; @@ -151,6 +148,6 @@ public static boolean canBlockPassAir(World world, Block block, BlockPos pos, En //General case - this should cover any block which correctly implements isBlockSolidOnSide //including most modded blocks - Forge microblocks in particular is covered by this. // ### Any exceptions in mods should implement the IPartialSealableBlock interface ### - return !block.isSideSolid(world, pos, EnumFacing.getFront(side.getIndex() ^ 1)); + return !block.isSideSolid(state, world, pos, side.getOpposite()); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java index bf3d5ac6ab..ecab32f32b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java @@ -68,10 +68,10 @@ public ThreadFindSeal(World world, BlockPos head, int checkCount, List 0) { - Block headBlock = this.world.getBlockState(head).getBlock(); - if (headBlock != null && !(headBlock.isAir(world, head))) + IBlockState headState = this.world.getBlockState(head); + if (!(headState.getBlock().isAir(headState, world, head))) { - this.canBlockPassAirCheck(headBlock, this.head, EnumFacing.UP); + this.canBlockPassAirCheck(headState.getBlock(), this.head, EnumFacing.UP); //reset the checkCount as canBlockPassAirCheck might have changed it this.checkCount = checkCount; } @@ -906,15 +906,16 @@ private boolean canBlockPassAirCheck(Block block, BlockVec3 vec, EnumFacing side { //Check leaves first, because their isOpaqueCube() test depends on graphics settings //(See net.minecraft.block.BlockLeaves.isOpaqueCube()!) - if (block instanceof BlockLeavesBase) + if (block instanceof BlockLeaves) { return true; } - if (block.isOpaqueCube()) + IBlockState state = world.getBlockState(vec.toBlockPos()); + if (block.isOpaqueCube(state)) { //Gravel, wool and sponge are porous - return block instanceof BlockGravel || block.getMaterial() == Material.CLOTH || block instanceof BlockSponge; + return block instanceof BlockGravel || block.getMaterial(state) == Material.CLOTH || block instanceof BlockSponge; } @@ -1003,10 +1004,9 @@ private boolean canBlockPassAirCheck(Block block, BlockVec3 vec, EnumFacing side if (block instanceof BlockPistonBase) { BlockPistonBase piston = (BlockPistonBase) block; - IBlockState state = this.world.getBlockState(new BlockPos(vec.x, vec.y, vec.z)); - if (((Boolean) state.getValue(BlockPistonBase.EXTENDED)).booleanValue()) + if (state.getValue(BlockPistonBase.EXTENDED).booleanValue()) { - EnumFacing facing = (EnumFacing) state.getValue(BlockPistonBase.FACING); + EnumFacing facing = state.getValue(BlockPistonBase.FACING); if (side == facing) { this.checked.remove(vec); @@ -1022,10 +1022,10 @@ private boolean canBlockPassAirCheck(Block block, BlockVec3 vec, EnumFacing side //General case - this should cover any block which correctly implements isBlockSolidOnSide //including most modded blocks - Forge microblocks in particular is covered by this. // ### Any exceptions in mods should implement the IPartialSealableBlock interface ### - if (block.isSideSolid(this.world, new BlockPos(vec.x, vec.y, vec.z), EnumFacing.getFront(side.getIndex() ^ 1))) + if (block.isSideSolid(state, this.world, new BlockPos(vec.x, vec.y, vec.z), side.getOpposite())) { //Solid on all sides - if (block.getMaterial().blocksMovement() && block.isFullCube()) + if (block.getMaterial(state).blocksMovement() && block.isFullCube(state)) { return false; } @@ -1036,7 +1036,7 @@ private boolean canBlockPassAirCheck(Block block, BlockVec3 vec, EnumFacing side } //Easy case: airblock, return without checking other sides - if (block.getMaterial() == Material.AIR) + if (block.getMaterial(state) == Material.AIR) { return true; } @@ -1049,7 +1049,7 @@ private boolean canBlockPassAirCheck(Block block, BlockVec3 vec, EnumFacing side { continue; } - if (block.isSideSolid(this.world, new BlockPos(vec.x, vec.y, vec.z), EnumFacing.getFront(i))) + if (block.isSideSolid(state, this.world, new BlockPos(vec.x, vec.y, vec.z), EnumFacing.getFront(i))) { vec.setSideDone(i); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCircuitFabricator.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCircuitFabricator.java index 8c9f677c01..dab3a1deb5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCircuitFabricator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCircuitFabricator.java @@ -115,7 +115,7 @@ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) return null; } } - else if (i == Items.diamond) + else if (i == Items.DIAMOND) { if (!this.mergeItemStack(var4, 1, 2, false)) { @@ -129,14 +129,14 @@ else if (i == GCItems.basicItem && i.getDamage(var4) == 2) return null; } } - else if (i == Items.redstone) + else if (i == Items.REDSTONE) { if (!this.mergeItemStack(var4, 4, 5, false)) { return null; } } - else if (i == Items.repeater || i == new ItemStack(Blocks.redstone_torch).getItem() || i == Items.DYE && i.getDamage(var4) == 4) + else if (i == Items.REPEATER || i == new ItemStack(Blocks.REDSTONE_TORCH).getItem() || i == Items.DYE && i.getDamage(var4) == 4) { if (!this.mergeItemStack(var4, 5, 6, false)) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCoalGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCoalGenerator.java index 597c0ed7a1..062a7e0390 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCoalGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCoalGenerator.java @@ -17,7 +17,7 @@ public class ContainerCoalGenerator extends Container public ContainerCoalGenerator(InventoryPlayer par1InventoryPlayer, TileEntityCoalGenerator tileEntity) { this.tileEntity = tileEntity; - this.addSlotToContainer(new SlotSpecific(tileEntity, 0, 33, 34, new ItemStack(Items.coal), new ItemStack(Item.getItemFromBlock(Blocks.coal_block)))); + this.addSlotToContainer(new SlotSpecific(tileEntity, 0, 33, 34, new ItemStack(Items.COAL), new ItemStack(Item.getItemFromBlock(Blocks.COAL_BLOCK)))); int var3; for (var3 = 0; var3 < 3; ++var3) @@ -63,7 +63,7 @@ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) if (par1 != 0) { - if (var4.getItem() == Items.coal) + if (var4.getItem() == Items.COAL) { if (!this.mergeItemStack(var4, 0, 1, false)) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryBuggyBench.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryBuggyBench.java index f75c6ff30b..47b9cbd086 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryBuggyBench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryBuggyBench.java @@ -170,7 +170,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryExtended.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryExtended.java index de1a63a08f..e857fc0b34 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryExtended.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryExtended.java @@ -128,7 +128,7 @@ public void dropExtendedItems(EntityPlayer player) if (stack != null) { - player.dropPlayerItemWithRandomChoice(stack, true); + player.dropItem(stack, true); } this.inventoryStacks[i] = null; @@ -226,7 +226,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryRocketBench.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryRocketBench.java index d438028571..cfbeedf10b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryRocketBench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryRocketBench.java @@ -174,7 +174,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventorySchematic.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventorySchematic.java index 5b4faa5832..ddd6fd36d0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventorySchematic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventorySchematic.java @@ -154,7 +154,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryTreasureChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryTreasureChest.java index 2b1026615e..2ed70d6e17 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryTreasureChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryTreasureChest.java @@ -3,42 +3,32 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.util.TextComponentString; -import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; public class InventoryTreasureChest implements IInventory { - /** - * Name of the chest. - */ private String name; - /** - * Inventory object corresponding to double chest upper part - */ private IInventory upperChest; - /** - * Inventory object corresponding to double chest lower part - */ private IInventory lowerChest; - private static final String __OBFID = "CL_00001507"; - public InventoryTreasureChest(String p_i1559_1_, IInventory p_i1559_2_, IInventory p_i1559_3_) + public InventoryTreasureChest(String name, IInventory upper, IInventory lower) { - this.name = p_i1559_1_; + this.name = name; - if (p_i1559_2_ == null) + if (upper == null) { - p_i1559_2_ = p_i1559_3_; + upper = lower; } - if (p_i1559_3_ == null) + if (lower == null) { - p_i1559_3_ = p_i1559_2_; + lower = upper; } - this.upperChest = p_i1559_2_; - this.lowerChest = p_i1559_3_; + this.upperChest = upper; + this.lowerChest = lower; } @Override @@ -155,8 +145,8 @@ public int getFieldCount() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { - return (IChatComponent) (this.hasCustomName() ? new TextComponentString(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); + return this.hasCustomName() ? new TextComponentString(this.getName()) : new TextComponentTranslation(this.getName(), new Object[0]); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/PersistantInventoryCrafting.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/PersistantInventoryCrafting.java index 0ed4658942..4b7ec8eb1e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/PersistantInventoryCrafting.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/PersistantInventoryCrafting.java @@ -249,7 +249,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotArmorGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotArmorGC.java index 7041877000..fbf8883c31 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotArmorGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/SlotArmorGC.java @@ -1,6 +1,7 @@ package micdoodle8.mods.galacticraft.core.inventory; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.Item; @@ -11,6 +12,7 @@ public class SlotArmorGC extends Slot { + private static final EntityEquipmentSlot[] VALID_EQUIPMENT_SLOTS = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET}; final int armorType; final EntityPlayer thePlayer; @@ -31,7 +33,7 @@ public int getSlotStackLimit() public boolean isItemValid(ItemStack par1ItemStack) { final Item item = par1ItemStack == null ? null : par1ItemStack.getItem(); - return item != null && item.isValidArmor(par1ItemStack, this.armorType, this.thePlayer); + return item != null && item.isValidArmor(par1ItemStack, VALID_EQUIPMENT_SLOTS[this.armorType], this.thePlayer); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemArmorGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemArmorGC.java index 17a08b4f8d..3c655596f8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemArmorGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemArmorGC.java @@ -7,6 +7,7 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; @@ -15,7 +16,7 @@ public class ItemArmorGC extends ItemArmor implements ISortableItem { - public ItemArmorGC(int armorIndex, String assetSuffix) + public ItemArmorGC(EntityEquipmentSlot armorIndex, String assetSuffix) { super(GCItems.ARMOR_STEEL, 0, armorIndex); this.setUnlocalizedName("steel_" + assetSuffix); @@ -36,7 +37,7 @@ public EnumRarity getRarity(ItemStack par1ItemStack) } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { if (this.getArmorMaterial() == GCItems.ARMOR_STEEL) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBasic.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBasic.java index 88f595505a..10da129acd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBasic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBasic.java @@ -2,21 +2,28 @@ import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.EnumColor; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.SoundEvents; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.TextComponentString; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -154,21 +161,24 @@ public float getSaturationModifier(ItemStack par1ItemStack) } @Override - public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn) + public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) { if (stack.getItemDamage() > 14 && stack.getItemDamage() < 19) { --stack.stackSize; - playerIn.getFoodStats().addStats(this.getHealAmount(stack), this.getSaturationModifier(stack)); - worldIn.playSoundAtEntity(playerIn, "random.burp", 0.5F, worldIn.rand.nextFloat() * 0.1F + 0.9F); + if (entityLiving instanceof EntityPlayer) + { + ((EntityPlayer) entityLiving).getFoodStats().addStats(this.getHealAmount(stack), this.getSaturationModifier(stack)); + } + worldIn.playSound(null, entityLiving.posX, entityLiving.posY, entityLiving.posZ, SoundEvents.ENTITY_PLAYER_BURP, SoundCategory.PLAYERS, 0.5F, worldIn.rand.nextFloat() * 0.1F + 0.9F); if (!worldIn.isRemote) { - playerIn.entityDropItem(new ItemStack(GCItems.canister, 1, 0), 0.0F); + entityLiving.entityDropItem(new ItemStack(GCItems.canister, 1, 0), 0.0F); } return stack; } - return super.onItemUseFinish(stack, worldIn, playerIn); + return super.onItemUseFinish(stack, worldIn, entityLiving); } @Override @@ -194,27 +204,29 @@ public EnumAction getItemUseAction(ItemStack par1ItemStack) } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + public ActionResult onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { - if (par1ItemStack.getItemDamage() > 14 && par1ItemStack.getItemDamage() < 19 && par3EntityPlayer.canEat(false)) + if (itemStackIn.getItemDamage() > 14 && itemStackIn.getItemDamage() < 19 && playerIn.canEat(false)) { - par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); + playerIn.setActiveHand(hand); + return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn); } - if (par1ItemStack.getItemDamage() == 19) + else if (itemStackIn.getItemDamage() == 19) { - if (par3EntityPlayer instanceof EntityPlayerMP) + if (playerIn instanceof EntityPlayerMP) { - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) par3EntityPlayer); - ItemStack gear = stats.extendedInventory.getStackInSlot(5); + IStatsCapability stats = playerIn.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + ItemStack gear = stats.getExtendedInventory().getStackInSlot(5); if (gear == null) { - stats.extendedInventory.setInventorySlotContents(5, par1ItemStack.copy()); - par1ItemStack.stackSize = 0; + stats.getExtendedInventory().setInventorySlotContents(5, itemStackIn.copy()); + itemStackIn.stackSize = 0; } } } - return par1ItemStack; + + return new ActionResult<>(EnumActionResult.FAIL, itemStackIn); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockDesc.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockDesc.java index eac14c978b..a24492f7db 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockDesc.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockDesc.java @@ -13,7 +13,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; @@ -71,7 +71,7 @@ public void addInformation(ItemStack stack, EntityPlayer player, List in float powerDrawn = ((TileBaseElectricBlock) te).storage.getMaxExtract(); if (powerDrawn > 0) { - info.add(EnumChatFormatting.GREEN + GCCoreUtil.translateWithFormat("item_desc.powerdraw.name", EnergyDisplayHelper.getEnergyDisplayS(powerDrawn * 20))); + info.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("item_desc.powerdraw.name", EnergyDisplayHelper.getEnergyDisplayS(powerDrawn * 20))); } } } @@ -83,7 +83,7 @@ else if (this.getBlock() instanceof BlockAdvancedTile) float powerDrawn = ((TileBaseElectricBlock) te).storage.getMaxExtract(); if (powerDrawn > 0) { - info.add(EnumChatFormatting.GREEN + GCCoreUtil.translateWithFormat("item_desc.powerdraw.name", EnergyDisplayHelper.getEnergyDisplayS(powerDrawn * 20))); + info.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("item_desc.powerdraw.name", EnergyDisplayHelper.getEnergyDisplayS(powerDrawn * 20))); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java index b5c2d42eb3..ae9cf6e3cd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java @@ -4,11 +4,15 @@ import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.CompatibilityManager; import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; @@ -43,20 +47,21 @@ public String getUnlocalizedName(ItemStack par1ItemStack) } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { int metadata = this.getMetadata(stack.getItemDamage()); BlockEnclosed.EnumEnclosedBlockType type = BlockEnclosed.EnumEnclosedBlockType.byMetadata(metadata); if (type != null && type.getBCPipeType() != null) { - Block block = worldIn.getBlockState(pos).getBlock(); + IBlockState state = worldIn.getBlockState(pos); + Block block = state.getBlock(); - if (block == Blocks.snow) + if (block == Blocks.SNOW) { side = EnumFacing.UP; } - else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && !block.isReplaceable(worldIn, pos)) + else if (block != Blocks.VINE && block != Blocks.TALLGRASS && block != Blocks.DEADBUSH && !block.isReplaceable(worldIn, pos)) { pos = pos.offset(side); // if (side == EnumFacing.DOWN) @@ -87,16 +92,16 @@ else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.de if (stack.stackSize == 0) { - return false; + return EnumActionResult.FAIL; } if (!playerIn.canPlayerEdit(pos, side, stack)) { - return false; + return EnumActionResult.FAIL; } - else if (pos.getY() == 255 && this.getBlock().getMaterial().isSolid()) + else if (pos.getY() == 255 && this.getBlock().getMaterial(state).isSolid()) { - return false; + return EnumActionResult.FAIL; } else if (worldIn.canBlockBePlaced(block, pos, false, side, playerIn, stack)) { @@ -106,7 +111,8 @@ else if (worldIn.canBlockBePlaced(block, pos, false, side, playerIn, stack)) if (placeBlockAt(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ, j1)) { - worldIn.playSoundEffect(pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, this.getBlock().stepSound.getPlaceSound(), (this.getBlock().stepSound.getVolume() + 1.0F) / 2.0F, 1.0F * 0.8F); + SoundType soundType = this.getBlock().getSoundType(state, worldIn, pos, playerIn); + worldIn.playSound(playerIn, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, soundType.getPlaceSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F); --stack.stackSize; if (metadata >= BlockEnclosed.EnumEnclosedBlockType.BC_ITEM_STONEPIPE.getMeta() && metadata <= BlockEnclosed.EnumEnclosedBlockType.BC_POWER_GOLDPIPE.getMeta()) @@ -130,17 +136,17 @@ else if (metadata == BlockEnclosed.EnumEnclosedBlockType.ME_CABLE.getMeta()) } } - return true; + return EnumActionResult.SUCCESS; } else { - return false; + return EnumActionResult.FAIL; } } else { - return super.onItemUse(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ); + return super.onItemUse(stack, playerIn, worldIn, pos, hand, side, hitX, hitY, hitZ); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBucketGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBucketGC.java index d0a3816752..4658d01003 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBucketGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBucketGC.java @@ -20,7 +20,7 @@ public ItemBucketGC(Block block) { super(block); // this.texture_prefix = texture_prefix; - this.setContainerItem(Items.bucket); + this.setContainerItem(Items.BUCKET); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java index 9842e889ed..945ef74a63 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java @@ -8,21 +8,28 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.TextComponentString; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import javax.annotation.Nullable; + public class ItemFlag extends Item implements IHoldableItemCustom, ISortableItem { public int placeProgress; @@ -43,13 +50,20 @@ public CreativeTabs getCreativeTab() } @Override - public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) + public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entity, int timeLeft) { - final int useTime = this.getMaxItemUseDuration(par1ItemStack) - par4; + final int useTime = this.getMaxItemUseDuration(stack) - timeLeft; boolean placed = false; - final MovingObjectPosition var12 = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true); + if (!(entity instanceof EntityPlayer)) + { + return; + } + + EntityPlayer player = (EntityPlayer) entity; + + final RayTraceResult var12 = this.rayTrace(worldIn, player, true); float var7 = useTime / 20.0F; var7 = (var7 * var7 + var7 * 2.0F) / 3.0F; @@ -59,37 +73,37 @@ public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, Entit var7 = 1.0F; } - if (var7 == 1.0F && var12 != null && var12.typeOfHit == MovingObjectType.BLOCK) + if (var7 == 1.0F && var12 != null && var12.typeOfHit == RayTraceResult.Type.BLOCK) { final BlockPos pos = var12.getBlockPos(); - if (!par2World.isRemote) + if (!worldIn.isRemote) { - final EntityFlag flag = new EntityFlag(par2World, pos.getX() + 0.5F, pos.getY() + 1.0F, pos.getZ() + 0.5F, (int) (par3EntityPlayer.rotationYaw - 90)); + final EntityFlag flag = new EntityFlag(worldIn, pos.getX() + 0.5F, pos.getY() + 1.0F, pos.getZ() + 0.5F, (int) (entity.rotationYaw - 90)); - if (par2World.getEntitiesWithinAABB(EntityFlag.class, new AxisAlignedBB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 3, pos.getZ() + 1)).isEmpty()) + if (worldIn.getEntitiesWithinAABB(EntityFlag.class, new AxisAlignedBB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 3, pos.getZ() + 1)).isEmpty()) { - par2World.spawnEntityInWorld(flag); - flag.setType(par1ItemStack.getItemDamage()); - flag.setOwner(par3EntityPlayer.getGameProfile().getName()); - par2World.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), Block.soundTypeMetal.getBreakSound(), Block.soundTypeMetal.getVolume(), Block.soundTypeMetal.getFrequency() + 2.0F); + worldIn.spawnEntityInWorld(flag); + flag.setType(stack.getItemDamage()); + flag.setOwner(player.getGameProfile().getName()); + worldIn.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundType.METAL.getBreakSound(), SoundCategory.BLOCKS, SoundType.METAL.getVolume(), SoundType.METAL.getPitch() + 2.0F); placed = true; } else { - par3EntityPlayer.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.flag.already_placed"))); + entity.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.flag.already_placed"))); } } if (placed) { - final int var2 = this.getInventorySlotContainItem(par3EntityPlayer, par1ItemStack); + final int var2 = this.getInventorySlotContainItem(player, stack); - if (var2 >= 0 && !par3EntityPlayer.capabilities.isCreativeMode) + if (var2 >= 0 && !player.capabilities.isCreativeMode) { - if (--par3EntityPlayer.inventory.mainInventory[var2].stackSize <= 0) + if (--player.inventory.mainInventory[var2].stackSize <= 0) { - par3EntityPlayer.inventory.mainInventory[var2] = null; + player.inventory.mainInventory[var2] = null; } } } @@ -109,12 +123,6 @@ private int getInventorySlotContainItem(EntityPlayer player, ItemStack stack) return -1; } - @Override - public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn) - { - return stack; - } - @Override public int getMaxItemUseDuration(ItemStack par1ItemStack) { @@ -128,11 +136,10 @@ public EnumAction getItemUseAction(ItemStack par1ItemStack) } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + public ActionResult onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { - par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); - - return par1ItemStack; + playerIn.setActiveHand(hand); + return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemMeteorChunk.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemMeteorChunk.java index 9dcdbd7c69..55b17cf252 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemMeteorChunk.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemMeteorChunk.java @@ -8,10 +8,15 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.SoundEvents; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -30,7 +35,7 @@ public ItemMeteorChunk(String assetName) this.setMaxDamage(0); this.setHasSubtypes(true); this.maxStackSize = 16; - this.setCreativeTab(CreativeTabs.tabMaterials); + this.setCreativeTab(CreativeTabs.MATERIALS); this.setUnlocalizedName(assetName); //this.setTextureName("arrow"); } @@ -131,14 +136,14 @@ public String getUnlocalizedName(ItemStack itemStack) } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) + public ActionResult onItemRightClick(ItemStack itemStack, World world, EntityPlayer player, EnumHand hand) { if (!player.capabilities.isCreativeMode) { --itemStack.stackSize; } - world.playSoundAtEntity(player, "random.bow", 1.0F, 0.0001F / (Item.itemRand.nextFloat() * 0.1F)); + world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 0.0001F / (Item.itemRand.nextFloat() * 0.1F)); if (!world.isRemote) { @@ -153,9 +158,9 @@ public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer world.spawnEntityInWorld(meteor); } - player.swingItem(); + player.swingArm(player.getActiveHand()); - return itemStack; + return new ActionResult<>(EnumActionResult.SUCCESS, itemStack); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemOxygenGear.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemOxygenGear.java index f42a7d28f9..22c3eabaf5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemOxygenGear.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemOxygenGear.java @@ -1,7 +1,8 @@ package micdoodle8.mods.galacticraft.core.items; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem; import net.minecraft.creativetab.CreativeTabs; @@ -10,6 +11,9 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -42,19 +46,20 @@ public EnumSortCategoryItem getCategory(int meta) } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) + public ActionResult onItemRightClick(ItemStack itemStack, World worldIn, EntityPlayer player, EnumHand hand) { if (player instanceof EntityPlayerMP) { - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) player); - ItemStack gear = stats.extendedInventory.getStackInSlot(1); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + ItemStack gear = stats.getExtendedInventory().getStackInSlot(1); if (gear == null) { - stats.extendedInventory.setInventorySlotContents(1, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(1, itemStack.copy()); itemStack.stackSize = 0; + return new ActionResult<>(EnumActionResult.SUCCESS, itemStack); } } - return itemStack; + return new ActionResult<>(EnumActionResult.PASS, itemStack); } } \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemOxygenMask.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemOxygenMask.java index 4a0bacb822..1a4e799003 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemOxygenMask.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemOxygenMask.java @@ -1,7 +1,8 @@ package micdoodle8.mods.galacticraft.core.items; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem; import net.minecraft.creativetab.CreativeTabs; @@ -10,6 +11,9 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -43,19 +47,20 @@ public EnumSortCategoryItem getCategory(int meta) } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) + public ActionResult onItemRightClick(ItemStack itemStack, World worldIn, EntityPlayer player, EnumHand hand) { if (player instanceof EntityPlayerMP) { - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) player); - ItemStack gear = stats.extendedInventory.getStackInSlot(0); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + ItemStack gear = stats.getExtendedInventory().getStackInSlot(0); if (gear == null) { - stats.extendedInventory.setInventorySlotContents(0, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(0, itemStack.copy()); itemStack.stackSize = 0; + return new ActionResult<>(EnumActionResult.SUCCESS, itemStack); } } - return itemStack; + return new ActionResult<>(EnumActionResult.PASS, itemStack); } } \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemOxygenTank.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemOxygenTank.java index 502334e3df..88f0a56252 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemOxygenTank.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemOxygenTank.java @@ -1,7 +1,8 @@ package micdoodle8.mods.galacticraft.core.items; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; @@ -11,6 +12,9 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -65,25 +69,25 @@ public EnumSortCategoryItem getCategory(int meta) } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) + public ActionResult onItemRightClick(ItemStack itemStack, World worldIn, EntityPlayer player, EnumHand hand) { if (player instanceof EntityPlayerMP) { - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) player); - ItemStack gear = stats.extendedInventory.getStackInSlot(2); - ItemStack gear1 = stats.extendedInventory.getStackInSlot(3); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + ItemStack gear = stats.getExtendedInventory().getStackInSlot(2); + ItemStack gear1 = stats.getExtendedInventory().getStackInSlot(3); if (gear == null) { - stats.extendedInventory.setInventorySlotContents(2, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(2, itemStack.copy()); itemStack.stackSize = 0; } else if (gear1 == null) { - stats.extendedInventory.setInventorySlotContents(3, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(3, itemStack.copy()); itemStack.stackSize = 0; } } - return itemStack; + return new ActionResult<>(EnumActionResult.PASS, itemStack); } } \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemParaChute.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemParaChute.java index c174779f61..152c720ba2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemParaChute.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemParaChute.java @@ -1,7 +1,8 @@ package micdoodle8.mods.galacticraft.core.items; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem; import net.minecraft.creativetab.CreativeTabs; @@ -11,6 +12,9 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -246,19 +250,20 @@ public EnumSortCategoryItem getCategory(int meta) } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) + public ActionResult onItemRightClick(ItemStack itemStack, World worldIn, EntityPlayer player, EnumHand hand) { if (player instanceof EntityPlayerMP) { - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) player); - ItemStack gear = stats.extendedInventory.getStackInSlot(4); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + ItemStack gear = stats.getExtendedInventory().getStackInSlot(4); if (gear == null) { - stats.extendedInventory.setInventorySlotContents(4, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(4, itemStack.copy()); itemStack.stackSize = 0; + return new ActionResult<>(EnumActionResult.SUCCESS, itemStack); } } - return itemStack; + return new ActionResult<>(EnumActionResult.PASS, itemStack); } } \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemPreLaunchChecklist.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemPreLaunchChecklist.java index 822dd11748..4236111646 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemPreLaunchChecklist.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemPreLaunchChecklist.java @@ -11,6 +11,9 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -52,14 +55,15 @@ public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlaye } @Override - public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) + public ActionResult onItemRightClick(ItemStack itemStack, World worldIn, EntityPlayer playerIn, EnumHand hand) { if (worldIn.isRemote) { playerIn.openGui(GalacticraftCore.instance, GuiIdsCore.PRE_LAUNCH_CHECKLIST, playerIn.worldObj, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ); + return new ActionResult<>(EnumActionResult.SUCCESS, itemStack); } - return itemStackIn; + return new ActionResult<>(EnumActionResult.PASS, itemStack); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemSensorGlasses.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemSensorGlasses.java index 693f4b320f..cde1d83060 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemSensorGlasses.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemSensorGlasses.java @@ -10,6 +10,7 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; @@ -20,7 +21,7 @@ public class ItemSensorGlasses extends ItemArmor implements ISortableItem { public ItemSensorGlasses(String assetName) { - super(GCItems.ARMOR_SENSOR_GLASSES, 0, 0); + super(GCItems.ARMOR_SENSOR_GLASSES, 0, EntityEquipmentSlot.HEAD); this.setUnlocalizedName(assetName); //this.setTextureName(Constants.TEXTURE_PREFIX + assetName); } @@ -32,7 +33,7 @@ public CreativeTabs getCreativeTab() } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { return Constants.TEXTURE_PREFIX + "textures/model/armor/sensor_1.png"; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java index 429ac823e8..667408a6bb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java @@ -20,6 +20,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; @@ -49,7 +51,7 @@ public CreativeTabs getCreativeTab() } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { boolean padFound = false; TileEntity tile = null; @@ -57,7 +59,7 @@ public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, if (worldIn.isRemote && playerIn instanceof EntityPlayerSP) { ClientProxyCore.playerClientHandler.onBuild(8, (EntityPlayerSP) playerIn); - return false; + return EnumActionResult.FAIL; } else { @@ -100,12 +102,12 @@ public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, { if (((TileEntityLandingPad) tile).getDockedEntity() != null) { - return false; + return EnumActionResult.FAIL; } } else { - return false; + return EnumActionResult.FAIL; } final EntityTier1Rocket spaceship = new EntityTier1Rocket(worldIn, centerX, centerY, centerZ, EnumRocketType.values()[stack.getItemDamage()]); @@ -135,10 +137,10 @@ public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, } else { - return false; + return EnumActionResult.FAIL; } } - return true; + return EnumActionResult.PASS; } @SuppressWarnings({ "unchecked", "rawtypes" }) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java index d98fe5a9d9..d4c4acb431 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java @@ -13,8 +13,11 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -71,13 +74,13 @@ public void wrenchUsed(EntityPlayer entityPlayer, BlockPos pos) } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { - return false; + return EnumActionResult.PASS; } @Override - public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player) + public boolean doesSneakBypassUse(ItemStack stack, IBlockAccess world, BlockPos pos, EntityPlayer player) { return true; } @@ -92,26 +95,26 @@ public void onCreated(ItemStack stack, World world, EntityPlayer player) } @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { if (world.isRemote) { - return false; + return EnumActionResult.FAIL; } IBlockState state = world.getBlockState(pos); Block blockID = state.getBlock(); - if (blockID == Blocks.furnace || blockID == Blocks.lit_furnace || blockID == Blocks.dropper || blockID == Blocks.hopper || blockID == Blocks.dispenser || blockID == Blocks.piston || blockID == Blocks.sticky_piston) + if (blockID == Blocks.FURNACE || blockID == Blocks.LIT_FURNACE || blockID == Blocks.DROPPER || blockID == Blocks.HOPPER || blockID == Blocks.DISPENSER || blockID == Blocks.PISTON || blockID == Blocks.STICKY_PISTON) { int metadata = blockID.getMetaFromState(state); world.setBlockState(pos, blockID.getStateFromMeta(EnumFacing.getHorizontal((metadata + 1) % 4).ordinal()), 3); this.wrenchUsed(player, pos); - return true; + return EnumActionResult.PASS; } - return false; + return EnumActionResult.FAIL; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java index 2f7e138aac..b4d324a911 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java @@ -38,10 +38,10 @@ import micdoodle8.mods.galacticraft.core.entities.EntityBuggy; import micdoodle8.mods.galacticraft.core.entities.IBubbleProvider; import micdoodle8.mods.galacticraft.core.entities.IControllableEntity; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerHandler; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerHandler.EnumModelPacketType; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.fluid.FluidNetwork; import micdoodle8.mods.galacticraft.core.inventory.ContainerSchematic; import micdoodle8.mods.galacticraft.core.inventory.IInventorySettable; @@ -58,7 +58,7 @@ import micdoodle8.mods.galacticraft.core.wrappers.ScheduledDimensionChange; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.Particle; import net.minecraft.client.settings.GameSettings; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; @@ -71,10 +71,15 @@ import net.minecraft.network.INetHandler; import net.minecraft.network.Packet; import net.minecraft.network.PacketBuffer; -import net.minecraft.network.play.server.S07PacketRespawn; +import net.minecraft.network.play.server.SPacketRespawn; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumHand; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.Style; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldServer; import net.minecraftforge.fml.client.FMLClientHandler; @@ -370,24 +375,21 @@ public void handleClientSide(EntityPlayer player) for (int i = 0; i < 4; i++) { - if (mc != null && mc.getRenderViewEntity() != null && mc.effectRenderer != null && mc.theWorld != null) + if (mc.getRenderViewEntity() != null && mc.effectRenderer != null && mc.theWorld != null) { - final EntityFX fx = new ParticleSparks(mc.theWorld, x - 0.15 + 0.5, y + 1.2, z + 0.15 + 0.5, mc.theWorld.rand.nextDouble() / 20 - mc.theWorld.rand.nextDouble() / 20, mc.theWorld.rand.nextDouble() / 20 - mc.theWorld.rand.nextDouble() / 20); + final Particle fx = new ParticleSparks(mc.theWorld, x - 0.15 + 0.5, y + 1.2, z + 0.15 + 0.5, mc.theWorld.rand.nextDouble() / 20 - mc.theWorld.rand.nextDouble() / 20, mc.theWorld.rand.nextDouble() / 20 - mc.theWorld.rand.nextDouble() / 20); - if (fx != null) - { - mc.effectRenderer.addEffect(fx); - } + mc.effectRenderer.addEffect(fx); } } break; case C_UPDATE_GEAR_SLOT: int subtype = (Integer) this.data.get(3); - EntityPlayer gearDataPlayer = null; - MinecraftServer server = MinecraftServer.getServer(); + EntityPlayer gearDataPlayer; + MinecraftServer server = player.worldObj.getMinecraftServer(); String gearName = (String) this.data.get(0); - if (server != null && server.getConfigurationManager() != null) + if (server != null) { gearDataPlayer = PlayerUtil.getPlayerForUsernameVanilla(server, gearName); } @@ -415,7 +417,7 @@ public void handleClientSide(EntityPlayer player) } EnumExtendedInventorySlot type = EnumExtendedInventorySlot.values()[(Integer) this.data.get(2)]; - EnumModelPacketType typeChange = EnumModelPacketType.values()[(Integer) this.data.get(1)]; + GCPlayerHandler.EnumModelPacketType typeChange = GCPlayerHandler.EnumModelPacketType.values()[(Integer) this.data.get(1)]; switch (type) { @@ -432,7 +434,7 @@ public void handleClientSide(EntityPlayer player) gearData.setRightTank(subtype); break; case PARACHUTE: - if (typeChange == EnumModelPacketType.ADD) + if (typeChange == GCPlayerHandler.EnumModelPacketType.ADD) { String name; @@ -759,7 +761,7 @@ public void handleClientSide(EntityPlayer player) } else { - ((TileEntityTelemetry) tile).clientClass = EntityList.stringToClassMapping.get(name); + ((TileEntityTelemetry) tile).clientClass = EntityList.NAME_TO_CLASS.get(name); } ((TileEntityTelemetry) tile).clientData = new int[5]; for (int i = 4; i < 7; i++) @@ -832,12 +834,12 @@ public void handleServerSide(EntityPlayer player) return; } - final GCPlayerStats stats = GCPlayerStats.get(playerBase); + IStatsCapability stats = playerBase.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); switch (this.type) { case S_RESPAWN_PLAYER: - playerBase.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.getDifficulty(), player.worldObj.getWorldInfo().getTerrainType(), playerBase.theItemInWorldManager.getGameType())); + playerBase.connection.sendPacket(new SPacketRespawn(player.dimension, player.worldObj.getDifficulty(), player.worldObj.getWorldInfo().getTerrainType(), playerBase.interactionManager.getGameType())); break; case S_TELEPORT_ENTITY: TickHandlerServer.scheduleNewDimensionChange(new ScheduledDimensionChange(playerBase, (String) PacketSimple.this.data.get(0))); @@ -852,24 +854,24 @@ public void handleServerSide(EntityPlayer player) System.err.println(ConfigManagerCore.rocketFuelFactor); if (ship.hasValidFuel()) { - ItemStack stack2 = stats.extendedInventory.getStackInSlot(4); + ItemStack stack2 = stats.getExtendedInventory().getStackInSlot(4); - if (stack2 != null && stack2.getItem() instanceof ItemParaChute || stats.launchAttempts > 0) + if (stack2 != null && stack2.getItem() instanceof ItemParaChute || stats.getLaunchAttempts() > 0) { ship.igniteCheckingCooldown(); - stats.launchAttempts = 0; + stats.setLaunchAttempts(0); } - else if (stats.chatCooldown == 0 && stats.launchAttempts == 0) + else if (stats.getChatCooldown() == 0 && stats.getLaunchAttempts() == 0) { player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.noparachute"))); - stats.chatCooldown = 250; - stats.launchAttempts = 1; + stats.setChatCooldown(250); + stats.setLaunchAttempts(1); } } - else if (stats.chatCooldown == 0) + else if (stats.getChatCooldown() == 0) { player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.nofuel"))); - stats.chatCooldown = 250; + stats.setChatCooldown(250); } } } @@ -924,7 +926,7 @@ else if (player.getRidingEntity() instanceof EntitySpaceshipBase) break; case S_BIND_SPACE_STATION_ID: int homeID = (Integer) this.data.get(0); - if ((!stats.spaceStationDimensionData.containsKey(homeID) || stats.spaceStationDimensionData.get(homeID) == -1 || stats.spaceStationDimensionData.get(homeID) == 0) + if ((!stats.getSpaceStationDimensionData().containsKey(homeID) || stats.getSpaceStationDimensionData().get(homeID) == -1 || stats.getSpaceStationDimensionData().get(homeID) == 0) && !ConfigManagerCore.disableSpaceStationCreation) { if (playerBase.capabilities.isCreativeMode || WorldUtil.getSpaceStationRecipe(homeID).matches(playerBase, true)) @@ -974,10 +976,10 @@ else if (player.getRidingEntity() instanceof EntitySpaceshipBase) } break; case S_ON_FAILED_CHEST_UNLOCK: - if (stats.chatCooldown == 0) + if (stats.getChatCooldown() == 0) { player.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.chest.warning.wrongkey", this.data.get(0)))); - stats.chatCooldown = 100; + stats.setChatCooldown(100); } break; case S_RENAME_SPACE_STATION: @@ -1120,7 +1122,8 @@ else if (player.getRidingEntity() instanceof EntitySpaceshipBase) if (race != null) { - GCPlayerStats.get(playerInvited).spaceRaceInviteTeamID = teamInvitedTo; + IStatsCapability invitedPlayerStats = playerInvited.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + invitedPlayerStats.setSpaceRaceInviteTeamID(teamInvitedTo); String dA = EnumColor.DARK_AQUA.getCode(); String bG = EnumColor.BRIGHT_GREEN.getCode(); String dB = EnumColor.PURPLE.getCode(); @@ -1130,7 +1133,7 @@ else if (player.getRidingEntity() instanceof EntitySpaceshipBase) { teamNameTotal = teamNameTotal.concat(dB + teamNamePart + " "); } - playerInvited.addChatMessage(new TextComponentString(dA + GCCoreUtil.translateWithFormat("gui.space_race.chat.invite_received", bG + player.getGameProfile().getName() + dA) + " " + GCCoreUtil.translateWithFormat("gui.space_race.chat.to_join", teamNameTotal, EnumColor.AQUA + "/joinrace" + dA)).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_AQUA))); + playerInvited.addChatMessage(new TextComponentString(dA + GCCoreUtil.translateWithFormat("gui.space_race.chat.invite_received", bG + player.getGameProfile().getName() + dA) + " " + GCCoreUtil.translateWithFormat("gui.space_race.chat.to_join", teamNameTotal, EnumColor.AQUA + "/joinrace" + dA)).setStyle(new Style().setColor(TextFormatting.DARK_AQUA))); } } break; @@ -1173,17 +1176,17 @@ else if (player.getRidingEntity() instanceof EntitySpaceshipBase) for (String member : spaceRaceToAddPlayer.getPlayerNames()) { - EntityPlayerMP memberObj = PlayerUtil.getPlayerForUsernameVanilla(MinecraftServer.getServer(), member); + EntityPlayerMP memberObj = PlayerUtil.getPlayerForUsernameVanilla(player.worldObj.getMinecraftServer(), member); if (memberObj != null) { - memberObj.addChatMessage(new TextComponentString(EnumColor.DARK_AQUA + GCCoreUtil.translateWithFormat("gui.space_race.chat.add_success", EnumColor.BRIGHT_GREEN + playerToAdd + EnumColor.DARK_AQUA)).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_AQUA))); + memberObj.addChatMessage(new TextComponentString(EnumColor.DARK_AQUA + GCCoreUtil.translateWithFormat("gui.space_race.chat.add_success", EnumColor.BRIGHT_GREEN + playerToAdd + EnumColor.DARK_AQUA)).setStyle(new Style().setColor(TextFormatting.DARK_AQUA))); } } } else { - player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.space_race.chat.already_part")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_RED))); + player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.space_race.chat.already_part")).setStyle(new Style().setColor(TextFormatting.DARK_RED))); } } break; @@ -1223,7 +1226,7 @@ else if (player.getRidingEntity() instanceof EntitySpaceshipBase) if (missingObjects.length() > 0) { - playerBase.playerNetServerHandler.kickPlayerFromServer("Missing Galacticraft Celestial Objects:\n\n " + missingObjects); + playerBase.connection.kickPlayerFromServer("Missing Galacticraft Celestial Objects:\n\n " + missingObjects); } break; @@ -1232,7 +1235,8 @@ else if (player.getRidingEntity() instanceof EntitySpaceshipBase) EntityPlayerMP e = PlayerUtil.getPlayerBaseServerFromPlayerUsername(name, true); if (e != null) { - GCPlayerHandler.checkGear(e, GCPlayerStats.get(e), true); + IStatsCapability statsRequested = e.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + GCPlayerHandler.checkGear(e, statsRequested, true); } break; case S_REQUEST_ARCLAMP_FACING: @@ -1243,7 +1247,7 @@ else if (player.getRidingEntity() instanceof EntitySpaceshipBase) } break; case S_BUILDFLAGS_UPDATE: - stats.buildFlags = (Integer) this.data.get(0); + stats.setBuildFlags((Integer) this.data.get(0)); break; case S_UPDATE_VIEWSCREEN_REQUEST: TileEntity tile = player.worldObj.getTileEntity((BlockPos) this.data.get(0)); @@ -1303,7 +1307,7 @@ else if (player.getRidingEntity() instanceof EntitySpaceshipBase) break; case S_REQUEST_PLAYERSKIN: String strName = (String) this.data.get(0); - EntityPlayerMP playerRequested = FMLServerHandler.instance().getServer().getConfigurationManager().getPlayerByUsername(strName); + EntityPlayerMP playerRequested = FMLServerHandler.instance().getServer().getPlayerList().getPlayerByUsername(strName); //Player not online if (playerRequested == null) @@ -1346,17 +1350,20 @@ else if (player.getRidingEntity() instanceof EntitySpaceshipBase) } break; case S_UPDATE_CHECKLIST: - ItemStack stack = player.getHeldItem(); - if (stack != null && stack.getItem() == GCItems.prelaunchChecklist) + for (EnumHand enumhand : EnumHand.values()) { - NBTTagCompound tagCompound = stack.getTagCompound(); - if (tagCompound == null) + ItemStack stack = player.getHeldItem(enumhand); + if (stack != null && stack.getItem() == GCItems.prelaunchChecklist) { - tagCompound = new NBTTagCompound(); + NBTTagCompound tagCompound = stack.getTagCompound(); + if (tagCompound == null) + { + tagCompound = new NBTTagCompound(); + } + NBTTagCompound tagCompoundRead = (NBTTagCompound) this.data.get(0); + tagCompound.setTag("checklistData", tagCompoundRead); + stack.setTagCompound(tagCompound); } - NBTTagCompound tagCompoundRead = (NBTTagCompound) this.data.get(0); - tagCompound.setTag("checklistData", tagCompoundRead); - stack.setTagCompound(tagCompound); } break; default: diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java index 5d83c93561..0840cbb928 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java @@ -53,7 +53,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.network.INetHandler; import net.minecraft.network.NetHandlerPlayServer; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.TextFormatting; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; @@ -106,7 +106,7 @@ public class ClientProxyCore extends CommonProxyCore public static boolean lastSpacebarDown; public static HashMap clientSpaceStationID = Maps.newHashMap(); public static MusicTicker.MusicType MUSIC_TYPE_MARS; - public static EnumRarity galacticraftItem = EnumHelper.addRarity("GCRarity", EnumChatFormatting.BLUE, "Space"); + public static EnumRarity galacticraftItem = EnumHelper.addRarity("GCRarity", TextFormatting.BLUE, "Space"); public static Map capeMap = new HashMap<>(); public static InventoryExtended dummyInventory = new InventoryExtended(); public static Map submergedTextures = Maps.newHashMap(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoLoader.java index 3ce5a0e781..35e7500c43 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoLoader.java @@ -146,7 +146,7 @@ public boolean hasCustomName() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return (this.hasCustomName() ? new TextComponentString(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java index 911b7ad405..1a61e1371f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java @@ -148,7 +148,7 @@ public boolean hasCustomName() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCircuitFabricator.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCircuitFabricator.java index 6c832fdcf9..07d76a66cf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCircuitFabricator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCircuitFabricator.java @@ -199,7 +199,7 @@ public boolean hasCustomName() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCoalGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCoalGenerator.java index 5a8ac93497..831c96bf1f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCoalGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCoalGenerator.java @@ -321,7 +321,7 @@ public boolean hasCustomName() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java index 6e7c7b7e46..cd4800f566 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java @@ -399,7 +399,7 @@ public boolean hasCustomName() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricFurnace.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricFurnace.java index f97a16a3ee..36c697a67d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricFurnace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricFurnace.java @@ -296,7 +296,7 @@ public boolean hasCustomName() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricIngotCompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricIngotCompressor.java index ba92112eb6..3797779ead 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricIngotCompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricIngotCompressor.java @@ -512,7 +512,7 @@ public boolean hasCustomName() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityEnergyStorageModule.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityEnergyStorageModule.java index 1586dc1d00..d02f735b81 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityEnergyStorageModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityEnergyStorageModule.java @@ -319,7 +319,7 @@ public boolean hasCustomName() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java index d8b1aaadbf..97ca9aafb3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java @@ -230,7 +230,7 @@ public boolean hasCustomName() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityIngotCompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityIngotCompressor.java index 9b76f1bb96..79124461a0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityIngotCompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityIngotCompressor.java @@ -602,7 +602,7 @@ public boolean hasCustomName() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java index e3a0a21f9b..bdc6d34698 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java @@ -378,7 +378,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCompressor.java index 2732a85175..d1c5ae3aea 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCompressor.java @@ -341,7 +341,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDecompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDecompressor.java index 9173f559c0..9bcebad7d9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDecompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDecompressor.java @@ -337,7 +337,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java index b34e81ee3e..9e90993c09 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java @@ -594,7 +594,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java index bcd6b408db..6b8e683a42 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java @@ -471,7 +471,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenStorageModule.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenStorageModule.java index 932012875d..1592af0701 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenStorageModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenStorageModule.java @@ -385,7 +385,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java index f6cb2529b2..9f4a7531dc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java @@ -416,7 +416,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityRefinery.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityRefinery.java index d55659212c..d8435f69be 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityRefinery.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityRefinery.java @@ -408,7 +408,7 @@ else if (from.equals(getFront())) } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java index 0c64d17d6c..35a2e931a5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java @@ -605,7 +605,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTreasureChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTreasureChest.java index c1e5964e93..f006e65e4a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTreasureChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTreasureChest.java @@ -415,9 +415,9 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { - return (IChatComponent) (this.hasCustomName() ? new TextComponentString(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); + return (ITextComponent) (this.hasCustomName() ? new TextComponentString(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java index c439400445..876620a728 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java @@ -14,7 +14,7 @@ import net.minecraft.world.WorldServer; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeCache; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.gen.NoiseGeneratorOctaves; import net.minecraft.world.gen.layer.GenLayer; @@ -46,7 +46,7 @@ public class MapGen extends WorldChunkManager implements Runnable private int biomeMapCz; private int biomeMapFactor; - private BiomeGenBase[] biomeList; + private Biome[] biomeList; private BiomeCache biomeCache; private GenLayer genBiomes; private GenLayer biomeIndexLayer; @@ -60,7 +60,7 @@ public class MapGen extends WorldChunkManager implements Runnable private double[] heighttemp = null; private WorldType worldType = WorldType.DEFAULT; private int[] biomesGrid = null; //Memory efficient to keep re-using the same one. - private BiomeGenBase[] biomesGridHeights = null; + private Biome[] biomesGridHeights = null; private int[] biomeCount = null; private final int dimID; @@ -99,7 +99,7 @@ public MapGen(World world, int sx, int sz, int cx, int cz, int scale, File file) this.ix = 0; this.iz = 0; long seed = world.getSeed(); - this.biomeList = BiomeGenBase.getBiomeGenArray(); + this.biomeList = Biome.getBiomeGenArray(); this.biomeCache = new BiomeCache(this); this.worldType = world.getWorldInfo().getTerrainType(); GenLayerGCMap[] agenlayerOrig = GenLayerGCMap.initializeAllBiomeGenerators(seed, worldType, world.getWorldInfo().getGeneratorOptions()); @@ -425,7 +425,7 @@ private void func_147423_a(int cx, int cy, int cz) int baseIndex = xx + x + 22 + zz * 10; for (int z = -2; z <= 2; ++z) { - BiomeGenBase biomegenbase1 = biomesGridHeights[baseIndex + z * 10]; + Biome biomegenbase1 = biomesGridHeights[baseIndex + z * 10]; float f3 = biomegenbase1.minHeight; float f4 = biomegenbase1.maxHeight; @@ -513,7 +513,7 @@ private void func_147423_a(int cx, int cy, int cz) * REPLICATES method in WorldChunkManager * Returns an array of biomes for the location input, used for generating the height map */ - public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] biomes, int x, int z, int width, int height) + public Biome[] getBiomesForGeneration(Biome[] biomes, int x, int z, int width, int height) { IntCache.resetIntCache(); int[] aint = this.genBiomes.getInts(x, z, width, height); @@ -521,19 +521,19 @@ public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] biomes, int x, int z int size = width * height; if (biomes == null || biomes.length < size) { - biomes = new BiomeGenBase[size]; + biomes = new Biome[size]; } for (int i = 0; i < size; ++i) { int biomeId = aint[i]; - BiomeGenBase biomegenbase = null; + Biome biomegenbase = null; if (biomeId >= 0 && biomeId <= biomeList.length) { biomegenbase = biomeList[biomeId]; } // else // System.err.println("MapGen: Biome ID is out of bounds: " + biomeId + ", defaulting to 0 (Ocean)"); - biomes[i] = biomegenbase == null ? BiomeGenBase.ocean : biomegenbase; + biomes[i] = biomegenbase == null ? Biome.ocean : biomegenbase; } return biomes; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java index 60f967e68a..7d97b89908 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java @@ -22,7 +22,7 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; @@ -916,13 +916,13 @@ private static File makeFileName(File folder, int cx, int cz) private static int getBiomeBaseColour(int biomeId) { - BiomeGenBase[] biomeList = BiomeGenBase.getBiomeGenArray(); - BiomeGenBase biomegenbase = null; + Biome[] biomeList = Biome.getBiomeGenArray(); + Biome biomegenbase = null; if (biomeId >= 0 && biomeId <= biomeList.length) { biomegenbase = biomeList[biomeId]; } - return biomegenbase == null ? BiomeGenBase.ocean.color : biomegenbase.color; + return biomegenbase == null ? Biome.ocean.color : biomegenbase.color; } public static int convertBiomeColour(int in, int height) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java index 03cd171be9..dfec3c01ac 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java @@ -22,6 +22,7 @@ import micdoodle8.mods.galacticraft.core.entities.EntityCelestialFake; import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerHandler; import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.items.ItemParaChute; import micdoodle8.mods.galacticraft.core.network.PacketSimple; import micdoodle8.mods.galacticraft.core.network.PacketSimple.EnumSimplePacket; @@ -525,7 +526,7 @@ public static void registerSpaceStations(File spaceStationList) * IMPORTANT: GalacticraftRegistry.registerProvider() must always be called in parallel with this * meaning the CelestialBodies are iterated in the same order when registered there and here. */ - public static boolean registerPlanet(int planetID, boolean initialiseDimensionAtServerInit, int defaultID) + public static boolean registerPlanet(DimensionType type, boolean initialiseDimensionAtServerInit, int defaultID) { if (WorldUtil.registeredPlanets == null) { @@ -534,26 +535,26 @@ public static boolean registerPlanet(int planetID, boolean initialiseDimensionAt if (initialiseDimensionAtServerInit) { - if (!DimensionManager.isDimensionRegistered(planetID)) + if (!DimensionManager.isDimensionRegistered(type.getId())) { - DimensionManager.registerDimension(planetID, planetID); - GCLog.info("Registered Dimension: " + planetID); - WorldUtil.registeredPlanets.add(planetID); + DimensionManager.registerDimension(type.getId(), type); + GCLog.info("Registered Dimension: " + type); + WorldUtil.registeredPlanets.add(type.getId()); } else { - GCLog.severe("Dimension already registered to another mod: unable to register planet dimension " + planetID); + GCLog.severe("Dimension already registered to another mod: unable to register planet dimension " + type); //Add 0 to the list to preserve the correct order of the other planets (e.g. if server/client initialise with different dimension IDs in configs, the order becomes important for figuring out what is going on) WorldUtil.registeredPlanets.add(defaultID); return false; } - World w = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(planetID); - WorldUtil.dimNames.put(planetID, getDimensionName(w.provider)); + World w = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(type.getId()); + WorldUtil.dimNames.put(type.getId(), getDimensionName(w.provider)); return true; } //Not to be initialised - still add to the registered planets list (for hotloading later?) - WorldUtil.registeredPlanets.add(planetID); + WorldUtil.registeredPlanets.add(type.getId()); return true; } @@ -754,7 +755,7 @@ else if (entity.getRidingEntity() instanceof EntityCelestialFake) try { GCLog.info("DEBUG: Attempting to remove player from old dimension " + oldDimID); - ((WorldServer) worldOld).getPlayerManager().removePlayer(player); + ((WorldServer) worldOld).getPlayerChunkMap().removePlayer(player); GCLog.info("DEBUG: Successfully removed player from old dimension " + oldDimID); } catch (Exception e) @@ -766,7 +767,7 @@ else if (entity.getRidingEntity() instanceof EntityCelestialFake) { try { - ((WorldServer) worldOld).getPlayerManager().removePlayer(player); + ((WorldServer) worldOld).getPlayerChunkMap().removePlayer(player); } catch (Exception e) { @@ -1225,10 +1226,10 @@ private static void registerSSdim(Integer dimID, Integer providerKey) } } - public static void toCelestialSelection(EntityPlayerMP player, GCPlayerStats stats, int tier) + public static void toCelestialSelection(EntityPlayerMP player, IStatsCapability stats, int tier) { - player.mountEntity(null); - stats.spaceshipTier = tier; + player.dismountRidingEntity(); + stats.setSpaceshipTier(tier); HashMap map = WorldUtil.getArrayOfPossibleDimensions(tier, player); String dimensionList = ""; @@ -1240,11 +1241,11 @@ public static void toCelestialSelection(EntityPlayerMP player, GCPlayerStats sta } GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_DIMENSION_LIST, player.worldObj.provider.getDimension(), new Object[] { player.getGameProfile().getName(), dimensionList }), player); - stats.usingPlanetSelectionGui = true; - stats.savedPlanetList = dimensionList; + stats.setUsingPlanetSelectionGui(true); + stats.setSavedPlanetList(dimensionList); Entity fakeEntity = new EntityCelestialFake(player.worldObj, player.posX, player.posY, player.posZ); player.worldObj.spawnEntityInWorld(fakeEntity); - player.mountEntity(fakeEntity); + player.startRiding(fakeEntity); } public static Vector3 getFootprintPosition(World world, float rotation, Vector3 startPosition, BlockVec3 playerCenter) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java index bfa634c3b8..b1cd05ffb9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java @@ -10,7 +10,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeDecorator; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.common.MinecraftForge; @@ -35,7 +35,7 @@ public BiomeDecoratorMoon() } @Override - public void decorate(World worldIn, Random random, BiomeGenBase p_180292_3_, BlockPos pos) + public void decorate(World worldIn, Random random, Biome p_180292_3_, BlockPos pos) { if (this.worldObj != null) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenBaseMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenBaseMoon.java index 7b8e882787..f7fbbbb67f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenBaseMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenBaseMoon.java @@ -6,13 +6,13 @@ import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedZombie; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import net.minecraft.world.biome.BiomeDecorator; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; -public class BiomeGenBaseMoon extends BiomeGenBase +public class BiomeMoon extends Biome { - public static final BiomeGenBase moonFlat = new BiomeGenFlatMoon(ConfigManagerCore.biomeIDbase).setBiomeName("Moon"); + public static final Biome moonFlat = new BiomeGenFlatMoon(ConfigManagerCore.biomeIDbase).setBiomeName("Moon"); - BiomeGenBaseMoon(int var1) + BiomeMoon(int var1) { super(var1); this.spawnableMonsterList.clear(); @@ -33,9 +33,9 @@ public BiomeDecorator createBiomeDecorator() } @Override - public BiomeGenBaseMoon setColor(int var1) + public BiomeMoon setColor(int var1) { - return (BiomeGenBaseMoon) super.setColor(var1); + return (BiomeMoon) super.setColor(var1); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenBaseOrbit.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenBaseOrbit.java index 5b7c4e7c17..8d7440ad0c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenBaseOrbit.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenBaseOrbit.java @@ -3,14 +3,14 @@ import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSpider; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedZombie; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; -public class BiomeGenBaseOrbit extends BiomeGenBase +public class BiomeOrbit extends Biome { - public static final BiomeGenBase space = new BiomeGenBaseOrbit(ConfigManagerCore.biomeIDbase + 3).setBiomeName("Space"); + public static final Biome space = new BiomeOrbit(ConfigManagerCore.biomeIDbase + 3).setBiomeName("Space"); @SuppressWarnings("unchecked") - private BiomeGenBaseOrbit(int var1) + private BiomeOrbit(int var1) { super(var1); this.spawnableMonsterList.clear(); @@ -23,9 +23,9 @@ private BiomeGenBaseOrbit(int var1) } @Override - public BiomeGenBaseOrbit setColor(int var1) + public BiomeOrbit setColor(int var1) { - return (BiomeGenBaseOrbit) super.setColor(var1); + return (BiomeOrbit) super.setColor(var1); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenFlatMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenFlatMoon.java index d6642490e9..f408e08b29 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenFlatMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenFlatMoon.java @@ -3,7 +3,7 @@ import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import net.minecraftforge.common.BiomeDictionary; -public class BiomeGenFlatMoon extends BiomeGenBaseMoon +public class BiomeGenFlatMoon extends BiomeMoon { public BiomeGenFlatMoon(int par1) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeProviderMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeProviderMoon.java new file mode 100644 index 0000000000..48da50d011 --- /dev/null +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeProviderMoon.java @@ -0,0 +1,13 @@ +package micdoodle8.mods.galacticraft.core.world.gen; + +import micdoodle8.mods.galacticraft.api.prefab.world.gen.BiomeProviderSpace; +import net.minecraft.world.biome.Biome; + +public class BiomeProviderMoon extends BiomeProviderSpace +{ + @Override + public Biome getBiome() + { + return BiomeMoon.moonFlat; + } +} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeProviderOrbit.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeProviderOrbit.java new file mode 100644 index 0000000000..fc546acad6 --- /dev/null +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeProviderOrbit.java @@ -0,0 +1,13 @@ +package micdoodle8.mods.galacticraft.core.world.gen; + +import micdoodle8.mods.galacticraft.api.prefab.world.gen.BiomeProviderSpace; +import net.minecraft.world.biome.Biome; + +public class BiomeProviderOrbit extends BiomeProviderSpace +{ + @Override + public Biome getBiome() + { + return BiomeOrbit.space; + } +} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java index 094c9f2349..7d657bca5a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java @@ -15,19 +15,17 @@ import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.IProgressUpdate; -import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.util.math.ChunkPos; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkPrimer; -import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.gen.ChunkProviderGenerate; +import net.minecraft.world.gen.ChunkProviderOverworld; import java.util.List; import java.util.Random; -public class ChunkProviderMoon extends ChunkProviderGenerate +public class ChunkProviderMoon extends ChunkProviderOverworld { private final IBlockState BLOCK_TOP = GCBlocks.blockMoon.getDefaultState().withProperty(BlockBasicMoon.BASIC_TYPE_MOON, BlockBasicMoon.EnumBlockBasicMoon.MOON_TURF); private final IBlockState BLOCK_FILL = GCBlocks.blockMoon.getDefaultState().withProperty(BlockBasicMoon.BASIC_TYPE_MOON, BlockBasicMoon.EnumBlockBasicMoon.MOON_DIRT); @@ -45,7 +43,7 @@ public class ChunkProviderMoon extends ChunkProviderGenerate private final MapGenDungeon dungeonGeneratorMoon = new MapGenDungeon(new DungeonConfiguration(GCBlocks.blockMoon.getDefaultState().withProperty(BlockBasicMoon.BASIC_TYPE_MOON, BlockBasicMoon.EnumBlockBasicMoon.MOON_DUNGEON_BRICK), 25, 8, 16, 5, 6, RoomBoss.class, RoomTreasure.class)); - private BiomeGenBase[] biomesForGeneration = { BiomeGenBaseMoon.moonFlat }; + private Biome[] biomesForGeneration = { BiomeMoon.moonFlat }; private final MapGenBaseMeta caveGenerator = new MapGenCavesMoon(); @@ -68,7 +66,6 @@ public ChunkProviderMoon(World par1World, long par2, boolean par4) this.noiseGen4 = new Gradient(this.rand.nextLong(), 1, 0.25F); } - @Override public void setBlocksInChunk(int chunkX, int chunkZ, ChunkPrimer primer) { this.noiseGen1.setFrequency(0.0125F); @@ -104,15 +101,14 @@ else if (d3 > 1.0D) { if (y < ChunkProviderMoon.MID_HEIGHT + yDev) { - primer.setBlockState(getIndex(x, y, z), BLOCK_LOWER); + primer.setBlockState(x, y, z, BLOCK_LOWER); } } } } } - @Override - public void replaceBlocksForBiome(int par1, int par2, ChunkPrimer primer, BiomeGenBase[] par4ArrayOfBiomeGenBase) + public void replaceBlocksForBiome(int par1, int par2, ChunkPrimer primer, Biome[] par4ArrayOfBiome) { final int var5 = 20; for (int var8 = 0; var8 < 16; ++var8) @@ -130,11 +126,11 @@ public void replaceBlocksForBiome(int par1, int par2, ChunkPrimer primer, BiomeG if (var16 <= this.rand.nextInt(5)) { - primer.setBlockState(index, Blocks.bedrock.getDefaultState()); + primer.setBlockState(var8, var16, var9, Blocks.BEDROCK.getDefaultState()); } else { - IBlockState var18 = primer.getBlockState(index); + IBlockState var18 = primer.getBlockState(var8, var16, var9); if (Blocks.AIR == var18) { var13 = -1; @@ -157,17 +153,17 @@ else if (var16 >= var5 - -16 && var16 <= var5 + 1) if (var16 >= var5 - 1) { - primer.setBlockState(index, state0); + primer.setBlockState(var8, var16, var9, state0); } else if (var16 < var5 - 1 && var16 >= var5 - 2) { - primer.setBlockState(index, state1); + primer.setBlockState(var8, var16, var9, state1); } } else if (var13 > 0) { --var13; - primer.setBlockState(index, state1); + primer.setBlockState(var8, var16, var9, state1); } } } @@ -182,21 +178,21 @@ public Chunk provideChunk(int x, int z) this.rand.setSeed((long) x * 341873128712L + (long) z * 132897987541L); ChunkPrimer chunkprimer = new ChunkPrimer(); this.setBlocksInChunk(x, z, chunkprimer); - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); + this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomesForGeneration(this.biomesForGeneration, x * 16, z * 16, 16, 16); this.createCraters(x, z, chunkprimer); this.replaceBlocksForBiome(x, z, chunkprimer, this.biomesForGeneration); - this.caveGenerator.generate(this, this.worldObj, x, z, chunkprimer); + this.caveGenerator.generate(this.worldObj, x, z, chunkprimer); - this.dungeonGeneratorMoon.generate(this, this.worldObj, x, z, chunkprimer); - this.villageGenerator.generate(this, this.worldObj, x, z, chunkprimer); + this.dungeonGeneratorMoon.generate(this.worldObj, x, z, chunkprimer); + this.villageGenerator.generate(this.worldObj, x, z, chunkprimer); Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z); byte[] abyte = chunk.getBiomeArray(); for (int i = 0; i < abyte.length; ++i) { - abyte[i] = (byte) this.biomesForGeneration[i].biomeID; + abyte[i] = (byte) Biome.getIdForBiome(this.biomesForGeneration[i]); } chunk.generateSkylightMap(); @@ -244,9 +240,9 @@ private void makeCrater(int craterX, int craterZ, int chunkX, int chunkZ, int si int helper = 0; for (int y = 127; y > 0; y--) { - if (Blocks.AIR != primer.getBlockState(this.getIndex(x, y, z)).getBlock() && helper <= yDev) + if (Blocks.AIR != primer.getBlockState(x, y, z).getBlock() && helper <= yDev) { - primer.setBlockState(this.getIndex(x, y, z), Blocks.AIR.getDefaultState()); + primer.setBlockState(x, y, z, Blocks.AIR.getDefaultState()); helper++; } if (helper > yDev) @@ -259,24 +255,6 @@ private void makeCrater(int craterX, int craterZ, int chunkX, int chunkZ, int si } } - @Override - public boolean chunkExists(int par1, int par2) - { - return true; - } - - @Override - public boolean unloadQueuedChunks() - { - return false; - } - - @Override - public int getLoadedChunkCount() - { - return 0; - } - private int getIndex(int x, int y, int z) { return (x * 16 + z) * 256 + y; @@ -291,13 +269,13 @@ private double randFromPoint(int x, int z) } @Override - public void populate(IChunkProvider chunkProvider, int x, int z) + public void populate(int x, int z) { BlockFalling.fallInstantly = true; int i = x * 16; int j = z * 16; BlockPos blockpos = new BlockPos(i, 0, j); - BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos.add(16, 0, 16)); + Biome biomegenbase = this.worldObj.getBiome(blockpos.add(16, 0, 16)); this.rand.setSeed(this.worldObj.getSeed()); long k = this.rand.nextLong() / 2L * 2L + 1L; long l = this.rand.nextLong() / 2L * 2L + 1L; @@ -305,38 +283,20 @@ public void populate(IChunkProvider chunkProvider, int x, int z) if (!ConfigManagerCore.disableMoonVillageGen) { - this.villageGenerator.generateStructure(this.worldObj, this.rand, new ChunkCoordIntPair(x, z)); + this.villageGenerator.generateStructure(this.worldObj, this.rand, new ChunkPos(x, z)); } - this.dungeonGeneratorMoon.generateStructure(this.worldObj, this.rand, new ChunkCoordIntPair(x, z)); + this.dungeonGeneratorMoon.generateStructure(this.worldObj, this.rand, new ChunkPos(x, z)); biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(i, 0, j)); BlockFalling.fallInstantly = false; } - @Override - public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) - { - return true; - } - - @Override - public boolean canSave() - { - return true; - } - - @Override - public String makeString() - { - return "MoonLevelSource"; - } - @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) + public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { - BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos); + Biome biomegenbase = this.worldObj.getBiome(pos); return biomegenbase.getSpawnableList(creatureType); } @@ -345,9 +305,9 @@ public void recreateStructures(Chunk chunk, int x, int z) { if (!ConfigManagerCore.disableMoonVillageGen) { - this.villageGenerator.generate(this, this.worldObj, x, z, null); + this.villageGenerator.generate(this.worldObj, x, z, null); } - this.dungeonGeneratorMoon.generate(this, this.worldObj, x, z, null); + this.dungeonGeneratorMoon.generate(this.worldObj, x, z, null); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderOrbit.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderOrbit.java index d528906ac6..68e9c94c79 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderOrbit.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderOrbit.java @@ -5,16 +5,15 @@ import net.minecraft.block.BlockFalling; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.IProgressUpdate; import net.minecraft.world.World; +import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkPrimer; -import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.gen.ChunkProviderGenerate; +import net.minecraft.world.gen.ChunkProviderOverworld; import java.util.Random; -public class ChunkProviderOrbit extends ChunkProviderGenerate +public class ChunkProviderOrbit extends ChunkProviderOverworld { private final Random rand; @@ -27,30 +26,6 @@ public ChunkProviderOrbit(World par1World, long par2, boolean par4) this.worldObj = par1World; } - @Override - public boolean unloadQueuedChunks() - { - return false; - } - - @Override - public int getLoadedChunkCount() - { - return 0; - } - - @Override - public boolean saveChunks(boolean var1, IProgressUpdate var2) - { - return true; - } - - @Override - public boolean canSave() - { - return true; - } - @Override public Chunk provideChunk(int par1, int par2) { @@ -62,7 +37,7 @@ public Chunk provideChunk(int par1, int par2) final byte[] biomesArray = var4.getBiomeArray(); for (int i = 0; i < biomesArray.length; ++i) { - biomesArray[i] = (byte) BiomeGenBaseOrbit.space.biomeID; + biomesArray[i] = (byte) Biome.getIdForBiome(BiomeOrbit.space); } @@ -71,21 +46,15 @@ public Chunk provideChunk(int par1, int par2) } @Override - public boolean chunkExists(int par1, int par2) - { - return true; - } - - @Override - public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) + public void populate(int x, int z) { BlockFalling.fallInstantly = true; - final int k = par2 * 16; - final int l = par3 * 16; + final int k = x * 16; + final int l = z * 16; this.rand.setSeed(this.worldObj.getSeed()); final long i1 = this.rand.nextLong() / 2L * 2L + 1L; final long j1 = this.rand.nextLong() / 2L * 2L + 1L; - this.rand.setSeed(par2 * i1 + par3 * j1 ^ this.worldObj.getSeed()); + this.rand.setSeed(x * i1 + z * j1 ^ this.worldObj.getSeed()); if (k == 0 && l == 0) { BlockPos pos = new BlockPos(k, 64, l); @@ -102,10 +71,4 @@ public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) } BlockFalling.fallInstantly = false; } - - @Override - public String makeString() - { - return "OrbitLevelSource"; - } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenVillageMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenVillageMoon.java index 66c7ca015c..0576620d4b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenVillageMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenVillageMoon.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.structure.MapGenStructure; import net.minecraft.world.gen.structure.MapGenStructureIO; import net.minecraft.world.gen.structure.StructureStart; @@ -12,7 +12,7 @@ public class MapGenVillageMoon extends MapGenStructure { - public static List villageSpawnBiomes = Arrays.asList(new BiomeGenBase[] { BiomeGenBaseMoon.moonFlat }); + public static List villageSpawnBiomes = Arrays.asList(new Biome[] { BiomeMoon.moonFlat }); private final int terrainType; private static boolean initialized; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldChunkManagerMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldChunkManagerMoon.java deleted file mode 100644 index fd7e78136e..0000000000 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldChunkManagerMoon.java +++ /dev/null @@ -1,13 +0,0 @@ -package micdoodle8.mods.galacticraft.core.world.gen; - -import micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldChunkManagerSpace; -import net.minecraft.world.biome.BiomeGenBase; - -public class WorldChunkManagerMoon extends WorldChunkManagerSpace -{ - @Override - public BiomeGenBase getBiome() - { - return BiomeGenBaseMoon.moonFlat; - } -} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldChunkManagerOrbit.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldChunkManagerOrbit.java deleted file mode 100644 index 3a6de98d7b..0000000000 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldChunkManagerOrbit.java +++ /dev/null @@ -1,13 +0,0 @@ -package micdoodle8.mods.galacticraft.core.world.gen; - -import micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldChunkManagerSpace; -import net.minecraft.world.biome.BiomeGenBase; - -public class WorldChunkManagerOrbit extends WorldChunkManagerSpace -{ - @Override - public BiomeGenBase getBiome() - { - return BiomeGenBaseOrbit.space; - } -} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddMushroomIsland.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddMushroomIsland.java index ee1b41a571..bd0ef1c86f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddMushroomIsland.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddMushroomIsland.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; public class GenLayerAddMushroomIsland extends GenLayerGCMap { @@ -36,7 +36,7 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) if (k2 == 0 && k1 == 0 && l1 == 0 && i2 == 0 && j2 == 0 && this.nextInt(100) == 0) { - aint1[j1 + i1 * areaWidth] = BiomeGenBase.mushroomIsland.biomeID; + aint1[j1 + i1 * areaWidth] = Biome.mushroomIsland.biomeID; } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiome.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiome.java index efdcbcf7ec..f0940eb52b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiome.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiome.java @@ -1,7 +1,7 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; import net.minecraft.world.WorldType; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.ChunkProviderSettings; public class GenLayerBiome extends GenLayerGCMap @@ -27,19 +27,19 @@ public GenLayerBiome(long p_i45560_1_, GenLayerGCMap p_i45560_3_, WorldType p_i4 int desertIdx = net.minecraftforge.common.BiomeManager.BiomeType.DESERT.ordinal(); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.desert, 30)); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.savanna, 20)); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.plains, 10)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.desert, 30)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.savanna, 20)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.plains, 10)); if (p_i45560_4_ == WorldType.DEFAULT_1_1) { biomes[desertIdx].clear(); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.desert, 10)); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.forest, 10)); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.extremeHills, 10)); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.swampland, 10)); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.plains, 10)); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(BiomeGenBase.taiga, 10)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.desert, 10)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.forest, 10)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.extremeHills, 10)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.swampland, 10)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.plains, 10)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.taiga, 10)); this.field_175973_g = null; } else if (p_i45560_4_ == WorldType.CUSTOMIZED) @@ -78,7 +78,7 @@ else if (isBiomeOceanic(k)) { aint1[j + i * areaWidth] = k; } - else if (k == BiomeGenBase.mushroomIsland.biomeID) + else if (k == Biome.mushroomIsland.biomeID) { aint1[j + i * areaWidth] = k; } @@ -88,11 +88,11 @@ else if (k == 1) { if (this.nextInt(3) == 0) { - aint1[j + i * areaWidth] = BiomeGenBase.mesaPlateau.biomeID; + aint1[j + i * areaWidth] = Biome.mesaPlateau.biomeID; } else { - aint1[j + i * areaWidth] = BiomeGenBase.mesaPlateau_F.biomeID; + aint1[j + i * areaWidth] = Biome.mesaPlateau_F.biomeID; } } else @@ -104,7 +104,7 @@ else if (k == 2) { if (l > 0) { - aint1[j + i * areaWidth] = BiomeGenBase.jungle.biomeID; + aint1[j + i * areaWidth] = Biome.jungle.biomeID; } else { @@ -115,7 +115,7 @@ else if (k == 3) { if (l > 0) { - aint1[j + i * areaWidth] = BiomeGenBase.megaTaiga.biomeID; + aint1[j + i * areaWidth] = Biome.megaTaiga.biomeID; } else { @@ -128,7 +128,7 @@ else if (k == 4) } else { - aint1[j + i * areaWidth] = BiomeGenBase.mushroomIsland.biomeID; + aint1[j + i * areaWidth] = Biome.mushroomIsland.biomeID; } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiomeEdge.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiomeEdge.java index 012d5a81bd..80c7266a3e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiomeEdge.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiomeEdge.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; public class GenLayerBiomeEdge extends GenLayerGCMap { @@ -26,45 +26,45 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) this.initChunkSeed((long)(j + areaX), (long)(i + areaY)); int k = aint[j + 1 + (i + 1) * (areaWidth + 2)]; - if (!this.replaceBiomeEdgeIfNecessary(aint, aint1, j, i, areaWidth, k, BiomeGenBase.extremeHills.biomeID, BiomeGenBase.extremeHillsEdge.biomeID) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, BiomeGenBase.mesaPlateau_F.biomeID, BiomeGenBase.mesa.biomeID) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, BiomeGenBase.mesaPlateau.biomeID, BiomeGenBase.mesa.biomeID) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, BiomeGenBase.megaTaiga.biomeID, BiomeGenBase.taiga.biomeID)) + if (!this.replaceBiomeEdgeIfNecessary(aint, aint1, j, i, areaWidth, k, Biome.extremeHills.biomeID, Biome.extremeHillsEdge.biomeID) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, Biome.mesaPlateau_F.biomeID, Biome.mesa.biomeID) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, Biome.mesaPlateau.biomeID, Biome.mesa.biomeID) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, Biome.megaTaiga.biomeID, Biome.taiga.biomeID)) { - if (k == BiomeGenBase.desert.biomeID) + if (k == Biome.desert.biomeID) { int l1 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; int i2 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; int j2 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)]; int k2 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)]; - if (l1 != BiomeGenBase.icePlains.biomeID && i2 != BiomeGenBase.icePlains.biomeID && j2 != BiomeGenBase.icePlains.biomeID && k2 != BiomeGenBase.icePlains.biomeID) + if (l1 != Biome.icePlains.biomeID && i2 != Biome.icePlains.biomeID && j2 != Biome.icePlains.biomeID && k2 != Biome.icePlains.biomeID) { aint1[j + i * areaWidth] = k; } else { - aint1[j + i * areaWidth] = BiomeGenBase.extremeHillsPlus.biomeID; + aint1[j + i * areaWidth] = Biome.extremeHillsPlus.biomeID; } } - else if (k == BiomeGenBase.swampland.biomeID) + else if (k == Biome.swampland.biomeID) { int l = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; int i1 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; int j1 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)]; int k1 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)]; - if (l != BiomeGenBase.desert.biomeID && i1 != BiomeGenBase.desert.biomeID && j1 != BiomeGenBase.desert.biomeID && k1 != BiomeGenBase.desert.biomeID && l != BiomeGenBase.coldTaiga.biomeID && i1 != BiomeGenBase.coldTaiga.biomeID && j1 != BiomeGenBase.coldTaiga.biomeID && k1 != BiomeGenBase.coldTaiga.biomeID && l != BiomeGenBase.icePlains.biomeID && i1 != BiomeGenBase.icePlains.biomeID && j1 != BiomeGenBase.icePlains.biomeID && k1 != BiomeGenBase.icePlains.biomeID) + if (l != Biome.desert.biomeID && i1 != Biome.desert.biomeID && j1 != Biome.desert.biomeID && k1 != Biome.desert.biomeID && l != Biome.coldTaiga.biomeID && i1 != Biome.coldTaiga.biomeID && j1 != Biome.coldTaiga.biomeID && k1 != Biome.coldTaiga.biomeID && l != Biome.icePlains.biomeID && i1 != Biome.icePlains.biomeID && j1 != Biome.icePlains.biomeID && k1 != Biome.icePlains.biomeID) { - if (l != BiomeGenBase.jungle.biomeID && k1 != BiomeGenBase.jungle.biomeID && i1 != BiomeGenBase.jungle.biomeID && j1 != BiomeGenBase.jungle.biomeID) + if (l != Biome.jungle.biomeID && k1 != Biome.jungle.biomeID && i1 != Biome.jungle.biomeID && j1 != Biome.jungle.biomeID) { aint1[j + i * areaWidth] = k; } else { - aint1[j + i * areaWidth] = BiomeGenBase.jungleEdge.biomeID; + aint1[j + i * areaWidth] = Biome.jungleEdge.biomeID; } } else { - aint1[j + i * areaWidth] = BiomeGenBase.plains.biomeID; + aint1[j + i * areaWidth] = Biome.plains.biomeID; } } else @@ -148,14 +148,14 @@ private boolean canBiomesBeNeighbors(int p_151634_1_, int p_151634_2_) } else { - BiomeGenBase biomegenbase = BiomeGenBase.getBiome(p_151634_1_); - BiomeGenBase biomegenbase1 = BiomeGenBase.getBiome(p_151634_2_); + Biome biomegenbase = Biome.getBiome(p_151634_1_); + Biome biomegenbase1 = Biome.getBiome(p_151634_2_); if (biomegenbase != null && biomegenbase1 != null) { - BiomeGenBase.TempCategory biomegenbase$tempcategory = biomegenbase.getTempCategory(); - BiomeGenBase.TempCategory biomegenbase$tempcategory1 = biomegenbase1.getTempCategory(); - return biomegenbase$tempcategory == biomegenbase$tempcategory1 || biomegenbase$tempcategory == BiomeGenBase.TempCategory.MEDIUM || biomegenbase$tempcategory1 == BiomeGenBase.TempCategory.MEDIUM; + Biome.TempCategory biomegenbase$tempcategory = biomegenbase.getTempCategory(); + Biome.TempCategory biomegenbase$tempcategory1 = biomegenbase1.getTempCategory(); + return biomegenbase$tempcategory == biomegenbase$tempcategory1 || biomegenbase$tempcategory == Biome.TempCategory.MEDIUM || biomegenbase$tempcategory1 == Biome.TempCategory.MEDIUM; } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerDeepOcean.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerDeepOcean.java index 0cb44bc2b9..d2edae99f2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerDeepOcean.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerDeepOcean.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; public class GenLayerDeepOcean extends GenLayerGCMap { @@ -56,7 +56,7 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) if (k2 == 0 && l2 > 3) { - aint1[j1 + i1 * areaWidth] = BiomeGenBase.deepOcean.biomeID; + aint1[j1 + i1 * areaWidth] = Biome.deepOcean.biomeID; } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerGCMap.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerGCMap.java index f88de09729..ecb5dbbdbb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerGCMap.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerGCMap.java @@ -6,7 +6,7 @@ import net.minecraft.crash.CrashReportCategory; import net.minecraft.util.ReportedException; import net.minecraft.world.WorldType; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.ChunkProviderSettings; public abstract class GenLayerGCMap extends net.minecraft.world.gen.layer.GenLayer @@ -182,10 +182,10 @@ protected static boolean biomesEqualOrMesaPlateau(int biomeIDA, int biomeIDB) { return true; } - else if (biomeIDA != BiomeGenBase.mesaPlateau_F.biomeID && biomeIDA != BiomeGenBase.mesaPlateau.biomeID) + else if (biomeIDA != Biome.mesaPlateau_F.biomeID && biomeIDA != Biome.mesaPlateau.biomeID) { - final BiomeGenBase biomegenbase = BiomeGenBase.getBiome(biomeIDA); - final BiomeGenBase biomegenbase1 = BiomeGenBase.getBiome(biomeIDB); + final Biome biomegenbase = Biome.getBiome(biomeIDA); + final Biome biomegenbase1 = Biome.getBiome(biomeIDB); try { @@ -216,7 +216,7 @@ public String call() throws Exception } else { - return biomeIDB == BiomeGenBase.mesaPlateau_F.biomeID || biomeIDB == BiomeGenBase.mesaPlateau.biomeID; + return biomeIDB == Biome.mesaPlateau_F.biomeID || biomeIDB == Biome.mesaPlateau.biomeID; } } @@ -225,7 +225,7 @@ public String call() throws Exception */ protected static boolean isBiomeOceanic(int p_151618_0_) { - return net.minecraftforge.common.BiomeManager.oceanBiomes.contains(BiomeGenBase.getBiome(p_151618_0_)); + return net.minecraftforge.common.BiomeManager.oceanBiomes.contains(Biome.getBiome(p_151618_0_)); } /** diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerHills.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerHills.java index 524cba371c..c75dfa697c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerHills.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerHills.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -42,7 +42,7 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) if (k != 0 && l >= 2 && (l - 2) % 29 == 1 && k < 128) { - if (BiomeGenBase.getBiome(k + 128) != null) + if (Biome.getBiome(k + 128) != null) { aint2[j + i * areaWidth] = k + 128; } @@ -59,86 +59,86 @@ else if (this.nextInt(3) != 0 && !flag) { int i1 = k; - if (k == BiomeGenBase.desert.biomeID) + if (k == Biome.desert.biomeID) { - i1 = BiomeGenBase.desertHills.biomeID; + i1 = Biome.desertHills.biomeID; } - else if (k == BiomeGenBase.forest.biomeID) + else if (k == Biome.forest.biomeID) { - i1 = BiomeGenBase.forestHills.biomeID; + i1 = Biome.forestHills.biomeID; } - else if (k == BiomeGenBase.birchForest.biomeID) + else if (k == Biome.birchForest.biomeID) { - i1 = BiomeGenBase.birchForestHills.biomeID; + i1 = Biome.birchForestHills.biomeID; } - else if (k == BiomeGenBase.roofedForest.biomeID) + else if (k == Biome.roofedForest.biomeID) { - i1 = BiomeGenBase.plains.biomeID; + i1 = Biome.plains.biomeID; } - else if (k == BiomeGenBase.taiga.biomeID) + else if (k == Biome.taiga.biomeID) { - i1 = BiomeGenBase.taigaHills.biomeID; + i1 = Biome.taigaHills.biomeID; } - else if (k == BiomeGenBase.megaTaiga.biomeID) + else if (k == Biome.megaTaiga.biomeID) { - i1 = BiomeGenBase.megaTaigaHills.biomeID; + i1 = Biome.megaTaigaHills.biomeID; } - else if (k == BiomeGenBase.coldTaiga.biomeID) + else if (k == Biome.coldTaiga.biomeID) { - i1 = BiomeGenBase.coldTaigaHills.biomeID; + i1 = Biome.coldTaigaHills.biomeID; } - else if (k == BiomeGenBase.plains.biomeID) + else if (k == Biome.plains.biomeID) { if (this.nextInt(3) == 0) { - i1 = BiomeGenBase.forestHills.biomeID; + i1 = Biome.forestHills.biomeID; } else { - i1 = BiomeGenBase.forest.biomeID; + i1 = Biome.forest.biomeID; } } - else if (k == BiomeGenBase.icePlains.biomeID) + else if (k == Biome.icePlains.biomeID) { - i1 = BiomeGenBase.iceMountains.biomeID; + i1 = Biome.iceMountains.biomeID; } - else if (k == BiomeGenBase.jungle.biomeID) + else if (k == Biome.jungle.biomeID) { - i1 = BiomeGenBase.jungleHills.biomeID; + i1 = Biome.jungleHills.biomeID; } - else if (k == BiomeGenBase.ocean.biomeID) + else if (k == Biome.ocean.biomeID) { - i1 = BiomeGenBase.deepOcean.biomeID; + i1 = Biome.deepOcean.biomeID; } - else if (k == BiomeGenBase.extremeHills.biomeID) + else if (k == Biome.extremeHills.biomeID) { - i1 = BiomeGenBase.extremeHillsPlus.biomeID; + i1 = Biome.extremeHillsPlus.biomeID; } - else if (k == BiomeGenBase.savanna.biomeID) + else if (k == Biome.savanna.biomeID) { - i1 = BiomeGenBase.savannaPlateau.biomeID; + i1 = Biome.savannaPlateau.biomeID; } - else if (biomesEqualOrMesaPlateau(k, BiomeGenBase.mesaPlateau_F.biomeID)) + else if (biomesEqualOrMesaPlateau(k, Biome.mesaPlateau_F.biomeID)) { - i1 = BiomeGenBase.mesa.biomeID; + i1 = Biome.mesa.biomeID; } - else if (k == BiomeGenBase.deepOcean.biomeID && this.nextInt(3) == 0) + else if (k == Biome.deepOcean.biomeID && this.nextInt(3) == 0) { int j1 = this.nextInt(2); if (j1 == 0) { - i1 = BiomeGenBase.plains.biomeID; + i1 = Biome.plains.biomeID; } else { - i1 = BiomeGenBase.forest.biomeID; + i1 = Biome.forest.biomeID; } } if (flag && i1 != k) { - if (BiomeGenBase.getBiome(i1 + 128) != null) + if (Biome.getBiome(i1 + 128) != null) { i1 += 128; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRareBiome.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRareBiome.java index 18477bae90..c3e19fc891 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRareBiome.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRareBiome.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; public class GenLayerRareBiome extends GenLayerGCMap { @@ -28,9 +28,9 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) if (this.nextInt(57) == 0) { - if (k == BiomeGenBase.plains.biomeID) + if (k == Biome.plains.biomeID) { - aint1[j + i * areaWidth] = BiomeGenBase.plains.biomeID + 128; + aint1[j + i * areaWidth] = Biome.plains.biomeID + 128; } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiver.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiver.java index 51136fb401..386a5584cb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiver.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiver.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; public class GenLayerRiver extends GenLayerGCMap { @@ -39,7 +39,7 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) } else { - aint1[j1 + i1 * areaWidth] = BiomeGenBase.river.biomeID; + aint1[j1 + i1 * areaWidth] = Biome.river.biomeID; } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverMix.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverMix.java index 0cbf386533..d533e0146f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverMix.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverMix.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; public class GenLayerRiverMix extends GenLayerGCMap { @@ -37,21 +37,21 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) for (int i = 0; i < areaWidth * areaHeight; ++i) { - if (aint[i] != BiomeGenBase.ocean.biomeID && aint[i] != BiomeGenBase.deepOcean.biomeID) + if (aint[i] != Biome.ocean.biomeID && aint[i] != Biome.deepOcean.biomeID) { - if (aint1[i] == BiomeGenBase.river.biomeID) + if (aint1[i] == Biome.river.biomeID) { - if (aint[i] == BiomeGenBase.icePlains.biomeID) + if (aint[i] == Biome.icePlains.biomeID) { - aint2[i] = BiomeGenBase.frozenRiver.biomeID; + aint2[i] = Biome.frozenRiver.biomeID; } - else if (aint[i] != BiomeGenBase.mushroomIsland.biomeID && aint[i] != BiomeGenBase.mushroomIslandShore.biomeID) + else if (aint[i] != Biome.mushroomIsland.biomeID && aint[i] != Biome.mushroomIslandShore.biomeID) { aint2[i] = aint1[i] & 255; } else { - aint2[i] = BiomeGenBase.mushroomIslandShore.biomeID; + aint2[i] = Biome.mushroomIslandShore.biomeID; } } else diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerShore.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerShore.java index 25009bbf52..7c24191ace 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerShore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerShore.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.BiomeGenJungle; import net.minecraft.world.biome.BiomeGenMesa; @@ -27,22 +27,22 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { this.initChunkSeed((long)(j + areaX), (long)(i + areaY)); int k = aint[j + 1 + (i + 1) * (areaWidth + 2)]; - BiomeGenBase biomegenbase = BiomeGenBase.getBiome(k); + Biome biomegenbase = Biome.getBiome(k); - if (k == BiomeGenBase.mushroomIsland.biomeID) + if (k == Biome.mushroomIsland.biomeID) { int j2 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; int i3 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; int l3 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)]; int k4 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)]; - if (j2 != BiomeGenBase.ocean.biomeID && i3 != BiomeGenBase.ocean.biomeID && l3 != BiomeGenBase.ocean.biomeID && k4 != BiomeGenBase.ocean.biomeID) + if (j2 != Biome.ocean.biomeID && i3 != Biome.ocean.biomeID && l3 != Biome.ocean.biomeID && k4 != Biome.ocean.biomeID) { aint1[j + i * areaWidth] = k; } else { - aint1[j + i * areaWidth] = BiomeGenBase.mushroomIslandShore.biomeID; + aint1[j + i * areaWidth] = Biome.mushroomIslandShore.biomeID; } } else if (biomegenbase != null && biomegenbase.getBiomeClass() == BiomeGenJungle.class) @@ -60,23 +60,23 @@ else if (biomegenbase != null && biomegenbase.getBiomeClass() == BiomeGenJungle. } else { - aint1[j + i * areaWidth] = BiomeGenBase.beach.biomeID; + aint1[j + i * areaWidth] = Biome.beach.biomeID; } } else { - aint1[j + i * areaWidth] = BiomeGenBase.jungleEdge.biomeID; + aint1[j + i * areaWidth] = Biome.jungleEdge.biomeID; } } - else if (k != BiomeGenBase.extremeHills.biomeID && k != BiomeGenBase.extremeHillsPlus.biomeID && k != BiomeGenBase.extremeHillsEdge.biomeID) + else if (k != Biome.extremeHills.biomeID && k != Biome.extremeHillsPlus.biomeID && k != Biome.extremeHillsEdge.biomeID) { if (biomegenbase != null && biomegenbase.isSnowyBiome()) { - this.func_151632_a(aint, aint1, j, i, areaWidth, k, BiomeGenBase.coldBeach.biomeID); + this.func_151632_a(aint, aint1, j, i, areaWidth, k, Biome.coldBeach.biomeID); } - else if (k != BiomeGenBase.mesa.biomeID && k != BiomeGenBase.mesaPlateau_F.biomeID) + else if (k != Biome.mesa.biomeID && k != Biome.mesaPlateau_F.biomeID) { - if (k != BiomeGenBase.ocean.biomeID && k != BiomeGenBase.deepOcean.biomeID && k != BiomeGenBase.river.biomeID && k != BiomeGenBase.swampland.biomeID) + if (k != Biome.ocean.biomeID && k != Biome.deepOcean.biomeID && k != Biome.river.biomeID && k != Biome.swampland.biomeID) { int l1 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; int k2 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; @@ -89,7 +89,7 @@ else if (k != BiomeGenBase.mesa.biomeID && k != BiomeGenBase.mesaPlateau_F.biome } else { - aint1[j + i * areaWidth] = BiomeGenBase.beach.biomeID; + aint1[j + i * areaWidth] = Biome.beach.biomeID; } } else @@ -112,7 +112,7 @@ else if (k != BiomeGenBase.mesa.biomeID && k != BiomeGenBase.mesaPlateau_F.biome } else { - aint1[j + i * areaWidth] = BiomeGenBase.desert.biomeID; + aint1[j + i * areaWidth] = Biome.desert.biomeID; } } else @@ -123,7 +123,7 @@ else if (k != BiomeGenBase.mesa.biomeID && k != BiomeGenBase.mesaPlateau_F.biome } else { - this.func_151632_a(aint, aint1, j, i, areaWidth, k, BiomeGenBase.stoneBeach.biomeID); + this.func_151632_a(aint, aint1, j, i, areaWidth, k, Biome.stoneBeach.biomeID); } } } @@ -157,11 +157,11 @@ private void func_151632_a(int[] p_151632_1_, int[] p_151632_2_, int p_151632_3_ private boolean func_151631_c(int p_151631_1_) { - return BiomeGenBase.getBiome(p_151631_1_) != null && BiomeGenBase.getBiome(p_151631_1_).getBiomeClass() == BiomeGenJungle.class ? true : p_151631_1_ == BiomeGenBase.jungleEdge.biomeID || p_151631_1_ == BiomeGenBase.jungle.biomeID || p_151631_1_ == BiomeGenBase.jungleHills.biomeID || p_151631_1_ == BiomeGenBase.forest.biomeID || p_151631_1_ == BiomeGenBase.taiga.biomeID || isBiomeOceanic(p_151631_1_); + return Biome.getBiome(p_151631_1_) != null && Biome.getBiome(p_151631_1_).getBiomeClass() == BiomeGenJungle.class ? true : p_151631_1_ == Biome.jungleEdge.biomeID || p_151631_1_ == Biome.jungle.biomeID || p_151631_1_ == Biome.jungleHills.biomeID || p_151631_1_ == Biome.forest.biomeID || p_151631_1_ == Biome.taiga.biomeID || isBiomeOceanic(p_151631_1_); } private boolean func_151633_d(int p_151633_1_) { - return BiomeGenBase.getBiome(p_151633_1_) instanceof BiomeGenMesa; + return Biome.getBiome(p_151633_1_) instanceof BiomeGenMesa; } } \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ModelTransformWrapper.java b/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ModelTransformWrapper.java index 866ada0902..9cbbf9dd2f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ModelTransformWrapper.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ModelTransformWrapper.java @@ -1,22 +1,18 @@ package micdoodle8.mods.galacticraft.core.wrappers; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.*; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.block.model.ItemTransformVec3f; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.model.*; +import net.minecraftforge.client.model.IPerspectiveAwareModel; +import net.minecraftforge.common.model.TRSRTransformation; import org.apache.commons.lang3.tuple.Pair; import javax.vecmath.Matrix4f; import java.util.List; -@SuppressWarnings({ "deprecation", "unchecked" }) -public abstract class ModelTransformWrapper implements IFlexibleBakedModel, ISmartItemModel, ISmartBlockModel, IPerspectiveAwareModel +public abstract class ModelTransformWrapper implements IPerspectiveAwareModel { private final IBakedModel iBakedModel; @@ -28,7 +24,7 @@ public ModelTransformWrapper(IBakedModel i_modelToWrap) protected abstract Matrix4f getTransformForPerspective(TransformType cameraTransformType); @Override - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { Matrix4f matrix4f = getTransformForPerspective(cameraTransformType); @@ -41,28 +37,15 @@ public Pair handlePerspective(Transform } @Override - public List getFaceQuads(EnumFacing enumFacing) + public List getQuads(IBlockState state, EnumFacing side, long rand) { - return iBakedModel.getFaceQuads(enumFacing); + return iBakedModel.getQuads(state, side, rand); } @Override - public List getGeneralQuads() + public ItemOverrideList getOverrides() { - return iBakedModel.getGeneralQuads(); - } - - @Override - public VertexFormat getFormat() - { - if (iBakedModel instanceof IFlexibleBakedModel) - { - return ((IFlexibleBakedModel) iBakedModel).getFormat(); - } - else - { - return Attributes.DEFAULT_BAKED_FORMAT; - } + return iBakedModel.getOverrides(); } @Override @@ -94,16 +77,4 @@ public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; } - - @Override - public IBakedModel handleItemState(ItemStack stack) - { - return this; - } - - @Override - public IBakedModel handleBlockState(IBlockState state) - { - return this; - } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/WorldProviderAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/WorldProviderAsteroids.java index 579a1d216b..1fbbaea157 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/WorldProviderAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/WorldProviderAsteroids.java @@ -11,7 +11,7 @@ import micdoodle8.mods.galacticraft.planets.asteroids.AsteroidsModule; import micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityAstroMiner; import micdoodle8.mods.galacticraft.planets.asteroids.world.gen.ChunkProviderAsteroids; -import micdoodle8.mods.galacticraft.planets.asteroids.world.gen.WorldChunkManagerAsteroids; +import micdoodle8.mods.galacticraft.planets.asteroids.world.gen.BiomeProviderAsteroids; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -81,9 +81,9 @@ public Class getChunkProviderClass() } @Override - public Class getWorldChunkManagerClass() + public Class getBiomeProviderClass() { - return WorldChunkManagerAsteroids.class; + return BiomeProviderAsteroids.class; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicAstroMiner.java index e9add1c827..98f2b8b182 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicAstroMiner.java @@ -173,7 +173,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicTier3Rocket.java index c82de853b1..84b8448b26 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicTier3Rocket.java @@ -173,7 +173,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java index d2c5ccc245..41aeef18b0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java @@ -907,7 +907,7 @@ public void setDisabled(int index, boolean disabled) } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java index cb0fd48fff..52ccc9d7c2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java @@ -388,7 +388,7 @@ public boolean hasCustomName() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return (this.hasCustomName() ? new TextComponentString(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/BiomeGenBaseAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/BiomeGenBaseAsteroids.java index 28841d1189..9c9c6c1bf1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/BiomeGenBaseAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/BiomeGenBaseAsteroids.java @@ -6,15 +6,15 @@ import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedZombie; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import net.minecraft.entity.monster.EntityEnderman; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraftforge.common.BiomeDictionary; -public class BiomeGenBaseAsteroids extends BiomeGenBase +public class BiomeAsteroids extends Biome { - public static final BiomeGenBase asteroid = new BiomeGenBaseAsteroids(ConfigManagerCore.biomeIDbase + 2).setBiomeName("Asteroids"); + public static final Biome asteroid = new BiomeAsteroids(ConfigManagerCore.biomeIDbase + 2).setBiomeName("Asteroids"); @SuppressWarnings("unchecked") - private BiomeGenBaseAsteroids(int var1) + private BiomeAsteroids(int var1) { super(var1); this.spawnableMonsterList.clear(); @@ -37,9 +37,9 @@ private BiomeGenBaseAsteroids(int var1) } @Override - public BiomeGenBaseAsteroids setColor(int var1) + public BiomeAsteroids setColor(int var1) { - return (BiomeGenBaseAsteroids) super.setColor(var1); + return (BiomeAsteroids) super.setColor(var1); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/BiomeProviderAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/BiomeProviderAsteroids.java new file mode 100644 index 0000000000..621510df2d --- /dev/null +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/BiomeProviderAsteroids.java @@ -0,0 +1,13 @@ +package micdoodle8.mods.galacticraft.planets.asteroids.world.gen; + +import micdoodle8.mods.galacticraft.api.prefab.world.gen.BiomeProviderSpace; +import net.minecraft.world.biome.Biome; + +public class BiomeProviderAsteroids extends BiomeProviderSpace +{ + @Override + public Biome getBiome() + { + return BiomeAsteroids.asteroid; + } +} diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java index ea6898e8f3..2da9ee29f7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java @@ -17,7 +17,7 @@ import net.minecraft.util.IProgressUpdate; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.chunk.IChunkProvider; @@ -548,7 +548,7 @@ public Chunk provideChunk(int par1, int par2) for (int var6 = 0; var6 < var5.length; ++var6) { - var5[var6] = (byte) BiomeGenBaseAsteroids.asteroid.biomeID; + var5[var6] = (byte) BiomeAsteroids.asteroid.biomeID; } // long time3 = System.nanoTime(); @@ -964,9 +964,9 @@ public String makeString() @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) + public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { - BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos); + Biome biomegenbase = this.worldObj.getBiomeGenForCoords(pos); return biomegenbase.getSpawnableList(creatureType); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/WorldChunkManagerAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/WorldChunkManagerAsteroids.java deleted file mode 100644 index 111d852a2a..0000000000 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/WorldChunkManagerAsteroids.java +++ /dev/null @@ -1,13 +0,0 @@ -package micdoodle8.mods.galacticraft.planets.asteroids.world.gen; - -import micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldChunkManagerSpace; -import net.minecraft.world.biome.BiomeGenBase; - -public class WorldChunkManagerAsteroids extends WorldChunkManagerSpace -{ - @Override - public BiomeGenBase getBiome() - { - return BiomeGenBaseAsteroids.asteroid; - } -} diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/WorldProviderMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/WorldProviderMars.java index b4b3f70eb3..2928760288 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/WorldProviderMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/WorldProviderMars.java @@ -9,7 +9,7 @@ import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.planets.mars.MarsModule; import micdoodle8.mods.galacticraft.planets.mars.world.gen.ChunkProviderMars; -import micdoodle8.mods.galacticraft.planets.mars.world.gen.WorldChunkManagerMars; +import micdoodle8.mods.galacticraft.planets.mars.world.gen.BiomeProviderMars; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.math.MathHelper; import net.minecraft.world.biome.WorldChunkManager; @@ -60,9 +60,9 @@ public Class getChunkProviderClass() } @Override - public Class getWorldChunkManagerClass() + public Class getBiomeProviderClass() { - return WorldChunkManagerMars.class; + return BiomeProviderMars.class; } // @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicCargoRocket.java index b27ba98e9f..54f261a5ea 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicCargoRocket.java @@ -173,7 +173,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicTier2Rocket.java index 9da16112ff..83db417463 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicTier2Rocket.java @@ -173,7 +173,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySlimeling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySlimeling.java index c53957a1dc..9d4b2df2ca 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySlimeling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySlimeling.java @@ -232,7 +232,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java index c313bf5bce..5513ea9794 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java @@ -15,7 +15,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.TextComponentString; import net.minecraft.util.ChatStyle; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.TextFormatting; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; @@ -51,7 +51,7 @@ public boolean placeBlockAt(ItemStack itemStack, EntityPlayer player, World worl { if (world.isRemote) { - FMLClientHandler.instance().getClient().ingameGUI.setRecordPlaying(new TextComponentString(GCCoreUtil.translate("gui.warning.noroom")).setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)).getFormattedText(), false); + FMLClientHandler.instance().getClient().ingameGUI.setRecordPlaying(new TextComponentString(GCCoreUtil.translate("gui.warning.noroom")).setChatStyle(new ChatStyle().setColor(TextFormatting.RED)).getFormattedText(), false); } return false; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java index aace8c8c61..5fff4837ff 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java @@ -20,7 +20,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.TextComponentString; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -74,7 +74,7 @@ public EnumStatus sleepInBedAt(EntityPlayer entityPlayer, int par1, int par2, in return EnumStatus.OTHER_PROBLEM; } - if (this.worldObj.getBiomeGenForCoords(new BlockPos(par1, par2, par3)) == BiomeGenBase.hell) + if (this.worldObj.getBiomeGenForCoords(new BlockPos(par1, par2, par3)) == Biome.hell) { return EnumStatus.NOT_POSSIBLE_HERE; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityElectrolyzer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityElectrolyzer.java index b2020dc7df..ad3797753e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityElectrolyzer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityElectrolyzer.java @@ -754,7 +754,7 @@ public boolean canConnect(EnumFacing direction, NetworkType type) } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityGasLiquefier.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityGasLiquefier.java index 6a87bb4943..4e783c3ffb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityGasLiquefier.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityGasLiquefier.java @@ -833,7 +833,7 @@ public boolean canConnect(EnumFacing direction, NetworkType type) } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java index f10f77afae..80fb361d49 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java @@ -495,7 +495,7 @@ public void updateRocketOnDockSettings() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java index ebd0c1db7f..1c15803201 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java @@ -671,7 +671,7 @@ public FluidTankInfo[] getTankInfo(EnumFacing from) } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeGenBaseMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeGenBaseMars.java index e18bb467b1..66a5e5b67f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeGenBaseMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeGenBaseMars.java @@ -5,31 +5,31 @@ import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSpider; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedZombie; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; -public class BiomeGenBaseMars extends BiomeGenBase +public class BiomeMars extends Biome { - public static final BiomeGenBase marsFlat = new BiomeGenFlatMars(ConfigManagerCore.biomeIDbase + 1).setBiomeName("Mars Flat"); + public static final Biome marsFlat = new BiomeGenFlatMars(ConfigManagerCore.biomeIDbase + 1).setBiomeName("Mars Flat"); @SuppressWarnings("unchecked") - BiomeGenBaseMars(int var1) + BiomeMars(int var1) { super(var1); this.spawnableMonsterList.clear(); this.spawnableWaterCreatureList.clear(); this.spawnableCreatureList.clear(); this.spawnableCaveCreatureList.clear(); - this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityEvolvedZombie.class, 8, 2, 3)); - this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityEvolvedSpider.class, 8, 2, 3)); - this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityEvolvedSkeleton.class, 8, 2, 3)); - this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityEvolvedCreeper.class, 8, 2, 3)); + this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityEvolvedZombie.class, 8, 2, 3)); + this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityEvolvedSpider.class, 8, 2, 3)); + this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityEvolvedSkeleton.class, 8, 2, 3)); + this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityEvolvedCreeper.class, 8, 2, 3)); this.rainfall = 0F; } @Override - public BiomeGenBaseMars setColor(int var1) + public BiomeMars setColor(int var1) { - return (BiomeGenBaseMars) super.setColor(var1); + return (BiomeMars) super.setColor(var1); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeGenFlatMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeGenFlatMars.java index b0a6db0e4c..7186dfc7bd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeGenFlatMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeGenFlatMars.java @@ -3,7 +3,7 @@ import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import net.minecraftforge.common.BiomeDictionary; -public class BiomeGenFlatMars extends BiomeGenBaseMars +public class BiomeGenFlatMars extends BiomeMars { public BiomeGenFlatMars(int par1) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeProviderMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeProviderMars.java new file mode 100644 index 0000000000..d8696ff311 --- /dev/null +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeProviderMars.java @@ -0,0 +1,13 @@ +package micdoodle8.mods.galacticraft.planets.mars.world.gen; + +import micdoodle8.mods.galacticraft.api.prefab.world.gen.BiomeProviderSpace; +import net.minecraft.world.biome.Biome; + +public class BiomeProviderMars extends BiomeProviderSpace +{ + @Override + public Biome getBiome() + { + return BiomeMars.marsFlat; + } +} diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/ChunkProviderMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/ChunkProviderMars.java index 6880652db5..3007aac26d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/ChunkProviderMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/ChunkProviderMars.java @@ -11,7 +11,7 @@ import micdoodle8.mods.galacticraft.planets.mars.blocks.MarsBlocks; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.chunk.IChunkProvider; @@ -38,9 +38,9 @@ protected BiomeDecoratorSpace getBiomeGenerator() } @Override - protected BiomeGenBase[] getBiomesForGeneration() + protected Biome[] getBiomesForGeneration() { - return new BiomeGenBase[] { BiomeGenBaseMars.marsFlat }; + return new Biome[] { BiomeMars.marsFlat }; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldChunkManagerMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldChunkManagerMars.java deleted file mode 100644 index d0c95a8525..0000000000 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldChunkManagerMars.java +++ /dev/null @@ -1,13 +0,0 @@ -package micdoodle8.mods.galacticraft.planets.mars.world.gen; - -import micdoodle8.mods.galacticraft.api.prefab.world.gen.WorldChunkManagerSpace; -import net.minecraft.world.biome.BiomeGenBase; - -public class WorldChunkManagerMars extends WorldChunkManagerSpace -{ - @Override - public BiomeGenBase getBiome() - { - return BiomeGenBaseMars.marsFlat; - } -} diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/WorldProviderVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/WorldProviderVenus.java index b5a2e56bbb..39f7dfc81a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/WorldProviderVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/WorldProviderVenus.java @@ -78,7 +78,7 @@ public Class getChunkProviderClass() } @Override - public Class getWorldChunkManagerClass() + public Class getBiomeProviderClass() { return WorldChunkManagerVenus.class; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityWebShot.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityWebShot.java index c83db94810..df49a1de22 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityWebShot.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityWebShot.java @@ -4,10 +4,10 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.IProjectile; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.MobEffects; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -import net.minecraft.util.*; +import net.minecraft.util.EnumParticleTypes; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -225,7 +225,7 @@ public void onUpdate() { if (movingobjectposition.entityHit instanceof EntityLivingBase) { - ((EntityLivingBase) movingobjectposition.entityHit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 180, 2, true, true)); + ((EntityLivingBase) movingobjectposition.entityHit).addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 180, 2, true, true)); this.setDead(); } else diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityCrashedProbe.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityCrashedProbe.java index 73e668a275..a56ac5e4d3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityCrashedProbe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityCrashedProbe.java @@ -188,7 +188,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java index ea5f097fdc..2e97721786 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java @@ -393,7 +393,7 @@ public void clear() } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java index 0bcc22370d..316cd497eb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java @@ -6,7 +6,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeDecorator; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.common.MinecraftForge; @@ -33,7 +33,7 @@ public BiomeDecoratorVenus() } @Override - public void decorate(World worldIn, Random random, BiomeGenBase biome, BlockPos blockPos) + public void decorate(World worldIn, Random random, Biome biome, BlockPos blockPos) { if (this.worldObj != null) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenBaseVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenBaseVenus.java index f5aa6cb194..ecedcdca62 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenBaseVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenBaseVenus.java @@ -12,19 +12,19 @@ import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeDecorator; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.ChunkPrimer; import java.util.Random; -public class BiomeGenBaseVenus extends BiomeGenBase +public class BiomeVenus extends Biome { - public static final BiomeGenBase venusFlat = new BiomeGenFlatVenus(ConfigManagerCore.biomeIDbase + 4).setBiomeName("Venus Flat"); - public static final BiomeGenBase venusMountain = new BiomeGenVenusMountain(ConfigManagerCore.biomeIDbase + 5).setBiomeName("Venus Mountain"); - public static final BiomeGenBase venusValley = new BiomeGenVenusValley(ConfigManagerCore.biomeIDbase + 6).setBiomeName("Venus Valley"); + public static final Biome venusFlat = new BiomeGenFlatVenus(ConfigManagerCore.biomeIDbase + 4).setBiomeName("Venus Flat"); + public static final Biome venusMountain = new BiomeGenVenusMountain(ConfigManagerCore.biomeIDbase + 5).setBiomeName("Venus Mountain"); + public static final Biome venusValley = new BiomeGenVenusValley(ConfigManagerCore.biomeIDbase + 6).setBiomeName("Venus Valley"); @SuppressWarnings("unchecked") - BiomeGenBaseVenus(int var1) + BiomeVenus(int var1) { super(var1); this.spawnableMonsterList.clear(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenFlatVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenFlatVenus.java index afd877397a..4da9eafb90 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenFlatVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenFlatVenus.java @@ -9,7 +9,7 @@ import java.util.Random; -public class BiomeGenFlatVenus extends BiomeGenBaseVenus +public class BiomeGenFlatVenus extends BiomeVenus { public BiomeGenFlatVenus(int par1) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusMountain.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusMountain.java index 8619076cde..d368d9aba8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusMountain.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusMountain.java @@ -9,7 +9,7 @@ import java.util.Random; -public class BiomeGenVenusMountain extends BiomeGenBaseVenus +public class BiomeGenVenusMountain extends BiomeVenus { public BiomeGenVenusMountain(int par1) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusValley.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusValley.java index e74724df95..503541938a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusValley.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusValley.java @@ -12,7 +12,7 @@ import java.util.Random; -public class BiomeGenVenusValley extends BiomeGenBaseVenus +public class BiomeGenVenusValley extends BiomeVenus { public BiomeGenVenusValley(int par1) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java index 6531b46979..393a38ae58 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java @@ -18,7 +18,7 @@ import net.minecraft.world.SpawnerAnimals; import net.minecraft.world.World; import net.minecraft.world.WorldType; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkPrimer; import net.minecraft.world.chunk.IChunkProvider; @@ -50,7 +50,7 @@ public class ChunkProviderVenus implements IChunkProvider private double[] stoneNoise = new double[256]; private MapGenBaseMeta caveGenerator = new MapGenCaveVenus(); private MapGenBaseMeta lavaCaveGenerator = new MapGenLavaVenus(); - private BiomeGenBase[] biomesForGeneration; + private Biome[] biomesForGeneration; private double[] octaves1; private double[] octaves2; private double[] octaves3; @@ -160,7 +160,7 @@ private void setBlocksInChunk(int chunkX, int chunkZ, ChunkPrimer primer) } } - private void replaceBlocksForBiome(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) + private void replaceBlocksForBiome(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, Biome[] p_180517_4_) { double d0 = 0.03125D; this.stoneNoise = this.noiseGen4.func_151599_a(this.stoneNoise, (double) (p_180517_1_ * 16), (double) (p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); @@ -169,7 +169,7 @@ private void replaceBlocksForBiome(int p_180517_1_, int p_180517_2_, ChunkPrimer { for (int j = 0; j < 16; ++j) { - BiomeGenBase biomegenbase = p_180517_4_[j + i * 16]; + Biome biomegenbase = p_180517_4_[j + i * 16]; biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_180517_3_, p_180517_1_ * 16 + i, p_180517_2_ * 16 + j, this.stoneNoise[j + i * 16]); } } @@ -219,13 +219,13 @@ private void createLandPerBiome(int x, int z) float f3 = 0.0F; float f4 = 0.0F; int i1 = 2; - BiomeGenBase biomegenbase = this.biomesForGeneration[k + 2 + (l + 2) * 10]; + Biome biomegenbase = this.biomesForGeneration[k + 2 + (l + 2) * 10]; for (int j1 = -i1; j1 <= i1; ++j1) { for (int k1 = -i1; k1 <= i1; ++k1) { - BiomeGenBase biomegenbase1 = this.biomesForGeneration[k + j1 + 2 + (l + k1 + 2) * 10]; + Biome biomegenbase1 = this.biomesForGeneration[k + j1 + 2 + (l + k1 + 2) * 10]; float f5 = biomegenbase1.minHeight; float f6 = biomegenbase1.maxHeight; @@ -331,7 +331,7 @@ public void populate(IChunkProvider provider, int x, int z) int i = x * 16; int j = z * 16; BlockPos blockpos = new BlockPos(i, 0, j); - BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos.add(16, 0, 16)); + Biome biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos.add(16, 0, 16)); this.rand.setSeed(this.worldObj.getSeed()); long k = this.rand.nextLong() / 2L * 2L + 1L; long l = this.rand.nextLong() / 2L * 2L + 1L; @@ -411,9 +411,9 @@ public String makeString() } @Override - public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) + public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { - BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos); + Biome biomegenbase = this.worldObj.getBiomeGenForCoords(pos); return biomegenbase.getSpawnableList(creatureType); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldChunkManagerVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldChunkManagerVenus.java index bae3ae16a4..dee4a18f7c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldChunkManagerVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldChunkManagerVenus.java @@ -5,7 +5,7 @@ import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeCache; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; @@ -22,7 +22,7 @@ public class WorldChunkManagerVenus extends WorldChunkManager private GenLayer unzoomedBiomes; private GenLayer zoomedBiomes; private BiomeCache biomeCache; - private List biomesToSpawnIn; + private List biomesToSpawnIn; protected WorldChunkManagerVenus() { @@ -45,15 +45,15 @@ public WorldChunkManagerVenus(World world) } @Override - public List getBiomesToSpawnIn() + public List getBiomesToSpawnIn() { return this.biomesToSpawnIn; } @Override - public BiomeGenBase getBiomeGenerator(BlockPos pos, BiomeGenBase biomeGenBaseIn) + public Biome getBiomeGenerator(BlockPos pos, Biome biomeGenBaseIn) { - return this.biomeCache.func_180284_a(pos.getX(), pos.getZ(), BiomeGenBaseVenus.venusFlat); + return this.biomeCache.func_180284_a(pos.getX(), pos.getZ(), BiomeVenus.venusFlat); } @Override @@ -76,13 +76,13 @@ public float getTemperatureAtHeight(float par1, int par2) } @Override - public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] biomes, int x, int z, int length, int width) + public Biome[] getBiomesForGeneration(Biome[] biomes, int x, int z, int length, int width) { IntCache.resetIntCache(); if (biomes == null || biomes.length < length * width) { - biomes = new BiomeGenBase[length * width]; + biomes = new Biome[length * width]; } int[] intArray = unzoomedBiomes.getInts(x, z, length, width); @@ -91,11 +91,11 @@ public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] biomes, int x, int z { if (intArray[i] >= 0) { - biomes[i] = BiomeGenBase.getBiome(intArray[i]); + biomes[i] = Biome.getBiome(intArray[i]); } else { - biomes[i] = BiomeGenBaseVenus.venusFlat; + biomes[i] = BiomeVenus.venusFlat; } } @@ -103,24 +103,24 @@ public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] biomes, int x, int z } @Override - public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] oldBiomeList, int x, int z, int length, int width) + public Biome[] loadBlockGeneratorData(Biome[] oldBiomeList, int x, int z, int length, int width) { return getBiomeGenAt(oldBiomeList, x, z, length, width, true); } @Override - public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] listToReuse, int x, int z, int length, int width, boolean cacheFlag) + public Biome[] getBiomeGenAt(Biome[] listToReuse, int x, int z, int length, int width, boolean cacheFlag) { IntCache.resetIntCache(); if (listToReuse == null || listToReuse.length < length * width) { - listToReuse = new BiomeGenBase[width * length]; + listToReuse = new Biome[width * length]; } if (cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (z & 15) == 0) { - BiomeGenBase[] cached = this.biomeCache.getCachedBiomes(x, z); + Biome[] cached = this.biomeCache.getCachedBiomes(x, z); System.arraycopy(cached, 0, listToReuse, 0, width * length); return listToReuse; } @@ -131,11 +131,11 @@ public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] listToReuse, int x, int z, in { if (zoomed[i] >= 0) { - listToReuse[i] = BiomeGenBase.getBiome(zoomed[i]); + listToReuse[i] = Biome.getBiome(zoomed[i]); } else { - listToReuse[i] = BiomeGenBase.beach; // TODO Replace with venus default + listToReuse[i] = Biome.beach; // TODO Replace with venus default } } @@ -143,7 +143,7 @@ public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] listToReuse, int x, int z, in } @Override - public boolean areBiomesViable(int x, int z, int range, List viables) + public boolean areBiomesViable(int x, int z, int range, List viables) { int i = x - range >> 2; int j = z - range >> 2; @@ -155,7 +155,7 @@ public boolean areBiomesViable(int x, int z, int range, List viabl for (int a = 0; a < diffX * diffZ; ++a) { - BiomeGenBase biome = BiomeGenBase.getBiome(unzoomed[a]); + Biome biome = Biome.getBiome(unzoomed[a]); if (!viables.contains(biome)) { @@ -167,7 +167,7 @@ public boolean areBiomesViable(int x, int z, int range, List viabl } @Override - public BlockPos findBiomePosition(int x, int z, int range, List biomes, Random random) + public BlockPos findBiomePosition(int x, int z, int range, List biomes, Random random) { int i = x - range >> 2; int j = z - range >> 2; @@ -183,7 +183,7 @@ public BlockPos findBiomePosition(int x, int z, int range, List bi { int x0 = i + a % diffX << 2; int z0 = j + a / diffX << 2; - BiomeGenBase biome = BiomeGenBase.getBiome(unzoomed[a]); + Biome biome = Biome.getBiome(unzoomed[a]); if (biomes.contains(biome) && (blockPos == null || random.nextInt(count + 1) == 0)) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java index 3686d0ba14..e06fa1bc38 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java @@ -7,7 +7,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.feature.WorldGenerator; import java.util.Random; @@ -117,7 +117,7 @@ public boolean generate(World worldIn, Random rand, BlockPos position) if (worldIn.getBlockState(blockpos).getBlock() == Blocks.dirt && worldIn.getLightFor(EnumSkyBlock.SKY, position.add(i2, j4, j3)) > 0) { - BiomeGenBase biomegenbase = worldIn.getBiomeGenForCoords(blockpos); + Biome biomegenbase = worldIn.getBiomeGenForCoords(blockpos); if (biomegenbase.topBlock.getBlock() == Blocks.mycelium) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/layer/GenLayerVenusBiomes.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/layer/GenLayerVenusBiomes.java index 325b35eb54..5cc898e211 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/layer/GenLayerVenusBiomes.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/layer/GenLayerVenusBiomes.java @@ -1,13 +1,13 @@ package micdoodle8.mods.galacticraft.planets.venus.world.gen.layer; -import micdoodle8.mods.galacticraft.planets.venus.world.gen.BiomeGenBaseVenus; -import net.minecraft.world.biome.BiomeGenBase; +import micdoodle8.mods.galacticraft.planets.venus.world.gen.BiomeVenus; +import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; public class GenLayerVenusBiomes extends GenLayer { - private static final BiomeGenBase[] biomes = new BiomeGenBase[] { BiomeGenBaseVenus.venusFlat, BiomeGenBaseVenus.venusMountain, BiomeGenBaseVenus.venusValley}; + private static final Biome[] biomes = new Biome[] { BiomeVenus.venusFlat, BiomeVenus.venusMountain, BiomeVenus.venusValley}; public GenLayerVenusBiomes(long l, GenLayer parent) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/layer/GenLayerVenusSurround.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/layer/GenLayerVenusSurround.java index d140b6f8ab..1c56d3415c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/layer/GenLayerVenusSurround.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/layer/GenLayerVenusSurround.java @@ -34,9 +34,9 @@ public int[] getInts(int x, int z, int width, int depth) int up = input[dx + 1 + (dz + 0) * nwidth]; int down = input[dx + 1 + (dz + 2) * nwidth]; int center = input[dx + 1 + (dz + 1) * nwidth]; -// if (surrounded(BiomeGenBaseVenus.venusMountain.biomeID, center, right, left, up, down) && nextInt(25) == 0) +// if (surrounded(BiomeVenus.venusMountain.biomeID, center, right, left, up, down) && nextInt(25) == 0) // { -// output[dx + dz * width] = BiomeGenBaseVenus.venusVolcano.biomeID; +// output[dx + dz * width] = BiomeVenus.venusVolcano.biomeID; // } // else { From 499d5c088ab01524c3bf30feea45183e765a75ec Mon Sep 17 00:00:00 2001 From: Mitch Date: Wed, 8 Mar 2017 02:00:13 -0500 Subject: [PATCH 004/535] Even more 1.10.2 error fixing --- .../codechicken/nei/WorldOverlayRenderer.java | 14 +- .../api/prefab/entity/EntityAutoRocket.java | 3 +- .../prefab/entity/EntitySpaceshipBase.java | 2 +- .../galacticraft/api/vector/BlockVec3.java | 6 +- .../mods/galacticraft/api/vector/Vector3.java | 12 +- .../core/blocks/BlockBrightLamp.java | 2 +- .../galacticraft/core/blocks/BlockDish.java | 3 +- .../core/blocks/BlockGlowstoneTorch.java | 2 +- .../core/blocks/BlockNasaWorkbench.java | 2 +- .../galacticraft/core/blocks/BlockScreen.java | 2 +- .../core/blocks/BlockSpinThruster.java | 2 +- .../core/blocks/BlockTelemetry.java | 5 +- .../core/blocks/BlockUnlitTorch.java | 2 +- .../core/client/SkyProviderOverworld.java | 1 - .../core/client/fx/ParticleLanderFlame.java | 8 +- .../core/client/fx/ParticleLaunchFlame.java | 8 +- .../core/client/gui/GuiHandler.java | 16 +- .../gui/overlay/OverlaySensorGlasses.java | 9 +- .../client/gui/screen/GuiJoinSpaceRace.java | 7 +- .../client/gui/screen/GuiMissingCore.java | 2 +- .../gui/screen/GuiPreLaunchChecklist.java | 3 +- .../core/client/sounds/GCSounds.java | 39 ++ .../client/sounds/SoundUpdaterRocket.java | 4 +- .../core/command/CommandGCAstroMiner.java | 11 +- .../core/command/CommandGCInv.java | 13 +- .../core/command/CommandJoinSpaceRace.java | 11 +- .../core/command/CommandPlanetTeleport.java | 17 +- .../command/CommandSpaceStationAddOwner.java | 9 +- .../CommandSpaceStationChangeOwner.java | 11 +- .../CommandSpaceStationRemoveOwner.java | 15 +- .../core/dimension/SpaceStationWorldData.java | 14 +- .../core/dimension/SpinManager.java | 17 +- .../core/dimension/TeleportTypeMoon.java | 13 +- .../core/dimension/TeleportTypeOverworld.java | 7 +- .../core/dimension/WorldProviderMoon.java | 8 +- .../energy/tile/TileBaseElectricBlock.java | 3 +- .../tile/TileBaseUniversalElectrical.java | 1 + .../core/entities/EntityAdvancedMotion.java | 32 +- .../core/entities/EntityAlienVillager.java | 141 ++--- .../core/entities/EntityBossBase.java | 47 +- .../core/entities/EntityBuggy.java | 105 ++-- .../core/entities/EntityCelestialFake.java | 49 +- .../core/entities/EntityEvolvedCreeper.java | 57 +- .../core/entities/EntityEvolvedSkeleton.java | 103 ++-- .../core/entities/EntityEvolvedSpider.java | 49 +- .../core/entities/EntityEvolvedZombie.java | 57 +- .../core/entities/EntityFlag.java | 51 +- .../core/entities/EntityLander.java | 29 +- .../core/entities/EntityLanderBase.java | 64 +- .../core/entities/EntityMeteor.java | 41 +- .../core/entities/EntityMeteorChunk.java | 70 ++- .../core/entities/EntityParachest.java | 6 +- .../core/entities/EntitySkeletonBoss.java | 95 +-- .../core/entities/EntityTier1Rocket.java | 21 +- .../player/CapabilityProviderStats.java | 3 + .../player/CapabilityProviderStatsClient.java | 35 ++ .../player/CapabilityStatsClientHandler.java | 32 + .../core/entities/player/FreefallHandler.java | 32 +- .../player/GCEntityClientPlayerMP.java | 12 +- .../entities/player/GCEntityPlayerMP.java | 2 +- .../core/entities/player/GCPlayerHandler.java | 5 + .../entities/player/GCPlayerStatsClient.java | 483 +++++++-------- .../player/IStatsClientCapability.java | 135 ++++ .../core/entities/player/PlayerClient.java | 124 ++-- .../core/entities/player/PlayerServer.java | 17 +- .../player/StatsClientCapability.java | 582 ++++++++++++++++++ .../core/event/EventHandlerGC.java | 296 +++++---- .../core/fluid/ThreadFindSeal.java | 5 +- .../ContainerSchematicTier1Rocket.java | 2 +- .../galacticraft/core/items/ItemBuggy.java | 56 +- .../items/ItemCanisterOxygenInfinite.java | 20 +- .../core/network/ConnectionEvents.java | 22 +- .../core/network/ConnectionPacket.java | 8 +- .../core/network/PacketDynamic.java | 3 +- .../core/network/PacketSimple.java | 45 +- .../core/proxy/ClientProxyCore.java | 42 +- .../core/recipe/RecipeManagerGC.java | 150 ++--- .../core/tick/KeyHandlerClient.java | 7 +- .../core/tick/TickHandlerClient.java | 32 +- .../core/tick/TickHandlerServer.java | 23 +- .../core/tile/TileEntityArclamp.java | 16 +- .../core/tile/TileEntityTreasureChest.java | 101 ++- .../world/gen/StructureComponentMoon.java | 16 +- .../world/gen/StructureComponentVillage.java | 4 +- .../gen/StructureComponentVillageHouse.java | 8 +- .../gen/StructureComponentVillagePathGen.java | 4 +- .../gen/StructureComponentVillageTorch.java | 10 +- .../gen/StructureComponentVillageWell.java | 4 +- .../gen/StructureComponentVillageWoodHut.java | 8 +- .../core/world/gen/dungeon/RoomTreasure.java | 10 +- .../client/SkyProviderAsteroids.java | 6 +- .../client/render/entity/RenderGrapple.java | 4 +- .../asteroids/entities/EntityAstroMiner.java | 30 +- .../asteroids/entities/EntityEntryPod.java | 2 +- .../asteroids/entities/EntityGrapple.java | 29 +- .../entities/EntitySmallAsteroid.java | 18 +- .../world/gen/ChunkProviderAsteroids.java | 2 +- .../planets/mars/client/SkyProviderMars.java | 8 +- .../mars/dimension/WorldProviderMars.java | 8 +- .../mars/entities/EntityCreeperBoss.java | 4 +- .../mars/entities/EntityLandingBalloons.java | 2 +- .../mars/entities/EntitySlimeling.java | 70 +-- .../mars/entities/EntitySludgeling.java | 6 +- .../planets/mars/world/gen/RoomBossMars.java | 2 +- .../mars/world/gen/RoomTreasureMars.java | 2 +- .../planets/venus/blocks/BlockTorchWeb.java | 2 +- .../venus/client/SkyProviderVenus.java | 8 +- .../venus/entities/EntityEntryPodVenus.java | 2 +- .../planets/venus/entities/EntityJuicer.java | 16 +- .../venus/entities/EntitySpiderQueen.java | 8 +- .../planets/venus/entities/EntityWebShot.java | 12 +- .../entities/ai/PathNavigateCeiling.java | 12 +- .../world/gen/dungeon/RoomTreasureVenus.java | 2 +- 113 files changed, 2439 insertions(+), 1491 deletions(-) create mode 100644 src/main/java/micdoodle8/mods/galacticraft/core/client/sounds/GCSounds.java create mode 100644 src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityProviderStatsClient.java create mode 100644 src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityStatsClientHandler.java create mode 100644 src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IStatsClientCapability.java create mode 100644 src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsClientCapability.java diff --git a/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java b/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java index 3729aee17b..d513ecc4c7 100644 --- a/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java +++ b/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java @@ -11,11 +11,11 @@ import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.passive.EntityPig; import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.EnumSkyBlock; -import net.minecraft.world.SpawnerAnimals; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.WorldEntitySpawner; +import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; import static org.lwjgl.opengl.GL11.*; @@ -74,7 +74,7 @@ private static void renderMobSpawnOverlay(Entity entity) { for (int z = z1 - 16; z <= z1 + 16; z++) { BlockPos pos = new BlockPos(x, y1, z); Chunk chunk = world.getChunkFromBlockCoords(pos); - BiomeGenBase biome = world.getBiomeGenForCoords(pos); + Biome biome = world.getBiome(pos); if (biome.getSpawnableList(EnumCreatureType.MONSTER).isEmpty() || biome.getSpawningChance() <= 0) { continue; } @@ -110,15 +110,15 @@ private static void renderMobSpawnOverlay(Entity entity) { private static int getSpawnMode(Chunk chunk, int x, int y, int z) { World world = chunk.getWorld(); BlockPos pos = new BlockPos(x, y, z); - if (!SpawnerAnimals.canCreatureTypeSpawnAtLocation(SpawnPlacementType.ON_GROUND, world, pos) || chunk.getLightFor(EnumSkyBlock.BLOCK, pos) >= 8) { + if (!WorldEntitySpawner.canCreatureTypeSpawnAtLocation(SpawnPlacementType.ON_GROUND, world, pos) || chunk.getLightFor(EnumSkyBlock.BLOCK, pos) >= 8) { return 0; } c.set(x + 0.2, y + 0.01, z + 0.2, x + 0.8, y + 1.8, z + 0.8); AxisAlignedBB aabb = c.aabb(); if (!world.checkNoEntityCollision(aabb) || - !world.getCollidingBoundingBoxes(dummyEntity, aabb).isEmpty() || - world.isAnyLiquid(aabb)) { + !world.getCollisionBoxes(dummyEntity, aabb).isEmpty() || + world.containsAnyLiquid(aabb)) { return 0; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityAutoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityAutoRocket.java index cdda68458f..525638270e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityAutoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityAutoRocket.java @@ -24,6 +24,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.SoundEvents; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -878,7 +879,7 @@ public void onLaunch() stats.launchpadStack = amountRemoved == 9 ? new ItemStack(GCBlocks.landingPad, 9, 0) : null; } - this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + this.playSound(SoundEvents.ENTITY_ITEM_PICKUP, 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java index 8e68c6528d..a3f6195ccd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java @@ -416,7 +416,7 @@ protected void failRocket() @Override @SideOnly(Side.CLIENT) - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean b) + public void setPositionAndRotationDirect(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean b) { this.setRotation(yaw, pitch); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java index 068de2f0c8..f4e56a5197 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java @@ -90,7 +90,7 @@ public BlockPos toBlockPos() * @return the block ID, or null if the y-coordinate is less than 0 or * greater than 256 or the x or z is outside the Minecraft worldmap. */ - public Block getBlockID(World world) + public IBlockState getBlockState(World world) { if (this.y < 0 || this.y >= 256 || this.x < -30000000 || this.z < -30000000 || this.x >= 30000000 || this.z >= 30000000) { @@ -105,7 +105,7 @@ public Block getBlockID(World world) // this will be within the same chunk if (BlockVec3.chunkCacheX == chunkx && BlockVec3.chunkCacheZ == chunkz && BlockVec3.chunkCacheDim == world.provider.getDimension() && BlockVec3.chunkCached.isLoaded()) { - return BlockVec3.chunkCached.getBlock(this.x & 15, this.y, this.z & 15); + return BlockVec3.chunkCached.getBlockState(this.x & 15, this.y, this.z & 15); } else { @@ -114,7 +114,7 @@ public Block getBlockID(World world) BlockVec3.chunkCacheDim = world.provider.getDimension(); BlockVec3.chunkCacheX = chunkx; BlockVec3.chunkCacheZ = chunkz; - return chunk.getBlock(this.x & 15, this.y, this.z & 15); + return chunk.getBlockState(this.x & 15, this.y, this.z & 15); } } catch (Throwable throwable) diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java b/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java index 172b930e42..596c55a381 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java @@ -176,11 +176,11 @@ public Vector2 toVector2() } /** - * Converts this vector three into a Minecraft Vec3 object + * Converts this vector three into a Minecraft Vec3d object */ - public Vec3 toVec3() + public Vec3d toVec3() { - return new Vec3(this.x, this.y, this.z); + return new Vec3d(this.x, this.y, this.z); } /** @@ -710,10 +710,10 @@ public MovingObjectPosition rayTraceEntities(World world, float rotationYaw, flo public MovingObjectPosition rayTraceEntities(World world, Vector3 target) { MovingObjectPosition pickedEntity = null; - Vec3 startingPosition = this.toVec3(); - Vec3 look = target.toVec3(); + Vec3d startingPosition = this.toVec3(); + Vec3d look = target.toVec3(); double reachDistance = this.distance(target); - Vec3 reachPoint = new Vec3(startingPosition.xCoord + look.xCoord * reachDistance, startingPosition.yCoord + look.yCoord * reachDistance, startingPosition.zCoord + look.zCoord * reachDistance); + Vec3d reachPoint = new Vec3d(startingPosition.xCoord + look.xCoord * reachDistance, startingPosition.yCoord + look.yCoord * reachDistance, startingPosition.zCoord + look.zCoord * reachDistance); double checkBorder = 1.1 * reachDistance; AxisAlignedBB boxToScan = new AxisAlignedBB(-checkBorder, -checkBorder, -checkBorder, checkBorder, checkBorder, checkBorder).offset(this.x, this.y, this.z); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java index 74db2437a1..731ca7db6d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java @@ -136,7 +136,7 @@ public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighb } // @Override -// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) // { // EnumFacing side = worldIn.getBlockState(pos).getValue(FACING); // float var8 = 0.3F; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java index 1c836ad87b..4a6bba4f9e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java @@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; @@ -126,7 +127,7 @@ public boolean onUseWrench(World world, BlockPos pos, EntityPlayer entityPlayer, } @Override - public boolean onSneakMachineActivated(World world, BlockPos pos, EntityPlayer entityPlayer, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onSneakMachineActivated(World world, BlockPos pos, EntityPlayer entityPlayer, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { //entityPlayer.openGui(GalacticraftCore.instance, -1, world, x, y, z); return true; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java index 8289d5d6bb..4560dd59c7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java @@ -197,7 +197,7 @@ public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random ra } // @Override -// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) // { // int l = getMetaFromState(worldIn.getBlockState(pos)) & 7; // float f = 0.15F; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java index 13a96df208..75f3056c3a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java @@ -74,7 +74,7 @@ public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World world // } // // @Override -// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) // { // this.setBlockBounds(-0.0F, 0.0F, -0.0F, 1.0F, 1.4F, 1.0F); // diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java index e965926825..b713f14019 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java @@ -137,7 +137,7 @@ public boolean isSealed(World worldIn, BlockPos pos, EnumFacing direction) } // @Override -// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) // { // final int metadata = getMetaFromState(worldIn.getBlockState(pos)) & 7; // float boundsFront = 0.094F; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java index f9fcf814a5..bfee2fb8de 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java @@ -190,7 +190,7 @@ private boolean dropTorchIfCantStay(World worldIn, BlockPos pos) } // @Override -// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) // { // float var8 = 0.3F; // diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java index 4e673365be..6b3c7c027f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java @@ -2,7 +2,7 @@ import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; import micdoodle8.mods.galacticraft.core.items.IShiftDescription; import micdoodle8.mods.galacticraft.core.tile.TileEntityTelemetry; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; @@ -13,7 +13,6 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -143,7 +142,7 @@ public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, return true; } - ItemStack wearing = GCPlayerStats.get((EntityPlayerMP) entityPlayer).frequencyModuleInSlot; + ItemStack wearing = entityPlayer.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null).getFrequencyModuleInSlot(); if (wearing != null) { if (wearing.hasTagCompound() && wearing.getTagCompound().hasKey("teDim")) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java index e910fbf0ea..46a1585ae1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java @@ -272,7 +272,7 @@ private void checkOxygen(World world, BlockPos pos) * returning a ray trace hit. Args: world, x, y, z, startVec, endVec */ // @Override -// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) +// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) // { // EnumFacing enumfacing = worldIn.getBlockState(pos).getValue(FACING); // float f = 0.15F; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/SkyProviderOverworld.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/SkyProviderOverworld.java index 018da53c83..0cd8370fea 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/SkyProviderOverworld.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/SkyProviderOverworld.java @@ -16,7 +16,6 @@ import net.minecraft.launchwrapper.Launch; import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3; import net.minecraft.util.math.Vec3d; import net.minecraftforge.client.IRenderHandler; import net.minecraftforge.fml.client.FMLClientHandler; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLanderFlame.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLanderFlame.java index 31cc8a0462..f6865ca2c5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLanderFlame.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLanderFlame.java @@ -18,9 +18,9 @@ public class ParticleLanderFlame extends Particle { private float smokeParticleScale; - private EntityLivingBase getRidingEntity(); + private EntityLivingBase ridingEntity; - public ParticleLanderFlame(World world, double x, double y, double z, double mX, double mY, double mZ, EntityLivingBase getRidingEntity()) + public ParticleLanderFlame(World world, double x, double y, double z, double mX, double mY, double mZ, EntityLivingBase ridingEntity) { super(world, x, y, z, mX, mY, mZ); this.motionX *= 0.10000000149011612D; @@ -35,7 +35,7 @@ public ParticleLanderFlame(World world, double x, double y, double z, double mX, this.smokeParticleScale = this.particleScale; this.particleMaxAge = (int) 5.0D; this.canCollide = true; - this.getRidingEntity() = getRidingEntity(); + this.ridingEntity = ridingEntity; } @Override @@ -101,7 +101,7 @@ public void onUpdate() if (var5 instanceof EntityLivingBase) { - if (!var5.isDead && !var5.isBurning() && !var5.equals(this.getRidingEntity())) + if (!var5.isDead && !var5.isBurning() && !var5.equals(this.ridingEntity)) { var5.setFire(3); GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_SET_ENTITY_FIRE, var5.worldObj.provider.getDimension(), new Object[] { var5.getEntityId() })); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchFlame.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchFlame.java index 0cae401a78..2025107ed6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchFlame.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchFlame.java @@ -20,9 +20,9 @@ public class ParticleLaunchFlame extends Particle { private float smokeParticleScale; private boolean spawnSmokeShort; - private EntityLivingBase getRidingEntity(); + private EntityLivingBase ridingEntity; - public ParticleLaunchFlame(World par1World, Vector3 position, Vector3 motion, boolean launched, EntityLivingBase getRidingEntity()) + public ParticleLaunchFlame(World par1World, Vector3 position, Vector3 motion, boolean launched, EntityLivingBase ridingEntity) { super(par1World, position.x, position.y, position.z, 0.0D, 0.0D, 0.0D); this.motionX *= 0.10000000149011612D; @@ -40,7 +40,7 @@ public ParticleLaunchFlame(World par1World, Vector3 position, Vector3 motion, bo this.particleMaxAge = (int) (this.particleMaxAge * 1F); this.canCollide = true; this.spawnSmokeShort = launched; - this.getRidingEntity() = getRidingEntity(); + this.ridingEntity = ridingEntity; } @Override @@ -111,7 +111,7 @@ public void onUpdate() if (var5 instanceof EntityLivingBase) { - if (!var5.isDead && !var5.isBurning() && !var5.equals(this.getRidingEntity())) + if (!var5.isDead && !var5.isBurning() && !var5.equals(this.ridingEntity)) { var5.setFire(3); GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_SET_ENTITY_FIRE, var5.worldObj.provider.getDimension(), new Object[] { var5.getEntityId() })); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java index 34ae8ae595..c95106b21e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java @@ -8,8 +8,10 @@ import micdoodle8.mods.galacticraft.core.client.gui.screen.GuiJoinSpaceRace; import micdoodle8.mods.galacticraft.core.client.gui.screen.GuiNewSpaceRace; import micdoodle8.mods.galacticraft.core.client.gui.screen.GuiPreLaunchChecklist; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsClientHandler; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsClientCapability; import micdoodle8.mods.galacticraft.core.inventory.*; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.tile.*; @@ -42,7 +44,7 @@ public Object getServerGuiElement(int ID, EntityPlayer player, World world, int return null; } - GCPlayerStats stats = GCPlayerStats.get(playerBase); + IStatsCapability stats = playerBase.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); if (ID == GuiIdsCore.ROCKET_INVENTORY && player.getRidingEntity() instanceof EntityTieredRocket) { @@ -50,7 +52,7 @@ public Object getServerGuiElement(int ID, EntityPlayer player, World world, int } else if (ID == GuiIdsCore.EXTENDED_INVENTORY) { - return new ContainerExtendedInventory(player, stats.extendedInventory); + return new ContainerExtendedInventory(player, stats.getExtendedInventory()); } BlockPos pos = new BlockPos(x, y, z); @@ -132,7 +134,7 @@ else if (tile instanceof TileEntityOxygenDecompressor) } } - for (ISchematicPage page : stats.unlockedSchematics) + for (ISchematicPage page : stats.getUnlockedSchematics()) { if (ID == page.getGuiID()) { @@ -268,8 +270,8 @@ else if (tile instanceof TileEntityOxygenDecompressor) if (playerClient != null) { - GCPlayerStatsClient stats = GCPlayerStatsClient.get(playerClient); - for (ISchematicPage page : stats.unlockedSchematics) + IStatsClientCapability stats = playerClient.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); + for (ISchematicPage page : stats.getUnlockedSchematics()) { if (ID == page.getGuiID()) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/overlay/OverlaySensorGlasses.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/overlay/OverlaySensorGlasses.java index 24e4076d97..18317b98c6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/overlay/OverlaySensorGlasses.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/overlay/OverlaySensorGlasses.java @@ -2,7 +2,8 @@ import micdoodle8.mods.galacticraft.api.vector.BlockVec3; import micdoodle8.mods.galacticraft.core.Constants; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsClientHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsClientCapability; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.ClientUtil; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; @@ -15,8 +16,8 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -100,8 +101,8 @@ public static void renderSensorGlassesValueableBlocks(ItemStack stack, EntityPla if (client != null) { - GCPlayerStatsClient stats = GCPlayerStatsClient.get(client); - var2 = stats.usingAdvancedGoggles; + IStatsClientCapability stats = client.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); + var2 = stats.isUsingAdvancedGoggles(); } OverlaySensorGlasses.minecraft.fontRendererObj.drawString(GCCoreUtil.translate("gui.sensor.advanced") + ": " + (var2 ? GCCoreUtil.translate("gui.sensor.advancedon") : GCCoreUtil.translate("gui.sensor.advancedoff")), var6 / 2 - 50, 4, 0x03b88f); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiJoinSpaceRace.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiJoinSpaceRace.java index 1fc9b87e0b..767fa520e3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiJoinSpaceRace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiJoinSpaceRace.java @@ -12,7 +12,8 @@ import micdoodle8.mods.galacticraft.core.dimension.SpaceRace; import micdoodle8.mods.galacticraft.core.dimension.SpaceRaceManager; import micdoodle8.mods.galacticraft.core.entities.EntityFlag; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsClientHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsClientCapability; import micdoodle8.mods.galacticraft.core.network.PacketSimple; import micdoodle8.mods.galacticraft.core.network.PacketSimple.EnumSimplePacket; import micdoodle8.mods.galacticraft.core.util.ColorUtil; @@ -50,9 +51,9 @@ public class GuiJoinSpaceRace extends GuiScreen implements ICheckBoxCallback, IT public GuiJoinSpaceRace(EntityPlayerSP player) { this.thePlayer = player; - GCPlayerStatsClient stats = GCPlayerStatsClient.get(player); + IStatsClientCapability stats = player.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); - SpaceRace race = SpaceRaceManager.getSpaceRaceFromID(stats.spaceRaceInviteTeamID); + SpaceRace race = SpaceRaceManager.getSpaceRaceFromID(stats.getSpaceRaceInviteTeamID()); if (race != null) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiMissingCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiMissingCore.java index 548aeac67e..1017732625 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiMissingCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiMissingCore.java @@ -5,7 +5,7 @@ import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.util.TextFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiPreLaunchChecklist.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiPreLaunchChecklist.java index 3e53488a4a..9c9166ba1c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiPreLaunchChecklist.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiPreLaunchChecklist.java @@ -13,6 +13,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -142,7 +143,7 @@ private void onDataChange() GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(PacketSimple.EnumSimplePacket.S_UPDATE_CHECKLIST, mc.thePlayer.worldObj.provider.getDimension(), new Object[] { this.tagCompound })); // Update client item - ItemStack stack = mc.thePlayer.getHeldItem(); + ItemStack stack = mc.thePlayer.getHeldItem(EnumHand.MAIN_HAND /* TODO Support off-hand use */); NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound == null) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/sounds/GCSounds.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/sounds/GCSounds.java new file mode 100644 index 0000000000..1831b2e3ee --- /dev/null +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/sounds/GCSounds.java @@ -0,0 +1,39 @@ +package micdoodle8.mods.galacticraft.core.client.sounds; + +import micdoodle8.mods.galacticraft.core.Constants; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundEvent; +import net.minecraftforge.fml.common.registry.GameRegistry; + +public class GCSounds +{ + public static SoundEvent bossDeath; + public static SoundEvent bossLaugh; + public static SoundEvent bossOoh; + public static SoundEvent bossOuch; + public static SoundEvent slimeDeath; + public static SoundEvent astroMiner; + public static SoundEvent shuttle; + public static SoundEvent parachute; + + public static SoundEvent music; + + public static void registerSounds() + { + bossDeath = registerSound("entity.bossdeath"); + bossLaugh = registerSound("entity.bosslaugh"); + bossOoh = registerSound("entity.ooh"); + bossOuch = registerSound("entity.ouch"); + slimeDeath = registerSound("entity.slime_death"); + astroMiner = registerSound("entity.astrominer"); + shuttle = registerSound("shuttle.shuttle"); + parachute = registerSound("player.parachute"); + music = registerSound("galacticraft.musicSpace"); + } + + private static SoundEvent registerSound(String soundName) + { + ResourceLocation soundID = new ResourceLocation(Constants.ASSET_PREFIX, soundName); + return GameRegistry.register(new SoundEvent(soundID).setRegistryName(soundID)); + } +} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/sounds/SoundUpdaterRocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/sounds/SoundUpdaterRocket.java index dd112cb8c4..e0291fc94e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/sounds/SoundUpdaterRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/sounds/SoundUpdaterRocket.java @@ -7,7 +7,7 @@ import net.minecraft.client.audio.MovingSound; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; /** * This file is part of the Galacticraft project @@ -23,7 +23,7 @@ public class SoundUpdaterRocket extends MovingSound public SoundUpdaterRocket(EntityPlayerSP par1EntityPlayerSP, EntityAutoRocket par2Entity) { - super(new ResourceLocation(Constants.TEXTURE_PREFIX + "shuttle.shuttle")); + super(GCSounds.shuttle, SoundCategory.NEUTRAL); this.theRocket = par2Entity; this.thePlayer = par1EntityPlayerSP; this.attenuationType = ISound.AttenuationType.NONE; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java index cfec1e1081..5ebdd2697c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java @@ -1,6 +1,7 @@ package micdoodle8.mods.galacticraft.core.command; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.core.util.PlayerUtil; import net.minecraft.command.CommandBase; @@ -116,18 +117,18 @@ else if (args[0].length() > 3 && args[0].substring(0, 3).equalsIgnoreCase("set") if (playerBase != null) { - GCPlayerStats stats = GCPlayerStats.get(playerBase); + IStatsCapability stats = playerBase.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); switch (type) { case 1: - sender.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("command.gcastrominer.count", playerBase.getGameProfile().getName(), "" + stats.astroMinerCount))); + sender.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("command.gcastrominer.count", playerBase.getGameProfile().getName(), "" + stats.getAstroMinerCount()))); break; case 2: - stats.astroMinerCount = 0; + stats.setAstroMinerCount(0); sender.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("command.gcastrominer.count", playerBase.getGameProfile().getName(), "" + 0))); break; case 3: - stats.astroMinerCount = newvalue; + stats.setAstroMinerCount(newvalue); sender.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("command.gcastrominer.count", playerBase.getGameProfile().getName(), "" + newvalue))); break; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCInv.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCInv.java index 7f0575e243..507578faef 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCInv.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCInv.java @@ -1,7 +1,8 @@ package micdoodle8.mods.galacticraft.core.command; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.inventory.InventoryExtended; import micdoodle8.mods.galacticraft.core.util.PlayerUtil; import net.minecraft.command.CommandBase; @@ -84,16 +85,16 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args EntityPlayerMP thePlayer = PlayerUtil.getPlayerBaseServerFromPlayerUsername(args[1], true); if (thePlayer != null && !thePlayer.isDead && thePlayer.worldObj != null) { - GCPlayerStats stats = GCPlayerStats.get(thePlayer); + IStatsCapability stats = thePlayer.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); if (args[0].equalsIgnoreCase("drop")) { - InventoryExtended gcInventory = stats.extendedInventory; + InventoryExtended gcInventory = stats.getExtendedInventory(); gcInventory.dropExtendedItems(thePlayer); } else if (args[0].equalsIgnoreCase("save")) { - InventoryExtended gcInventory = stats.extendedInventory; + InventoryExtended gcInventory = stats.getExtendedInventory(); ItemStack[] saveinv = new ItemStack[gcInventory.getSizeInventory()]; for (int i = 0; i < gcInventory.getSizeInventory(); i++) { @@ -120,7 +121,7 @@ else if (args[0].equalsIgnoreCase("restore")) } else if (args[0].equalsIgnoreCase("clear")) { - InventoryExtended gcInventory = stats.extendedInventory; + InventoryExtended gcInventory = stats.getExtendedInventory(); for (int i = 0; i < gcInventory.getSizeInventory(); i++) { gcInventory.setInventorySlotContents(i, null); @@ -181,7 +182,7 @@ public static void doLoad(EntityPlayerMP thePlayer) // auto-restore on a server restart. { ItemStack[] saveinv = CommandGCInv.savedata.get(theName); - InventoryExtended gcInventory = GCPlayerStats.get(thePlayer).extendedInventory; + InventoryExtended gcInventory = thePlayer.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null).getExtendedInventory(); for (int i = 0; i < gcInventory.getSizeInventory(); i++) { gcInventory.setInventorySlotContents(i, saveinv[i]); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandJoinSpaceRace.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandJoinSpaceRace.java index 6298e6c2f8..2fa34249da 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandJoinSpaceRace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandJoinSpaceRace.java @@ -2,7 +2,8 @@ import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.dimension.SpaceRaceManager; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.network.PacketSimple; import micdoodle8.mods.galacticraft.core.network.PacketSimple.EnumSimplePacket; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; @@ -45,12 +46,12 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args { if (playerBase != null) { - GCPlayerStats stats = GCPlayerStats.get(playerBase); + IStatsCapability stats = playerBase.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); - if (stats.spaceRaceInviteTeamID > 0) + if (stats.getSpaceRaceInviteTeamID() > 0) { - SpaceRaceManager.sendSpaceRaceData(playerBase, SpaceRaceManager.getSpaceRaceFromID(stats.spaceRaceInviteTeamID)); - GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_OPEN_JOIN_RACE_GUI, playerBase.worldObj.provider.getDimension(), new Object[] { stats.spaceRaceInviteTeamID }), playerBase); + SpaceRaceManager.sendSpaceRaceData(playerBase, SpaceRaceManager.getSpaceRaceFromID(stats.getSpaceRaceInviteTeamID())); + GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_OPEN_JOIN_RACE_GUI, playerBase.worldObj.provider.getDimension(), new Object[] { stats.getSpaceRaceInviteTeamID() }), playerBase); } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandPlanetTeleport.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandPlanetTeleport.java index b5d478d561..01e78d2b2f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandPlanetTeleport.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandPlanetTeleport.java @@ -2,7 +2,8 @@ import micdoodle8.mods.galacticraft.api.entity.IRocketType; import micdoodle8.mods.galacticraft.core.GCItems; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.util.EnumColor; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.core.util.PlayerUtil; @@ -53,13 +54,13 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args { WorldServer worldserver = server.worldServerForDimension(server.worldServers[0].provider.getDimension()); BlockPos spawnPoint = worldserver.getSpawnPoint(); - GCPlayerStats stats = GCPlayerStats.get(playerBase); - stats.rocketStacks = new ItemStack[2]; - stats.rocketType = IRocketType.EnumRocketType.DEFAULT.ordinal(); - stats.rocketItem = GCItems.rocketTier1; - stats.fuelLevel = 1000; - stats.coordsTeleportedFromX = spawnPoint.getX(); - stats.coordsTeleportedFromZ = spawnPoint.getZ(); + IStatsCapability stats = playerBase.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + stats.setRocketStacks(new ItemStack[2]); + stats.setRocketType(IRocketType.EnumRocketType.DEFAULT.ordinal()); + stats.setRocketItem(GCItems.rocketTier1); + stats.setFuelLevel(1000); + stats.setCoordsTeleportedFromX(spawnPoint.getX()); + stats.setCoordsTeleportedFromZ(spawnPoint.getZ()); try { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java index 8c2ae3d444..f06b1ed9f5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java @@ -1,7 +1,8 @@ package micdoodle8.mods.galacticraft.core.command; import micdoodle8.mods.galacticraft.core.dimension.SpaceStationWorldData; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.core.util.PlayerUtil; import net.minecraft.command.CommandBase; @@ -52,15 +53,15 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args if (playerBase != null) { - GCPlayerStats stats = GCPlayerStats.get(playerBase); + IStatsCapability stats = playerBase.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); - if (stats.spaceStationDimensionData.isEmpty()) + if (stats.getSpaceStationDimensionData().isEmpty()) { throw new WrongUsageException(GCCoreUtil.translate("commands.ssinvite.not_found"), new Object[0]); } else { - for (Map.Entry ownedStations : stats.spaceStationDimensionData.entrySet()) + for (Map.Entry ownedStations : stats.getSpaceStationDimensionData().entrySet()) { final SpaceStationWorldData data = SpaceStationWorldData.getStationData(playerBase.worldObj, ownedStations.getValue(), playerBase); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationChangeOwner.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationChangeOwner.java index c5302e30d4..26d467f02f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationChangeOwner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationChangeOwner.java @@ -2,7 +2,8 @@ import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.dimension.SpaceStationWorldData; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.network.PacketSimple; import micdoodle8.mods.galacticraft.core.network.PacketSimple.EnumSimplePacket; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; @@ -89,15 +90,15 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args final EntityPlayerMP newPlayer = PlayerUtil.getPlayerBaseServerFromPlayerUsername(newOwner, true); if (oldPlayer != null) { - final GCPlayerStats stats = GCPlayerStats.get(oldPlayer); + IStatsCapability stats = oldPlayer.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); SpaceStationWorldData.updateSSOwnership(oldPlayer, oldOwner, stats, stationID, stationData); - GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_SPACESTATION_CLIENT_ID, oldPlayer.worldObj.provider.getDimension(), new Object[] { WorldUtil.spaceStationDataToString(stats.spaceStationDimensionData) }), oldPlayer); + GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_SPACESTATION_CLIENT_ID, oldPlayer.worldObj.provider.getDimension(), new Object[] { WorldUtil.spaceStationDataToString(stats.getSpaceStationDimensionData()) }), oldPlayer); } if (newPlayer != null) { - final GCPlayerStats stats = GCPlayerStats.get(newPlayer); + IStatsCapability stats = newPlayer.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); SpaceStationWorldData.updateSSOwnership(newPlayer, newOwner.replace(".", ""), stats, stationID, stationData); - GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_SPACESTATION_CLIENT_ID, oldPlayer.worldObj.provider.getDimension(), new Object[] { WorldUtil.spaceStationDataToString(stats.spaceStationDimensionData) }), newPlayer); + GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_SPACESTATION_CLIENT_ID, oldPlayer.worldObj.provider.getDimension(), new Object[] { WorldUtil.spaceStationDataToString(stats.getSpaceStationDimensionData()) }), newPlayer); } } catch (final Exception var6) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java index 4e55a7bc9c..e4687537c8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java @@ -2,7 +2,8 @@ import com.google.common.collect.Sets; import micdoodle8.mods.galacticraft.core.dimension.SpaceStationWorldData; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.core.util.PlayerUtil; import net.minecraft.command.CommandBase; @@ -52,15 +53,15 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args if (playerBase != null) { - GCPlayerStats stats = GCPlayerStats.get(playerBase); + IStatsCapability stats = playerBase.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); - if (stats.spaceStationDimensionData.isEmpty()) + if (stats.getSpaceStationDimensionData().isEmpty()) { throw new WrongUsageException(GCCoreUtil.translate("commands.ssinvite.not_found"), new Object[0]); } else { - for (Map.Entry e : stats.spaceStationDimensionData.entrySet()) + for (Map.Entry e : stats.getSpaceStationDimensionData().entrySet()) { final SpaceStationWorldData data = SpaceStationWorldData.getStationData(playerBase.worldObj, e.getValue(), playerBase); @@ -117,15 +118,15 @@ protected String[] getPlayers(MinecraftServer server, ICommandSender sender) if (playerBase != null) { - GCPlayerStats stats = GCPlayerStats.get(playerBase); - if (!stats.spaceStationDimensionData.isEmpty()) + IStatsCapability stats = playerBase.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + if (!stats.getSpaceStationDimensionData().isEmpty()) { String[] allNames = server.getAllUsernames(); //data.getAllowedPlayers may include some in lowercase //Convert to correct case at least for those players who are online HashSet allowedNames = Sets.newHashSet(); - for (Map.Entry e : stats.spaceStationDimensionData.entrySet()) + for (Map.Entry e : stats.getSpaceStationDimensionData().entrySet()) { final SpaceStationWorldData data = SpaceStationWorldData.getStationData(playerBase.worldObj, e.getValue(), playerBase); allowedNames.addAll(data.getAllowedPlayers()); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceStationWorldData.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceStationWorldData.java index f41deae89f..8a5cd06691 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceStationWorldData.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceStationWorldData.java @@ -2,7 +2,7 @@ import micdoodle8.mods.galacticraft.api.galaxies.GalaxyRegistry; import micdoodle8.mods.galacticraft.api.galaxies.Satellite; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.core.util.GCLog; import micdoodle8.mods.galacticraft.core.util.WorldUtil; @@ -340,7 +340,7 @@ public static String getSpaceStationID(int dimID) return "spacestation_" + dimID; } - public static void updateSSOwnership(EntityPlayerMP player, String playerName, GCPlayerStats stats, int stationID, SpaceStationWorldData stationData) + public static void updateSSOwnership(EntityPlayerMP player, String playerName, IStatsCapability stats, int stationID, SpaceStationWorldData stationData) { if (stationData == null) { @@ -350,25 +350,25 @@ public static void updateSSOwnership(EntityPlayerMP player, String playerName, G if (stationData.owner.equals(playerName)) { //This player is the owner of the station - ensure stats data matches - if (!(stats.spaceStationDimensionData.values().contains(stationID))) + if (!(stats.getSpaceStationDimensionData().values().contains(stationID))) { GCLog.debug("Player owns station: " + stationData.getSpaceStationName() + " with home planet " + stationData.getHomePlanet()); - stats.spaceStationDimensionData.put(stationData.getHomePlanet(), stationID); + stats.getSpaceStationDimensionData().put(stationData.getHomePlanet(), stationID); } } else { //This player is the owner of the station - remove from stats data - Integer savedOwned = stats.spaceStationDimensionData.get(stationData.getHomePlanet()); + Integer savedOwned = stats.getSpaceStationDimensionData().get(stationData.getHomePlanet()); if (savedOwned != null && savedOwned == stationID) { GCLog.debug("Player does not own station: " + stationData.getSpaceStationName() + " with home planet " + stationData.getHomePlanet()); - stats.spaceStationDimensionData.remove(savedOwned); + stats.getSpaceStationDimensionData().remove(savedOwned); } } } - public static void checkAllStations(EntityPlayerMP thePlayer, GCPlayerStats stats) + public static void checkAllStations(EntityPlayerMP thePlayer, IStatsCapability stats) { String name = thePlayer.getGameProfile().getName().replace(".", ""); for (int id : WorldUtil.registeredSpaceStations.keySet()) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java index 5a4d8ca8d1..7cf923877e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java @@ -189,7 +189,7 @@ public void removeThruster(BlockPos thruster, boolean positive) */ public boolean refresh(BlockPos baseBlock, boolean placingThruster) { - if (this.oneSSBlock == null || this.worldProvider.worldObj.getBlockState(this.oneSSBlock).getBlock().isAir(this.worldProvider.worldObj, this.oneSSBlock)) + if (this.oneSSBlock == null || this.worldProvider.worldObj.getBlockState(this.oneSSBlock).getBlock().isAir(this.worldProvider.worldObj.getBlockState(this.oneSSBlock), this.worldProvider.worldObj, this.oneSSBlock)) { if (baseBlock != null) { @@ -269,11 +269,12 @@ public boolean refresh(BlockPos baseBlock, boolean placingThruster) if (!this.checked.contains(sideVec)) { this.checked.add(sideVec); - Block b = sideVec.getBlockID(this.worldProvider.worldObj); - if (b != null && !b.isAir(this.worldProvider.worldObj, sideVec.toBlockPos())) + IBlockState state = sideVec.getBlockState(this.worldProvider.worldObj); + Block b = state.getBlock(); + if (b != null && !b.isAir(this.worldProvider.worldObj.getBlockState(sideVec.toBlockPos()), this.worldProvider.worldObj, sideVec.toBlockPos())) { nextLayer.add(sideVec); - if (bStart.isAir(this.worldProvider.worldObj, this.oneSSBlock)) + if (bStart.isAir(this.worldProvider.worldObj.getBlockState(this.oneSSBlock), this.worldProvider.worldObj, this.oneSSBlock)) { this.oneSSBlock = sideVec.toBlockPos(); bStart = b; @@ -283,7 +284,7 @@ public boolean refresh(BlockPos baseBlock, boolean placingThruster) if (!(b instanceof BlockLiquid)) { //For most blocks, hardness gives a good idea of mass - m = b.getBlockHardness(this.worldProvider.worldObj, sideVec.toBlockPos()); + m = b.getBlockHardness(this.worldProvider.worldObj.getBlockState(sideVec.toBlockPos()), this.worldProvider.worldObj, sideVec.toBlockPos()); if (m < 0.1F) { m = 0.1F; @@ -293,7 +294,7 @@ else if (m > 30F) m = 30F; } //Wood items have a high hardness compared with their presumed mass - if (b.getMaterial() == Material.WOOD) + if (b.getMaterial(state) == Material.WOOD) { m /= 4; } @@ -337,7 +338,8 @@ else if (m > 30F) if (!this.oneSSBlock.equals(baseBlock)) { this.oneSSBlock = baseBlock; - if (this.worldProvider.worldObj.getBlockState(this.oneSSBlock).getBlock().getMaterial() != Material.AIR) + IBlockState state = this.worldProvider.worldObj.getBlockState(this.oneSSBlock); + if (state.getBlock().getMaterial(state) != Material.AIR) { return this.refresh(baseBlock, true); } @@ -771,5 +773,6 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) oneBlock.setInteger("z", this.oneSSBlock.getZ()); nbt.setTag("oneBlock", oneBlock); } + return nbt; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeMoon.java index 01dad1ae29..ee62795686 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeMoon.java @@ -3,7 +3,8 @@ import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.api.world.ITeleportType; import micdoodle8.mods.galacticraft.core.entities.EntityLander; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; @@ -25,8 +26,8 @@ public Vector3 getPlayerSpawnLocation(WorldServer world, EntityPlayerMP player) { if (player != null) { - GCPlayerStats stats = GCPlayerStats.get(player); - return new Vector3(stats.coordsTeleportedFromX, ConfigManagerCore.disableLander ? 250.0 : 900.0, stats.coordsTeleportedFromZ); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + return new Vector3(stats.getCoordsTeleportedFromX(), ConfigManagerCore.disableLander ? 250.0 : 900.0, stats.getCoordsTeleportedFromZ()); } return null; @@ -54,8 +55,8 @@ public Vector3 getParaChestSpawnLocation(WorldServer world, EntityPlayerMP playe @Override public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boolean ridingAutoRocket) { - GCPlayerStats stats = GCPlayerStats.get(player); - if (!ridingAutoRocket && !ConfigManagerCore.disableLander && stats.teleportCooldown <= 0) + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + if (!ridingAutoRocket && !ConfigManagerCore.disableLander && stats.getTeleportCooldown() <= 0) { if (player.capabilities.isFlying) { @@ -70,7 +71,7 @@ public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boole newWorld.spawnEntityInWorld(lander); } - stats.teleportCooldown = 10; + stats.setTeleportCooldown(10); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeOverworld.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeOverworld.java index 35c32db27a..82606a0cb4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeOverworld.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeOverworld.java @@ -2,7 +2,8 @@ import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.api.world.ITeleportType; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.world.World; @@ -23,8 +24,8 @@ public Vector3 getPlayerSpawnLocation(WorldServer world, EntityPlayerMP player) { if (player != null) { - GCPlayerStats stats = GCPlayerStats.get(player); - return new Vector3(stats.coordsTeleportedFromX, 250.0, stats.coordsTeleportedFromZ); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + return new Vector3(stats.getCoordsTeleportedFromX(), 250.0, stats.getCoordsTeleportedFromZ()); } return null; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldProviderMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldProviderMoon.java index a45ac497b8..fc8d9ecfd7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldProviderMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/WorldProviderMoon.java @@ -101,15 +101,15 @@ public Class getBiomeProviderClass() // @SideOnly(Side.CLIENT) // @Override -// public Vec3 getFogColor(float var1, float var2) +// public Vec3d getFogColor(float var1, float var2) // { -// return Vec3.createVectorHelper((double) 0F / 255F, (double) 0F / 255F, (double) 0F / 255F); +// return Vec3d.createVectorHelper((double) 0F / 255F, (double) 0F / 255F, (double) 0F / 255F); // } // @Override -// public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) +// public Vec3d getSkyColor(Entity cameraEntity, float partialTicks) // { -// return Vec3.createVectorHelper(0, 0, 0); +// return Vec3d.createVectorHelper(0, 0, 0); // } // @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java index 54f668aa9b..1db7019f6b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java @@ -144,6 +144,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) super.writeToNBT(nbt); nbt.setBoolean("isDisabled", this.getDisabled(0)); + return nbt; } @Override @@ -194,7 +195,7 @@ public boolean wrenchCanRemove(World world, BlockPos pos, EntityPlayer player) public List getWrenchDrops(World world, BlockPos pos, IBlockState state, TileEntity te, EntityPlayer player, int fortune) { List drops = Lists.newArrayList(); - drops.add(this.getBlockType().getPickBlock(null, this.worldObj, this.getPos(), player)); + drops.add(this.getBlockType().getPickBlock(this.worldObj.getBlockState(this.getPos()), null, this.worldObj, this.getPos(), player)); return drops; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseUniversalElectrical.java b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseUniversalElectrical.java index 50a9d97434..3d2b6d80a5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseUniversalElectrical.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseUniversalElectrical.java @@ -166,6 +166,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); // nbt.setFloat("energyStored", this.energyStored); + return nbt; } public void discharge(ItemStack itemStack) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAdvancedMotion.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAdvancedMotion.java index e2f7b2df67..2eb1be85a9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAdvancedMotion.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAdvancedMotion.java @@ -8,7 +8,7 @@ import micdoodle8.mods.galacticraft.core.network.PacketEntityUpdate; import micdoodle8.mods.galacticraft.core.network.PacketEntityUpdate.IEntityFullSync; import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.Particle; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -88,13 +88,13 @@ public boolean canBeCollidedWith() } @Override - public void updateRiderPosition() + public void updatePassenger(Entity passenger) { - if (this.riddenByEntity != null) + if (this.isPassenger(passenger)) { - final double var1 = Math.cos(this.rotationYaw * Math.PI / 180.0D + 114.8) * -0.5D; - final double var3 = Math.sin(this.rotationYaw * Math.PI / 180.0D + 114.8) * -0.5D; - this.riddenByEntity.setPosition(this.posX + var1, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ + var3); + final double offsetx = Math.cos(this.rotationYaw * Math.PI / 180.0D + 114.8) * -0.5D; + final double offsetz = Math.sin(this.rotationYaw * Math.PI / 180.0D + 114.8) * -0.5D; + passenger.setPosition(this.posX + offsetx, this.posY + this.getMountedYOffset() + passenger.getYOffset(), this.posZ + offsetz); } } @@ -168,9 +168,9 @@ public boolean attackEntityFrom(DamageSource var1, float var2) if (this.currentDamage > 70) { - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { - this.riddenByEntity.mountEntity(this); + this.removePassengers(); return false; } @@ -202,7 +202,7 @@ public boolean attackEntityFrom(DamageSource var1, float var2) public abstract Map getParticleMap(); @SideOnly(Side.CLIENT) - public abstract EntityFX getParticle(Random rand, double x, double y, double z, double motX, double motY, double motZ); + public abstract Particle getParticle(Random rand, double x, double y, double z, double motX, double motY, double motZ); public abstract void tickInAir(); @@ -246,18 +246,18 @@ public void dropItems() } @Override - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean b) + public void setPositionAndRotationDirect(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean b) { - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { - if (this.riddenByEntity instanceof EntityPlayer && FMLClientHandler.instance().getClient().thePlayer.equals(this.riddenByEntity)) + if (this.getPassengers().contains(FMLClientHandler.instance().getClient().thePlayer)) { } else { this.posRotIncrements = posRotationIncrements + 5; this.advancedPositionX = x; - this.advancedPositionY = y + (this.riddenByEntity == null ? 1 : 0); + this.advancedPositionY = y; this.advancedPositionZ = z; this.advancedYaw = yaw; this.advancedPitch = pitch; @@ -290,7 +290,7 @@ public void onUpdate() super.onUpdate(); - if (this.canSetPositionClient() && this.worldObj.isRemote && (this.riddenByEntity == null || !(this.riddenByEntity instanceof EntityPlayer) || !FMLClientHandler.instance().getClient().thePlayer.equals(this.riddenByEntity))) + if (this.canSetPositionClient() && this.worldObj.isRemote && (this.getPassengers().isEmpty() || !this.getPassengers().contains(FMLClientHandler.instance().getClient().thePlayer))) { double x; double y; @@ -301,7 +301,7 @@ public void onUpdate() x = this.posX + (this.advancedPositionX - this.posX) / this.posRotIncrements; y = this.posY + (this.advancedPositionY - this.posY) / this.posRotIncrements; z = this.posZ + (this.advancedPositionZ - this.posZ) / this.posRotIncrements; - var12 = MathHelper.wrapAngleTo180_double(this.advancedYaw - this.rotationYaw); + var12 = MathHelper.wrapDegrees(this.advancedYaw - this.rotationYaw); this.rotationYaw = (float) (this.rotationYaw + var12 / this.posRotIncrements); this.rotationPitch = (float) (this.rotationPitch + (this.advancedPitch - this.rotationPitch) / this.posRotIncrements); --this.posRotIncrements; @@ -409,7 +409,7 @@ public void spawnParticles(Map points) } @SideOnly(Side.CLIENT) - public void spawnParticle(EntityFX fx) + public void spawnParticle(Particle fx) { final Minecraft mc = FMLClientHandler.instance().getClient(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAlienVillager.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAlienVillager.java index ddcf635baf..42cff4f3c5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAlienVillager.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAlienVillager.java @@ -2,13 +2,11 @@ import micdoodle8.mods.galacticraft.api.entity.IEntityBreathable; import micdoodle8.mods.galacticraft.core.GCItems; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.core.wrappers.PlayerGearData; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentData; -import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.*; import net.minecraft.entity.ai.*; import net.minecraft.entity.effect.EntityLightningBolt; @@ -20,16 +18,19 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Items; +import net.minecraft.init.MobEffects; +import net.minecraft.init.SoundEvents; import net.minecraft.inventory.InventoryBasic; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.pathfinding.PathNavigateGround; -import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.stats.StatList; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentString; import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipeList; import net.minecraft.village.Village; @@ -38,6 +39,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import javax.annotation.Nullable; import java.util.Random; public class EntityAlienVillager extends EntityAgeable implements IMerchant, INpc, IEntityBreathable @@ -68,7 +70,6 @@ public EntityAlienVillager(World worldIn) this.villagerInventory = new InventoryBasic("Items", false, 8); this.setSize(0.6F, 1.8F); ((PathNavigateGround) this.getNavigator()).setBreakDoors(true); - ((PathNavigateGround) this.getNavigator()).setAvoidsWater(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(1, new EntityAIAvoidEntity<>(this, EntityZombie.class, 8.0F, 0.6D, 0.6D)); this.tasks.addTask(1, new EntityAITradePlayerGC(this)); @@ -93,7 +94,7 @@ protected void onGrowingAdult() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D); + this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.5D); } @Override @@ -145,11 +146,11 @@ protected void updateAITasks() if (this.villageObj != null && this.lastBuyingPlayer != null) { this.worldObj.setEntityState(this, (byte) 14); - this.villageObj.setReputationForPlayer(this.lastBuyingPlayer, 1); + this.villageObj.modifyPlayerReputation(this.lastBuyingPlayer, 1); } } - this.addPotionEffect(new PotionEffect(Potion.regeneration.id, 200, 0)); + this.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 200, 0)); } } @@ -157,10 +158,10 @@ protected void updateAITasks() } @Override - public boolean interact(EntityPlayer player) + public boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack) { ItemStack itemstack = player.inventory.getCurrentItem(); - boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg; + boolean flag = itemstack != null && itemstack.getItem() == Items.SPAWN_EGG; if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking()) { @@ -178,22 +179,22 @@ public boolean interact(EntityPlayer player) if (player instanceof EntityPlayerMP) { EntityPlayerMP playerMP = (EntityPlayerMP) player; - GCPlayerStats stats = GCPlayerStats.get(playerMP); - if (stats.chatCooldown == 0) + IStatsCapability stats = playerMP.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + if (stats.getChatCooldown() == 0) { player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.village.warning.no_freq_mod"))); - stats.chatCooldown = 20; + stats.setChatCooldown(20); } } } } - player.triggerAchievement(StatList.timesTalkedToVillagerStat); + player.addStat(StatList.TALKED_TO_VILLAGER); return true; } else { - return super.interact(player); + return super.processInteract(player, hand, stack); } } @@ -243,7 +244,7 @@ public void readEntityFromNBT(NBTTagCompound tagCompund) if (itemstack != null) { - this.villagerInventory.func_174894_a(itemstack); + this.villagerInventory.addItem(itemstack); } } @@ -262,22 +263,19 @@ protected float getSoundPitch() return (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 0.5F; } - @Override - protected String getLivingSound() + protected SoundEvent getAmbientSound() { - return this.isTrading() ? "mob.villager.haggle" : "mob.villager.idle"; + return this.isTrading() ? SoundEvents.ENTITY_VILLAGER_TRADING : SoundEvents.ENTITY_VILLAGER_AMBIENT; } - @Override - protected String getHurtSound() + protected SoundEvent getHurtSound() { - return "mob.villager.hit"; + return SoundEvents.ENTITY_VILLAGER_HURT; } - @Override - protected String getDeathSound() + protected SoundEvent getDeathSound() { - return "mob.villager.death"; + return SoundEvents.ENTITY_VILLAGER_DEATH; } public boolean isMating() @@ -318,7 +316,7 @@ public void setRevengeTarget(EntityLivingBase livingBase) i = -3; } - this.villageObj.setReputationForPlayer(livingBase.getName(), i); + this.villageObj.modifyPlayerReputation(livingBase.getName(), i); if (this.isEntityAlive()) { @@ -339,7 +337,7 @@ public void onDeath(DamageSource cause) { if (entity instanceof EntityPlayer) { - this.villageObj.setReputationForPlayer(entity.getName(), -2); + this.villageObj.modifyPlayerReputation(entity.getName(), -2); } else if (entity instanceof IMob) { @@ -382,7 +380,7 @@ public void useRecipe(MerchantRecipe recipe) { recipe.incrementToolUses(); this.livingSoundTime = -this.getTalkInterval(); - this.playSound("mob.villager.yes", this.getSoundVolume(), this.getSoundPitch()); + this.playSound(SoundEvents.ENTITY_VILLAGER_YES, this.getSoundVolume(), this.getSoundPitch()); int i = 3 + this.rand.nextInt(4); if (recipe.getToolUses() == 1 || this.rand.nextInt(5) == 0) @@ -402,7 +400,7 @@ public void useRecipe(MerchantRecipe recipe) i += 5; } - if (recipe.getItemToBuy().getItem() == Items.emerald) + if (recipe.getItemToBuy().getItem() == Items.EMERALD) { this.wealth += recipe.getItemToBuy().stackSize; } @@ -422,11 +420,11 @@ public void verifySellingItem(ItemStack stack) if (stack != null) { - this.playSound("mob.villager.yes", this.getSoundVolume(), this.getSoundPitch()); + this.playSound(SoundEvents.ENTITY_VILLAGER_YES, this.getSoundVolume(), this.getSoundPitch()); } else { - this.playSound("mob.villager.no", this.getSoundVolume(), this.getSoundPitch()); + this.playSound(SoundEvents.ENTITY_VILLAGER_NO, this.getSoundVolume(), this.getSoundPitch()); } } } @@ -524,7 +522,7 @@ public EntityAlienVillager createChild(EntityAgeable ageable) } @Override - public boolean allowLeashing() + public boolean canBeLeashedTo(EntityPlayer player) { return false; } @@ -563,7 +561,7 @@ protected void updateEquipmentIfNeeded(EntityItem itemEntity) if (this.canVillagerPickupItem(item)) { - ItemStack itemstack1 = this.villagerInventory.func_174894_a(itemstack); + ItemStack itemstack1 = this.villagerInventory.addItem(itemstack); if (itemstack1 == null) { @@ -578,7 +576,7 @@ protected void updateEquipmentIfNeeded(EntityItem itemEntity) private boolean canVillagerPickupItem(Item itemIn) { - return itemIn == Items.bread || itemIn == Items.potato || itemIn == Items.carrot || itemIn == Items.wheat || itemIn == Items.wheat_seeds; + return itemIn == Items.BREAD || itemIn == Items.POTATO || itemIn == Items.CARROT || itemIn == Items.WHEAT || itemIn == Items.WHEAT_SEEDS; } public boolean func_175553_cp() @@ -604,12 +602,12 @@ private boolean hasEnoughItems(int multiplier) if (itemstack != null) { - if (itemstack.getItem() == Items.bread && itemstack.stackSize >= 3 * multiplier || itemstack.getItem() == Items.potato && itemstack.stackSize >= 12 * multiplier || itemstack.getItem() == Items.carrot && itemstack.stackSize >= 12 * multiplier) + if (itemstack.getItem() == Items.BREAD && itemstack.stackSize >= 3 * multiplier || itemstack.getItem() == Items.POTATO && itemstack.stackSize >= 12 * multiplier || itemstack.getItem() == Items.CARROT && itemstack.stackSize >= 12 * multiplier) { return true; } - if (itemstack.getItem() == Items.wheat && itemstack.stackSize >= 9 * multiplier) + if (itemstack.getItem() == Items.WHEAT && itemstack.stackSize >= 9 * multiplier) { return true; } @@ -714,68 +712,15 @@ public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random rando } } - public static class ListEnchantedBookForEmeralds implements EntityAlienVillager.ITradeList - { - @Override - public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) - { - Enchantment enchantment = Enchantment.enchantmentsBookList[random.nextInt(Enchantment.enchantmentsBookList.length)]; - int i = MathHelper.getRandomIntegerInRange(random, enchantment.getMinLevel(), enchantment.getMaxLevel()); - ItemStack itemstack = Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(enchantment, i)); - int j = 2 + random.nextInt(5 + i * 10) + 3 * i; - - if (j > 64) - { - j = 64; - } - - recipeList.add(new MerchantRecipe(new ItemStack(Items.book), new ItemStack(GCItems.itemBasicMoon, j, 2), itemstack)); - } - } - - public static class ListEnchantedItemForEmeralds implements EntityAlienVillager.ITradeList - { - public ItemStack field_179407_a; - public EntityAlienVillager.PriceInfo field_179406_b; - - public ListEnchantedItemForEmeralds(Item p_i45814_1_, EntityAlienVillager.PriceInfo p_i45814_2_) - { - this.field_179407_a = new ItemStack(p_i45814_1_); - this.field_179406_b = p_i45814_2_; - } - - @Override - public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random) - { - int i = 1; - - if (this.field_179406_b != null) - { - i = this.field_179406_b.getPrice(random); - } - - ItemStack itemstack = new ItemStack(GCItems.itemBasicMoon, i, 2); - ItemStack itemstack1 = new ItemStack(this.field_179407_a.getItem(), 1, this.field_179407_a.getMetadata()); - itemstack1 = EnchantmentHelper.addRandomEnchantment(random, itemstack1, 5 + random.nextInt(15)); - recipeList.add(new MerchantRecipe(itemstack, itemstack1)); - } - } - public static class ListItemForEmeralds implements EntityAlienVillager.ITradeList { - public ItemStack field_179403_a; - public EntityAlienVillager.PriceInfo field_179402_b; - - public ListItemForEmeralds(Item par1Item, EntityAlienVillager.PriceInfo priceInfo) - { - this.field_179403_a = new ItemStack(par1Item); - this.field_179402_b = priceInfo; - } + public ItemStack itemToBuy; + public EntityAlienVillager.PriceInfo priceInfo; public ListItemForEmeralds(ItemStack stack, EntityAlienVillager.PriceInfo priceInfo) { - this.field_179403_a = stack; - this.field_179402_b = priceInfo; + this.itemToBuy = stack; + this.priceInfo = priceInfo; } @Override @@ -783,9 +728,9 @@ public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random rando { int i = 1; - if (this.field_179402_b != null) + if (this.priceInfo != null) { - i = this.field_179402_b.getPrice(random); + i = this.priceInfo.getPrice(random); } ItemStack itemstack; @@ -794,12 +739,12 @@ public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random rando if (i < 0) { itemstack = new ItemStack(GCItems.itemBasicMoon, 1, 2); - itemstack1 = new ItemStack(this.field_179403_a.getItem(), -i, this.field_179403_a.getMetadata()); + itemstack1 = new ItemStack(this.itemToBuy.getItem(), -i, this.itemToBuy.getMetadata()); } else { itemstack = new ItemStack(GCItems.itemBasicMoon, i, 2); - itemstack1 = new ItemStack(this.field_179403_a.getItem(), 1, this.field_179403_a.getMetadata()); + itemstack1 = new ItemStack(this.itemToBuy.getItem(), 1, this.itemToBuy.getMetadata()); } recipeList.add(new MerchantRecipe(itemstack, itemstack1)); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java index 5900d67ee8..aca9e9e19b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java @@ -6,26 +6,26 @@ import micdoodle8.mods.galacticraft.core.tile.TileEntityDungeonSpawner; import micdoodle8.mods.galacticraft.core.tile.TileEntityTreasureChest; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; -import net.minecraft.entity.boss.IBossDisplayData; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.TextComponentString; import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.world.BossInfo; +import net.minecraft.world.BossInfoServer; import net.minecraft.world.World; -import net.minecraftforge.common.ChestGenHooks; import net.minecraftforge.fml.common.network.NetworkRegistry; import java.util.List; import java.util.Random; -public abstract class EntityBossBase extends EntityMob implements IBossDisplayData, IBoss +public abstract class EntityBossBase extends EntityMob implements IBoss { private TileEntityDungeonSpawner spawner; public int deathTicks = 0; @@ -36,6 +36,8 @@ public abstract class EntityBossBase extends EntityMob implements IBossDisplayDa public int entitiesWithin; public int entitiesWithinLast; + private final BossInfoServer bossInfo = (BossInfoServer)(new BossInfoServer(this.getDisplayName(), getHealthBarColor(), BossInfo.Overlay.PROGRESS)); + public EntityBossBase(World world) { super(world); @@ -47,6 +49,15 @@ public EntityBossBase(World world) public abstract void dropKey(); + public abstract BossInfo.Color getHealthBarColor(); + + @Override + protected void updateAITasks() + { + this.bossInfo.setPercent(this.getHealth() / this.getMaxHealth()); + super.updateAITasks(); + } + @Override protected void onDeathUpdate() { @@ -127,11 +138,13 @@ protected void onDeathUpdate() chest.setInventorySlotContents(k, null); } - ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); + chest.fillWithLoot(null); - // Generate twice, since it's an extra special chest - WeightedRandomChestContent.generateChestContents(this.rand, info.getItems(this.rand), chest, info.getCount(this.rand)); - WeightedRandomChestContent.generateChestContents(this.rand, info.getItems(this.rand), chest, info.getCount(this.rand)); +// ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); +// +// // Generate twice, since it's an extra special chest +// WeightedRandomChestContent.generateChestContents(this.rand, info.getItems(this.rand), chest, info.getCount(this.rand)); +// WeightedRandomChestContent.generateChestContents(this.rand, info.getItems(this.rand), chest, info.getCount(this.rand)); ItemStack schematic = this.getGuaranteedLoot(this.rand); int slot = this.rand.nextInt(chest.getSizeInventory()); @@ -253,4 +266,18 @@ public void onBossSpawned(TileEntityDungeonSpawner spawner) { this.spawner = spawner; } + + @Override + public void addTrackingPlayer(EntityPlayerMP player) + { + super.addTrackingPlayer(player); + this.bossInfo.addPlayer(player); + } + + @Override + public void removeTrackingPlayer(EntityPlayerMP player) + { + super.removeTrackingPlayer(player); + this.bossInfo.removePlayer(player); + } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBuggy.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBuggy.java index 7bc6962ad6..10da780d32 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBuggy.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBuggy.java @@ -18,14 +18,20 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.SoundEvents; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.TextComponentString; +import net.minecraft.network.datasync.DataParameter; +import net.minecraft.network.datasync.DataSerializers; +import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTank; @@ -39,6 +45,9 @@ public class EntityBuggy extends Entity implements IInventory, IPacketReceiver, IDockable, IControllableEntity, IEntityFullSync { + private static final DataParameter CURRENT_DAMAGE = EntityDataManager.createKey(EntityBuggy.class, DataSerializers.VARINT); + private static final DataParameter TIME_SINCE_HIT = EntityDataManager.createKey(EntityBuggy.class, DataSerializers.VARINT); + private static final DataParameter ROCK_DIRECTION = EntityDataManager.createKey(EntityBuggy.class, DataSerializers.VARINT); public static final int tankCapacity = 1000; public FluidTank buggyFuelTank = new FluidTank(this.tankCapacity); protected long ticks = 0; @@ -68,14 +77,11 @@ public EntityBuggy(World var1) { super(var1); this.setSize(0.98F, 1F); - this.currentDamage = 18; - this.timeSinceHit = 19; - this.rockDirection = 20; this.speed = 0.0D; this.preventEntitySpawning = true; - this.dataWatcher.addObject(this.currentDamage, new Integer(0)); - this.dataWatcher.addObject(this.timeSinceHit, new Integer(0)); - this.dataWatcher.addObject(this.rockDirection, new Integer(1)); + this.dataManager.register(CURRENT_DAMAGE, 0); + this.dataManager.register(TIME_SINCE_HIT, 0); + this.dataManager.register(ROCK_DIRECTION, 1); this.ignoreFrustumCheck = true; this.isImmuneToFire = true; } @@ -101,7 +107,7 @@ public ModelBase getModel() } @Override - public ItemStack getPickedResult(MovingObjectPosition target) + public ItemStack getPickedResult(RayTraceResult target) { return new ItemStack(GCItems.buggy, 1, this.buggyType); } @@ -146,13 +152,13 @@ public void setBuggyType(int par1) } @Override - public void updateRiderPosition() + public void updatePassenger(Entity passenger) { - if (this.riddenByEntity != null) + if (this.isPassenger(passenger)) { - final double var1 = Math.cos(this.rotationYaw * Math.PI / 180.0D + 114.8) * -0.5D; - final double var3 = Math.sin(this.rotationYaw * Math.PI / 180.0D + 114.8) * -0.5D; - this.riddenByEntity.setPosition(this.posX + var1, this.posY + 0.4F + this.riddenByEntity.getYOffset(), this.posZ + var3); + final double offsetX = Math.cos(this.rotationYaw * Math.PI / 180.0D + 114.8) * -0.5D; + final double offsetZ = Math.sin(this.rotationYaw * Math.PI / 180.0D + 114.8) * -0.5D; + passenger.setPosition(this.posX + offsetX, this.posY + 0.4F + passenger.getYOffset(), this.posZ + offsetZ); } } @@ -184,9 +190,9 @@ public void setPositionRotationAndMotion(double x, double y, double z, float yaw @Override public void performHurtAnimation() { - this.dataWatcher.updateObject(this.rockDirection, Integer.valueOf(-this.dataWatcher.getWatchableObjectInt(this.rockDirection))); - this.dataWatcher.updateObject(this.timeSinceHit, Integer.valueOf(10)); - this.dataWatcher.updateObject(this.currentDamage, Integer.valueOf(this.dataWatcher.getWatchableObjectInt(this.currentDamage) * 5)); + this.dataManager.set(ROCK_DIRECTION, -this.dataManager.get(ROCK_DIRECTION)); + this.dataManager.set(TIME_SINCE_HIT, 10); + this.dataManager.set(CURRENT_DAMAGE, this.dataManager.get(CURRENT_DAMAGE) * 5); } @Override @@ -207,30 +213,23 @@ public boolean attackEntityFrom(DamageSource var1, float var2) } else { - this.dataWatcher.updateObject(this.rockDirection, Integer.valueOf(-this.dataWatcher.getWatchableObjectInt(this.rockDirection))); - this.dataWatcher.updateObject(this.timeSinceHit, Integer.valueOf(10)); - this.dataWatcher.updateObject(this.currentDamage, Integer.valueOf((int) (this.dataWatcher.getWatchableObjectInt(this.currentDamage) + var2 * 10))); + this.dataManager.set(ROCK_DIRECTION, -this.dataManager.get(ROCK_DIRECTION)); + this.dataManager.set(TIME_SINCE_HIT, 10); + this.dataManager.set(CURRENT_DAMAGE, (int) (this.dataManager.get(CURRENT_DAMAGE) + var2 * 10)); this.setBeenAttacked(); if (e instanceof EntityPlayer && ((EntityPlayer) e).capabilities.isCreativeMode) { - this.dataWatcher.updateObject(this.currentDamage, 100); + this.dataManager.set(CURRENT_DAMAGE, 100); } - if (flag || this.dataWatcher.getWatchableObjectInt(this.currentDamage) > 2) + if (flag || this.dataManager.get(CURRENT_DAMAGE) > 2) { - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { - this.riddenByEntity.mountEntity(this); + this.removePassengers(); } - if (!this.worldObj.isRemote) - { - if (this.riddenByEntity != null) - { - this.riddenByEntity.mountEntity(this); - } - } if (flag) { this.setDead(); @@ -292,18 +291,18 @@ public List getItemsDropped() } @Override - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean b) + public void setPositionAndRotationDirect(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean b) { - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { - if (this.riddenByEntity instanceof EntityPlayer && FMLClientHandler.instance().getClient().thePlayer.equals(this.riddenByEntity)) + if (this.getPassengers().contains(FMLClientHandler.instance().getClient().thePlayer)) { } else { this.boatPosRotationIncrements = posRotationIncrements + 5; this.boatX = x; - this.boatY = y + (this.riddenByEntity == null ? 1 : 0); + this.boatY = y; this.boatZ = z; this.boatYaw = yaw; this.boatPitch = pitch; @@ -341,7 +340,7 @@ public void onUpdate() x = this.posX + (this.boatX - this.posX) / this.boatPosRotationIncrements; y = this.posY + (this.boatY - this.posY) / this.boatPosRotationIncrements; z = this.posZ + (this.boatZ - this.posZ) / this.boatPosRotationIncrements; - var12 = MathHelper.wrapAngleTo180_double(this.boatYaw - this.rotationYaw); + var12 = MathHelper.wrapDegrees(this.boatYaw - this.rotationYaw); this.rotationYaw = (float) (this.rotationYaw + var12 / this.boatPosRotationIncrements); this.rotationPitch = (float) (this.rotationPitch + (this.boatPitch - this.rotationPitch) / this.boatPosRotationIncrements); --this.boatPosRotationIncrements; @@ -353,7 +352,7 @@ public void onUpdate() x = this.posX + this.motionX; y = this.posY + this.motionY; z = this.posZ + this.motionZ; - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { this.setPosition(x, y, z); } @@ -372,14 +371,14 @@ public void onUpdate() return; } - if (this.dataWatcher.getWatchableObjectInt(this.timeSinceHit) > 0) + if (this.dataManager.get(TIME_SINCE_HIT) > 0) { - this.dataWatcher.updateObject(this.timeSinceHit, Integer.valueOf(this.dataWatcher.getWatchableObjectInt(this.timeSinceHit) - 1)); + this.dataManager.set(TIME_SINCE_HIT, this.dataManager.get(TIME_SINCE_HIT) - 1); } - if (this.dataWatcher.getWatchableObjectInt(this.currentDamage) > 0) + if (this.dataManager.get(CURRENT_DAMAGE) > 0) { - this.dataWatcher.updateObject(this.currentDamage, Integer.valueOf(this.dataWatcher.getWatchableObjectInt(this.currentDamage) - 1)); + this.dataManager.set(CURRENT_DAMAGE, this.dataManager.get(CURRENT_DAMAGE) - 1); } if (!this.onGround) @@ -389,7 +388,7 @@ public void onUpdate() if (this.inWater && this.speed > 0.2D) { - this.worldObj.playSoundEffect((float) this.posX, (float) this.posY, (float) this.posZ, "random.fizz", 0.5F, 2.6F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.8F); + this.worldObj.playSound(null, (float) this.posX, (float) this.posY, (float) this.posZ, SoundEvents.ENTITY_GENERIC_BURN, SoundCategory.NEUTRAL, 0.5F, 2.6F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.8F); } this.speed *= 0.98D; @@ -626,30 +625,30 @@ public void closeInventory(EntityPlayer player) } @Override - public boolean interactFirst(EntityPlayer var1) + public boolean processInitialInteract(EntityPlayer player, ItemStack stack, EnumHand hand) { if (this.worldObj.isRemote) { - if (this.riddenByEntity == null) + if (this.getPassengers().isEmpty()) { - var1.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.leftKey.getKeyCode()) + " / " + GameSettings.getKeyDisplayString(KeyHandlerClient.rightKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.turn.name"))); - var1.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.accelerateKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.accel.name"))); - var1.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.decelerateKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.decel.name"))); - var1.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.openFuelGui.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.inv.name"))); + player.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.leftKey.getKeyCode()) + " / " + GameSettings.getKeyDisplayString(KeyHandlerClient.rightKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.turn.name"))); + player.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.accelerateKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.accel.name"))); + player.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.decelerateKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.decel.name"))); + player.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.openFuelGui.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.inv.name"))); } return true; } else { - if (this.riddenByEntity != null) + if (this.getPassengers().contains(player)) { - var1.mountEntity(null); + this.removePassenger(player); return true; } else { - var1.mountEntity(this); + player.startRiding(this); return true; } } @@ -840,12 +839,12 @@ public boolean hasCustomName() @Override public UUID getOwnerUUID() { - if (this.riddenByEntity != null && !(this.riddenByEntity instanceof EntityPlayer)) + if (!this.getPassengers().isEmpty() && !(this.getPassengers().get(0) instanceof EntityPlayer)) { return null; } - return this.riddenByEntity != null ? ((EntityPlayer) this.riddenByEntity).getPersistentID() : null; + return !this.getPassengers().isEmpty() ? this.getPassengers().get(0).getPersistentID() : null; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityCelestialFake.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityCelestialFake.java index 9f06c48764..53d316087a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityCelestialFake.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityCelestialFake.java @@ -4,15 +4,15 @@ import micdoodle8.mods.galacticraft.api.entity.IIgnoreShift; import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.core.network.IPacketReceiver; -import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.Particle; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.DamageSource; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; @@ -33,15 +33,6 @@ public EntityCelestialFake(World var1) this.setSize(3.0F, 1.0F); } - @Override - public void updateRiderPosition() - { - if (this.riddenByEntity != null) - { - this.riddenByEntity.setPosition(this.posX, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ); - } - } - @Override public boolean shouldSendAdvancedMotionPacket() { @@ -66,8 +57,7 @@ public EntityCelestialFake(EntityPlayerMP player) this.setPositionAndRotation(player.posX, player.posY, player.posZ, 0, 0); - this.riddenByEntity = player; - player.getRidingEntity() = this; + player.startRiding(this, true); } @Override @@ -77,13 +67,13 @@ public void onUpdate() if (this.ticks < 40 && this.posY > 150) { - if (this.riddenByEntity == null) + if (this.getPassengers().isEmpty()) { final EntityPlayer player = this.worldObj.getClosestPlayerToEntity(this, 5); if (player != null && player.getRidingEntity() == null) { - player.mountEntity(this); + player.startRiding(this, true); } } } @@ -96,7 +86,7 @@ public void onUpdate() { for (Entity entity : var15) { - if (entity != this.riddenByEntity) + if (!this.getPassengers().contains(entity)) { this.pushEntityAway(entity); } @@ -106,7 +96,7 @@ public void onUpdate() private void pushEntityAway(Entity entityToPush) { - if (this.riddenByEntity != entityToPush && this.getRidingEntity() != entityToPush) + if (!this.getPassengers().contains(entityToPush) && this.getRidingEntity() != entityToPush) { double d0 = this.posX - entityToPush.posX; double d1 = this.posZ - entityToPush.posZ; @@ -190,7 +180,7 @@ public ArrayList getNetworkedData() this.shouldMoveServer = this.shouldMove(); objList.add(this.shouldMoveServer); //Server send rider information for client to check - objList.add(this.riddenByEntity == null ? -1 : this.riddenByEntity.getEntityId()); + objList.add(this.getPassengers().isEmpty() ? -1 : this.getPassengers().get(0).getEntityId()); } return objList; @@ -226,29 +216,29 @@ public void readNetworkedData(ByteBuf buffer) //Check has correct rider on client int shouldBeMountedId = buffer.readInt(); - if (this.riddenByEntity == null) + if (this.getPassengers().isEmpty()) { if (shouldBeMountedId > -1) { Entity e = FMLClientHandler.instance().getWorldClient().getEntityByID(shouldBeMountedId); if (e != null) { - e.mountEntity(this); + e.startRiding(this, true); } } } - else if (this.riddenByEntity.getEntityId() != shouldBeMountedId) + else if (this.getPassengers().get(0).getEntityId() != shouldBeMountedId) { if (shouldBeMountedId == -1) { - this.riddenByEntity.mountEntity(null); + this.removePassengers(); } else { Entity e = FMLClientHandler.instance().getWorldClient().getEntityByID(shouldBeMountedId); if (e != null) { - e.mountEntity(this); + e.startRiding(this, true); } } } @@ -291,21 +281,18 @@ public double getPacketRange() @Override public UUID getOwnerUUID() { - if (this.riddenByEntity != null && !(this.riddenByEntity instanceof EntityPlayer)) + if (!this.getPassengers().isEmpty() && !(this.getPassengers().get(0) instanceof EntityPlayer)) { return null; } UUID id; - if (riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { - id = ((EntityPlayer) this.riddenByEntity).getPersistentID(); + id = this.getPassengers().get(0).getPersistentID(); - if (id != null) - { - this.persistantRiderUUID = id; - } + this.persistantRiderUUID = id; } else { @@ -352,7 +339,7 @@ public Map getParticleMap() } @Override - public EntityFX getParticle(Random rand, double x, double y, double z, + public Particle getParticle(Random rand, double x, double y, double z, double motX, double motY, double motZ) { return null; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedCreeper.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedCreeper.java index cda9c2cc70..bca41fe35f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedCreeper.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedCreeper.java @@ -13,10 +13,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.item.Item; +import net.minecraft.init.MobEffects; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.potion.Potion; +import net.minecraft.network.datasync.DataParameter; +import net.minecraft.network.datasync.DataSerializers; +import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; @@ -27,6 +29,7 @@ public class EntityEvolvedCreeper extends EntityCreeper implements IEntityBreath { private float sizeXBase = -1.0F; private float sizeYBase; + private static final DataParameter IS_CHILD = EntityDataManager.createKey(EntityEvolvedCreeper.class, DataSerializers.BOOLEAN); private static final UUID babySpeedBoostUUID = UUID.fromString("ef67a435-32a4-4efd-b218-e7431438b109"); private static final AttributeModifier babySpeedBoostModifier = new AttributeModifier(babySpeedBoostUUID, "Baby speed boost evolved creeper", 0.5D, 1); @@ -37,7 +40,7 @@ public EntityEvolvedCreeper(World par1World) this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAICreeperSwell(this)); this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityOcelot.class, 6.0F, 1.0D, 1.2D)); - this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, false)); + this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, false)); this.tasks.addTask(5, new EntityAIWander(this, 0.8D)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(6, new EntityAILookIdle(this)); @@ -46,19 +49,11 @@ public EntityEvolvedCreeper(World par1World) this.setSize(0.7F, 2.2F); } - @Override - protected void entityInit() - { - super.entityInit(); - this.getDataWatcher().addObject(12, Byte.valueOf((byte) 0)); - } - @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(25.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); + this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(25.0D); } @Override @@ -116,7 +111,7 @@ protected final void setCreeperScale(float scale) @Override public boolean isChild() { - return this.getDataWatcher().getWatchableObjectByte(12) == 1; + return this.dataManager.get(IS_CHILD); } @Override @@ -132,11 +127,11 @@ protected int getExperiencePoints(EntityPlayer p_70693_1_) public void setChild(boolean isChild) { - this.getDataWatcher().updateObject(12, Byte.valueOf((byte) (isChild ? 1 : 0))); + this.dataManager.set(IS_CHILD, isChild); if (this.worldObj != null && !this.worldObj.isRemote) { - IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); iattributeinstance.removeModifier(babySpeedBoostModifier); if (isChild) @@ -157,9 +152,9 @@ protected void jump() this.motionY = 0.22D; } - if (this.isPotionActive(Potion.jump)) + if (this.isPotionActive(MobEffects.JUMP_BOOST)) { - this.motionY += (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F; + this.motionY += (this.getActivePotionEffect(MobEffects.JUMP_BOOST).getAmplifier() + 1) * 0.1F; } if (this.isSprinting()) @@ -173,17 +168,6 @@ protected void jump() ForgeHooks.onLivingJump(this); } - @Override - protected Item getDropItem() - { - if (this.isBurning()) - { - return Items.blaze_rod; - } - return Items.redstone; - } - - @Override protected void addRandomDrop() { switch (this.rand.nextInt(12)) @@ -192,7 +176,7 @@ protected void addRandomDrop() case 1: case 2: case 3: - this.entityDropItem(new ItemStack(Blocks.sand), 0.0F); + this.entityDropItem(new ItemStack(Blocks.SAND), 0.0F); break; case 4: case 5: @@ -204,11 +188,22 @@ protected void addRandomDrop() break; case 7: case 8: - this.entityDropItem(new ItemStack(Blocks.ice), 0.0F); + this.entityDropItem(new ItemStack(Blocks.ICE), 0.0F); break; default: - if (ConfigManagerCore.challengeMode || ConfigManagerCore.challengeMobDropsAndSpawning) this.dropItem(Items.reeds, 1); + if (ConfigManagerCore.challengeMode || ConfigManagerCore.challengeMobDropsAndSpawning) this.dropItem(Items.REEDS, 1); break; } } + + @Override + protected void dropFewItems(boolean wasRecentlyHit, int lootingModifier) + { + super.dropFewItems(wasRecentlyHit, lootingModifier); + + if (this.recentlyHit > 0 && this.rand.nextFloat() < 0.025F + (float)lootingModifier * 0.01F) + { + this.addRandomDrop(); + } + } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSkeleton.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSkeleton.java index 76815f7e03..b34fa2bfc5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSkeleton.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSkeleton.java @@ -5,21 +5,23 @@ import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.core.util.WorldUtil; -import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.*; -import net.minecraft.entity.monster.EntityIronGolem; import net.minecraft.entity.monster.EntitySkeleton; -import net.minecraft.entity.passive.EntityWolf; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.monster.SkeletonType; +import net.minecraft.entity.projectile.EntityTippedArrow; +import net.minecraft.init.Enchantments; import net.minecraft.init.Items; +import net.minecraft.init.MobEffects; +import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; +import net.minecraft.world.DifficultyInstance; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; @@ -28,31 +30,14 @@ public class EntityEvolvedSkeleton extends EntitySkeleton implements IEntityBrea public EntityEvolvedSkeleton(World worldIn) { super(worldIn); - this.tasks.taskEntries.clear(); - this.targetTasks.taskEntries.clear(); - this.tasks.addTask(1, new EntityAISwimming(this)); - this.tasks.addTask(2, new EntityAIRestrictSun(this)); - this.tasks.addTask(3, new EntityAIFleeSun(this, 1.0D)); - this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityWolf.class, 6.0F, 1.0D, 1.2D)); - this.tasks.addTask(4, new EntityAIWander(this, 1.0D)); - this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); - this.tasks.addTask(6, new EntityAILookIdle(this)); - this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0])); - this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); - this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityIronGolem.class, true)); - - if (worldIn != null && !worldIn.isRemote) - { - this.setCombatTask(); - } } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(25); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.35F); + this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(25); + this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.35F); } @Override @@ -62,30 +47,50 @@ public boolean canBreath() } @Override - public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) + public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) { - EntityArrow entityarrow = new EntityArrow(this.worldObj, this, par1EntityLivingBase, 0.4F, 17 - this.worldObj.getDifficulty().getDifficultyId() * 4); - int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem()); - int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem()); - entityarrow.setDamage(par2 * 2.0F + this.rand.nextGaussian() * 0.25D + this.worldObj.getDifficulty().getDifficultyId() * 0.11F); + EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.worldObj, this); + double d0 = target.posX - this.posX; + double d1 = target.getEntityBoundingBox().minY + (double)(target.height / 3.0F) - entitytippedarrow.posY; + double d2 = target.posZ - this.posZ; + double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2); + entitytippedarrow.setThrowableHeading(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float)(14 - this.worldObj.getDifficulty().getDifficultyId() * 4)); + int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this); + int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this); + DifficultyInstance difficultyinstance = this.worldObj.getDifficultyForLocation(new BlockPos(this)); + entitytippedarrow.setDamage((double)(distanceFactor * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.worldObj.getDifficulty().getDifficultyId() * 0.11F)); if (i > 0) { - entityarrow.setDamage(entityarrow.getDamage() + i * 0.5D + 0.5D); + entitytippedarrow.setDamage(entitytippedarrow.getDamage() + (double)i * 0.5D + 0.5D); } if (j > 0) { - entityarrow.setKnockbackStrength(j); + entitytippedarrow.setKnockbackStrength(j); } - if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()) > 0 || this.getSkeletonType() == 1) + boolean flag = this.isBurning() && difficultyinstance.isHard() && this.rand.nextBoolean() || this.getSkeletonType() == SkeletonType.WITHER; + flag = flag || EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FLAME, this) > 0; + + if (flag) { - entityarrow.setFire(100); + entitytippedarrow.setFire(100); } - this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); - this.worldObj.spawnEntityInWorld(entityarrow); + ItemStack itemstack = this.getHeldItem(EnumHand.OFF_HAND); + + if (itemstack != null && itemstack.getItem() == Items.TIPPED_ARROW) + { + entitytippedarrow.setPotionEffect(itemstack); + } + else if (this.getSkeletonType() == SkeletonType.STRAY) + { + entitytippedarrow.addEffect(new PotionEffect(MobEffects.SLOWNESS, 600)); + } + + this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); + this.worldObj.spawnEntityInWorld(entitytippedarrow); } @Override @@ -97,9 +102,9 @@ protected void jump() this.motionY = 0.24D; } - if (this.isPotionActive(Potion.jump)) + if (this.isPotionActive(MobEffects.JUMP_BOOST)) { - this.motionY += (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F; + this.motionY += (this.getActivePotionEffect(MobEffects.JUMP_BOOST).getAmplifier() + 1) * 0.1F; } if (this.isSprinting()) @@ -113,7 +118,6 @@ protected void jump() ForgeHooks.onLivingJump(this); } - @Override protected void addRandomDrop() { int r = this.rand.nextInt(12); @@ -136,13 +140,13 @@ protected void addRandomDrop() this.dropItem(GCItems.canister, 1); break; default: - if (ConfigManagerCore.challengeMode || ConfigManagerCore.challengeMobDropsAndSpawning) this.dropItem(Items.pumpkin_seeds, 1); + if (ConfigManagerCore.challengeMode || ConfigManagerCore.challengeMobDropsAndSpawning) this.dropItem(Items.PUMPKIN_SEEDS, 1); break; } } @Override - protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + protected void dropFewItems(boolean wasRecentlyHit, int lootingModifier) { Item item = this.getDropItem(); @@ -150,9 +154,9 @@ protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) if (item != null) { - if (p_70628_2_ > 0) + if (lootingModifier > 0) { - j += this.rand.nextInt(p_70628_2_ + 1); + j += this.rand.nextInt(lootingModifier + 1); } for (int k = 1; k < j; ++k) @@ -161,12 +165,17 @@ protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) } } - j = this.rand.nextInt(3 + p_70628_2_); + j = this.rand.nextInt(3 + lootingModifier); if (j > 1) - this.dropItem(Items.bone, 1); + this.dropItem(Items.BONE, 1); //Drop lapis as semi-rare drop if player hit and if dropping bones - if (p_70628_1_ && (ConfigManagerCore.challengeMode || ConfigManagerCore.challengeMobDropsAndSpawning) && j > 1 && this.rand.nextInt(12) == 0) + if (wasRecentlyHit && (ConfigManagerCore.challengeMode || ConfigManagerCore.challengeMobDropsAndSpawning) && j > 1 && this.rand.nextInt(12) == 0) this.entityDropItem(new ItemStack(Items.DYE, 1, 4), 0.0F); + + if (this.recentlyHit > 0 && this.rand.nextFloat() < 0.025F + (float)lootingModifier * 0.01F) + { + this.addRandomDrop(); + } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSpider.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSpider.java index b509fb8fb9..ac1e60130c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSpider.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSpider.java @@ -9,6 +9,7 @@ import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntitySpider; import net.minecraft.init.Items; +import net.minecraft.init.MobEffects; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; @@ -30,9 +31,9 @@ public EntityEvolvedSpider(World par1World) protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(22.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(ConfigManagerCore.hardMode ? 0.40000001192092896D : 0.30000001192092896D); - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(ConfigManagerCore.hardMode ? 4.0D : 2.0D); + this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(22.0D); + this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(ConfigManagerCore.hardMode ? 0.40000001192092896D : 0.30000001192092896D); + this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(ConfigManagerCore.hardMode ? 4.0D : 2.0D); } @Override @@ -50,38 +51,38 @@ public boolean isAIEnabled() @Override public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) { - Object p_180482_2_1 = super.onInitialSpawn(difficulty, livingdata); + livingdata = super.onInitialSpawn(difficulty, livingdata); if (this.worldObj.rand.nextInt(100) == 0) { EntitySkeleton entityskeleton = new EntitySkeleton(this.worldObj); entityskeleton.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); - entityskeleton.onInitialSpawn(difficulty, (IEntityLivingData) null); + entityskeleton.onInitialSpawn(difficulty, (IEntityLivingData)null); this.worldObj.spawnEntityInWorld(entityskeleton); - entityskeleton.mountEntity(this); + entityskeleton.startRiding(this); } - if (p_180482_2_1 == null) + if (livingdata == null) { - p_180482_2_1 = new EntitySpider.GroupData(); + livingdata = new EntitySpider.GroupData(); if (this.worldObj.getDifficulty() == EnumDifficulty.HARD && this.worldObj.rand.nextFloat() < 0.1F * difficulty.getClampedAdditionalDifficulty()) { - ((EntitySpider.GroupData) p_180482_2_1).func_111104_a(this.worldObj.rand); + ((EntitySpider.GroupData)livingdata).setRandomEffect(this.worldObj.rand); } } - if (p_180482_2_1 instanceof EntitySpider.GroupData) + if (livingdata instanceof EntitySpider.GroupData) { - int i = ((EntitySpider.GroupData) p_180482_2_1).potionEffectId; + Potion potion = ((EntitySpider.GroupData)livingdata).effect; - if (i > 0 && Potion.potionTypes[i] != null) + if (potion != null) { - this.addPotionEffect(new PotionEffect(i, Integer.MAX_VALUE)); + this.addPotionEffect(new PotionEffect(potion, Integer.MAX_VALUE)); } } - return (IEntityLivingData) p_180482_2_1; + return livingdata; } @Override @@ -93,9 +94,9 @@ protected void jump() this.motionY = 0.26D; } - if (this.isPotionActive(Potion.jump)) + if (this.isPotionActive(MobEffects.JUMP_BOOST)) { - this.motionY += (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F; + this.motionY += (this.getActivePotionEffect(MobEffects.JUMP_BOOST).getAmplifier() + 1) * 0.1F; } if (this.isSprinting()) @@ -109,7 +110,6 @@ protected void jump() ForgeHooks.onLivingJump(this); } - @Override protected void addRandomDrop() { switch (this.rand.nextInt(14)) @@ -122,7 +122,7 @@ protected void addRandomDrop() case 3: case 4: case 5: - this.dropItem(Items.fermented_spider_eye, 1); + this.dropItem(Items.FERMENTED_SPIDER_EYE, 1); break; case 6: case 7: @@ -136,8 +136,19 @@ protected void addRandomDrop() this.dropItem(GCItems.oxygenConcentrator, 1); break; default: - if (ConfigManagerCore.challengeMode || ConfigManagerCore.challengeMobDropsAndSpawning) this.dropItem(Items.nether_wart, 1); + if (ConfigManagerCore.challengeMode || ConfigManagerCore.challengeMobDropsAndSpawning) this.dropItem(Items.NETHER_WART, 1); break; } } + + @Override + protected void dropFewItems(boolean wasRecentlyHit, int lootingModifier) + { + super.dropFewItems(wasRecentlyHit, lootingModifier); + + if (this.recentlyHit > 0 && this.rand.nextFloat() < 0.025F + (float)lootingModifier * 0.01F) + { + this.addRandomDrop(); + } + } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedZombie.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedZombie.java index 8aec3bcfb5..2e494665ca 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedZombie.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedZombie.java @@ -4,18 +4,12 @@ import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.core.util.WorldUtil; -import net.minecraft.entity.ai.*; import net.minecraft.entity.ai.attributes.IAttribute; -import net.minecraft.entity.monster.EntityIronGolem; -import net.minecraft.entity.monster.EntityPigZombie; import net.minecraft.entity.monster.EntityZombie; -import net.minecraft.entity.passive.EntityVillager; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; +import net.minecraft.init.MobEffects; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.pathfinding.PathNavigateGround; -import net.minecraft.potion.Potion; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; @@ -27,31 +21,9 @@ public class EntityEvolvedZombie extends EntityZombie implements IEntityBreathab public EntityEvolvedZombie(World par1World) { super(par1World); - this.tasks.taskEntries.clear(); - this.targetTasks.taskEntries.clear(); - ((PathNavigateGround) this.getNavigator()).setBreakDoors(true); - this.tasks.addTask(0, new EntityAISwimming(this)); - this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); - this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); - this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); - this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); - this.tasks.addTask(8, new EntityAILookIdle(this)); - this.applyEntityAI(); this.setSize(0.6F, 1.95F); } - @Override - protected void applyEntityAI() - { - this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityVillager.class, 1.0D, true)); - this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityIronGolem.class, 1.0D, true)); - this.tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, false)); - this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[] { EntityPigZombie.class })); - this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); - this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, false)); - this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityIronGolem.class, true)); - } - @Override public boolean canBreath() { @@ -60,7 +32,7 @@ public boolean canBreath() public IAttribute getReinforcementsAttribute() { - return EntityZombie.reinforcementChance; + return EntityZombie.SPAWN_REINFORCEMENTS_CHANCE; } @Override @@ -72,9 +44,9 @@ protected void jump() this.motionY = 0.24D; } - if (this.isPotionActive(Potion.jump)) + if (this.isPotionActive(MobEffects.JUMP_BOOST)) { - this.motionY += (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F; + this.motionY += (this.getActivePotionEffect(MobEffects.JUMP_BOOST).getAmplifier() + 1) * 0.1F; } if (this.isSprinting()) @@ -88,8 +60,6 @@ protected void jump() ForgeHooks.onLivingJump(this); } - - @Override protected void addRandomDrop() { switch (this.rand.nextInt(16)) @@ -122,20 +92,20 @@ protected void addRandomDrop() break; case 11: case 12: - this.dropItem(Items.carrot, 1); + this.dropItem(Items.CARROT, 1); break; case 13: case 14: case 15: - if (ConfigManagerCore.challengeMode || ConfigManagerCore.challengeMobDropsAndSpawning) this.dropItem(Items.melon_seeds, 1); + if (ConfigManagerCore.challengeMode || ConfigManagerCore.challengeMobDropsAndSpawning) this.dropItem(Items.MELON_SEEDS, 1); break; } } @Override - protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) + protected void dropFewItems(boolean wasRecentlyHit, int lootingModifier) { - super.dropFewItems(p_70628_1_, p_70628_2_); + super.dropFewItems(wasRecentlyHit, lootingModifier); Item item = this.getDropItem(); //Less rotten flesh than vanilla @@ -143,9 +113,9 @@ protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) if (item != null) { - if (p_70628_2_ > 0) + if (lootingModifier > 0) { - j += this.rand.nextInt(p_70628_2_ + 1); + j += this.rand.nextInt(lootingModifier + 1); } for (int k = 0; k < j; ++k) @@ -155,7 +125,12 @@ protected void dropFewItems(boolean p_70628_1_, int p_70628_2_) } //Drop copper ingot as semi-rare drop if player hit and if dropping rotten flesh (50% chance) - if (p_70628_1_ && (ConfigManagerCore.challengeMode || ConfigManagerCore.challengeMobDropsAndSpawning) && j > 0 && this.rand.nextInt(6) == 0) + if (wasRecentlyHit && (ConfigManagerCore.challengeMode || ConfigManagerCore.challengeMobDropsAndSpawning) && j > 0 && this.rand.nextInt(6) == 0) this.entityDropItem(new ItemStack(GCItems.basicItem, 1, 3), 0.0F); + + if (this.recentlyHit > 0 && this.rand.nextFloat() < 0.025F + (float)lootingModifier * 0.01F) + { + this.addRandomDrop(); + } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityFlag.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityFlag.java index 48b058be44..b7ee8dc24b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityFlag.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityFlag.java @@ -6,19 +6,29 @@ import micdoodle8.mods.galacticraft.core.wrappers.FlagData; import net.minecraft.block.Block; import net.minecraft.block.BlockFence; +import net.minecraft.block.SoundType; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.datasync.DataParameter; +import net.minecraft.network.datasync.DataSerializers; +import net.minecraft.network.datasync.EntityDataManager; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; public class EntityFlag extends Entity { + private static final DataParameter OWNER = EntityDataManager.createKey(EntityFlag.class, DataSerializers.STRING); + private static final DataParameter DAMAGE = EntityDataManager.createKey(EntityFlag.class, DataSerializers.FLOAT); + private static final DataParameter TYPE = EntityDataManager.createKey(EntityFlag.class, DataSerializers.VARINT); + private static final DataParameter FACING_ANGLE = EntityDataManager.createKey(EntityFlag.class, DataSerializers.VARINT); public double xPosition; public double yPosition; public double zPosition; @@ -57,7 +67,7 @@ public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { this.setBeenAttacked(); this.setDamage(this.getDamage() + par2 * 10); - this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, Block.soundTypeMetal.getBreakSound(), Block.soundTypeMetal.getVolume(), Block.soundTypeMetal.getFrequency() + 1.0F); + this.worldObj.playSound(null, this.posX, this.posY, this.posZ, SoundType.METAL.getBreakSound(), SoundCategory.BLOCKS, SoundType.METAL.getVolume(), SoundType.METAL.getPitch() + 1.0F); if (par1DamageSource.getEntity() instanceof EntityPlayer && ((EntityPlayer) par1DamageSource.getEntity()).capabilities.isCreativeMode) { @@ -66,9 +76,9 @@ public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) if (flag || this.getDamage() > 40) { - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { - this.riddenByEntity.mountEntity(this); + this.removePassengers(); } if (flag) @@ -92,7 +102,7 @@ public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) } @Override - public ItemStack getPickedResult(MovingObjectPosition target) + public ItemStack getPickedResult(RayTraceResult target) { return new ItemStack(GCItems.flag, 1, this.getType()); } @@ -134,10 +144,10 @@ public boolean canBePushed() @Override protected void entityInit() { - this.dataWatcher.addObject(17, ""); - this.dataWatcher.addObject(18, 0.0F); - this.dataWatcher.addObject(19, -1); - this.dataWatcher.addObject(20, -1); + this.dataManager.register(OWNER, ""); + this.dataManager.register(DAMAGE, 0.0F); + this.dataManager.register(TYPE, -1); + this.dataManager.register(FACING_ANGLE, -1); } @Override @@ -186,11 +196,12 @@ public void onUpdate() if (blockAt != null) { + BlockPos pos = new BlockPos(vec.intX(), vec.intY(), vec.intZ()); if (blockAt instanceof BlockFence) { } - else if (blockAt.isAir(this.worldObj, new BlockPos(vec.intX(), vec.intY(), vec.intZ()))) + else if (blockAt.isAir(this.worldObj.getBlockState(pos), this.worldObj, pos)) { this.motionY -= 0.02F; } @@ -200,7 +211,7 @@ else if (blockAt.isAir(this.worldObj, new BlockPos(vec.intX(), vec.intY(), vec.i } @Override - public boolean interactFirst(EntityPlayer par1EntityPlayer) + public boolean processInitialInteract(EntityPlayer player, ItemStack stack, EnumHand hand) { if (!this.worldObj.isRemote) { @@ -212,41 +223,41 @@ public boolean interactFirst(EntityPlayer par1EntityPlayer) public void setOwner(String par1) { - this.dataWatcher.updateObject(17, String.valueOf(par1)); + this.dataManager.set(OWNER, String.valueOf(par1)); } public String getOwner() { - return this.dataWatcher.getWatchableObjectString(17); + return this.dataManager.get(OWNER); } public void setDamage(float par1) { - this.dataWatcher.updateObject(18, Float.valueOf(par1)); + this.dataManager.set(DAMAGE, Float.valueOf(par1)); } public float getDamage() { - return this.dataWatcher.getWatchableObjectFloat(18); + return this.dataManager.get(DAMAGE); } public void setType(int par1) { - this.dataWatcher.updateObject(19, Integer.valueOf(par1)); + this.dataManager.set(TYPE, Integer.valueOf(par1)); } public int getType() { - return this.dataWatcher.getWatchableObjectInt(19); + return this.dataManager.get(TYPE); } public void setFacingAngle(int par1) { - this.dataWatcher.updateObject(20, Integer.valueOf(par1)); + this.dataManager.set(FACING_ANGLE, Integer.valueOf(par1)); } public int getFacingAngle() { - return this.dataWatcher.getWatchableObjectInt(20); + return this.dataManager.get(FACING_ANGLE); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLander.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLander.java index 9260ffb8e4..d44e89273c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLander.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLander.java @@ -5,12 +5,14 @@ import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.core.client.fx.ParticleLanderFlame; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; -import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.Particle; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -76,7 +78,7 @@ public boolean hasCustomName() } @Override - public boolean interactFirst(EntityPlayer var1) + public boolean processInitialInteract(EntityPlayer player, ItemStack stack, EnumHand hand) { if (this.worldObj.isRemote) { @@ -85,27 +87,27 @@ public boolean interactFirst(EntityPlayer var1) return false; } - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { - this.riddenByEntity.mountEntity(this); + this.removePassengers(); } return true; } - if (this.riddenByEntity == null && var1 instanceof EntityPlayerMP) + if (this.getPassengers().isEmpty() && player instanceof EntityPlayerMP) { - GCCoreUtil.openParachestInv((EntityPlayerMP) var1, this); + GCCoreUtil.openParachestInv((EntityPlayerMP) player, this); return true; } - else if (var1 instanceof EntityPlayerMP) + else if (player instanceof EntityPlayerMP) { if (!this.onGround) { return false; } - var1.mountEntity(null); + this.removePassengers(); return true; } else @@ -175,9 +177,10 @@ public Map getParticleMap() @SideOnly(Side.CLIENT) @Override - public EntityFX getParticle(Random rand, double x, double y, double z, double motX, double motY, double motZ) + public Particle getParticle(Random rand, double x, double y, double z, double motX, double motY, double motZ) { - return new ParticleLanderFlame(this.worldObj, x, y, z, motX, motY, motZ, this.riddenByEntity instanceof EntityLivingBase ? (EntityLivingBase) this.riddenByEntity : null); + EntityLivingBase passenger = this.getPassengers().isEmpty() || !(this.getPassengers().get(0) instanceof EntityLivingBase) ? null : (EntityLivingBase) this.getPassengers().get(0); + return new ParticleLanderFlame(this.worldObj, x, y, z, motX, motY, motZ, passenger); } @Override @@ -213,11 +216,7 @@ public void onGroundHit() { if (Math.abs(this.lastMotionY) > 2.0D) { - if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayerMP) - { - this.riddenByEntity.mountEntity(this); - } - + this.removePassengers(); this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 12, true); this.setDead(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLanderBase.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLanderBase.java index b480199862..5249521d90 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLanderBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityLanderBase.java @@ -3,7 +3,8 @@ import io.netty.buffer.ByteBuf; import micdoodle8.mods.galacticraft.core.GCFluids; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.inventory.IInventorySettable; import micdoodle8.mods.galacticraft.core.network.IPacketReceiver; import micdoodle8.mods.galacticraft.core.network.PacketDynamicInventory; @@ -45,11 +46,11 @@ public EntityLanderBase(World var1) } @Override - public void updateRiderPosition() + public void updatePassenger(Entity passenger) { - if (this.riddenByEntity != null) + if (this.isPassenger(passenger)) { - this.riddenByEntity.setPosition(this.posX, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ); + passenger.setPosition(this.posX, this.posY + this.getMountedYOffset() + passenger.getYOffset(), this.posZ); } } @@ -83,15 +84,15 @@ public EntityLanderBase(EntityPlayerMP player, float yOffset) { this(player.worldObj, player.posX, player.posY, player.posZ, yOffset); - GCPlayerStats stats = GCPlayerStats.get(player); - this.containedItems = new ItemStack[stats.rocketStacks.length + 1]; - this.fuelTank.setFluid(new FluidStack(GCFluids.fluidFuel, stats.fuelLevel)); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + this.containedItems = new ItemStack[stats.getRocketStacks().length + 1]; + this.fuelTank.setFluid(new FluidStack(GCFluids.fluidFuel, stats.getFuelLevel())); - for (int i = 0; i < stats.rocketStacks.length; i++) + for (int i = 0; i < stats.getRocketStacks().length; i++) { - if (stats.rocketStacks[i] != null) + if (stats.getRocketStacks()[i] != null) { - this.containedItems[i] = stats.rocketStacks[i].copy(); + this.containedItems[i] = stats.getRocketStacks()[i].copy(); } else { @@ -101,7 +102,7 @@ public EntityLanderBase(EntityPlayerMP player, float yOffset) this.setPositionAndRotation(player.posX, player.posY, player.posZ, 0, 0); - player.mountEntity(this); + player.startRiding(this, true); } @Override @@ -111,13 +112,13 @@ public void onUpdate() if (this.ticks < 40 && this.posY > 150) { - if (this.riddenByEntity == null) + if (this.getPassengers().isEmpty()) { final EntityPlayer player = this.worldObj.getClosestPlayerToEntity(this, 5); if (player != null && player.getRidingEntity() == null) { - player.mountEntity(this); + player.startRiding(this); } } } @@ -135,7 +136,7 @@ public void onUpdate() { for (Entity entity : var15) { - if (entity != this.riddenByEntity) + if (!this.getPassengers().contains(entity)) { this.pushEntityAway(entity); } @@ -151,7 +152,7 @@ private void checkFluidTankTransfer(int slot, FluidTank tank) private void pushEntityAway(Entity entityToPush) { - if (this.riddenByEntity != entityToPush && this.getRidingEntity() != entityToPush) + if (!this.getPassengers().contains(entityToPush) && this.getRidingEntity() != entityToPush) { double d0 = this.posX - entityToPush.posX; double d1 = this.posZ - entityToPush.posZ; @@ -261,7 +262,7 @@ public boolean shouldMove() return false; } - return this.riddenByEntity != null && !this.onGround; + return !this.getPassengers().isEmpty() && !this.onGround; } public abstract double getInitialMotionY(); @@ -307,7 +308,7 @@ public ArrayList getNetworkedData() this.shouldMoveServer = this.shouldMove(); objList.add(this.shouldMoveServer); //Server send rider information for client to check - objList.add(this.riddenByEntity == null ? -1 : this.riddenByEntity.getEntityId()); + objList.add(this.getPassengers().isEmpty() ? -1 : this.getPassengers().get(0).getEntityId()); } return objList; @@ -352,7 +353,7 @@ public void readNetworkedData(ByteBuf buffer) //Check has correct rider on client int shouldBeMountedId = buffer.readInt(); - if (this.riddenByEntity == null) + if (this.getPassengers().isEmpty()) { if (shouldBeMountedId > -1) { @@ -363,22 +364,22 @@ public void readNetworkedData(ByteBuf buffer) { if (e instanceof EntityPlayer) { - e = WorldUtil.forceRespawnClient(this.dimension, e.worldObj.getDifficulty().getDifficultyId(), e.worldObj.getWorldInfo().getTerrainType().getWorldTypeName(), ((EntityPlayerMP) e).theItemInWorldManager.getGameType().getID()); - e.mountEntity(this); + e = WorldUtil.forceRespawnClient(this.dimension, e.worldObj.getDifficulty().getDifficultyId(), e.worldObj.getWorldInfo().getTerrainType().getWorldTypeName(), ((EntityPlayerMP) e).interactionManager.getGameType().getID()); + e.startRiding(this); } } else { - e.mountEntity(this); + e.startRiding(this); } } } } - else if (this.riddenByEntity.getEntityId() != shouldBeMountedId) + else if (this.getPassengers().get(0).getEntityId() != shouldBeMountedId) { if (shouldBeMountedId == -1) { - this.riddenByEntity.mountEntity(null); + this.removePassengers(); } else { @@ -389,13 +390,13 @@ else if (this.riddenByEntity.getEntityId() != shouldBeMountedId) { if (e instanceof EntityPlayer) { - e = WorldUtil.forceRespawnClient(this.dimension, e.worldObj.getDifficulty().getDifficultyId(), e.worldObj.getWorldInfo().getTerrainType().getWorldTypeName(), ((EntityPlayerMP) e).theItemInWorldManager.getGameType().getID()); - e.mountEntity(this); + e = WorldUtil.forceRespawnClient(this.dimension, e.worldObj.getDifficulty().getDifficultyId(), e.worldObj.getWorldInfo().getTerrainType().getWorldTypeName(), ((EntityPlayerMP) e).interactionManager.getGameType().getID()); + e.startRiding(this, true); } } else { - e.mountEntity(this); + e.startRiding(this, true); } } } @@ -451,21 +452,18 @@ public double getPacketRange() @Override public UUID getOwnerUUID() { - if (this.riddenByEntity != null && !(this.riddenByEntity instanceof EntityPlayer)) + if (!this.getPassengers().isEmpty() && !(this.getPassengers().get(0) instanceof EntityPlayer)) { return null; } UUID id; - if (riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { - id = ((EntityPlayer) this.riddenByEntity).getPersistentID(); + id = this.getPassengers().get(0).getPersistentID(); - if (id != null) - { - this.persistantRiderUUID = id; - } + this.persistantRiderUUID = id; } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityMeteor.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityMeteor.java index d344bbbf16..5f377de82d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityMeteor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityMeteor.java @@ -9,7 +9,16 @@ import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.*; +import net.minecraft.network.datasync.DataParameter; +import net.minecraft.network.datasync.DataSerializers; +import net.minecraft.network.datasync.EntityDataManager; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntityDamageSourceIndirect; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.text.translation.I18n; import net.minecraft.world.Explosion; import net.minecraft.world.World; @@ -18,6 +27,7 @@ public class EntityMeteor extends Entity { + private static final DataParameter SIZE = EntityDataManager.createKey(EntityBuggy.class, DataSerializers.VARINT); public EntityLiving shootingEntity; public int size; @@ -55,15 +65,15 @@ public void onUpdate() this.spawnParticles(); } - Vec3 var15 = new Vec3(this.posX, this.posY, this.posZ); - Vec3 var2 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - MovingObjectPosition var3 = this.worldObj.rayTraceBlocks(var15, var2, true, true, false); - var15 = new Vec3(this.posX, this.posY, this.posZ); - var2 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3d var15 = new Vec3d(this.posX, this.posY, this.posZ); + Vec3d var2 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + RayTraceResult var3 = this.worldObj.rayTraceBlocks(var15, var2, true, true, false); + var15 = new Vec3d(this.posX, this.posY, this.posZ); + var2 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (var3 != null) { - var2 = new Vec3(var3.hitVec.xCoord, var3.hitVec.yCoord, var3.hitVec.zCoord); + var2 = new Vec3d(var3.hitVec.xCoord, var3.hitVec.yCoord, var3.hitVec.zCoord); } Entity var4 = null; @@ -79,7 +89,7 @@ public void onUpdate() { final float var10 = 0.01F; final AxisAlignedBB var11 = var9.getEntityBoundingBox().expand(var10, var10, var10); - final MovingObjectPosition var12 = var11.calculateIntercept(var15, var2); + final RayTraceResult var12 = var11.calculateIntercept(var15, var2); if (var12 != null) { @@ -96,7 +106,7 @@ public void onUpdate() if (var4 != null) { - var3 = new MovingObjectPosition(var4); + var3 = new RayTraceResult(var4); } if (var3 != null) @@ -119,13 +129,14 @@ protected void spawnParticles() GalacticraftCore.proxy.spawnParticle("distanceSmoke", new Vector3(this.posX, this.posY + 1D + Math.random(), this.posZ - Math.random()), new Vector3(0.0D, 0.0D, 0.0D), new Object[] {}); } - protected void onImpact(MovingObjectPosition movingObjPos) + protected void onImpact(RayTraceResult movingObjPos) { if (!this.worldObj.isRemote) { if (movingObjPos != null) { - if (this.worldObj.getBlockState(movingObjPos.getBlockPos().up()).getBlock().isAir(worldObj, movingObjPos.getBlockPos().up())) + BlockPos above = movingObjPos.getBlockPos().up(); + if (this.worldObj.getBlockState(movingObjPos.getBlockPos().up()).getBlock().isAir(worldObj.getBlockState(above), worldObj, above)) { this.worldObj.setBlockState(movingObjPos.getBlockPos().up(), GCBlocks.fallenMeteor.getDefaultState(), 3); } @@ -152,7 +163,7 @@ public static DamageSource causeMeteorDamage(EntityMeteor par0EntityMeteor, Enti { if (par1Entity != null && par1Entity instanceof EntityPlayer) { - StatCollector.translateToLocalFormatted("death." + "meteor", ((EntityPlayer) par1Entity).getGameProfile().getName() + " was hit by a meteor! That's gotta hurt!"); + I18n.translateToLocalFormatted("death." + "meteor", ((EntityPlayer) par1Entity).getGameProfile().getName() + " was hit by a meteor! That's gotta hurt!"); } return new EntityDamageSourceIndirect("explosion", par0EntityMeteor, par1Entity).setProjectile(); } @@ -160,13 +171,13 @@ public static DamageSource causeMeteorDamage(EntityMeteor par0EntityMeteor, Enti @Override protected void entityInit() { - this.dataWatcher.addObject(16, this.size); + this.dataManager.register(SIZE, this.size); this.noClip = true; } public int getSize() { - return this.dataWatcher.getWatchableObjectInt(16); + return this.dataManager.get(SIZE); } /** @@ -174,7 +185,7 @@ public int getSize() */ public void setSize(int par1) { - this.dataWatcher.updateObject(16, Integer.valueOf(par1)); + this.dataManager.set(SIZE, Integer.valueOf(par1)); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityMeteorChunk.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityMeteorChunk.java index 89b528e837..91030deea6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityMeteorChunk.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityMeteorChunk.java @@ -12,10 +12,17 @@ import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.play.server.S2BPacketChangeGameState; -import net.minecraft.util.*; +import net.minecraft.network.datasync.DataParameter; +import net.minecraft.network.datasync.DataSerializers; +import net.minecraft.network.datasync.EntityDataManager; +import net.minecraft.network.play.server.SPacketChangeGameState; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EntityDamageSourceIndirect; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.math.*; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -24,6 +31,7 @@ public class EntityMeteorChunk extends Entity implements IProjectile { + private static final DataParameter IS_HOT = EntityDataManager.createKey(EntityMeteorChunk.class, DataSerializers.BOOLEAN); private int xTile = -1; private int yTile = -1; private int zTile = -1; @@ -45,7 +53,6 @@ public class EntityMeteorChunk extends Entity implements IProjectile public EntityMeteorChunk(World world) { super(world); - this.renderDistanceWeight = 10.0D; this.setSize(0.25F, 0.25F); this.randPitchInc = rand.nextFloat() * 20 - 10; this.randYawInc = rand.nextFloat() * 20 - 10; @@ -56,7 +63,6 @@ public EntityMeteorChunk(World par1World, EntityLivingBase par2EntityLivingBase, super(par1World); this.randPitchInc = rand.nextFloat() * 20 - 10; this.randYawInc = rand.nextFloat() * 20 - 10; - this.renderDistanceWeight = 10.0D; this.shootingEntity = par2EntityLivingBase; if (par2EntityLivingBase instanceof EntityPlayer) @@ -145,14 +151,13 @@ else if (!this.worldObj.isRemote) } BlockPos pos = new BlockPos(this.xTile, this.yTile, this.zTile); - Block block = this.worldObj.getBlockState(pos).getBlock(); + IBlockState stateIn = this.worldObj.getBlockState(pos); - if (!block.isAir(this.worldObj, pos)) + if (!stateIn.getBlock().isAir(this.worldObj.getBlockState(pos), this.worldObj, pos)) { - block.setBlockBoundsBasedOnState(this.worldObj, pos); - AxisAlignedBB axisalignedbb = block.getCollisionBoundingBox(this.worldObj, pos, this.worldObj.getBlockState(pos)); + AxisAlignedBB axisalignedbb = stateIn.getCollisionBoundingBox(this.worldObj, pos); - if (axisalignedbb != null && axisalignedbb.isVecInside(new Vec3(this.posX, this.posY, this.posZ))) + if (axisalignedbb != null && axisalignedbb.isVecInside(new Vec3d(this.posX, this.posY, this.posZ))) { this.inGround = true; } @@ -185,15 +190,15 @@ else if (!this.worldObj.isRemote) else { ++this.ticksInAir; - Vec3 vec3 = new Vec3(this.posX, this.posY, this.posZ); - Vec3 vec31 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31, false, true, false); - vec3 = new Vec3(this.posX, this.posY, this.posZ); - vec31 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3d vec3 = new Vec3d(this.posX, this.posY, this.posZ); + Vec3d vec31 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + RayTraceResult movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31, false, true, false); + vec3 = new Vec3d(this.posX, this.posY, this.posZ); + vec31 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (movingobjectposition != null) { - vec31 = new Vec3(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + vec31 = new Vec3d(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); } this.rotationPitch += 1F; @@ -212,7 +217,7 @@ else if (!this.worldObj.isRemote) { f1 = 0.3F; AxisAlignedBB axisalignedbb1 = entity1.getEntityBoundingBox().expand(f1, f1, f1); - MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3, vec31); + RayTraceResult movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3, vec31); if (movingobjectposition1 != null) { @@ -229,7 +234,7 @@ else if (!this.worldObj.isRemote) if (entity != null) { - movingobjectposition = new MovingObjectPosition(entity); + movingobjectposition = new RayTraceResult(entity); } if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) @@ -298,7 +303,7 @@ else if (!this.worldObj.isRemote) if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && this.shootingEntity instanceof EntityPlayerMP) { - ((EntityPlayerMP) this.shootingEntity).playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0.0F)); + ((EntityPlayerMP) this.shootingEntity).connection.sendPacket(new SPacketChangeGameState(6, 0.0F)); } } @@ -334,9 +339,10 @@ else if (!this.worldObj.isRemote) this.posZ -= this.motionZ / f2 * 0.05000000074505806D; this.inGround = true; - if (!this.inTile.isAir(this.worldObj, movingobjectposition.getBlockPos())) + IBlockState hitState = this.worldObj.getBlockState(movingobjectposition.getBlockPos()); + if (!this.inTile.isAir(hitState, this.worldObj, movingobjectposition.getBlockPos())) { - this.inTile.onEntityCollidedWithBlock(this.worldObj, movingobjectposition.getBlockPos(), this); + this.inTile.onEntityCollidedWithBlock(this.worldObj, movingobjectposition.getBlockPos(), hitState, this); } } } @@ -378,17 +384,17 @@ else if (!this.worldObj.isRemote) @Override protected void entityInit() { - this.dataWatcher.addObject(16, Integer.valueOf(0)); + this.dataManager.register(IS_HOT, false); } public boolean isHot() { - return this.dataWatcher.getWatchableObjectInt(16) == 1; + return this.dataManager.get(IS_HOT); } public void setHot(boolean isHot) { - this.dataWatcher.updateObject(16, isHot ? 1 : 0); + this.dataManager.set(IS_HOT, isHot); } @Override @@ -417,7 +423,7 @@ public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) if (flag) { - this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + this.playSound(SoundEvents.ENTITY_ITEM_PICKUP, 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); par1EntityPlayer.onItemPickup(this, 1); this.setDead(); } @@ -425,8 +431,22 @@ public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) } @Override - public boolean canAttackWithItem() + public boolean canBeAttackedWithItem() { return false; } + + @Override + public boolean isInRangeToRenderDist(double distance) + { + double d0 = this.getEntityBoundingBox().getAverageEdgeLength(); + + if (Double.isNaN(d0)) + { + d0 = 1.0D; + } + + d0 = d0 * 64.0D * 10.0; + return distance < d0 * d0; + } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java index 8a0c0dae64..56563f3b28 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java @@ -8,6 +8,7 @@ import micdoodle8.mods.galacticraft.core.network.PacketDynamic; import micdoodle8.mods.galacticraft.core.tile.TileEntityParaChest; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.EnumDyeColor; @@ -117,9 +118,10 @@ public void onUpdate() final int z = MathHelper.floor_double(this.posZ); BlockPos pos = new BlockPos(x, y + i, z); - Block block = this.worldObj.getBlockState(pos).getBlock(); + IBlockState state = this.worldObj.getBlockState(pos); + Block block = state.getBlock(); - if (block.getMaterial().isReplaceable()) + if (block.getMaterial(state).isReplaceable()) { if (this.placeChest(pos)) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntitySkeletonBoss.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntitySkeletonBoss.java index 6607a0e264..4374d28bd6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntitySkeletonBoss.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntitySkeletonBoss.java @@ -3,9 +3,9 @@ import micdoodle8.mods.galacticraft.api.GalacticraftRegistry; import micdoodle8.mods.galacticraft.api.entity.IEntityBreathable; import micdoodle8.mods.galacticraft.api.entity.IIgnoreShift; -import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.GalacticraftCore; +import micdoodle8.mods.galacticraft.core.client.sounds.GCSounds; import micdoodle8.mods.galacticraft.core.network.PacketSimple; import micdoodle8.mods.galacticraft.core.network.PacketSimple.EnumSimplePacket; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; @@ -15,17 +15,19 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityTippedArrow; import net.minecraft.init.Items; +import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.stats.AchievementList; import net.minecraft.util.DamageSource; +import net.minecraft.util.SoundEvent; import net.minecraft.util.math.MathHelper; +import net.minecraft.world.BossInfo; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; import java.util.List; import java.util.Random; @@ -33,7 +35,7 @@ public class EntitySkeletonBoss extends EntityBossBase implements IEntityBreathable, IRangedAttackMob, IIgnoreShift { protected long ticks = 0; - private static final ItemStack defaultHeldItem = new ItemStack(Items.bow, 1); + private static final ItemStack defaultHeldItem = new ItemStack(Items.BOW, 1); public int throwTimer; public int postThrowDelay = 20; @@ -58,8 +60,8 @@ public EntitySkeletonBoss(World par1World) protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(150.0F * ConfigManagerCore.dungeonBossHealthMod); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(ConfigManagerCore.hardMode ? 0.4F : 0.25F); + this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(150.0F * ConfigManagerCore.dungeonBossHealthMod); + this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(ConfigManagerCore.hardMode ? 0.4F : 0.25F); } @Override @@ -89,15 +91,15 @@ public boolean handleWaterMovement() } @Override - public void updateRiderPosition() + public void updatePassenger(Entity passenger) { - if (this.riddenByEntity != null) + if (this.isPassenger(passenger)) { final double offsetX = Math.sin(-this.rotationYawHead * (Math.PI / 180.0D)); final double offsetZ = Math.cos(this.rotationYawHead * (Math.PI / 180.0D)); final double offsetY = 2 * Math.cos((this.throwTimer + this.postThrowDelay) * 0.05F); - this.riddenByEntity.setPosition(this.posX + offsetX, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset() + offsetY, this.posZ + offsetZ); + passenger.setPosition(this.posX + offsetX, this.posY + this.getMountedYOffset() + passenger.getYOffset() + offsetY, this.posZ + offsetZ); } } @@ -109,12 +111,12 @@ public void knockBack(Entity par1Entity, float par2, double par3, double par5) @Override public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { - if (this.riddenByEntity == null && this.postThrowDelay == 0 && this.throwTimer == 0 && par1EntityPlayer.equals(this.targetEntity) && this.deathTicks == 0) + if (this.getPassengers().isEmpty() && this.postThrowDelay == 0 && this.throwTimer == 0 && par1EntityPlayer.equals(this.targetEntity) && this.deathTicks == 0) { if (!this.worldObj.isRemote) { GalacticraftCore.packetPipeline.sendToAllAround(new PacketSimple(EnumSimplePacket.C_PLAY_SOUND_BOSS_LAUGH, this.worldObj.provider.getDimension(), new Object[] {}), new TargetPoint(this.worldObj.provider.getDimension(), this.posX, this.posY, this.posZ, 40.0D)); - par1EntityPlayer.mountEntity(this); + par1EntityPlayer.startRiding(this); } this.throwTimer = 40; @@ -130,30 +132,24 @@ public boolean canBePushed() } @Override - protected String getLivingSound() + protected SoundEvent getHurtSound() { + this.playSound(GCSounds.bossOoh, this.getSoundVolume(), this.getSoundPitch() + 1.0F); return null; } @Override - protected String getHurtSound() + protected SoundEvent getDeathSound() { - this.playSound(Constants.TEXTURE_PREFIX + "entity.ooh", this.getSoundVolume(), this.getSoundPitch() + 1.0F); return null; } - @Override - protected String getDeathSound() - { - return null; - } - - @Override - @SideOnly(Side.CLIENT) - public ItemStack getHeldItem() - { - return EntitySkeletonBoss.defaultHeldItem; - } +// @Override +// @SideOnly(Side.CLIENT) +// public ItemStack getHeldItem() +// { +// return EntitySkeletonBoss.defaultHeldItem; +// } @Override public EnumCreatureAttribute getCreatureAttribute() @@ -173,10 +169,10 @@ public void onLivingUpdate() if (!this.worldObj.isRemote && this.getHealth() <= 150.0F * ConfigManagerCore.dungeonBossHealthMod / 2) { - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed); + this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); } - final EntityPlayer player = this.worldObj.getClosestPlayer(this.posX, this.posY, this.posZ, 20.0); + final EntityPlayer player = this.worldObj.getClosestPlayer(this.posX, this.posY, this.posZ, 20.0, false); if (player != null && !player.equals(this.targetEntity)) { @@ -201,15 +197,15 @@ public void onLivingUpdate() this.postThrowDelay--; } - if (this.riddenByEntity != null && this.throwTimer == 0) + if (!this.getPassengers().isEmpty() && this.throwTimer == 0) { this.postThrowDelay = 20; - this.thrownEntity = this.riddenByEntity; + this.thrownEntity = this.getPassengers().get(0); if (!this.worldObj.isRemote) { - this.riddenByEntity.mountEntity(null); + this.removePassengers(); } } @@ -256,13 +252,13 @@ public void onDeath(DamageSource par1DamageSource) if (par1DamageSource.getSourceOfDamage() instanceof EntityArrow && par1DamageSource.getEntity() instanceof EntityPlayer) { - final EntityPlayer var2 = (EntityPlayer) par1DamageSource.getEntity(); - final double var3 = var2.posX - this.posX; - final double var5 = var2.posZ - this.posZ; + final EntityPlayer entityPlayer = (EntityPlayer) par1DamageSource.getEntity(); + final double var3 = entityPlayer.posX - this.posX; + final double var5 = entityPlayer.posZ - this.posZ; if (var3 * var3 + var5 * var5 >= 2500.0D) { - var2.triggerAchievement(AchievementList.snipeSkeleton); + entityPlayer.addStat(AchievementList.SNIPE_SKELETON); } } } @@ -270,7 +266,7 @@ public void onDeath(DamageSource par1DamageSource) @Override protected Item getDropItem() { - return Items.arrow; + return Items.ARROW; } @Override @@ -300,13 +296,13 @@ protected void dropFewItems(boolean b, int i) if (i > 0) { - final ItemStack var2 = new ItemStack(Items.bow); - EnchantmentHelper.addRandomEnchantment(this.rand, var2, 5); + final ItemStack var2 = new ItemStack(Items.BOW); + EnchantmentHelper.addRandomEnchantment(this.rand, var2, 5, false); this.entityDropItem(var2, 0.0F); } else { - this.dropItem(Items.bow, 1); + this.dropItem(Items.BOW, 1); } } @@ -317,17 +313,22 @@ public boolean canBreath() } @Override - public void attackEntityWithRangedAttack(EntityLivingBase entitylivingbase, float f) + public void attackEntityWithRangedAttack(EntityLivingBase target, float f) { - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { return; } - Entity var1 = new EntityArrow(this.worldObj, this, entitylivingbase, 1.6F, 12.0F); + EntityTippedArrow arrow = new EntityTippedArrow(this.worldObj, this); + double d0 = target.posX - this.posX; + double d1 = target.getEntityBoundingBox().minY + (double)(target.height / 3.0F) - arrow.posY; + double d2 = target.posZ - this.posZ; + double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2); + arrow.setThrowableHeading(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float)(14 - this.worldObj.getDifficulty().getDifficultyId() * 4)); - this.worldObj.playSoundAtEntity(this, "random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); - this.worldObj.spawnEntityInWorld(var1); + this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); + this.worldObj.spawnEntityInWorld(arrow); } @Override @@ -353,4 +354,10 @@ public void dropKey() { this.entityDropItem(new ItemStack(GCItems.key, 1, 0), 0.5F); } + + @Override + public BossInfo.Color getHealthBarColor() + { + return BossInfo.Color.GREEN; + } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityTier1Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityTier1Rocket.java index 2eb220166f..348432f583 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityTier1Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityTier1Rocket.java @@ -6,7 +6,8 @@ import micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider; import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.tile.TileEntityLandingPad; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.core.util.PlayerUtil; @@ -16,7 +17,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import java.util.List; @@ -54,7 +55,7 @@ public float getRotateOffset() } @Override - public ItemStack getPickedResult(MovingObjectPosition target) + public ItemStack getPickedResult(RayTraceResult target) { return new ItemStack(GCItems.rocketTier1, 1, this.rocketType.getIndex()); } @@ -139,20 +140,20 @@ public void onTeleport(EntityPlayerMP player) if (playerBase != null) { - GCPlayerStats stats = GCPlayerStats.get(player); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); if (this.cargoItems == null || this.cargoItems.length == 0) { - stats.rocketStacks = new ItemStack[2]; + stats.setRocketStacks(new ItemStack[2]); } else { - stats.rocketStacks = this.cargoItems; + stats.setRocketStacks(this.cargoItems); } - stats.rocketType = this.rocketType.getIndex(); - stats.rocketItem = GCItems.rocketTier1; - stats.fuelLevel = this.fuelTank.getFluidAmount(); + stats.setRocketType(this.rocketType.getIndex()); + stats.setRocketItem(GCItems.rocketTier1); + stats.setFuelLevel(this.fuelTank.getFluidAmount()); } } @@ -178,7 +179,7 @@ protected void spawnParticles(boolean launched) final double x2 = this.posX + x1; final double z2 = this.posZ + z1; - EntityLivingBase riddenByEntity = this.riddenByEntity instanceof EntityLivingBase ? (EntityLivingBase) this.riddenByEntity : null; + EntityLivingBase riddenByEntity = !this.getPassengers().isEmpty() && this.getPassengers().get(0) instanceof EntityLivingBase ? (EntityLivingBase) this.getPassengers().get(0) : null; if (this.getLaunched()) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityProviderStats.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityProviderStats.java index 104d6b8f32..f10d9f31e5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityProviderStats.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityProviderStats.java @@ -6,6 +6,8 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilitySerializable; +import java.lang.ref.WeakReference; + public class CapabilityProviderStats implements ICapabilitySerializable { private EntityPlayerMP owner; @@ -15,6 +17,7 @@ public CapabilityProviderStats(EntityPlayerMP owner) { this.owner = owner; this.statsCapability = CapabilityStatsHandler.GC_STATS_CAPABILITY.getDefaultInstance(); + this.statsCapability.setPlayer(new WeakReference<>(this.owner)); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityProviderStatsClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityProviderStatsClient.java new file mode 100644 index 0000000000..1e456437a4 --- /dev/null +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityProviderStatsClient.java @@ -0,0 +1,35 @@ +package micdoodle8.mods.galacticraft.core.entities.player; + +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ICapabilityProvider; + +public class CapabilityProviderStatsClient implements ICapabilityProvider +{ + private EntityPlayerSP owner; + private IStatsClientCapability statsCapability; + + public CapabilityProviderStatsClient(EntityPlayerSP owner) + { + this.owner = owner; + this.statsCapability = CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY.getDefaultInstance(); + } + + @Override + public boolean hasCapability(Capability capability, EnumFacing facing) + { + return capability == CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY; + } + + @Override + public T getCapability(Capability capability, EnumFacing facing) + { + if (CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY != null && capability == CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY) + { + return CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY.cast(statsCapability); + } + + return null; + } +} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityStatsClientHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityStatsClientHandler.java new file mode 100644 index 0000000000..e276bab635 --- /dev/null +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/CapabilityStatsClientHandler.java @@ -0,0 +1,32 @@ +package micdoodle8.mods.galacticraft.core.entities.player; + +import micdoodle8.mods.galacticraft.core.Constants; +import net.minecraft.nbt.NBTBase; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityInject; +import net.minecraftforge.common.capabilities.CapabilityManager; + +public class CapabilityStatsClientHandler +{ + @CapabilityInject(IStatsClientCapability.class) + public static Capability GC_STATS_CLIENT_CAPABILITY = null; + + public static final ResourceLocation GC_PLAYER_CLIENT_PROP = new ResourceLocation(Constants.ASSET_PREFIX, "player_stats_client"); + + public static void register() + { + CapabilityManager.INSTANCE.register(IStatsClientCapability.class, new Capability.IStorage() + { + @Override + public NBTBase writeNBT(Capability capability, IStatsClientCapability instance, EnumFacing side) + { + return null; + } + + @Override + public void readNBT(Capability capability, IStatsClientCapability instance, EnumFacing side, NBTBase nbt) { } + }, StatsClientCapability::new); + } +} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java index 795f123c7c..cc441643d3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java @@ -44,9 +44,9 @@ public boolean testFreefall(EntityPlayer player) BlockPos pos = new BlockPos(xx, playerFeetOnY, zz); IBlockState state = player.worldObj.getBlockState(pos); Block b = state.getBlock(); - if (b.getMaterial() != Material.AIR && !(b instanceof BlockLiquid)) + if (b.getMaterial(state) != Material.AIR && !(b instanceof BlockLiquid)) { - double blockYmax = playerFeetOnY + b.getBlockBoundsMaxY(); + double blockYmax = playerFeetOnY + b.getBoundingBox(state, player.worldObj, pos).maxY; if (player.getEntityBoundingBox().minY - blockYmax < 0.01D && player.getEntityBoundingBox().minY - blockYmax > -0.5D) { player.onGround = true; @@ -57,7 +57,8 @@ public boolean testFreefall(EntityPlayer player) } else if (b.canCollideCheck(player.worldObj.getBlockState(new BlockPos(xx, playerFeetOnY, zz)), false)) { - AxisAlignedBB collisionBox = b.getCollisionBoundingBox(player.worldObj, new BlockPos(xx, playerFeetOnY, zz), state); + BlockPos offsetPos = new BlockPos(xx, playerFeetOnY, zz); + AxisAlignedBB collisionBox = b.getCollisionBoundingBox(player.worldObj.getBlockState(offsetPos), player.worldObj, offsetPos); if (collisionBox != null && collisionBox.intersectsWith(player.getEntityBoundingBox())) { player.posY -= player.getEntityBoundingBox().minY - blockYmax; @@ -81,8 +82,8 @@ private boolean testFreefall(EntityPlayerSP p, boolean flag) } WorldProviderZeroGravity worldProviderOrbit = (WorldProviderZeroGravity) worldProvider; SpinManager spinManager = worldProviderOrbit.getSpinManager(); - GCPlayerStatsClient stats = GCPlayerStatsClient.get(p); - if (this.pjumpticks > 0 || (stats.ssOnGroundLast && p.movementInput.jump)) + IStatsClientCapability stats = p.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); + if (this.pjumpticks > 0 || (stats.isSsOnGroundLast() && p.movementInput.jump)) { return false; } @@ -252,12 +253,13 @@ public void freefallMotion(EntityPlayerSP p) double posOffsetZ = -p.motionZ; //if (p.capabilities.isFlying) + IStatsClientCapability stats = p.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); ///Undo whatever vanilla tried to do to our y motion if (dY < 0D && p.motionY != 0.0D) { p.motionY = pPrevMotionY; } - else if (dY > 0.01D && GCPlayerStatsClient.get(p).inFreefallLast) + else if (dY > 0.01D && stats.isInFreefallLast()) { //Impulse upwards - it's probably a jetpack from another mod if (dX < 0.01D && dZ < 0.01D) @@ -376,8 +378,8 @@ public void updateFreefall(EntityPlayer p) public void preVanillaMotion(EntityPlayerSP p) { this.setupFreefallPre(p); - GCPlayerStatsClient stats = GCPlayerStatsClient.get(p); - stats.ssOnGroundLast = p.onGround; + IStatsClientCapability stats = p.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); + stats.setSsOnGroundLast(p.onGround); } @SideOnly(Side.CLIENT) @@ -391,12 +393,12 @@ public void postVanillaMotion(EntityPlayerSP p) } WorldProviderZeroGravity worldProviderOrbit = (WorldProviderZeroGravity) worldProvider; SpinManager spinManager = worldProviderOrbit.getSpinManager(); - GCPlayerStatsClient stats = GCPlayerStatsClient.get(p); - boolean freefall = stats.inFreefall; + IStatsClientCapability stats = p.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); + boolean freefall = stats.isInFreefall(); // if (freefall) p.ySize = 0F; //Undo the sneak height adjust TODO Fix this for 1.8 freefall = this.testFreefall(p, freefall); - stats.inFreefall = freefall; - stats.inFreefallFirstCheck = true; + stats.setInFreefall(freefall); + stats.setInFreefallFirstCheck(true); boolean doGravity = true; @@ -433,13 +435,13 @@ public void postVanillaMotion(EntityPlayerSP p) //Check for block collisions here - if so move the player appropriately //First check that there are no existing collisions where the player is now (TODO: bounce the player away) - if (world.getCollidingBoundingBoxes(p, p.getEntityBoundingBox()).size() == 0) + if (world.getCollisionBoxes(p, p.getEntityBoundingBox()).size() == 0) { //Now check for collisions in the new direction and if there are some, try reducing the movement int collisions = 0; do { - List list = world.getCollidingBoundingBoxes(p, p.getEntityBoundingBox().addCoord(offsetX, 0.0D, offsetZ)); + List list = world.getCollisionBoxes(p, p.getEntityBoundingBox().addCoord(offsetX, 0.0D, offsetZ)); collisions = list.size(); if (collisions > 0) { @@ -555,7 +557,7 @@ public void postVanillaMotion(EntityPlayerSP p) //if (p.motionY != 0) p.motionY = this.pPrevMotionY; if (p.movementInput.jump) { - if (p.onGround || stats.ssOnGroundLast) + if (p.onGround || stats.isSsOnGroundLast()) { this.pjumpticks = 20; p.motionY -= 0.015D; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityClientPlayerMP.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityClientPlayerMP.java index 88a7b0aed4..79f0ffbd10 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityClientPlayerMP.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityClientPlayerMP.java @@ -5,7 +5,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.network.NetHandlerPlayClient; -import net.minecraft.stats.StatFileWriter; +import net.minecraft.stats.StatisticsManager; import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.relauncher.Side; @@ -13,7 +13,7 @@ public class GCEntityClientPlayerMP extends EntityPlayerSP { - public GCEntityClientPlayerMP(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandler, StatFileWriter statFileWriter) + public GCEntityClientPlayerMP(Minecraft mcIn, World worldIn, NetHandlerPlayClient netHandler, StatisticsManager statFileWriter) { super(mcIn, worldIn, netHandler, statFileWriter); } @@ -68,16 +68,16 @@ public boolean isSneaking() { if (this.worldObj.provider instanceof WorldProviderZeroGravity) { - GCPlayerStatsClient stats = GCPlayerStatsClient.get(this); - if (stats.freefallHandler.testFreefall(this)) + IStatsClientCapability stats = this.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); + if (stats.getFreefallHandler().testFreefall(this)) { return false; } - if (stats.inFreefall) + if (stats.isInFreefall()) { return false; } - if (stats.landingTicks > 0) + if (stats.getLandingTicks() > 0) { return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityPlayerMP.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityPlayerMP.java index cdae4ea00a..6a10978762 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityPlayerMP.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityPlayerMP.java @@ -23,7 +23,7 @@ public GCEntityPlayerMP(MinecraftServer server, WorldServer world, GameProfile p super(server, WorldUtil.getStartWorld(world), profile, itemInWorldManager); if (this.worldObj != world) { - GCPlayerStats.get(this).startAdventure(WorldUtil.getDimensionName(this.worldObj.provider)); + this.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null).setStartDimension(WorldUtil.getDimensionName(this.worldObj.provider)); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java index 5c0e1cb097..bb4413779d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java @@ -33,6 +33,7 @@ import micdoodle8.mods.galacticraft.planets.venus.VenusItems; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -111,6 +112,10 @@ public void onAttachCapability(AttachCapabilitiesEvent event) { event.addCapability(CapabilityStatsHandler.GC_PLAYER_PROP, new CapabilityProviderStats((EntityPlayerMP) event.getObject())); } + else if (event.getObject() instanceof EntityPlayerSP) + { + event.addCapability(CapabilityStatsClientHandler.GC_PLAYER_CLIENT_PROP, new CapabilityProviderStatsClient((EntityPlayerSP) event.getObject())); + } } // @SubscribeEvent diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java index 90ec63f471..fba0b545dd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStatsClient.java @@ -1,260 +1,223 @@ -package micdoodle8.mods.galacticraft.core.entities.player; - -import micdoodle8.mods.galacticraft.api.recipe.ISchematicPage; -import micdoodle8.mods.galacticraft.core.Constants; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.entity.Entity; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.world.World; - -import java.lang.ref.WeakReference; -import java.util.ArrayList; - -public class GCPlayerStatsClient implements IExtendedEntityProperties -{ - public static final ResourceLocation GC_PLAYER_PROP = new ResourceLocation(Constants.ASSET_PREFIX, "player_stats_client"); - - public WeakReference player; - - public boolean usingParachute; - public boolean lastUsingParachute; - public boolean usingAdvancedGoggles; - public int thermalLevel; - public boolean thermalLevelNormalising; - public int thirdPersonView = 0; - public long tick; - public boolean oxygenSetupValid = true; - AxisAlignedBB boundingBoxBefore; - public boolean lastOnGround; - - public double distanceSinceLastStep; - public int lastStep; - public boolean inFreefall; - public boolean inFreefallLast; - public boolean inFreefallFirstCheck; - public double downMotionLast; - public boolean lastRidingCameraZoomEntity; - public int landingTicks; - - public EnumGravity gdir = EnumGravity.down; - public float gravityTurnRate; - public float gravityTurnRatePrev; - public float gravityTurnVecX; - public float gravityTurnVecY; - public float gravityTurnVecZ; - public float gravityTurnYaw; - - public int spaceRaceInviteTeamID; - public boolean lastZoomed; - public int buildFlags = -1; - - public boolean ssOnGroundLast; - - public FreefallHandler freefallHandler = new FreefallHandler(); - - public ArrayList unlockedSchematics = new ArrayList(); - - public GCPlayerStatsClient(EntityPlayerSP player) - { - this.player = new WeakReference(player); - } - - public void setGravity(EnumGravity newGravity) - { - if (this.gdir == newGravity) - { - return; - } - this.gravityTurnRatePrev = this.gravityTurnRate = 0.0F; - float turnSpeed = 0.05F; - this.gravityTurnVecX = 0.0F; - this.gravityTurnVecY = 0.0F; - this.gravityTurnVecZ = 0.0F; - this.gravityTurnYaw = 0.0F; - - switch (this.gdir.getIntValue()) - { - case 1: - switch (newGravity.getIntValue()) - { - case 1: - break; - case 2: - this.gravityTurnVecX = -2.0F; - break; - case 3: - this.gravityTurnVecY = -1.0F; - this.gravityTurnYaw = -90.0F; - break; - case 4: - this.gravityTurnVecY = 1.0F; - this.gravityTurnYaw = 90.0F; - break; - case 5: - this.gravityTurnVecX = 1.0F; - break; - case 6: - this.gravityTurnVecX = -1.0F; - } - - break; - case 2: - switch (newGravity.getIntValue()) - { - case 1: - this.gravityTurnVecX = -2.0F; - break; - case 2: - break; - case 3: - this.gravityTurnVecY = 1.0F; - this.gravityTurnYaw = 90.0F; - break; - case 4: - this.gravityTurnVecY = -1.0F; - this.gravityTurnYaw = -90.0F; - break; - case 5: - this.gravityTurnVecX = -1.0F; - break; - case 6: - this.gravityTurnVecX = 1.0F; - } - - break; - case 3: - switch (newGravity.getIntValue()) - { - case 1: - this.gravityTurnVecY = 1.0F; - this.gravityTurnYaw = 90.0F; - break; - case 2: - this.gravityTurnVecY = -1.0F; - this.gravityTurnYaw = -90.0F; - break; - case 3: - break; - case 4: - this.gravityTurnVecZ = -2.0F; - break; - case 5: - this.gravityTurnVecZ = -1.0F; - this.gravityTurnYaw = -180.0F; - break; - case 6: - this.gravityTurnVecZ = 1.0F; - } - - break; - case 4: - switch (newGravity.getIntValue()) - { - case 1: - this.gravityTurnVecY = -1.0F; - this.gravityTurnYaw = -90.0F; - break; - case 2: - this.gravityTurnVecY = 1.0F; - this.gravityTurnYaw = 90.0F; - break; - case 3: - this.gravityTurnVecZ = -2.0F; - break; - case 4: - break; - case 5: - this.gravityTurnVecZ = 1.0F; - this.gravityTurnYaw = -180.0F; - break; - case 6: - this.gravityTurnVecZ = -1.0F; - } - - break; - case 5: - switch (newGravity.getIntValue()) - { - case 1: - this.gravityTurnVecX = -1.0F; - break; - case 2: - this.gravityTurnVecX = 1.0F; - break; - case 3: - this.gravityTurnVecZ = 1.0F; - this.gravityTurnYaw = 180.0F; - break; - case 4: - this.gravityTurnVecZ = -1.0F; - this.gravityTurnYaw = 180.0F; - break; - case 5: - break; - case 6: - this.gravityTurnVecX = -2.0F; - } - - break; - case 6: - switch (newGravity.getIntValue()) - { - case 1: - this.gravityTurnVecX = 1.0F; - break; - case 2: - this.gravityTurnVecX = -1.0F; - break; - case 3: - this.gravityTurnVecZ = -1.0F; - break; - case 4: - this.gravityTurnVecZ = 1.0F; - break; - case 5: - this.gravityTurnVecX = -2.0F; - case 6: - } - break; - } - - this.gdir = newGravity; - } - - public void setParachute(boolean tf) - { - this.usingParachute = tf; - - if (!tf) - { - this.lastUsingParachute = false; - } - } - - @Override - public void saveNBTData(NBTTagCompound nbt) - { - } - - @Override - public void loadNBTData(NBTTagCompound nbt) - { - } - - @Override - public void init(Entity entity, World world) - { - } - - public static void register(EntityPlayerSP player) - { - player.registerExtendedProperties(GCPlayerStatsClient.GC_PLAYER_PROP, new GCPlayerStatsClient(player)); - } - - public static GCPlayerStatsClient get(EntityPlayerSP player) - { - return (GCPlayerStatsClient) player.getExtendedProperties(GCPlayerStatsClient.GC_PLAYER_PROP); - } -} +//package micdoodle8.mods.galacticraft.core.entities.player; +// +//import micdoodle8.mods.galacticraft.api.recipe.ISchematicPage; +//import micdoodle8.mods.galacticraft.core.Constants; +//import net.minecraft.client.entity.EntityPlayerSP; +//import net.minecraft.entity.Entity; +//import net.minecraft.nbt.NBTTagCompound; +//import net.minecraft.util.ResourceLocation; +//import net.minecraft.util.math.AxisAlignedBB; +//import net.minecraft.world.World; +// +//import java.lang.ref.WeakReference; +//import java.util.ArrayList; +// +//public class GCPlayerStatsClient +//{ +// public static final ResourceLocation GC_PLAYER_PROP = new ResourceLocation(Constants.ASSET_PREFIX, "player_stats_client"); +// +// public WeakReference player; +// +// +// public GCPlayerStatsClient(EntityPlayerSP player) +// { +// this.player = new WeakReference(player); +// } +// +// public void setGravity(EnumGravity newGravity) +// { +// if (this.gdir == newGravity) +// { +// return; +// } +// this.gravityTurnRatePrev = this.gravityTurnRate = 0.0F; +// float turnSpeed = 0.05F; +// this.gravityTurnVecX = 0.0F; +// this.gravityTurnVecY = 0.0F; +// this.gravityTurnVecZ = 0.0F; +// this.gravityTurnYaw = 0.0F; +// +// switch (this.gdir.getIntValue()) +// { +// case 1: +// switch (newGravity.getIntValue()) +// { +// case 1: +// break; +// case 2: +// this.gravityTurnVecX = -2.0F; +// break; +// case 3: +// this.gravityTurnVecY = -1.0F; +// this.gravityTurnYaw = -90.0F; +// break; +// case 4: +// this.gravityTurnVecY = 1.0F; +// this.gravityTurnYaw = 90.0F; +// break; +// case 5: +// this.gravityTurnVecX = 1.0F; +// break; +// case 6: +// this.gravityTurnVecX = -1.0F; +// } +// +// break; +// case 2: +// switch (newGravity.getIntValue()) +// { +// case 1: +// this.gravityTurnVecX = -2.0F; +// break; +// case 2: +// break; +// case 3: +// this.gravityTurnVecY = 1.0F; +// this.gravityTurnYaw = 90.0F; +// break; +// case 4: +// this.gravityTurnVecY = -1.0F; +// this.gravityTurnYaw = -90.0F; +// break; +// case 5: +// this.gravityTurnVecX = -1.0F; +// break; +// case 6: +// this.gravityTurnVecX = 1.0F; +// } +// +// break; +// case 3: +// switch (newGravity.getIntValue()) +// { +// case 1: +// this.gravityTurnVecY = 1.0F; +// this.gravityTurnYaw = 90.0F; +// break; +// case 2: +// this.gravityTurnVecY = -1.0F; +// this.gravityTurnYaw = -90.0F; +// break; +// case 3: +// break; +// case 4: +// this.gravityTurnVecZ = -2.0F; +// break; +// case 5: +// this.gravityTurnVecZ = -1.0F; +// this.gravityTurnYaw = -180.0F; +// break; +// case 6: +// this.gravityTurnVecZ = 1.0F; +// } +// +// break; +// case 4: +// switch (newGravity.getIntValue()) +// { +// case 1: +// this.gravityTurnVecY = -1.0F; +// this.gravityTurnYaw = -90.0F; +// break; +// case 2: +// this.gravityTurnVecY = 1.0F; +// this.gravityTurnYaw = 90.0F; +// break; +// case 3: +// this.gravityTurnVecZ = -2.0F; +// break; +// case 4: +// break; +// case 5: +// this.gravityTurnVecZ = 1.0F; +// this.gravityTurnYaw = -180.0F; +// break; +// case 6: +// this.gravityTurnVecZ = -1.0F; +// } +// +// break; +// case 5: +// switch (newGravity.getIntValue()) +// { +// case 1: +// this.gravityTurnVecX = -1.0F; +// break; +// case 2: +// this.gravityTurnVecX = 1.0F; +// break; +// case 3: +// this.gravityTurnVecZ = 1.0F; +// this.gravityTurnYaw = 180.0F; +// break; +// case 4: +// this.gravityTurnVecZ = -1.0F; +// this.gravityTurnYaw = 180.0F; +// break; +// case 5: +// break; +// case 6: +// this.gravityTurnVecX = -2.0F; +// } +// +// break; +// case 6: +// switch (newGravity.getIntValue()) +// { +// case 1: +// this.gravityTurnVecX = 1.0F; +// break; +// case 2: +// this.gravityTurnVecX = -1.0F; +// break; +// case 3: +// this.gravityTurnVecZ = -1.0F; +// break; +// case 4: +// this.gravityTurnVecZ = 1.0F; +// break; +// case 5: +// this.gravityTurnVecX = -2.0F; +// case 6: +// } +// break; +// } +// +// this.gdir = newGravity; +// } +// +//// public void setParachute(boolean tf) +//// { +//// this.usingParachute = tf; +//// +//// if (!tf) +//// { +//// this.lastUsingParachute = false; +//// } +//// } +// +// @Override +// public void saveNBTData(NBTTagCompound nbt) +// { +// } +// +// @Override +// public void loadNBTData(NBTTagCompound nbt) +// { +// } +// +// @Override +// public void init(Entity entity, World world) +// { +// } +// +// public static void register(EntityPlayerSP player) +// { +// player.registerExtendedProperties(GCPlayerStatsClient.GC_PLAYER_PROP, new GCPlayerStatsClient(player)); +// } +// +// public static GCPlayerStatsClient get(EntityPlayerSP player) +// { +// return (GCPlayerStatsClient) player.getExtendedProperties(GCPlayerStatsClient.GC_PLAYER_PROP); +// } +//} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IStatsClientCapability.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IStatsClientCapability.java new file mode 100644 index 0000000000..54a64fc078 --- /dev/null +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IStatsClientCapability.java @@ -0,0 +1,135 @@ +package micdoodle8.mods.galacticraft.core.entities.player; + +import micdoodle8.mods.galacticraft.api.recipe.ISchematicPage; +import net.minecraft.util.math.AxisAlignedBB; + +import java.util.ArrayList; + +public interface IStatsClientCapability +{ + void setGravity(EnumGravity newGravity); + + boolean isUsingParachute(); + + void setUsingParachute(boolean usingParachute); + + boolean isLastUsingParachute(); + + void setLastUsingParachute(boolean lastUsingParachute); + + boolean isUsingAdvancedGoggles(); + + void setUsingAdvancedGoggles(boolean usingAdvancedGoggles); + + int getThermalLevel(); + + void setThermalLevel(int thermalLevel); + + boolean isThermalLevelNormalising(); + + void setThermalLevelNormalising(boolean thermalLevelNormalising); + + int getThirdPersonView(); + + void setThirdPersonView(int thirdPersonView); + + long getTick(); + + void setTick(long tick); + + boolean isOxygenSetupValid(); + + void setOxygenSetupValid(boolean oxygenSetupValid); + + AxisAlignedBB getBoundingBoxBefore(); + + void setBoundingBoxBefore(AxisAlignedBB boundingBoxBefore); + + boolean isLastOnGround(); + + void setLastOnGround(boolean lastOnGround); + + double getDistanceSinceLastStep(); + + void setDistanceSinceLastStep(double distanceSinceLastStep); + + int getLastStep(); + + void setLastStep(int lastStep); + + boolean isInFreefall(); + + void setInFreefall(boolean inFreefall); + + boolean isInFreefallLast(); + + void setInFreefallLast(boolean inFreefallLast); + + boolean isInFreefallFirstCheck(); + + void setInFreefallFirstCheck(boolean inFreefallFirstCheck); + + double getDownMotionLast(); + + void setDownMotionLast(double downMotionLast); + + boolean isLastRidingCameraZoomEntity(); + + void setLastRidingCameraZoomEntity(boolean lastRidingCameraZoomEntity); + + int getLandingTicks(); + + void setLandingTicks(int landingTicks); + + EnumGravity getGdir(); + + void setGdir(EnumGravity gdir); + + float getGravityTurnRate(); + + void setGravityTurnRate(float gravityTurnRate); + + float getGravityTurnRatePrev(); + + void setGravityTurnRatePrev(float gravityTurnRatePrev); + + float getGravityTurnVecX(); + + void setGravityTurnVecX(float gravityTurnVecX); + + float getGravityTurnVecY(); + + void setGravityTurnVecY(float gravityTurnVecY); + + float getGravityTurnVecZ(); + + void setGravityTurnVecZ(float gravityTurnVecZ); + + float getGravityTurnYaw(); + + void setGravityTurnYaw(float gravityTurnYaw); + + int getSpaceRaceInviteTeamID(); + + void setSpaceRaceInviteTeamID(int spaceRaceInviteTeamID); + + boolean isLastZoomed(); + + void setLastZoomed(boolean lastZoomed); + + int getBuildFlags(); + + void setBuildFlags(int buildFlags); + + boolean isSsOnGroundLast(); + + void setSsOnGroundLast(boolean ssOnGroundLast); + + FreefallHandler getFreefallHandler(); + + void setFreefallHandler(FreefallHandler freefallHandler); + + ArrayList getUnlockedSchematics(); + + void setUnlockedSchematics(ArrayList unlockedSchematics); +} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java index db80d6b21d..c1c1d9ec1d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java @@ -9,6 +9,7 @@ import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.client.FootprintRenderer; import micdoodle8.mods.galacticraft.core.client.model.ModelPlayerGC; +import micdoodle8.mods.galacticraft.core.client.sounds.GCSounds; import micdoodle8.mods.galacticraft.core.dimension.WorldProviderMoon; import micdoodle8.mods.galacticraft.core.dimension.WorldProviderZeroGravity; import micdoodle8.mods.galacticraft.core.entities.EntityLanderBase; @@ -26,8 +27,13 @@ import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.*; -import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.ChunkPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.FMLClientHandler; @@ -52,10 +58,10 @@ public boolean wakeUpPlayer(EntityPlayerSP player, boolean par1, boolean par2, b @Override public void onUpdate(EntityPlayerSP player) { - GCPlayerStatsClient stats = GCPlayerStatsClient.get(player); - stats.tick++; + IStatsClientCapability stats = player.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); + stats.setTick(stats.getTick() + 1); - if (stats.usingParachute && !player.capabilities.isFlying && !player.handleWaterMovement()) + if (stats.isUsingParachute() && !player.capabilities.isFlying && !player.handleWaterMovement()) { player.motionY = -0.5D; player.motionX *= 0.5F; @@ -66,9 +72,10 @@ public void onUpdate(EntityPlayerSP player) @Override public boolean isEntityInsideOpaqueBlock(EntityPlayerSP player, boolean vanillaInside) { - if (vanillaInside && GCPlayerStatsClient.get(player).inFreefall) + IStatsClientCapability stats = player.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); + if (vanillaInside && stats.isInFreefall()) { - GCPlayerStatsClient.get(player).inFreefall = false; + stats.setInFreefall(false); return false; } return !(player.getRidingEntity() instanceof EntityLanderBase) && vanillaInside; @@ -77,23 +84,23 @@ public boolean isEntityInsideOpaqueBlock(EntityPlayerSP player, boolean vanillaI @Override public void onLivingUpdatePre(EntityPlayerSP player) { - GCPlayerStatsClient stats = GCPlayerStatsClient.get(player); + IStatsClientCapability stats = player.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); if (player.worldObj.provider instanceof IGalacticraftWorldProvider) { if (!startup) { - stats.inFreefallLast = stats.inFreefall; - stats.inFreefall = stats.freefallHandler.testFreefall(player); + stats.setInFreefallLast(stats.isInFreefall()); + stats.setInFreefall(stats.getFreefallHandler().testFreefall(player)); startup = true; } if (player.worldObj.provider instanceof WorldProviderZeroGravity) { - stats.inFreefallLast = stats.inFreefall; - stats.inFreefall = stats.freefallHandler.testFreefall(player); - this.downMot2 = stats.downMotionLast; - stats.downMotionLast = player.motionY; - stats.freefallHandler.preVanillaMotion(player); + stats.setInFreefallLast(stats.isInFreefall()); + stats.setInFreefall(stats.getFreefallHandler().testFreefall(player)); + this.downMot2 = stats.getDownMotionLast(); + stats.setDownMotionLast(player.motionY); + stats.getFreefallHandler().preVanillaMotion(player); } } @@ -114,13 +121,13 @@ public void onLivingUpdatePre(EntityPlayerSP player) @Override public void onLivingUpdatePost(EntityPlayerSP player) { - GCPlayerStatsClient stats = GCPlayerStatsClient.get(player); + IStatsClientCapability stats = player.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); if (player.worldObj.provider instanceof WorldProviderZeroGravity) { - stats.freefallHandler.postVanillaMotion(player); + stats.getFreefallHandler().postVanillaMotion(player); - if (stats.inFreefall) + if (stats.isInFreefall()) { //No limb swing player.limbSwing -= player.limbSwingAmount; @@ -138,29 +145,29 @@ else if (player.limbSwing > 0) } else { - if (stats.inFreefallLast && this.downMot2 < -0.01D) + if (stats.isInFreefallLast() && this.downMot2 < -0.01D) { - stats.landingTicks = 2 - (int) (Math.min(this.downMot2, stats.downMotionLast) * 75); - if (stats.landingTicks > 6) + stats.setLandingTicks(2 - (int) (Math.min(this.downMot2, stats.getDownMotionLast()) * 75)); + if (stats.getLandingTicks() > 6) { - stats.landingTicks = 6; + stats.setLandingTicks(6); } } } - if (stats.landingTicks > 0) + if (stats.getLandingTicks() > 0) { - stats.landingTicks--; + stats.setLandingTicks(stats.getLandingTicks() - 1); } } else { - stats.inFreefall = false; + stats.setInFreefall(false); } boolean ridingThirdPersonEntity = player.getRidingEntity() instanceof ICameraZoomEntity && ((ICameraZoomEntity) player.getRidingEntity()).defaultThirdPerson(); - if (ridingThirdPersonEntity && !stats.lastRidingCameraZoomEntity) + if (ridingThirdPersonEntity && !stats.isLastRidingCameraZoomEntity()) { if(!ConfigManagerCore.disableVehicleCameraChanges) FMLClientHandler.instance().getClient().gameSettings.thirdPersonView = 1; @@ -170,33 +177,33 @@ else if (player.limbSwing > 0) { if(!ConfigManagerCore.disableVehicleCameraChanges) { - stats.lastZoomed = true; + stats.setLastZoomed(true); TickHandlerClient.zoom(((ICameraZoomEntity) player.getRidingEntity()).getCameraZoom()); } } - else if (stats.lastZoomed) + else if (stats.isLastZoomed()) { if(!ConfigManagerCore.disableVehicleCameraChanges) { - stats.lastZoomed = false; + stats.setLastZoomed(false); TickHandlerClient.zoom(4.0F); } } - stats.lastRidingCameraZoomEntity = ridingThirdPersonEntity; + stats.setLastRidingCameraZoomEntity(ridingThirdPersonEntity); - if (stats.usingParachute) + if (stats.isUsingParachute()) { player.fallDistance = 0.0F; } PlayerGearData gearData = ModelPlayerGC.getGearData(player); - stats.usingParachute = false; + stats.setUsingParachute(false); if (gearData != null) { - stats.usingParachute = gearData.getParachute() != null; + stats.setUsingParachute(gearData.getParachute() != null); if(!GalacticraftCore.isHeightConflictingModInstalled) { if (gearData.getMask() >= 0) @@ -212,35 +219,31 @@ else if (stats.lastZoomed) } } - if (stats.usingParachute && player.onGround) + if (stats.isUsingParachute() && player.onGround) { - stats.setParachute(false); - FMLClientHandler.instance().getClient().gameSettings.thirdPersonView = stats.thirdPersonView; + stats.setUsingParachute(false); + stats.setLastUsingParachute(false); + FMLClientHandler.instance().getClient().gameSettings.thirdPersonView = stats.getThirdPersonView(); } - if (!stats.lastUsingParachute && stats.usingParachute) + if (!stats.isLastUsingParachute() && stats.isUsingParachute()) { - FMLClientHandler.instance().getClient().getSoundHandler().playSound(new PositionedSoundRecord(new ResourceLocation(Constants.TEXTURE_PREFIX + "player.parachute"), 0.95F + player.getRNG().nextFloat() * 0.1F, 1.0F, (float) player.posX, (float) player.posY, (float) player.posZ)); + FMLClientHandler.instance().getClient().getSoundHandler().playSound(new PositionedSoundRecord(GCSounds.parachute, SoundCategory.PLAYERS, 0.95F + player.getRNG().nextFloat() * 0.1F, 1.0F, (float) player.posX, (float) player.posY, (float) player.posZ)); } - stats.lastUsingParachute = stats.usingParachute; - stats.lastOnGround = player.onGround; + stats.setLastUsingParachute(stats.isUsingParachute()); + stats.setLastOnGround(player.onGround); } @Override public float getBedOrientationInDegrees(EntityPlayerSP player, float vanillaDegrees) { - if (player.playerLocation != null) + if (player.bedLocation != null) { - int x = player.playerLocation.getX(); - int y = player.playerLocation.getY(); - int z = player.playerLocation.getZ(); - BlockPos pos = new BlockPos(x, y, z); - - if (player.worldObj.getTileEntity(pos) instanceof TileEntityAdvanced) + if (player.worldObj.getTileEntity(player.bedLocation) instanceof TileEntityAdvanced) { // int j = player.worldObj.getBlock(x, y, z).getBedDirection(player.worldObj, x, y, z); - IBlockState state = player.worldObj.getBlockState(pos); + IBlockState state = player.worldObj.getBlockState(player.bedLocation); switch (state.getBlock().getMetaFromState(state) - 4) { case 0: @@ -264,7 +267,7 @@ public float getBedOrientationInDegrees(EntityPlayerSP player, float vanillaDegr private void updateFeet(EntityPlayerSP player, double motionX, double motionZ) { - GCPlayerStatsClient stats = GCPlayerStatsClient.get(player); + IStatsClientCapability stats = player.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); double motionSqrd = motionX * motionX + motionZ * motionZ; // If the player is on the moon, not airbourne and not riding anything @@ -283,14 +286,14 @@ private void updateFeet(EntityPlayerSP player, double motionX, double motionZ) if (state.getBlock().getMetaFromState(state) == 5) { // If it has been long enough since the last step - if (stats.distanceSinceLastStep > 0.35) + if (stats.getDistanceSinceLastStep() > 0.35) { Vector3 pos = new Vector3(player); // Set the footprint position to the block below and add random number to stop z-fighting pos.y = MathHelper.floor_double(player.posY) + player.getRNG().nextFloat() / 100.0F; // Adjust footprint to left or right depending on step count - switch (stats.lastStep) + switch (stats.getLastStep()) { case 0: pos.translate(new Vector3(Math.sin(Math.toRadians(-player.rotationYaw + 90)) * 0.25, 0, Math.cos(Math.toRadians(-player.rotationYaw + 90)) * 0.25)); @@ -306,13 +309,12 @@ private void updateFeet(EntityPlayerSP player, double motionX, double motionZ) FootprintRenderer.addFootprint(chunkKey, player.worldObj.provider.getDimension(), pos, player.rotationYaw, player.getName()); // Increment and cap step counter at 1 - stats.lastStep++; - stats.lastStep %= 2; - stats.distanceSinceLastStep = 0; + stats.setLastStep((stats.getLastStep() + 1) % 2); + stats.setDistanceSinceLastStep(0); } else { - stats.distanceSinceLastStep += motionSqrd; + stats.setDistanceSinceLastStep(stats.getDistanceSinceLastStep() + motionSqrd); } } } @@ -321,14 +323,14 @@ private void updateFeet(EntityPlayerSP player, double motionX, double motionZ) public boolean wakeUpPlayer(EntityPlayerSP player, boolean par1, boolean par2, boolean par3, boolean bypass) { - BlockPos c = player.playerLocation; + BlockPos c = player.bedLocation; if (c != null) { EventWakePlayer event = new EventWakePlayer(player, c, par1, par2, par3, bypass); MinecraftForge.EVENT_BUS.post(event); - if (bypass || event.result == null || event.result == EntityPlayer.EnumStatus.OK) + if (bypass || event.result == null || event.result == EntityPlayer.SleepResult.OK) { return false; } @@ -345,8 +347,8 @@ public void onBuild(int i, EntityPlayerSP player) // 4,5,6 : Fuel loader, Launchpad, NASA Workbench // 7: oil found 8: placed rocket - GCPlayerStatsClient stats = GCPlayerStatsClient.get(player); - int flag = stats.buildFlags; + IStatsClientCapability stats = player.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); + int flag = stats.getBuildFlags(); if (flag == -1) { flag = 0; @@ -361,8 +363,8 @@ public void onBuild(int i, EntityPlayerSP player) return; } flag |= 1 << i; - stats.buildFlags = (flag & 511) + (repeatCount << 9); - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_BUILDFLAGS_UPDATE, player.worldObj.provider.getDimension(), new Object[] { stats.buildFlags })); + stats.setBuildFlags((flag & 511) + (repeatCount << 9)); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_BUILDFLAGS_UPDATE, player.worldObj.provider.getDimension(), new Object[] { stats.getBuildFlags() })); switch (i) { case 0: diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java index ad3fa42463..f24435d69d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java @@ -105,9 +105,8 @@ else if (par1DamageSource == DamageSource.fall || par1DamageSource == DamageSour int titaniumCount = 0; if (player.inventory != null) { - for (int i = 0; i < 4; i++) + for (ItemStack armorPiece : player.getArmorInventoryList()) { - ItemStack armorPiece = player.getCurrentArmor(i); if (armorPiece != null && armorPiece.getItem() instanceof ItemArmorAsteroids) { titaniumCount++; @@ -133,10 +132,12 @@ public void knockBack(EntityPlayerMP player, Entity p_70653_1_, float p_70653_2_ { for (int i = 0; i < 4; i++) { - ItemStack armorPiece = player.getCurrentArmor(i); - if (armorPiece != null && armorPiece.getItem() instanceof ItemArmorMars) + for (ItemStack armorPiece : player.getArmorInventoryList()) { - deshCount++; + if (armorPiece != null && armorPiece.getItem() instanceof ItemArmorMars) + { + deshCount++; + } } } } @@ -161,18 +162,16 @@ public void knockBack(EntityPlayerMP player, Entity p_70653_1_, float p_70653_2_ } } - - public boolean wakeUpPlayer(EntityPlayerMP player, boolean par1, boolean par2, boolean par3, boolean bypass) { - BlockPos c = player.playerLocation; + BlockPos c = player.bedLocation; if (c != null) { EventWakePlayer event = new EventWakePlayer(player, c, par1, par2, par3, bypass); MinecraftForge.EVENT_BUS.post(event); - if (bypass || event.result == null || event.result == EntityPlayer.EnumStatus.OK) + if (bypass || event.result == null || event.result == EntityPlayer.SleepResult.OK) { return false; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsClientCapability.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsClientCapability.java new file mode 100644 index 0000000000..9b761a9f93 --- /dev/null +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsClientCapability.java @@ -0,0 +1,582 @@ +package micdoodle8.mods.galacticraft.core.entities.player; + +import micdoodle8.mods.galacticraft.api.recipe.ISchematicPage; +import net.minecraft.util.math.AxisAlignedBB; + +import java.util.ArrayList; + +public class StatsClientCapability implements IStatsClientCapability +{ + public boolean usingParachute; + public boolean lastUsingParachute; + public boolean usingAdvancedGoggles; + public int thermalLevel; + public boolean thermalLevelNormalising; + public int thirdPersonView = 0; + public long tick; + public boolean oxygenSetupValid = true; + AxisAlignedBB boundingBoxBefore; + public boolean lastOnGround; + + public double distanceSinceLastStep; + public int lastStep; + public boolean inFreefall; + public boolean inFreefallLast; + public boolean inFreefallFirstCheck; + public double downMotionLast; + public boolean lastRidingCameraZoomEntity; + public int landingTicks; + + public EnumGravity gdir = EnumGravity.down; + public float gravityTurnRate; + public float gravityTurnRatePrev; + public float gravityTurnVecX; + public float gravityTurnVecY; + public float gravityTurnVecZ; + public float gravityTurnYaw; + + public int spaceRaceInviteTeamID; + public boolean lastZoomed; + public int buildFlags = -1; + + public boolean ssOnGroundLast; + + public FreefallHandler freefallHandler = new FreefallHandler(); + + public ArrayList unlockedSchematics = new ArrayList(); + + @Override + public void setGravity(EnumGravity newGravity) + { + if (this.gdir == newGravity) + { + return; + } + this.gravityTurnRatePrev = this.gravityTurnRate = 0.0F; + float turnSpeed = 0.05F; + this.gravityTurnVecX = 0.0F; + this.gravityTurnVecY = 0.0F; + this.gravityTurnVecZ = 0.0F; + this.gravityTurnYaw = 0.0F; + + switch (this.gdir.getIntValue()) + { + case 1: + switch (newGravity.getIntValue()) + { + case 1: + break; + case 2: + this.gravityTurnVecX = -2.0F; + break; + case 3: + this.gravityTurnVecY = -1.0F; + this.gravityTurnYaw = -90.0F; + break; + case 4: + this.gravityTurnVecY = 1.0F; + this.gravityTurnYaw = 90.0F; + break; + case 5: + this.gravityTurnVecX = 1.0F; + break; + case 6: + this.gravityTurnVecX = -1.0F; + } + + break; + case 2: + switch (newGravity.getIntValue()) + { + case 1: + this.gravityTurnVecX = -2.0F; + break; + case 2: + break; + case 3: + this.gravityTurnVecY = 1.0F; + this.gravityTurnYaw = 90.0F; + break; + case 4: + this.gravityTurnVecY = -1.0F; + this.gravityTurnYaw = -90.0F; + break; + case 5: + this.gravityTurnVecX = -1.0F; + break; + case 6: + this.gravityTurnVecX = 1.0F; + } + + break; + case 3: + switch (newGravity.getIntValue()) + { + case 1: + this.gravityTurnVecY = 1.0F; + this.gravityTurnYaw = 90.0F; + break; + case 2: + this.gravityTurnVecY = -1.0F; + this.gravityTurnYaw = -90.0F; + break; + case 3: + break; + case 4: + this.gravityTurnVecZ = -2.0F; + break; + case 5: + this.gravityTurnVecZ = -1.0F; + this.gravityTurnYaw = -180.0F; + break; + case 6: + this.gravityTurnVecZ = 1.0F; + } + + break; + case 4: + switch (newGravity.getIntValue()) + { + case 1: + this.gravityTurnVecY = -1.0F; + this.gravityTurnYaw = -90.0F; + break; + case 2: + this.gravityTurnVecY = 1.0F; + this.gravityTurnYaw = 90.0F; + break; + case 3: + this.gravityTurnVecZ = -2.0F; + break; + case 4: + break; + case 5: + this.gravityTurnVecZ = 1.0F; + this.gravityTurnYaw = -180.0F; + break; + case 6: + this.gravityTurnVecZ = -1.0F; + } + + break; + case 5: + switch (newGravity.getIntValue()) + { + case 1: + this.gravityTurnVecX = -1.0F; + break; + case 2: + this.gravityTurnVecX = 1.0F; + break; + case 3: + this.gravityTurnVecZ = 1.0F; + this.gravityTurnYaw = 180.0F; + break; + case 4: + this.gravityTurnVecZ = -1.0F; + this.gravityTurnYaw = 180.0F; + break; + case 5: + break; + case 6: + this.gravityTurnVecX = -2.0F; + } + + break; + case 6: + switch (newGravity.getIntValue()) + { + case 1: + this.gravityTurnVecX = 1.0F; + break; + case 2: + this.gravityTurnVecX = -1.0F; + break; + case 3: + this.gravityTurnVecZ = -1.0F; + break; + case 4: + this.gravityTurnVecZ = 1.0F; + break; + case 5: + this.gravityTurnVecX = -2.0F; + case 6: + } + break; + } + + this.gdir = newGravity; + } + + @Override + public boolean isUsingParachute() + { + return usingParachute; + } + + @Override + public void setUsingParachute(boolean usingParachute) + { + this.usingParachute = usingParachute; + } + + @Override + public boolean isLastUsingParachute() + { + return lastUsingParachute; + } + + @Override + public void setLastUsingParachute(boolean lastUsingParachute) + { + this.lastUsingParachute = lastUsingParachute; + } + + @Override + public boolean isUsingAdvancedGoggles() + { + return usingAdvancedGoggles; + } + + @Override + public void setUsingAdvancedGoggles(boolean usingAdvancedGoggles) + { + this.usingAdvancedGoggles = usingAdvancedGoggles; + } + + @Override + public int getThermalLevel() + { + return thermalLevel; + } + + @Override + public void setThermalLevel(int thermalLevel) + { + this.thermalLevel = thermalLevel; + } + + @Override + public boolean isThermalLevelNormalising() + { + return thermalLevelNormalising; + } + + @Override + public void setThermalLevelNormalising(boolean thermalLevelNormalising) + { + this.thermalLevelNormalising = thermalLevelNormalising; + } + + @Override + public int getThirdPersonView() + { + return thirdPersonView; + } + + @Override + public void setThirdPersonView(int thirdPersonView) + { + this.thirdPersonView = thirdPersonView; + } + + @Override + public long getTick() + { + return tick; + } + + @Override + public void setTick(long tick) + { + this.tick = tick; + } + + @Override + public boolean isOxygenSetupValid() + { + return oxygenSetupValid; + } + + @Override + public void setOxygenSetupValid(boolean oxygenSetupValid) + { + this.oxygenSetupValid = oxygenSetupValid; + } + + @Override + public AxisAlignedBB getBoundingBoxBefore() + { + return boundingBoxBefore; + } + + @Override + public void setBoundingBoxBefore(AxisAlignedBB boundingBoxBefore) + { + this.boundingBoxBefore = boundingBoxBefore; + } + + @Override + public boolean isLastOnGround() + { + return lastOnGround; + } + + @Override + public void setLastOnGround(boolean lastOnGround) + { + this.lastOnGround = lastOnGround; + } + + @Override + public double getDistanceSinceLastStep() + { + return distanceSinceLastStep; + } + + @Override + public void setDistanceSinceLastStep(double distanceSinceLastStep) + { + this.distanceSinceLastStep = distanceSinceLastStep; + } + + @Override + public int getLastStep() + { + return lastStep; + } + + @Override + public void setLastStep(int lastStep) + { + this.lastStep = lastStep; + } + + @Override + public boolean isInFreefall() + { + return inFreefall; + } + + @Override + public void setInFreefall(boolean inFreefall) + { + this.inFreefall = inFreefall; + } + + @Override + public boolean isInFreefallLast() + { + return inFreefallLast; + } + + @Override + public void setInFreefallLast(boolean inFreefallLast) + { + this.inFreefallLast = inFreefallLast; + } + + @Override + public boolean isInFreefallFirstCheck() + { + return inFreefallFirstCheck; + } + + @Override + public void setInFreefallFirstCheck(boolean inFreefallFirstCheck) + { + this.inFreefallFirstCheck = inFreefallFirstCheck; + } + + @Override + public double getDownMotionLast() + { + return downMotionLast; + } + + @Override + public void setDownMotionLast(double downMotionLast) + { + this.downMotionLast = downMotionLast; + } + + @Override + public boolean isLastRidingCameraZoomEntity() + { + return lastRidingCameraZoomEntity; + } + + @Override + public void setLastRidingCameraZoomEntity(boolean lastRidingCameraZoomEntity) + { + this.lastRidingCameraZoomEntity = lastRidingCameraZoomEntity; + } + + @Override + public int getLandingTicks() + { + return landingTicks; + } + + @Override + public void setLandingTicks(int landingTicks) + { + this.landingTicks = landingTicks; + } + + @Override + public EnumGravity getGdir() + { + return gdir; + } + + @Override + public void setGdir(EnumGravity gdir) + { + this.gdir = gdir; + } + + @Override + public float getGravityTurnRate() + { + return gravityTurnRate; + } + + @Override + public void setGravityTurnRate(float gravityTurnRate) + { + this.gravityTurnRate = gravityTurnRate; + } + + @Override + public float getGravityTurnRatePrev() + { + return gravityTurnRatePrev; + } + + @Override + public void setGravityTurnRatePrev(float gravityTurnRatePrev) + { + this.gravityTurnRatePrev = gravityTurnRatePrev; + } + + @Override + public float getGravityTurnVecX() + { + return gravityTurnVecX; + } + + @Override + public void setGravityTurnVecX(float gravityTurnVecX) + { + this.gravityTurnVecX = gravityTurnVecX; + } + + @Override + public float getGravityTurnVecY() + { + return gravityTurnVecY; + } + + @Override + public void setGravityTurnVecY(float gravityTurnVecY) + { + this.gravityTurnVecY = gravityTurnVecY; + } + + @Override + public float getGravityTurnVecZ() + { + return gravityTurnVecZ; + } + + @Override + public void setGravityTurnVecZ(float gravityTurnVecZ) + { + this.gravityTurnVecZ = gravityTurnVecZ; + } + + @Override + public float getGravityTurnYaw() + { + return gravityTurnYaw; + } + + @Override + public void setGravityTurnYaw(float gravityTurnYaw) + { + this.gravityTurnYaw = gravityTurnYaw; + } + + @Override + public int getSpaceRaceInviteTeamID() + { + return spaceRaceInviteTeamID; + } + + @Override + public void setSpaceRaceInviteTeamID(int spaceRaceInviteTeamID) + { + this.spaceRaceInviteTeamID = spaceRaceInviteTeamID; + } + + @Override + public boolean isLastZoomed() + { + return lastZoomed; + } + + @Override + public void setLastZoomed(boolean lastZoomed) + { + this.lastZoomed = lastZoomed; + } + + @Override + public int getBuildFlags() + { + return buildFlags; + } + + @Override + public void setBuildFlags(int buildFlags) + { + this.buildFlags = buildFlags; + } + + @Override + public boolean isSsOnGroundLast() + { + return ssOnGroundLast; + } + + @Override + public void setSsOnGroundLast(boolean ssOnGroundLast) + { + this.ssOnGroundLast = ssOnGroundLast; + } + + @Override + public FreefallHandler getFreefallHandler() + { + return freefallHandler; + } + + @Override + public void setFreefallHandler(FreefallHandler freefallHandler) + { + this.freefallHandler = freefallHandler; + } + + @Override + public ArrayList getUnlockedSchematics() + { + return unlockedSchematics; + } + + @Override + public void setUnlockedSchematics(ArrayList unlockedSchematics) + { + this.unlockedSchematics = unlockedSchematics; + } +} diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java index f6388b060c..e98619be26 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java @@ -20,16 +20,15 @@ import micdoodle8.mods.galacticraft.core.dimension.WorldProviderZeroGravity; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedZombie; import micdoodle8.mods.galacticraft.core.entities.EntityLanderBase; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsClientHandler; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsClientCapability; import micdoodle8.mods.galacticraft.core.network.PacketSimple; import micdoodle8.mods.galacticraft.core.network.PacketSimple.EnumSimplePacket; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.tick.TickHandlerServer; -import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; -import micdoodle8.mods.galacticraft.core.util.DamageSourceGC; -import micdoodle8.mods.galacticraft.core.util.OxygenUtil; -import micdoodle8.mods.galacticraft.core.util.PlayerUtil; +import micdoodle8.mods.galacticraft.core.util.*; import micdoodle8.mods.galacticraft.core.world.ChunkLoadingCallback; import micdoodle8.mods.galacticraft.core.wrappers.PlayerGearData; import micdoodle8.mods.galacticraft.planets.asteroids.AsteroidsModule; @@ -48,27 +47,33 @@ import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Biomes; import net.minecraft.init.Blocks; +import net.minecraft.init.MobEffects; import net.minecraft.item.Item; import net.minecraft.item.ItemFireball; import net.minecraft.item.ItemFlintAndSteel; import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.BiomeGenDesert; +import net.minecraft.world.biome.BiomeDesert; import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.client.event.EntityViewRenderEvent.FogColors; +import net.minecraftforge.client.event.EntityViewRenderEvent; import net.minecraftforge.client.event.sound.PlaySoundEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; -import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; +import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.living.LivingFallEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; -import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent; +import net.minecraftforge.event.entity.living.ZombieEvent; import net.minecraftforge.event.entity.player.FillBucketEvent; import net.minecraftforge.event.entity.player.PlayerDropsEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -95,13 +100,13 @@ public class EventHandlerGC @SubscribeEvent public void playerJoinWorld(EntityJoinWorldEvent event) { - TickHandlerServer.markWorldNeedsUpdate(event.world.provider.getDimension()); + TickHandlerServer.markWorldNeedsUpdate(event.getWorld().provider.getDimension()); } @SubscribeEvent public void onRocketLaunch(EntitySpaceshipBase.RocketLaunchEvent event) { -// if (!event.entity.worldObj.isRemote && event.entity.worldObj.provider.dimensionId == 0) +// if (!event.getEntity().worldObj.isRemote && event.getEntity().worldObj.provider.dimensionId == 0) // { // if (event.rocket.riddenByEntity instanceof EntityPlayerMP) // { @@ -113,7 +118,7 @@ public void onRocketLaunch(EntitySpaceshipBase.RocketLaunchEvent event) @SubscribeEvent public void onConfigChanged(ConfigChangedEvent event) { - if (event.modID.equals(Constants.MOD_ID_CORE)) + if (event.getModID().equals(Constants.MOD_ID_CORE)) { ConfigManagerCore.syncConfig(false); } @@ -122,42 +127,42 @@ public void onConfigChanged(ConfigChangedEvent event) @SubscribeEvent public void onWorldSave(Save event) { - ChunkLoadingCallback.save((WorldServer) event.world); + ChunkLoadingCallback.save((WorldServer) event.getWorld()); } @SubscribeEvent public void onChunkDataLoad(ChunkDataEvent.Load event) { - ChunkLoadingCallback.load((WorldServer) event.world); + ChunkLoadingCallback.load((WorldServer) event.getWorld()); } @SubscribeEvent public void onWorldLoad(Load event) { - if (!event.world.isRemote) + if (!event.getWorld().isRemote) { - ChunkLoadingCallback.load((WorldServer) event.world); + ChunkLoadingCallback.load((WorldServer) event.getWorld()); } } @SubscribeEvent public void onEntityDamaged(LivingHurtEvent event) { - if (event.source.damageType.equals(DamageSource.onFire.damageType)) + if (event.getSource().damageType.equals(DamageSource.onFire.damageType)) { - if (OxygenUtil.noAtmosphericCombustion(event.entityLiving.worldObj.provider)) + if (OxygenUtil.noAtmosphericCombustion(event.getEntityLiving().worldObj.provider)) { - if (OxygenUtil.isAABBInBreathableAirBlock(event.entityLiving.worldObj, event.entityLiving.getEntityBoundingBox())) + if (OxygenUtil.isAABBInBreathableAirBlock(event.getEntityLiving().worldObj, event.getEntityLiving().getEntityBoundingBox())) { return; } - if (event.entityLiving.worldObj instanceof WorldServer) + if (event.getEntityLiving().worldObj instanceof WorldServer) { - ((WorldServer) event.entityLiving.worldObj).spawnParticle(EnumParticleTypes.SMOKE_NORMAL, event.entityLiving.posX, event.entityLiving.posY + event.entityLiving.getEntityBoundingBox().maxY - event.entityLiving.getEntityBoundingBox().minY, event.entityLiving.posZ, 50, 0.0, 0.05, 0.0, 0.001); + ((WorldServer) event.getEntityLiving().worldObj).spawnParticle(EnumParticleTypes.SMOKE_NORMAL, event.getEntityLiving().posX, event.getEntityLiving().posY + event.getEntityLiving().getEntityBoundingBox().maxY - event.getEntityLiving().getEntityBoundingBox().minY, event.getEntityLiving().posZ, 50, 0.0, 0.05, 0.0, 0.001); } - event.entityLiving.extinguish(); + event.getEntityLiving().extinguish(); } } } @@ -165,45 +170,81 @@ public void onEntityDamaged(LivingHurtEvent event) @SubscribeEvent public void onEntityFall(LivingFallEvent event) { - if (event.entityLiving instanceof EntityPlayer) + if (event.getEntityLiving() instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) event.entityLiving; + EntityPlayer player = (EntityPlayer) event.getEntityLiving(); if (player.getRidingEntity() instanceof EntityAutoRocket || player.getRidingEntity() instanceof EntityLanderBase) { - event.distance = 0.0F; + event.setDistance(0.0F); event.setCanceled(true); return; } } - if (event.entityLiving.worldObj.provider instanceof IGalacticraftWorldProvider) + if (event.getEntityLiving().worldObj.provider instanceof IGalacticraftWorldProvider) { - event.distance *= ((IGalacticraftWorldProvider) event.entityLiving.worldObj.provider).getFallDamageModifier(); + event.setDistance(event.getDistance() * ((IGalacticraftWorldProvider) event.getEntityLiving().worldObj.provider).getFallDamageModifier()); } } @SubscribeEvent - public void onPlayerClicked(PlayerInteractEvent event) + public void onPlayerLeftClickedBlock(PlayerInteractEvent.LeftClickBlock event) { //Skip events triggered from Thaumcraft Golems and other non-players - if (event.entityPlayer == null || event.entityPlayer.inventory == null || event.pos == null || (event.pos.getX() == 0 && event.pos.getY() == 0 && event.pos.getZ() == 0)) + if (event.getEntityPlayer() == null || event.getEntityPlayer().inventory == null || event.getPos() == null || (event.getPos().getX() == 0 && event.getPos().getY() == 0 && event.getPos().getZ() == 0)) { return; } - final World worldObj = event.entityPlayer.worldObj; + final World worldObj = event.getEntityPlayer().worldObj; if (worldObj == null) { return; } - final Block idClicked = worldObj.getBlockState(event.pos).getBlock(); + final ItemStack heldStack = event.getEntityPlayer().inventory.getCurrentItem(); + final TileEntity tileClicked = worldObj.getTileEntity(event.getPos()); - if (idClicked == Blocks.bed && worldObj.provider instanceof IGalacticraftWorldProvider && event.action.equals(PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) && !worldObj.isRemote && !((IGalacticraftWorldProvider) worldObj.provider).hasBreathableAtmosphere()) + if (heldStack != null) + { + if (tileClicked != null && tileClicked instanceof IKeyable) + { + event.setCanceled(!((IKeyable) tileClicked).canBreak() && !event.getEntityPlayer().capabilities.isCreativeMode); + } + } + else if (tileClicked != null && tileClicked instanceof IKeyable) + { + event.setCanceled(!((IKeyable) tileClicked).canBreak() && !event.getEntityPlayer().capabilities.isCreativeMode); + } + } + + @SubscribeEvent + public void onPlayerRightClickedBlock(PlayerInteractEvent.RightClickBlock event) + { + //Skip events triggered from Thaumcraft Golems and other non-players + if (event.getEntityPlayer() == null || event.getEntityPlayer().inventory == null || event.getPos() == null || (event.getPos().getX() == 0 && event.getPos().getY() == 0 && event.getPos().getZ() == 0)) + { + return; + } + + final World worldObj = event.getEntityPlayer().worldObj; + if (worldObj == null) + { + return; + } + + final Block idClicked = worldObj.getBlockState(event.getPos()).getBlock(); + + if (idClicked == Blocks.BED && worldObj.provider instanceof IGalacticraftWorldProvider && !worldObj.isRemote && !((IGalacticraftWorldProvider) worldObj.provider).hasBreathableAtmosphere()) { if (GalacticraftCore.isPlanetsLoaded) { - GCPlayerStats.tryBedWarning((EntityPlayerMP) event.entityPlayer); + IStatsCapability stats = event.getEntityPlayer().getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + if (!stats.hasReceivedBedWarning()) + { + event.getEntityPlayer().addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.bed_fail.message"))); + stats.setReceivedBedWarning(true); + } } if (worldObj.provider instanceof WorldProviderZeroGravity) @@ -221,7 +262,7 @@ public void onPlayerClicked(PlayerInteractEvent event) EventHandlerGC.bedActivated = true; //On planets allow the bed to be used to designate a player spawn point - event.entityPlayer.setSpawnChunk(event.pos, false, event.world.provider.getDimension()); + event.getEntityPlayer().setSpawnChunk(event.getPos(), false, event.getWorld().provider.getDimension()); } else { @@ -229,43 +270,35 @@ public void onPlayerClicked(PlayerInteractEvent event) } } - final ItemStack heldStack = event.entityPlayer.inventory.getCurrentItem(); - final TileEntity tileClicked = worldObj.getTileEntity(event.pos); + final ItemStack heldStack = event.getEntityPlayer().inventory.getCurrentItem(); + final TileEntity tileClicked = worldObj.getTileEntity(event.getPos()); if (heldStack != null) { if (tileClicked != null && tileClicked instanceof IKeyable) { - if (event.action.equals(PlayerInteractEvent.Action.LEFT_CLICK_BLOCK)) + if (heldStack.getItem() instanceof IKeyItem) { - event.setCanceled(!((IKeyable) tileClicked).canBreak() && !event.entityPlayer.capabilities.isCreativeMode); - return; - } - else if (event.action.equals(PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)) - { - if (heldStack.getItem() instanceof IKeyItem) + if (((IKeyItem) heldStack.getItem()).getTier(heldStack) == -1 || ((IKeyable) tileClicked).getTierOfKeyRequired() == -1 || ((IKeyItem) heldStack.getItem()).getTier(heldStack) == ((IKeyable) tileClicked).getTierOfKeyRequired()) { - if (((IKeyItem) heldStack.getItem()).getTier(heldStack) == -1 || ((IKeyable) tileClicked).getTierOfKeyRequired() == -1 || ((IKeyItem) heldStack.getItem()).getTier(heldStack) == ((IKeyable) tileClicked).getTierOfKeyRequired()) - { - event.setCanceled(((IKeyable) tileClicked).onValidKeyActivated(event.entityPlayer, heldStack, event.face)); - } - else - { - event.setCanceled(((IKeyable) tileClicked).onActivatedWithoutKey(event.entityPlayer, event.face)); - } + event.setCanceled(((IKeyable) tileClicked).onValidKeyActivated(event.getEntityPlayer(), heldStack, event.getFace())); } else { - event.setCanceled(((IKeyable) tileClicked).onActivatedWithoutKey(event.entityPlayer, event.face)); + event.setCanceled(((IKeyable) tileClicked).onActivatedWithoutKey(event.getEntityPlayer(), event.getFace())); } } + else + { + event.setCanceled(((IKeyable) tileClicked).onActivatedWithoutKey(event.getEntityPlayer(), event.getFace())); + } } if (heldStack.getItem() instanceof ItemFlintAndSteel || heldStack.getItem() instanceof ItemFireball) { - if (!worldObj.isRemote && event.action.equals(PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)) + if (!worldObj.isRemote) { - if (idClicked != Blocks.tnt && OxygenUtil.noAtmosphericCombustion(event.entityPlayer.worldObj.provider) && !OxygenUtil.isAABBInBreathableAirBlock(event.entityLiving.worldObj, new AxisAlignedBB(event.pos.getX(), event.pos.getY(), event.pos.getZ(), event.pos.getX() + 1, event.pos.getY() + 2, event.pos.getZ() + 1))) + if (idClicked != Blocks.TNT && OxygenUtil.noAtmosphericCombustion(event.getEntityPlayer().worldObj.provider) && !OxygenUtil.isAABBInBreathableAirBlock(event.getEntityLiving().worldObj, new AxisAlignedBB(event.getPos().getX(), event.getPos().getY(), event.getPos().getZ(), event.getPos().getX() + 1, event.getPos().getY() + 2, event.getPos().getZ() + 1))) { event.setCanceled(true); } @@ -274,20 +307,14 @@ else if (event.action.equals(PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)) } else if (tileClicked != null && tileClicked instanceof IKeyable) { - if (event.action.equals(PlayerInteractEvent.Action.LEFT_CLICK_BLOCK)) - { - event.setCanceled(!((IKeyable) tileClicked).canBreak() && !event.entityPlayer.capabilities.isCreativeMode); - return; - } - - event.setCanceled(((IKeyable) tileClicked).onActivatedWithoutKey(event.entityPlayer, event.face)); + event.setCanceled(((IKeyable) tileClicked).onActivatedWithoutKey(event.getEntityPlayer(), event.getFace())); } } @SubscribeEvent - public void entityLivingEvent(LivingUpdateEvent event) + public void entityLivingEvent(LivingEvent.LivingUpdateEvent event) { - final EntityLivingBase entityLiving = event.entityLiving; + final EntityLivingBase entityLiving = event.getEntityLiving(); if (entityLiving instanceof EntityPlayerMP) { GalacticraftCore.handler.onPlayerUpdate((EntityPlayerMP) entityLiving); @@ -329,7 +356,7 @@ public void entityLivingEvent(LivingUpdateEvent event) } } - private ItemStack fillBucket(World world, MovingObjectPosition position) + private ItemStack fillBucket(World world, RayTraceResult position) { IBlockState state = world.getBlockState(position.getBlockPos()); Block block = state.getBlock(); @@ -348,32 +375,32 @@ private ItemStack fillBucket(World world, MovingObjectPosition position) @SubscribeEvent public void onBucketFill(FillBucketEvent event) { - MovingObjectPosition pos = event.target; - ItemStack ret = fillBucket(event.world, pos); + RayTraceResult pos = event.getTarget(); + ItemStack ret = fillBucket(event.getWorld(), pos); if (ret == null) { return; } - event.result = ret; + event.setFilledBucket(ret); event.setResult(Result.ALLOW); } @SubscribeEvent public void populate(PopulateChunkEvent.Post event) { - final boolean doGen = TerrainGen.populate(event.chunkProvider, event.world, event.rand, event.chunkX, event.chunkZ, event.hasVillageGenerated, PopulateChunkEvent.Populate.EventType.CUSTOM); + final boolean doGen = TerrainGen.populate(event.getGenerator(), event.getWorld(), event.getRand(), event.getChunkX(), event.getChunkZ(), event.isHasVillageGenerated(), PopulateChunkEvent.Populate.EventType.CUSTOM); if (!doGen) { return; } - final int worldX = event.chunkX << 4; - final int worldZ = event.chunkZ << 4; + final int worldX = event.getChunkX() << 4; + final int worldZ = event.getChunkZ() << 4; - EventHandlerGC.generateOil(event.world, event.rand, worldX + event.rand.nextInt(16), worldZ + event.rand.nextInt(16), false); + EventHandlerGC.generateOil(event.getWorld(), event.getRand(), worldX + event.getRand().nextInt(16), worldZ + event.getRand().nextInt(16), false); } public static boolean oilPresent(World world, Random rand, int x, int z, BlockVec3 pos) @@ -394,9 +421,9 @@ public static boolean oilPresent(World world, Random rand, int x, int z, BlockVe return false; } - final Biome biomegenbase = world.getBiomeGenForCoords(new BlockPos(x + 8, 0, z + 8)); + final Biome biome = world.getBiome(new BlockPos(x + 8, 0, z + 8)); - if (biomegenbase.biomeID == Biome.sky.biomeID || biomegenbase.biomeID == Biome.hell.biomeID) + if (biome == Biomes.SKY || biome == Biomes.HELL) { return false; } @@ -408,15 +435,15 @@ public static boolean oilPresent(World world, Random rand, int x, int z, BlockVe double randMod = Math.min(0.2D, 0.08D * ConfigManagerCore.oilGenFactor); - if (biomegenbase.minHeight >= 0.45F) + if (biome.getBaseHeight() >= 0.45F) { randMod /= 2; } - if (biomegenbase.minHeight < -0.5F) + if (biome.getBaseHeight() < -0.5F) { randMod *= 1.8; } - if (biomegenbase instanceof BiomeGenDesert) + if (biome instanceof BiomeDesert) { randMod *= 1.8; } @@ -556,8 +583,9 @@ public static void retrogenOil(World world, Chunk chunk) private static boolean checkBlock(World w, BlockPos pos) { - Block b = w.getBlockState(pos).getBlock(); - if (b.getMaterial() == Material.AIR) + IBlockState state = w.getBlockState(pos); + Block b = state.getBlock(); + if (b.getMaterial(state) == Material.AIR) { return true; } @@ -581,20 +609,20 @@ private static boolean checkBlockAbove(World w, BlockPos pos) @SubscribeEvent public void schematicUnlocked(Unlock event) { - GCPlayerStats stats = GCPlayerStats.get(event.player); + IStatsCapability stats = event.player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); - if (!stats.unlockedSchematics.contains(event.page)) + if (!stats.getUnlockedSchematics().contains(event.page)) { - stats.unlockedSchematics.add(event.page); - Collections.sort(stats.unlockedSchematics); + stats.getUnlockedSchematics().add(event.page); + Collections.sort(stats.getUnlockedSchematics()); - if (event.player != null && event.player.playerNetServerHandler != null) + if (event.player != null && event.player.connection != null) { - Integer[] iArray = new Integer[stats.unlockedSchematics.size()]; + Integer[] iArray = new Integer[stats.getUnlockedSchematics().size()]; for (int i = 0; i < iArray.length; i++) { - ISchematicPage page = stats.unlockedSchematics.get(i); + ISchematicPage page = stats.getUnlockedSchematics().get(i); iArray[i] = page == null ? -2 : page.getPageID(); } @@ -635,11 +663,11 @@ private static ISchematicPage getNextSchematic(int currentIndex) final HashMap idList = new HashMap(); EntityPlayerSP player = PlayerUtil.getPlayerBaseClientFromPlayer(FMLClientHandler.instance().getClient().thePlayer, false); - GCPlayerStatsClient stats = GCPlayerStatsClient.get(player); + IStatsClientCapability stats = player.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); - for (int i = 0; i < stats.unlockedSchematics.size(); i++) + for (int i = 0; i < stats.getUnlockedSchematics().size(); i++) { - idList.put(i, stats.unlockedSchematics.get(i).getPageID()); + idList.put(i, stats.getUnlockedSchematics().get(i).getPageID()); } final SortedSet keys = new TreeSet(idList.keySet()); @@ -652,9 +680,9 @@ private static ISchematicPage getNextSchematic(int currentIndex) if (page.getPageID() == currentIndex) { - if (count + 1 < stats.unlockedSchematics.size()) + if (count + 1 < stats.getUnlockedSchematics().size()) { - return stats.unlockedSchematics.get(count + 1); + return stats.getUnlockedSchematics().get(count + 1); } else { @@ -672,11 +700,11 @@ private static ISchematicPage getLastSchematic(int currentIndex) final HashMap idList = new HashMap(); EntityPlayerSP player = PlayerUtil.getPlayerBaseClientFromPlayer(FMLClientHandler.instance().getClient().thePlayer, false); - GCPlayerStatsClient stats = GCPlayerStatsClient.get(player); + IStatsClientCapability stats = player.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); - for (int i = 0; i < stats.unlockedSchematics.size(); i++) + for (int i = 0; i < stats.getUnlockedSchematics().size(); i++) { - idList.put(i, stats.unlockedSchematics.get(i).getPageID()); + idList.put(i, stats.getUnlockedSchematics().get(i).getPageID()); } final SortedSet keys = new TreeSet(idList.keySet()); @@ -691,7 +719,7 @@ private static ISchematicPage getLastSchematic(int currentIndex) { if (count - 1 >= 0) { - return stats.unlockedSchematics.get(count - 1); + return stats.getUnlockedSchematics().get(count - 1); } else { @@ -706,23 +734,23 @@ private static ISchematicPage getLastSchematic(int currentIndex) @SubscribeEvent public void onPlayerDeath(PlayerDropsEvent event) { - if (event.entityLiving instanceof EntityPlayerMP) + if (event.getEntityLiving() instanceof EntityPlayerMP) { - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) event.entityLiving); - if (!event.entityLiving.worldObj.getGameRules().getBoolean("keepInventory")) + IStatsCapability stats = event.getEntityLiving().getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + if (!event.getEntityLiving().worldObj.getGameRules().getBoolean("keepInventory")) { - event.entityLiving.captureDrops = true; - for (int i = stats.extendedInventory.getSizeInventory() - 1; i >= 0; i--) + event.getEntityLiving().captureDrops = true; + for (int i = stats.getExtendedInventory().getSizeInventory() - 1; i >= 0; i--) { - ItemStack stack = stats.extendedInventory.getStackInSlot(i); + ItemStack stack = stats.getExtendedInventory().getStackInSlot(i); if (stack != null) { - ((EntityPlayerMP) event.entityLiving).dropItem(stack, true, false); - stats.extendedInventory.setInventorySlotContents(i, null); + ((EntityPlayerMP) event.getEntityLiving()).dropItem(stack, true, false); + stats.getExtendedInventory().setInventorySlotContents(i, null); } } - event.entityLiving.captureDrops = false; + event.getEntityLiving().captureDrops = false; } } } @@ -787,7 +815,7 @@ public void onLeaveBedButtonClicked(SleepCancelledEvent event) { EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer; - BlockPos c = player.playerLocation; + BlockPos c = player.bedLocation; if (c != null) { @@ -798,13 +826,13 @@ public void onLeaveBedButtonClicked(SleepCancelledEvent event) } @SubscribeEvent - public void onZombieSummonAid(SummonAidEvent event) + public void onZombieSummonAid(ZombieEvent.SummonAidEvent event) { - if (event.entity instanceof EntityEvolvedZombie) + if (event.getEntity() instanceof EntityEvolvedZombie) { - event.customSummonedAid = new EntityEvolvedZombie(event.world); + event.setCustomSummonedAid(new EntityEvolvedZombie(event.getWorld())); - if (((EntityLivingBase) event.entity).getRNG().nextFloat() < ((EntityEvolvedZombie) event.entity).getEntityAttribute(((EntityEvolvedZombie) event.entity).getReinforcementsAttribute()).getAttributeValue()) + if (((EntityLivingBase) event.getEntity()).getRNG().nextFloat() < ((EntityEvolvedZombie) event.getEntity()).getEntityAttribute(((EntityEvolvedZombie) event.getEntity()).getReinforcementsAttribute()).getAttributeValue()) { event.setResult(Result.ALLOW); } @@ -817,28 +845,28 @@ public void onZombieSummonAid(SummonAidEvent event) @SideOnly(Side.CLIENT) @SubscribeEvent - public void overrideSkyColor(FogColors event) + public void overrideSkyColor(EntityViewRenderEvent.FogColors event) { //Disable any night vision effects on the sky, if the planet has no atmosphere - if (event.entity instanceof EntityLivingBase && ((EntityLivingBase) event.entity).isPotionActive(Potion.nightVision)) + if (event.getEntity() instanceof EntityLivingBase && ((EntityLivingBase) event.getEntity()).isPotionActive(MobEffects.NIGHT_VISION)) { WorldClient worldclient = Minecraft.getMinecraft().theWorld; - if (worldclient.provider instanceof IGalacticraftWorldProvider && ((IGalacticraftWorldProvider) worldclient.provider).getCelestialBody().atmosphere.size() == 0 && event.block.getMaterial() == Material.AIR && !((IGalacticraftWorldProvider) worldclient.provider).hasBreathableAtmosphere()) + if (worldclient.provider instanceof IGalacticraftWorldProvider && ((IGalacticraftWorldProvider) worldclient.provider).getCelestialBody().atmosphere.size() == 0 && event.getState().getBlock().getMaterial(event.getState()) == Material.AIR && !((IGalacticraftWorldProvider) worldclient.provider).hasBreathableAtmosphere()) { - Vec3 vec = worldclient.getFogColor(1.0F); - event.red = (float) vec.xCoord; - event.green = (float) vec.yCoord; - event.blue = (float) vec.zCoord; + Vec3d vec = worldclient.getFogColor(1.0F); + event.setRed((float) vec.xCoord); + event.setGreen((float) vec.yCoord); + event.setBlue((float) vec.zCoord); return; } - if (worldclient.provider.getSkyRenderer() instanceof SkyProviderOverworld && event.entity.posY > Constants.OVERWORLD_SKYPROVIDER_STARTHEIGHT) + if (worldclient.provider.getSkyRenderer() instanceof SkyProviderOverworld && event.getEntity().posY > Constants.OVERWORLD_SKYPROVIDER_STARTHEIGHT) { - Vec3 vec = TransformerHooks.getFogColorHook(event.entity.worldObj); - event.red = (float) vec.xCoord; - event.green = (float) vec.yCoord; - event.blue = (float) vec.zCoord; + Vec3d vec = TransformerHooks.getFogColorHook(event.getEntity().worldObj); + event.setRed((float) vec.xCoord); + event.setGreen((float) vec.yCoord); + event.setBlue((float) vec.zCoord); return; } } @@ -851,7 +879,7 @@ public void overrideSkyColor(FogColors event) public void onSoundPlayed(PlaySoundEvent event) { //The event.result starts off equal to event.sound, but could have been altered or set to null by another mod - if (event.result == null) + if (event.getResultSound() == null) { return; } @@ -861,13 +889,13 @@ public void onSoundPlayed(PlaySoundEvent event) if (player != null && player.worldObj != null && player.worldObj.provider instanceof IGalacticraftWorldProvider && event != null) { //Only modify standard game sounds, not music - if (event.result.getAttenuationType() != ISound.AttenuationType.NONE) + if (event.getResultSound().getAttenuationType() != ISound.AttenuationType.NONE) { PlayerGearData gearData = ClientProxyCore.playerItemData.get(player.getGameProfile().getName()); - float x = event.result.getXPosF(); - float y = event.result.getYPosF(); - float z = event.result.getZPosF(); + float x = event.getResultSound().getXPosF(); + float y = event.getResultSound().getYPosF(); + float z = event.getResultSound().getZPosF(); if (gearData == null || gearData.getFrequencyModule() == -1) { @@ -878,14 +906,14 @@ public void onSoundPlayed(PlaySoundEvent event) boolean soundInAtmosphere = OxygenUtil.isAABBInBreathableAirBlock(player.worldObj, bb); if ((!playerInAtmosphere || !soundInAtmosphere)) { - float volume = event.result.getVolume(); + float volume = event.getResultSound().getVolume(); //First check for duplicate firing of PlaySoundEvent17 on this handler's own playing of a reduced volume sound (see below) for (int i = 0; i < this.soundPlayList.size(); i++) { SoundPlayEntry entry = this.soundPlayList.get(i); - if (entry.name.equals(event.name) && entry.x == x && entry.y == y && entry.z == z && entry.volume == volume) + if (entry.name.equals(event.getName()) && entry.x == x && entry.y == y && entry.z == z && entry.volume == volume) { this.soundPlayList.remove(i); return; @@ -895,11 +923,11 @@ public void onSoundPlayed(PlaySoundEvent event) //If it's not a duplicate: play the same sound but at reduced volume float newVolume = volume / Math.max(0.01F, ((IGalacticraftWorldProvider) player.worldObj.provider).getSoundVolReductionAmount()); - this.soundPlayList.add(new SoundPlayEntry(event.name, x, y, z, newVolume)); - ISound newSound = new PositionedSoundRecord(event.result.getSoundLocation(), newVolume, event.result.getPitch(), x, y, z); - event.manager.playSound(newSound); - event.result = null; - return; + this.soundPlayList.add(new SoundPlayEntry(event.getName(), x, y, z, newVolume)); + SoundEvent soundEvent = SoundEvent.REGISTRY.getObject(event.getResultSound().getSoundLocation()); + ISound newSound = new PositionedSoundRecord(soundEvent, SoundCategory.NEUTRAL, newVolume, event.getResultSound().getPitch(), x, y, z); + event.getManager().playSound(newSound); + event.setResultSound(null); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java index ecab32f32b..b067e1c165 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java @@ -295,11 +295,12 @@ else if (headblock == GCBlocks.brightAir) if (!this.sealed) { - if (this.head.getBlockID(this.world) == GCBlocks.breatheableAir) + Block block = this.head.getBlockState(this.world).getBlock(); + if (block == GCBlocks.breatheableAir) { this.breatheableToReplace.add(this.head); } - if (this.head.getBlockID(this.world) == GCBlocks.brightBreatheableAir) + if (block == GCBlocks.brightBreatheableAir) { this.breatheableToReplaceBright.add(this.head); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java index bf62db4f99..f524b2ff36 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java @@ -164,7 +164,7 @@ else if (var2.getItem() == GCItems.rocketEngine) return null; } } - else if (var2.getItem() == Item.getItemFromBlock(Blocks.chest)) + else if (var2.getItem() == Item.getItemFromBlock(Blocks.CHEST)) { if (!this.mergeOneItem(var4, 15, 18, false)) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBuggy.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBuggy.java index f697512781..8f41399057 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBuggy.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBuggy.java @@ -14,8 +14,10 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.*; -import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.*; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.relauncher.Side; @@ -57,15 +59,15 @@ public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + public ActionResult onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { final float var4 = 1.0F; - final float var5 = par3EntityPlayer.prevRotationPitch + (par3EntityPlayer.rotationPitch - par3EntityPlayer.prevRotationPitch) * var4; - final float var6 = par3EntityPlayer.prevRotationYaw + (par3EntityPlayer.rotationYaw - par3EntityPlayer.prevRotationYaw) * var4; - final double var7 = par3EntityPlayer.prevPosX + (par3EntityPlayer.posX - par3EntityPlayer.prevPosX) * var4; - final double var9 = par3EntityPlayer.prevPosY + (par3EntityPlayer.posY - par3EntityPlayer.prevPosY) * var4 + 1.62D - par3EntityPlayer.getYOffset(); - final double var11 = par3EntityPlayer.prevPosZ + (par3EntityPlayer.posZ - par3EntityPlayer.prevPosZ) * var4; - final Vec3 var13 = new Vec3(var7, var9, var11); + final float var5 = playerIn.prevRotationPitch + (playerIn.rotationPitch - playerIn.prevRotationPitch) * var4; + final float var6 = playerIn.prevRotationYaw + (playerIn.rotationYaw - playerIn.prevRotationYaw) * var4; + final double var7 = playerIn.prevPosX + (playerIn.posX - playerIn.prevPosX) * var4; + final double var9 = playerIn.prevPosY + (playerIn.posY - playerIn.prevPosY) * var4 + 1.62D - playerIn.getYOffset(); + final double var11 = playerIn.prevPosZ + (playerIn.posZ - playerIn.prevPosZ) * var4; + final Vec3d var13 = new Vec3d(var7, var9, var11); final float var14 = MathHelper.cos(-var6 * 0.017453292F - (float) Math.PI); final float var15 = MathHelper.sin(-var6 * 0.017453292F - (float) Math.PI); final float var16 = -MathHelper.cos(-var5 * 0.017453292F); @@ -73,19 +75,19 @@ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, Enti final float var18 = var15 * var16; final float var20 = var14 * var16; final double var21 = 5.0D; - final Vec3 var23 = var13.addVector(var18 * var21, var17 * var21, var20 * var21); - final MovingObjectPosition var24 = par2World.rayTraceBlocks(var13, var23, true); + final Vec3d var23 = var13.addVector(var18 * var21, var17 * var21, var20 * var21); + final RayTraceResult var24 = worldIn.rayTraceBlocks(var13, var23, true); if (var24 == null) { - return par1ItemStack; + return new ActionResult<>(EnumActionResult.PASS, itemStackIn); } else { - final Vec3 var25 = par3EntityPlayer.getLook(var4); + final Vec3d var25 = playerIn.getLook(var4); boolean var26 = false; final float var27 = 1.0F; - final List var28 = par2World.getEntitiesWithinAABBExcludingEntity(par3EntityPlayer, par3EntityPlayer.getEntityBoundingBox().addCoord(var25.xCoord * var21, var25.yCoord * var21, var25.zCoord * var21).expand(var27, var27, var27)); + final List var28 = worldIn.getEntitiesWithinAABBExcludingEntity(playerIn, playerIn.getEntityBoundingBox().addCoord(var25.xCoord * var21, var25.yCoord * var21, var25.zCoord * var21).expand(var27, var27, var27)); int var29; for (var29 = 0; var29 < var28.size(); ++var29) @@ -106,45 +108,45 @@ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, Enti if (var26) { - return par1ItemStack; + return new ActionResult<>(EnumActionResult.PASS, itemStackIn); } else { - if (var24.typeOfHit == MovingObjectType.BLOCK) + if (var24.typeOfHit == RayTraceResult.Type.BLOCK) { var29 = var24.getBlockPos().getX(); int var33 = var24.getBlockPos().getY(); final int var34 = var24.getBlockPos().getZ(); - if (par2World.getBlockState(new BlockPos(var29, var33, var34)) == Blocks.snow) + if (worldIn.getBlockState(new BlockPos(var29, var33, var34)) == Blocks.SNOW) { --var33; } - final EntityBuggy var35 = new EntityBuggy(par2World, var29 + 0.5F, var33 + 1.0F, var34 + 0.5F, par1ItemStack.getItemDamage()); + final EntityBuggy var35 = new EntityBuggy(worldIn, var29 + 0.5F, var33 + 1.0F, var34 + 0.5F, itemStackIn.getItemDamage()); - if (!par2World.getCollidingBoundingBoxes(var35, var35.getEntityBoundingBox().expand(-0.1D, -0.1D, -0.1D)).isEmpty()) + if (!worldIn.getCollisionBoxes(var35, var35.getEntityBoundingBox().expand(-0.1D, -0.1D, -0.1D)).isEmpty()) { - return par1ItemStack; + return new ActionResult<>(EnumActionResult.PASS, itemStackIn); } - if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().hasKey("BuggyFuel")) + if (itemStackIn.hasTagCompound() && itemStackIn.getTagCompound().hasKey("BuggyFuel")) { - var35.buggyFuelTank.setFluid(new FluidStack(GCFluids.fluidFuel, par1ItemStack.getTagCompound().getInteger("BuggyFuel"))); + var35.buggyFuelTank.setFluid(new FluidStack(GCFluids.fluidFuel, itemStackIn.getTagCompound().getInteger("BuggyFuel"))); } - if (!par2World.isRemote) + if (!worldIn.isRemote) { - par2World.spawnEntityInWorld(var35); + worldIn.spawnEntityInWorld(var35); } - if (!par3EntityPlayer.capabilities.isCreativeMode) + if (!playerIn.capabilities.isCreativeMode) { - --par1ItemStack.stackSize; + --itemStackIn.stackSize; } } - return par1ItemStack; + return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemCanisterOxygenInfinite.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemCanisterOxygenInfinite.java index 904edf0034..de2fc88a0f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemCanisterOxygenInfinite.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemCanisterOxygenInfinite.java @@ -3,7 +3,8 @@ import micdoodle8.mods.galacticraft.api.item.IItemOxygenSupply; import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.EnumColor; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem; @@ -14,6 +15,9 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -95,25 +99,25 @@ public EnumSortCategoryItem getCategory(int meta) } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) + public ActionResult onItemRightClick(ItemStack itemStack, World worldIn, EntityPlayer player, EnumHand hand) { if (player instanceof EntityPlayerMP) { - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) player); - ItemStack gear = stats.extendedInventory.getStackInSlot(2); - ItemStack gear1 = stats.extendedInventory.getStackInSlot(3); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + ItemStack gear = stats.getExtendedInventory().getStackInSlot(2); + ItemStack gear1 = stats.getExtendedInventory().getStackInSlot(3); if (gear == null) { - stats.extendedInventory.setInventorySlotContents(2, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(2, itemStack.copy()); itemStack.stackSize = 0; } else if (gear1 == null) { - stats.extendedInventory.setInventorySlotContents(3, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(3, itemStack.copy()); itemStack.stackSize = 0; } } - return itemStack; + return new ActionResult(EnumActionResult.SUCCESS, itemStack); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/ConnectionEvents.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/ConnectionEvents.java index 0b9ce7d319..8cbf6abdb2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/ConnectionEvents.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/ConnectionEvents.java @@ -7,7 +7,8 @@ import micdoodle8.mods.galacticraft.core.dimension.SpaceRaceManager; import micdoodle8.mods.galacticraft.core.dimension.SpaceStationWorldData; import micdoodle8.mods.galacticraft.core.dimension.WorldProviderZeroGravity; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.network.PacketSimple.EnumSimplePacket; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.core.util.GCLog; @@ -17,6 +18,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.EnumConnectionState; import net.minecraft.network.EnumPacketDirection; +import net.minecraft.network.INetHandler; import net.minecraft.network.Packet; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; @@ -36,13 +38,13 @@ public class ConnectionEvents registerPacket(EnumPacketDirection.CLIENTBOUND, PacketSimple.class); } - protected static EnumConnectionState registerPacket(EnumPacketDirection direction, Class packetClass) + protected static EnumConnectionState registerPacket(EnumPacketDirection direction, Class> packetClass) { - BiMap> bimap = (BiMap) EnumConnectionState.PLAY.directionMaps.get(direction); + BiMap>> bimap = (BiMap) EnumConnectionState.PLAY.directionMaps.get(direction); if (bimap == null) { - bimap = HashBiMap.>create(); + bimap = HashBiMap.create(); EnumConnectionState.PLAY.directionMaps.put(direction, bimap); } @@ -73,9 +75,9 @@ public void onPlayerLogin(PlayerLoggedInEvent event) if (event.player instanceof EntityPlayerMP) { EntityPlayerMP thePlayer = (EntityPlayerMP) event.player; - GCPlayerStats stats = GCPlayerStats.get(thePlayer); + IStatsCapability stats = thePlayer.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); SpaceStationWorldData.checkAllStations(thePlayer, stats); - GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_SPACESTATION_CLIENT_ID, thePlayer.worldObj.provider.getDimension(), new Object[] { WorldUtil.spaceStationDataToString(stats.spaceStationDimensionData) }), thePlayer); + GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_SPACESTATION_CLIENT_ID, thePlayer.worldObj.provider.getDimension(), new Object[] { WorldUtil.spaceStationDataToString(stats.getSpaceStationDimensionData()) }), thePlayer); SpaceRace raceForPlayer = SpaceRaceManager.getSpaceRaceFromPlayer(thePlayer.getGameProfile().getName()); if (raceForPlayer != null) { @@ -102,15 +104,15 @@ public void onConnectionReceived(ServerConnectionFromClientEvent event) } GCLog.info("Galacticraft server sending dimension IDs to connecting client: " + ids); } - event.manager.sendPacket(ConnectionPacket.createDimPacket(WorldUtil.getPlanetListInts())); - event.manager.sendPacket(ConnectionPacket.createSSPacket(WorldUtil.getSpaceStationListInts())); - event.manager.sendPacket(ConnectionPacket.createConfigPacket(ConfigManagerCore.getServerConfigOverride())); + event.getManager().sendPacket(ConnectionPacket.createDimPacket(WorldUtil.getPlanetListInts())); + event.getManager().sendPacket(ConnectionPacket.createSSPacket(WorldUtil.getSpaceStationListInts())); + event.getManager().sendPacket(ConnectionPacket.createConfigPacket(ConfigManagerCore.getServerConfigOverride())); } @SubscribeEvent public void onConnectionOpened(ClientConnectedToServerEvent event) { - if (!event.isLocal) + if (!event.isLocal()) { ConnectionEvents.clientConnected = true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/ConnectionPacket.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/ConnectionPacket.java index 792ede7949..0476338c28 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/ConnectionPacket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/ConnectionPacket.java @@ -127,17 +127,17 @@ public static FMLProxyPacket createConfigPacket(List data) @SideOnly(Side.CLIENT) public void onPacketData(FMLNetworkEvent.ClientCustomPacketEvent event) { - FMLProxyPacket pkt = event.packet; + FMLProxyPacket pkt = event.getPacket(); - onFMLProxyPacketData(event.manager, pkt, Minecraft.getMinecraft().thePlayer); + onFMLProxyPacketData(event.getManager(), pkt, Minecraft.getMinecraft().thePlayer); } @SubscribeEvent public void onPacketData(FMLNetworkEvent.ServerCustomPacketEvent event) { - FMLProxyPacket pkt = event.packet; + FMLProxyPacket pkt = event.getPacket(); - onFMLProxyPacketData(event.manager, pkt, ((NetHandlerPlayServer) event.handler).playerEntity); + onFMLProxyPacketData(event.getManager(), pkt, ((NetHandlerPlayServer) event.getHandler()).playerEntity); } public void onFMLProxyPacketData(NetworkManager manager, FMLProxyPacket packet, EntityPlayer player) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java index 1a0318acc0..d1f57f7afa 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java @@ -5,7 +5,6 @@ import micdoodle8.mods.galacticraft.core.GalacticraftCore; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -97,7 +96,7 @@ public void decodeInto(ByteBuf buffer) if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { - world = MinecraftServer.getServer().worldServerForDimension(this.getDimensionID()); + world = world.getMinecraftServer().worldServerForDimension(this.getDimensionID()); } if (world == null) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java index b4d324a911..5193585e43 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java @@ -29,6 +29,7 @@ import micdoodle8.mods.galacticraft.core.client.gui.container.GuiBuggy; import micdoodle8.mods.galacticraft.core.client.gui.container.GuiParaChest; import micdoodle8.mods.galacticraft.core.client.gui.screen.GuiCelestialSelection; +import micdoodle8.mods.galacticraft.core.client.sounds.GCSounds; import micdoodle8.mods.galacticraft.core.command.CommandGCEnergyUnits; import micdoodle8.mods.galacticraft.core.dimension.SpaceRace; import micdoodle8.mods.galacticraft.core.dimension.SpaceRaceManager; @@ -38,10 +39,7 @@ import micdoodle8.mods.galacticraft.core.entities.EntityBuggy; import micdoodle8.mods.galacticraft.core.entities.IBubbleProvider; import micdoodle8.mods.galacticraft.core.entities.IControllableEntity; -import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerHandler; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient; -import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; +import micdoodle8.mods.galacticraft.core.entities.player.*; import micdoodle8.mods.galacticraft.core.fluid.FluidNetwork; import micdoodle8.mods.galacticraft.core.inventory.ContainerSchematic; import micdoodle8.mods.galacticraft.core.inventory.IInventorySettable; @@ -65,6 +63,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.SoundEvents; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -92,7 +91,7 @@ import java.io.IOException; import java.util.*; -public class PacketSimple extends PacketBase implements Packet +public class PacketSimple extends PacketBase implements Packet { public enum EnumSimplePacket { @@ -264,12 +263,12 @@ public void decodeInto(ByteBuf buffer) public void handleClientSide(EntityPlayer player) { EntityPlayerSP playerBaseClient = null; - GCPlayerStatsClient stats = null; + IStatsClientCapability stats = null; if (player instanceof EntityPlayerSP) { playerBaseClient = (EntityPlayerSP) player; - stats = GCPlayerStatsClient.get(playerBaseClient); + stats = playerBaseClient.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); } else { @@ -479,7 +478,7 @@ public void handleClientSide(EntityPlayer player) FMLClientHandler.instance().getClient().displayGuiScreen(null); break; case C_RESET_THIRD_PERSON: - FMLClientHandler.instance().getClient().gameSettings.thirdPersonView = stats.thirdPersonView; + FMLClientHandler.instance().getClient().gameSettings.thirdPersonView = stats.getThirdPersonView(); break; case C_UPDATE_SPACESTATION_LIST: WorldUtil.decodeSpaceStationListClient(data); @@ -500,9 +499,9 @@ public void handleClientSide(EntityPlayer player) break; case C_ADD_NEW_SCHEMATIC: final ISchematicPage page = SchematicRegistry.getMatchingRecipeForID((Integer) this.data.get(0)); - if (!stats.unlockedSchematics.contains(page)) + if (!stats.getUnlockedSchematics().contains(page)) { - stats.unlockedSchematics.add(page); + stats.getUnlockedSchematics().add(page); } break; case C_UPDATE_SCHEMATIC_LIST: @@ -512,29 +511,29 @@ public void handleClientSide(EntityPlayer player) if (schematicID != -2) { - Collections.sort(stats.unlockedSchematics); + Collections.sort(stats.getUnlockedSchematics()); - if (!stats.unlockedSchematics.contains(SchematicRegistry.getMatchingRecipeForID(schematicID))) + if (!stats.getUnlockedSchematics().contains(SchematicRegistry.getMatchingRecipeForID(schematicID))) { - stats.unlockedSchematics.add(SchematicRegistry.getMatchingRecipeForID(schematicID)); + stats.getUnlockedSchematics().add(SchematicRegistry.getMatchingRecipeForID(schematicID)); } } } break; case C_PLAY_SOUND_BOSS_DEATH: - player.playSound(Constants.TEXTURE_PREFIX + "entity.bossdeath", 10.0F, (Float) this.data.get(0)); + player.playSound(GCSounds.bossDeath, 10.0F, (Float) this.data.get(0)); break; case C_PLAY_SOUND_EXPLODE: - player.playSound("random.explode", 10.0F, 0.7F); + player.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 10.0F, 0.7F); break; case C_PLAY_SOUND_BOSS_LAUGH: - player.playSound(Constants.TEXTURE_PREFIX + "entity.bosslaugh", 10.0F, 1.1F); + player.playSound(GCSounds.bossLaugh, 10.0F, 1.1F); break; case C_PLAY_SOUND_BOW: - player.playSound("random.bow", 10.0F, 0.2F); + player.playSound(SoundEvents.ENTITY_ARROW_SHOOT, 10.0F, 0.2F); break; case C_UPDATE_OXYGEN_VALIDITY: - stats.oxygenSetupValid = (Boolean) this.data.get(0); + stats.setOxygenSetupValid((Boolean) this.data.get(0)); break; case C_OPEN_PARACHEST_GUI: switch ((Integer) this.data.get(1)) @@ -565,7 +564,7 @@ public void handleClientSide(EntityPlayer player) if (tile instanceof TileBaseConductor) { ((TileBaseConductor) tile).adjacentConnections = null; - player.worldObj.getBlockState(tile.getPos()).getBlock().setBlockBoundsBasedOnState(player.worldObj, tile.getPos()); +// player.worldObj.getBlockState(tile.getPos()).getBlock().setBlockBoundsBasedOnState(player.worldObj, tile.getPos()); TODO } break; case C_OPEN_SPACE_RACE_GUI: @@ -598,7 +597,7 @@ public void handleClientSide(EntityPlayer player) SpaceRaceManager.addSpaceRace(race); break; case C_OPEN_JOIN_RACE_GUI: - stats.spaceRaceInviteTeamID = (Integer) this.data.get(0); + stats.setSpaceRaceInviteTeamID((Integer) this.data.get(0)); player.openGui(GalacticraftCore.instance, GuiIdsCore.SPACE_RACE_JOIN, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ); break; case C_UPDATE_FOOTPRINT_LIST: @@ -657,8 +656,8 @@ public void handleClientSide(EntityPlayer player) } break; case C_UPDATE_THERMAL_LEVEL: - stats.thermalLevel = (Integer) this.data.get(0); - stats.thermalLevelNormalising = (Boolean) this.data.get(1); + stats.setThermalLevel((Integer) this.data.get(0)); + stats.setThermalLevelNormalising((Boolean) this.data.get(1)); break; case C_DISPLAY_ROCKET_CONTROLS: player.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.spaceKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.rocket.launch.name"))); @@ -715,7 +714,7 @@ public void handleClientSide(EntityPlayer player) // } // break; case C_UPDATE_STATS: - stats.buildFlags = (Integer) this.data.get(0); + stats.setBuildFlags((Integer) this.data.get(0)); break; case C_UPDATE_VIEWSCREEN: tile = player.worldObj.getTileEntity((BlockPos) this.data.get(0)); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java index 0840cbb928..214d727f85 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java @@ -21,6 +21,7 @@ import micdoodle8.mods.galacticraft.core.client.render.entities.*; import micdoodle8.mods.galacticraft.core.client.render.item.*; import micdoodle8.mods.galacticraft.core.client.render.tile.*; +import micdoodle8.mods.galacticraft.core.client.sounds.GCSounds; import micdoodle8.mods.galacticraft.core.entities.*; import micdoodle8.mods.galacticraft.core.entities.player.IPlayerClient; import micdoodle8.mods.galacticraft.core.entities.player.PlayerClient; @@ -40,31 +41,32 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.audio.MusicTicker; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ModelBakery; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.StateMapperBase; import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderPlayer; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.network.INetHandler; import net.minecraft.network.NetHandlerPlayServer; -import net.minecraft.util.TextFormatting; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.event.TextureStitchEvent; -import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.client.model.obj.OBJLoader; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fml.client.FMLClientHandler; @@ -132,7 +134,7 @@ public void preInit(FMLPreInitializationEvent event) { ClientProxyCore.registerEntityRenderers(); - OBJLoader.instance.addDomain(Constants.ASSET_PREFIX); + OBJLoader.INSTANCE.addDomain(Constants.ASSET_PREFIX); } @Override @@ -142,7 +144,7 @@ public void init(FMLInitializationEvent event) { { MusicTicker.MusicType.class, ResourceLocation.class, int.class, int.class }, }; - MUSIC_TYPE_MARS = EnumHelper.addEnum(commonTypes, MusicTicker.MusicType.class, "MARS_JC", new ResourceLocation(Constants.ASSET_PREFIX, "galacticraft.musicSpace"), 12000, 24000); + MUSIC_TYPE_MARS = EnumHelper.addEnum(MusicTicker.MusicType.class, "MARS_JC", new Class[] { SoundEvent.class, Integer.TYPE, Integer.TYPE }, GCSounds.music, 12000, 24000); ClientProxyCore.registerHandlers(); ClientProxyCore.registerTileEntityRenderers(); ClientProxyCore.updateCapeList(); @@ -330,16 +332,16 @@ public boolean isPaused() @SubscribeEvent public void onTextureStitchedPre(TextureStitchEvent.Pre event) { - event.map.registerSprite(new ResourceLocation("galacticraftcore:blocks/assembly")); - event.map.registerSprite(new ResourceLocation("galacticraftcore:model/rocketT1")); - event.map.registerSprite(new ResourceLocation("galacticraftcore:model/buggyMain")); - event.map.registerSprite(new ResourceLocation("galacticraftcore:model/buggyStorage")); - event.map.registerSprite(new ResourceLocation("galacticraftcore:model/buggyWheels")); - event.map.registerSprite(new ResourceLocation("galacticraftcore:model/flag0")); - event.map.registerSprite(new ResourceLocation("galacticraftcore:model/frequencyModule")); - event.map.registerSprite(new ResourceLocation("galacticraftcore:blocks/fluids/oxygen_gas")); - event.map.registerSprite(new ResourceLocation("galacticraftcore:blocks/fluids/hydrogen_gas")); - event.map.registerSprite(new ResourceLocation("galacticraftcore:blocks/bubble")); + event.getMap().registerSprite(new ResourceLocation("galacticraftcore:blocks/assembly")); + event.getMap().registerSprite(new ResourceLocation("galacticraftcore:model/rocketT1")); + event.getMap().registerSprite(new ResourceLocation("galacticraftcore:model/buggyMain")); + event.getMap().registerSprite(new ResourceLocation("galacticraftcore:model/buggyStorage")); + event.getMap().registerSprite(new ResourceLocation("galacticraftcore:model/buggyWheels")); + event.getMap().registerSprite(new ResourceLocation("galacticraftcore:model/flag0")); + event.getMap().registerSprite(new ResourceLocation("galacticraftcore:model/frequencyModule")); + event.getMap().registerSprite(new ResourceLocation("galacticraftcore:blocks/fluids/oxygen_gas")); + event.getMap().registerSprite(new ResourceLocation("galacticraftcore:blocks/fluids/hydrogen_gas")); + event.getMap().registerSprite(new ResourceLocation("galacticraftcore:blocks/bubble")); } @SubscribeEvent @@ -376,9 +378,9 @@ public void onModelBakeEvent(ModelBakeEvent event) for (int i = 0; i < container.getTextureCount(); ++i) { ModelResourceLocation modelResourceLocation = new ModelResourceLocation(container.getModID() + ":" + container.getBaseName() + "_" + i, "inventory"); - IBakedModel object = event.modelRegistry.getObject(modelResourceLocation); + IBakedModel object = event.getModelRegistry().getObject(modelResourceLocation); ItemLiquidCanisterModel modelFinal = new ItemLiquidCanisterModel(object); - event.modelRegistry.putObject(modelResourceLocation, modelFinal); + event.getModelRegistry().putObject(modelResourceLocation, modelFinal); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java index 11287ff4ac..e12a137c62 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java @@ -74,9 +74,9 @@ private static void addUniversalRecipes() FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(GCItems.canister, 1, 0), new ItemStack(GCItems.basicItem, 3, 4), 1.0F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(GCItems.canister, 1, 1), new ItemStack(GCItems.basicItem, 3, 3), 1.0F); - RecipeUtil.addRecipe(new ItemStack(GCItems.rocketEngine, 1, 1), new Object[] { "ZYZ", "ZWZ", "XVX", 'V', GCItems.oxygenVent, 'W', new ItemStack(GCItems.fuelCanister, 1, 1), 'X', GCItems.heavyPlatingTier1, 'Y', new ItemStack(Blocks.wool, 1, 4), 'Z', meteoricIronPlate }); + RecipeUtil.addRecipe(new ItemStack(GCItems.rocketEngine, 1, 1), new Object[] { "ZYZ", "ZWZ", "XVX", 'V', GCItems.oxygenVent, 'W', new ItemStack(GCItems.fuelCanister, 1, 1), 'X', GCItems.heavyPlatingTier1, 'Y', new ItemStack(Blocks.WOOL, 1, 4), 'Z', meteoricIronPlate }); - HashMap input = new HashMap(); + HashMap input = new HashMap<>(); input.put(1, new ItemStack(GCItems.partNoseCone)); input.put(2, new ItemStack(GCItems.heavyPlatingTier1)); input.put(3, new ItemStack(GCItems.heavyPlatingTier1)); @@ -97,45 +97,45 @@ private static void addUniversalRecipes() RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 0), input); HashMap input2 = new HashMap(input); - input2.put(15, new ItemStack(Blocks.chest)); + input2.put(15, new ItemStack(Blocks.CHEST)); input2.put(16, null); input2.put(17, null); RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 1), input2); input2 = new HashMap(input); input2.put(15, null); - input2.put(16, new ItemStack(Blocks.chest)); + input2.put(16, new ItemStack(Blocks.CHEST)); input2.put(17, null); RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 1), input2); input2 = new HashMap(input); input2.put(15, null); input2.put(16, null); - input2.put(17, new ItemStack(Blocks.chest)); + input2.put(17, new ItemStack(Blocks.CHEST)); RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 1), input2); input2 = new HashMap(input); - input2.put(15, new ItemStack(Blocks.chest)); - input2.put(16, new ItemStack(Blocks.chest)); + input2.put(15, new ItemStack(Blocks.CHEST)); + input2.put(16, new ItemStack(Blocks.CHEST)); input2.put(17, null); RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 2), input2); input2 = new HashMap(input); - input2.put(15, new ItemStack(Blocks.chest)); + input2.put(15, new ItemStack(Blocks.CHEST)); input2.put(16, null); - input2.put(17, new ItemStack(Blocks.chest)); + input2.put(17, new ItemStack(Blocks.CHEST)); RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 2), input2); input2 = new HashMap(input); input2.put(15, null); - input2.put(16, new ItemStack(Blocks.chest)); - input2.put(17, new ItemStack(Blocks.chest)); + input2.put(16, new ItemStack(Blocks.CHEST)); + input2.put(17, new ItemStack(Blocks.CHEST)); RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 2), input2); input2 = new HashMap(input); - input2.put(15, new ItemStack(Blocks.chest)); - input2.put(16, new ItemStack(Blocks.chest)); - input2.put(17, new ItemStack(Blocks.chest)); + input2.put(15, new ItemStack(Blocks.CHEST)); + input2.put(16, new ItemStack(Blocks.CHEST)); + input2.put(17, new ItemStack(Blocks.CHEST)); RecipeUtil.addRocketBenchRecipe(new ItemStack(GCItems.rocketTier1, 1, 3), input2); // @@ -247,20 +247,20 @@ private static void addUniversalRecipes() inputMap.put("ingotTin", 32); inputMap.put(aluminumIngots, 16); inputMap.put("waferAdvanced", 1); - inputMap.put(Items.iron_ingot, 24); + inputMap.put(Items.IRON_INGOT, 24); GalacticraftRegistry.registerSpaceStation(new SpaceStationType(ConfigManagerCore.idDimensionOverworldOrbit, ConfigManagerCore.idDimensionOverworld, new SpaceStationRecipe(inputMap))); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.aluminumWire, 6), new Object[] { "WWW", "CCC", "WWW", 'W', Blocks.wool, 'C', "ingotAluminum" }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.aluminumWire, 6), new Object[] { "WWW", "CCC", "WWW", 'W', Blocks.WOOL, 'C', "ingotAluminum" }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.aluminumWire, 1, 1), new Object[] { "X", "Y", "Z", 'X', Blocks.wool, 'Y', new ItemStack(GCBlocks.aluminumWire, 1), 'Z', "ingotAluminum" }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.aluminumWire, 1, 1), new Object[] { "X", "Y", "Z", 'X', Blocks.WOOL, 'Y', new ItemStack(GCBlocks.aluminumWire, 1), 'Z', "ingotAluminum" }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.aluminumWire, 1, 1), new Object[] { "Z", "Y", "X", 'X', Blocks.wool, 'Y', new ItemStack(GCBlocks.aluminumWire, 1), 'Z', "ingotAluminum" }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.aluminumWire, 1, 1), new Object[] { "Z", "Y", "X", 'X', Blocks.WOOL, 'Y', new ItemStack(GCBlocks.aluminumWire, 1), 'Z', "ingotAluminum" }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.machineBase, 1, 0), new Object[] { "WWW", "XZX", "XYX", 'W', "ingotCopper", 'X', Items.iron_ingot, 'Y', new ItemStack(GCBlocks.aluminumWire, 1, 0), 'Z', Blocks.furnace }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.machineBase, 1, 0), new Object[] { "WWW", "XZX", "XYX", 'W', "ingotCopper", 'X', Items.IRON_INGOT, 'Y', new ItemStack(GCBlocks.aluminumWire, 1, 0), 'Z', Blocks.FURNACE }); //Energy Storage Module: RecipeUtil.addRecipe(new ItemStack(GCBlocks.machineTiered, 1, 0), new Object[] { "SSS", "BBB", "SSS", 'B', new ItemStack(GCItems.battery, 1, GCItems.battery.getMaxDamage()), 'S', "compressedSteel" }); //Electric Furnace: - RecipeUtil.addRecipe(new ItemStack(GCBlocks.machineTiered, 1, 4), new Object[] { "XXX", "XZX", "WYW", 'W', "compressedAluminum", 'X', "compressedSteel", 'Y', "waferBasic", 'Z', Blocks.furnace }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.machineTiered, 1, 4), new Object[] { "XXX", "XZX", "WYW", 'W', "compressedAluminum", 'X', "compressedSteel", 'Y', "waferBasic", 'Z', Blocks.FURNACE }); if (GalacticraftCore.isPlanetsLoaded) { //Energy Storage Cluster: @@ -268,31 +268,31 @@ private static void addUniversalRecipes() //Electric Arc Furnace: RecipeUtil.addRecipe(new ItemStack(GCBlocks.machineTiered, 1, 12), new Object[] { "XXX", "XZX", "WYW", 'W', meteoricIronIngot, 'X', new ItemStack(GCItems.heavyPlatingTier1), 'Y', "waferAdvanced", 'Z', new ItemStack(GCBlocks.machineTiered, 1, 4) }); } - RecipeUtil.addRecipe(new ItemStack(GCBlocks.machineBase, 1, 12), new Object[] { "WXW", "WYW", "WZW", 'W', "ingotAluminum", 'X', Blocks.anvil, 'Y', "ingotCopper", 'Z', "waferBasic" }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.machineBase, 1, 12), new Object[] { "WXW", "WYW", "WZW", 'W', "ingotAluminum", 'X', Blocks.ANVIL, 'Y', "ingotCopper", 'Z', "waferBasic" }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.machineBase2, 1, 0), new Object[] { "WXW", "WYW", "VZV", 'V', new ItemStack(GCBlocks.aluminumWire), 'W', "compressedSteel", 'X', Blocks.anvil, 'Y', "compressedBronze", 'Z', "waferAdvanced" }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.machineBase2, 1, 0), new Object[] { "WXW", "WYW", "VZV", 'V', new ItemStack(GCBlocks.aluminumWire), 'W', "compressedSteel", 'X', Blocks.ANVIL, 'Y', "compressedBronze", 'Z', "waferAdvanced" }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.machineBase2, 1, 4), new Object[] { "WXW", "UYU", "VZV", 'U', Blocks.stone_button, 'V', new ItemStack(GCBlocks.aluminumWire), 'W', "ingotAluminum", 'X', Blocks.lever, 'Y', Blocks.furnace, 'Z', Blocks.redstone_torch }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.machineBase2, 1, 4), new Object[] { "WXW", "UYU", "VZV", 'U', Blocks.STONE_BUTTON, 'V', new ItemStack(GCBlocks.aluminumWire), 'W', "ingotAluminum", 'X', Blocks.LEVER, 'Y', Blocks.FURNACE, 'Z', Blocks.REDSTONE_TORCH }); RecipeUtil.addRecipe(new ItemStack(GCBlocks.machineBase2, 1, 8), new Object[] { "SSS", "BBB", "SSS", 'B', new ItemStack(GCItems.oxTankHeavy, 1, GCItems.oxTankHeavy.getMaxDamage()), 'S', "compressedSteel" }); - RecipeUtil.addRecipe(new ItemStack(GCItems.battery, 1, 100), new Object[] { " T ", "TRT", "TCT", 'T', "compressedTin", 'R', Items.redstone, 'C', Items.coal }); + RecipeUtil.addRecipe(new ItemStack(GCItems.battery, 1, 100), new Object[] { " T ", "TRT", "TCT", 'T', "compressedTin", 'R', Items.REDSTONE, 'C', Items.COAL }); - RecipeUtil.addRecipe(new ItemStack(GCItems.rocketEngine, 1), new Object[] { " YV", "XWX", "XZX", 'V', Blocks.stone_button, 'W', new ItemStack(GCItems.canister, 1, 0), 'X', GCItems.heavyPlatingTier1, 'Y', Items.flint_and_steel, 'Z', GCItems.oxygenVent }); + RecipeUtil.addRecipe(new ItemStack(GCItems.rocketEngine, 1), new Object[] { " YV", "XWX", "XZX", 'V', Blocks.STONE_BUTTON, 'W', new ItemStack(GCItems.canister, 1, 0), 'X', GCItems.heavyPlatingTier1, 'Y', Items.FLINT_AND_STEEL, 'Z', GCItems.oxygenVent }); - RecipeUtil.addRecipe(new ItemStack(GCItems.rocketEngine, 1), new Object[] { "VY ", "XWX", "XZX", 'V', Blocks.stone_button, 'W', new ItemStack(GCItems.canister, 1, 0), 'X', GCItems.heavyPlatingTier1, 'Y', Items.flint_and_steel, 'Z', GCItems.oxygenVent }); + RecipeUtil.addRecipe(new ItemStack(GCItems.rocketEngine, 1), new Object[] { "VY ", "XWX", "XZX", 'V', Blocks.STONE_BUTTON, 'W', new ItemStack(GCItems.canister, 1, 0), 'X', GCItems.heavyPlatingTier1, 'Y', Items.FLINT_AND_STEEL, 'Z', GCItems.oxygenVent }); - RecipeUtil.addRecipe(new ItemStack(GCItems.partNoseCone, 1), new Object[] { " Y ", " X ", "X X", 'X', GCItems.heavyPlatingTier1, 'Y', Blocks.redstone_torch }); + RecipeUtil.addRecipe(new ItemStack(GCItems.partNoseCone, 1), new Object[] { " Y ", " X ", "X X", 'X', GCItems.heavyPlatingTier1, 'Y', Blocks.REDSTONE_TORCH }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.oxygenPipe, 6), new Object[] { "XXX", " ", "XXX", 'X', Blocks.glass_pane }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.oxygenPipe, 6), new Object[] { "XXX", " ", "XXX", 'X', Blocks.GLASS_PANE }); - RecipeUtil.addRecipe(new ItemStack(GCItems.oxTankLight, 1, GCItems.oxTankLight.getMaxDamage()), new Object[] { "Z", "X", "Y", 'X', new ItemStack(GCItems.canister, 1, 0), 'Y', "compressedCopper", 'Z', new ItemStack(Blocks.wool, 1, 5) }); + RecipeUtil.addRecipe(new ItemStack(GCItems.oxTankLight, 1, GCItems.oxTankLight.getMaxDamage()), new Object[] { "Z", "X", "Y", 'X', new ItemStack(GCItems.canister, 1, 0), 'Y', "compressedCopper", 'Z', new ItemStack(Blocks.WOOL, 1, 5) }); - RecipeUtil.addRecipe(new ItemStack(GCItems.oxTankMedium, 1, GCItems.oxTankMedium.getMaxDamage()), new Object[] { "ZZ", "XX", "YY", 'X', new ItemStack(GCItems.canister, 1, 0), 'Y', "compressedTin", 'Z', new ItemStack(Blocks.wool, 1, 1) }); + RecipeUtil.addRecipe(new ItemStack(GCItems.oxTankMedium, 1, GCItems.oxTankMedium.getMaxDamage()), new Object[] { "ZZ", "XX", "YY", 'X', new ItemStack(GCItems.canister, 1, 0), 'Y', "compressedTin", 'Z', new ItemStack(Blocks.WOOL, 1, 1) }); - RecipeUtil.addRecipe(new ItemStack(GCItems.sensorGlasses, 1), new Object[] { "ZWZ", "Z Z", "XYX", 'W', Items.diamond, 'X', GCItems.sensorLens, 'Y', meteoricIronIngot, 'Z', Items.string }); + RecipeUtil.addRecipe(new ItemStack(GCItems.sensorGlasses, 1), new Object[] { "ZWZ", "Z Z", "XYX", 'W', Items.DIAMOND, 'X', GCItems.sensorLens, 'Y', meteoricIronIngot, 'Z', Items.STRING }); - RecipeUtil.addRecipe(new ItemStack(GCItems.sensorLens, 1), new Object[] { "ZXZ", "XYX", "ZXZ", 'X', Blocks.glass_pane, 'Y', meteoricIronPlate, 'Z', Items.redstone }); + RecipeUtil.addRecipe(new ItemStack(GCItems.sensorLens, 1), new Object[] { "ZXZ", "XYX", "ZXZ", 'X', Blocks.GLASS_PANE, 'Y', meteoricIronPlate, 'Z', Items.REDSTONE }); if (!ConfigManagerCore.alternateCanisterRecipe) { @@ -305,11 +305,11 @@ private static void addUniversalRecipes() RecipeUtil.addRecipe(new ItemStack(GCItems.canister, 2, 1), new Object[] { "XXX", "X ", "XXX", 'X', "ingotCopper" }); } - RecipeUtil.addRecipe(new ItemStack(GCItems.oxMask, 1), new Object[] { "XXX", "XYX", "XXX", 'X', Blocks.glass_pane, 'Y', Items.iron_helmet }); + RecipeUtil.addRecipe(new ItemStack(GCItems.oxMask, 1), new Object[] { "XXX", "XYX", "XXX", 'X', Blocks.GLASS_PANE, 'Y', Items.IRON_HELMET }); - RecipeUtil.addRecipe(new ItemStack(GCItems.canvas, 1), new Object[] { " XY", "XXX", "YX ", 'Y', Items.stick, 'X', Items.string }); + RecipeUtil.addRecipe(new ItemStack(GCItems.canvas, 1), new Object[] { " XY", "XXX", "YX ", 'Y', Items.STICK, 'X', Items.STRING }); - RecipeUtil.addRecipe(new ItemStack(GCItems.parachute, 1, 0), new Object[] { "XXX", "Y Y", " Y ", 'X', GCItems.canvas, 'Y', Items.string }); + RecipeUtil.addRecipe(new ItemStack(GCItems.parachute, 1, 0), new Object[] { "XXX", "Y Y", " Y ", 'X', GCItems.canvas, 'Y', Items.STRING }); RecipeUtil.addRecipe(new ItemStack(GCBlocks.sealableBlock, 1, 1), new Object[] { "XYX", 'Y', GCBlocks.oxygenPipe, 'X', new ItemStack(GCBlocks.basicBlock, 1, 4) }); @@ -319,9 +319,9 @@ private static void addUniversalRecipes() RecipeUtil.addRecipe(new ItemStack(GCItems.oxygenGear), new Object[] { " Y ", "YXY", "Y Y", 'X', GCItems.oxygenConcentrator, 'Y', GCBlocks.oxygenPipe }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.basicBlock, 4, 3), new Object[] { " ", " XY", " ", 'X', new ItemStack(Blocks.stone, 4, 0), 'Y', "compressedTin" }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.basicBlock, 4, 3), new Object[] { " ", " XY", " ", 'X', new ItemStack(Blocks.STONE, 4, 0), 'Y', "compressedTin" }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.basicBlock, 4, 4), new Object[] { " ", " X ", " Y ", 'X', new ItemStack(Blocks.stone, 4, 0), 'Y', "compressedTin" }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.basicBlock, 4, 4), new Object[] { " ", " X ", " Y ", 'X', new ItemStack(Blocks.STONE, 4, 0), 'Y', "compressedTin" }); RecipeUtil.addRecipe(new ItemStack(GCItems.flag), new Object[] { "XYY", "XYY", "X ", 'X', GCItems.flagPole, 'Y', GCItems.canvas }); @@ -332,17 +332,17 @@ private static void addUniversalRecipes() RecipeUtil.addRecipe(new ItemStack(GCItems.partFins, 1), new Object[] { " Y ", "XYX", "X X", 'X', GCItems.heavyPlatingTier1, 'Y', "compressedSteel" }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.landingPad, 9, 0), new Object[] { "YYY", "XXX", 'X', Blocks.iron_block, 'Y', "compressedIron" }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.landingPad, 9, 0), new Object[] { "YYY", "XXX", 'X', Blocks.IRON_BLOCK, 'Y', "compressedIron" }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.landingPad, 9, 1), new Object[] { "YYY", "XXX", 'X', Blocks.iron_block, 'Y', "compressedSteel" }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.landingPad, 9, 1), new Object[] { "YYY", "XXX", 'X', Blocks.IRON_BLOCK, 'Y', "compressedSteel" }); - RecipeUtil.addRecipe(new ItemStack(GCItems.partBuggy, 1, 0), new Object[] { " W ", "WXW", " W ", 'W', Items.leather, 'X', "compressedSteel" }); + RecipeUtil.addRecipe(new ItemStack(GCItems.partBuggy, 1, 0), new Object[] { " W ", "WXW", " W ", 'W', Items.LEATHER, 'X', "compressedSteel" }); RecipeUtil.addRecipe(new ItemStack(GCItems.partBuggy, 1, 1), new Object[] { " Y", " ZY", "XXX", 'X', "compressedSteel", 'Y', "compressedSteel", 'Z', "compressedIron" }); - RecipeUtil.addRecipe(new ItemStack(GCItems.partBuggy, 1, 2), new Object[] { "XXX", "YZY", "XXX", 'X', "compressedSteel", 'Y', "compressedIron", 'Z', Blocks.chest }); + RecipeUtil.addRecipe(new ItemStack(GCItems.partBuggy, 1, 2), new Object[] { "XXX", "YZY", "XXX", 'X', "compressedSteel", 'Y', "compressedIron", 'Z', Blocks.CHEST }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.oxygenDetector, 1), new Object[] { "WWW", "YVY", "ZUZ", 'U', "compressedAluminum", 'V', "waferBasic", 'W', "compressedSteel", 'X', GCItems.oxygenFan, 'Y', GCItems.oxygenVent, 'Z', Items.redstone }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.oxygenDetector, 1), new Object[] { "WWW", "YVY", "ZUZ", 'U', "compressedAluminum", 'V', "waferBasic", 'W', "compressedSteel", 'X', GCItems.oxygenFan, 'Y', GCItems.oxygenVent, 'Z', Items.REDSTONE }); RecipeUtil.addRecipe(new ItemStack(GCBlocks.oxygenDistributor, 1), new Object[] { "WXW", "YZY", "WXW", 'W', "compressedSteel", 'X', GCItems.oxygenFan, 'Y', GCItems.oxygenVent, 'Z', "compressedAluminum" }); @@ -350,27 +350,27 @@ private static void addUniversalRecipes() RecipeUtil.addRecipe(new ItemStack(GCBlocks.oxygenCollector, 1), new Object[] { "WWW", "YXZ", "UVU", 'U', "compressedAluminum", 'V', GCItems.oxygenConcentrator, 'W', "compressedSteel", 'X', new ItemStack(GCItems.canister, 1, 0), 'Y', GCItems.oxygenFan, 'Z', GCItems.oxygenVent }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.nasaWorkbench, 1), new Object[] { "XZX", "UWU", "YVY", 'U', Blocks.lever, 'V', Blocks.redstone_torch, 'W', "waferAdvanced", 'X', "compressedSteel", 'Y', "compressedSteel", 'Z', Blocks.crafting_table }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.nasaWorkbench, 1), new Object[] { "XZX", "UWU", "YVY", 'U', Blocks.LEVER, 'V', Blocks.REDSTONE_TORCH, 'W', "waferAdvanced", 'X', "compressedSteel", 'Y', "compressedSteel", 'Z', Blocks.CRAFTING_TABLE }); - RecipeUtil.addRecipe(new ItemStack(GCItems.oxTankHeavy, 1, GCItems.oxTankHeavy.getMaxDamage()), new Object[] { "ZZZ", "XXX", "YYY", 'X', new ItemStack(GCItems.canister, 1, 0), 'Y', "compressedSteel", 'Z', new ItemStack(Blocks.wool, 1, 14) }); + RecipeUtil.addRecipe(new ItemStack(GCItems.oxTankHeavy, 1, GCItems.oxTankHeavy.getMaxDamage()), new Object[] { "ZZZ", "XXX", "YYY", 'X', new ItemStack(GCItems.canister, 1, 0), 'Y', "compressedSteel", 'Z', new ItemStack(Blocks.WOOL, 1, 14) }); - RecipeUtil.addRecipe(new ItemStack(GCItems.oxygenFan, 1), new Object[] { "Z Z", " Y ", "ZXZ", 'X', Items.redstone, 'Y', "waferBasic", 'Z', "compressedSteel" }); + RecipeUtil.addRecipe(new ItemStack(GCItems.oxygenFan, 1), new Object[] { "Z Z", " Y ", "ZXZ", 'X', Items.REDSTONE, 'Y', "waferBasic", 'Z', "compressedSteel" }); RecipeUtil.addRecipe(new ItemStack(GCItems.oxygenConcentrator, 1), new Object[] { "ZWZ", "WYW", "ZXZ", 'W', "compressedTin", 'X', GCItems.oxygenVent, 'Y', new ItemStack(GCItems.canister, 1, 0), 'Z', "compressedSteel" }); - RecipeUtil.addRecipe(new ItemStack(GCItems.steelPickaxe, 1), new Object[] { "YYY", " X ", " X ", 'Y', "compressedSteel", 'X', Items.stick }); + RecipeUtil.addRecipe(new ItemStack(GCItems.steelPickaxe, 1), new Object[] { "YYY", " X ", " X ", 'Y', "compressedSteel", 'X', Items.STICK }); - RecipeUtil.addRecipe(new ItemStack(GCItems.steelAxe, 1), new Object[] { "YY ", "YX ", " X ", 'Y', "compressedSteel", 'X', Items.stick }); + RecipeUtil.addRecipe(new ItemStack(GCItems.steelAxe, 1), new Object[] { "YY ", "YX ", " X ", 'Y', "compressedSteel", 'X', Items.STICK }); - RecipeUtil.addRecipe(new ItemStack(GCItems.steelAxe, 1), new Object[] { " YY", " XY", " X ", 'Y', "compressedSteel", 'X', Items.stick }); + RecipeUtil.addRecipe(new ItemStack(GCItems.steelAxe, 1), new Object[] { " YY", " XY", " X ", 'Y', "compressedSteel", 'X', Items.STICK }); - RecipeUtil.addRecipe(new ItemStack(GCItems.steelHoe, 1), new Object[] { " YY", " X ", " X ", 'Y', "compressedSteel", 'X', Items.stick }); + RecipeUtil.addRecipe(new ItemStack(GCItems.steelHoe, 1), new Object[] { " YY", " X ", " X ", 'Y', "compressedSteel", 'X', Items.STICK }); - RecipeUtil.addRecipe(new ItemStack(GCItems.steelHoe, 1), new Object[] { "YY ", " X ", " X ", 'Y', "compressedSteel", 'X', Items.stick }); + RecipeUtil.addRecipe(new ItemStack(GCItems.steelHoe, 1), new Object[] { "YY ", " X ", " X ", 'Y', "compressedSteel", 'X', Items.STICK }); - RecipeUtil.addRecipe(new ItemStack(GCItems.steelSpade, 1), new Object[] { " Y ", " X ", " X ", 'Y', "compressedSteel", 'X', Items.stick }); + RecipeUtil.addRecipe(new ItemStack(GCItems.steelSpade, 1), new Object[] { " Y ", " X ", " X ", 'Y', "compressedSteel", 'X', Items.STICK }); - RecipeUtil.addRecipe(new ItemStack(GCItems.steelSword, 1), new Object[] { " Y ", " Y ", " X ", 'Y', "compressedSteel", 'X', Items.stick }); + RecipeUtil.addRecipe(new ItemStack(GCItems.steelSword, 1), new Object[] { " Y ", " Y ", " X ", 'Y', "compressedSteel", 'X', Items.STICK }); RecipeUtil.addRecipe(new ItemStack(GCItems.steelBoots, 1), new Object[] { "X X", "X X", 'X', "compressedSteel" }); @@ -391,19 +391,19 @@ private static void addUniversalRecipes() // Disable oil extractor: // RecipeUtil.addRecipe(new ItemStack(GCItems.oilExtractor), new Object[] { "X ", " XY", "ZYY", 'X', "compressedSteel", 'Y', "compressedBronze", 'Z', Items.redstone }); - RecipeUtil.addRecipe(new ItemStack(GCItems.basicItem, 1, 20), new Object[] { "WVW", "YXY", "YZY", 'X', "compressedSteel", 'Y', "compressedBronze", 'Z', "waferBasic", 'W', Items.redstone, 'V', GCItems.oxygenVent }); + RecipeUtil.addRecipe(new ItemStack(GCItems.basicItem, 1, 20), new Object[] { "WVW", "YXY", "YZY", 'X', "compressedSteel", 'Y', "compressedBronze", 'Z', "waferBasic", 'W', Items.REDSTONE, 'V', GCItems.oxygenVent }); - RecipeUtil.addRecipe(new ItemStack(GCItems.oilCanister, 1, GCItems.oilCanister.getMaxDamage()), new Object[] { "WXW", "WYW", "WZW", 'X', "compressedSteel", 'Y', Blocks.glass, 'Z', new ItemStack(GCItems.canister, 1, 0), 'W', "compressedTin" }); + RecipeUtil.addRecipe(new ItemStack(GCItems.oilCanister, 1, GCItems.oilCanister.getMaxDamage()), new Object[] { "WXW", "WYW", "WZW", 'X', "compressedSteel", 'Y', Blocks.GLASS, 'Z', new ItemStack(GCItems.canister, 1, 0), 'W', "compressedTin" }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.refinery), new Object[] { " Z ", "WZW", "XYX", 'X', "compressedSteel", 'Y', Blocks.furnace, 'Z', new ItemStack(GCItems.canister, 1, 1), 'W', Blocks.stone }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.refinery), new Object[] { " Z ", "WZW", "XYX", 'X', "compressedSteel", 'Y', Blocks.FURNACE, 'Z', new ItemStack(GCItems.canister, 1, 1), 'W', Blocks.STONE }); RecipeUtil.addRecipe(new ItemStack(GCBlocks.oxygenCompressor, 1, 0), new Object[] { "XWX", "WZW", "XYX", 'W', "compressedAluminum", 'X', "compressedSteel", 'Y', "compressedBronze", 'Z', GCItems.oxygenConcentrator }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.oxygenCompressor, 1, 4), new Object[] { "XVX", "WZW", "XYX", 'V', GCItems.oxygenFan, 'W', "compressedAluminum", 'X', "compressedSteel", 'Y', Blocks.redstone_torch, 'Z', GCItems.oxygenConcentrator }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.oxygenCompressor, 1, 4), new Object[] { "XVX", "WZW", "XYX", 'V', GCItems.oxygenFan, 'W', "compressedAluminum", 'X', "compressedSteel", 'Y', Blocks.REDSTONE_TORCH, 'Z', GCItems.oxygenConcentrator }); RecipeUtil.addRecipe(new ItemStack(GCBlocks.fuelLoader), new Object[] { "XXX", "XZX", "WYW", 'W', "compressedAluminum", 'X', "compressedSteel", 'Y', "waferBasic", 'Z', new ItemStack(GCItems.canister, 1, 0) }); - RecipeUtil.addRecipe(new ItemStack(GCItems.basicItem, 2, 0), new Object[] { "XXX", "YYY", "ZZZ", 'X', Blocks.glass, 'Y', "waferSolar", 'Z', new ItemStack(GCBlocks.aluminumWire, 1, 0) }); + RecipeUtil.addRecipe(new ItemStack(GCItems.basicItem, 2, 0), new Object[] { "XXX", "YYY", "ZZZ", 'X', Blocks.GLASS, 'Y', "waferSolar", 'Z', new ItemStack(GCBlocks.aluminumWire, 1, 0) }); RecipeUtil.addRecipe(new ItemStack(GCItems.basicItem, 1, 1), new Object[] { "XXX", "YYY", "XXX", 'X', new ItemStack(GCItems.basicItem, 1, 0), 'Y', new ItemStack(GCBlocks.aluminumWire, 1, 0) }); @@ -411,23 +411,23 @@ private static void addUniversalRecipes() RecipeUtil.addRecipe(new ItemStack(GCBlocks.solarPanel, 1, 4), new Object[] { "XYX", "XZX", "VWV", 'V', new ItemStack(GCBlocks.aluminumWire, 1, 1), 'W', "waferAdvanced", 'X', "compressedSteel", 'Y', new ItemStack(GCItems.basicItem, 1, 1), 'Z', GCItems.flagPole }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.cargoLoader, 1, 0), new Object[] { "XWX", "YZY", "XXX", 'W', Blocks.hopper, 'X', "compressedSteel", 'Y', "compressedAluminum", 'Z', Blocks.chest }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.cargoLoader, 1, 0), new Object[] { "XWX", "YZY", "XXX", 'W', Blocks.HOPPER, 'X', "compressedSteel", 'Y', "compressedAluminum", 'Z', Blocks.CHEST }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.cargoLoader, 1, 4), new Object[] { "XXX", "YZY", "XWX", 'W', Blocks.hopper, 'X', "compressedSteel", 'Y', "compressedAluminum", 'Z', Blocks.chest }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.cargoLoader, 1, 4), new Object[] { "XXX", "YZY", "XWX", 'W', Blocks.HOPPER, 'X', "compressedSteel", 'Y', "compressedAluminum", 'Z', Blocks.CHEST }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.glowstoneTorch, 4), new Object[] { "Y", "X", 'X', Items.stick, 'Y', Items.glowstone_dust }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.glowstoneTorch, 4), new Object[] { "Y", "X", 'X', Items.STICK, 'Y', Items.GLOWSTONE_DUST }); - RecipeUtil.addRecipe(new ItemStack(GCItems.basicItem, 1, 19), new Object[] { " X ", "YUY", "ZWZ", 'U', Items.repeater, 'W', "waferBasic", 'X', "compressedAluminum", 'Y', "compressedIron", 'Z', Items.redstone }); + RecipeUtil.addRecipe(new ItemStack(GCItems.basicItem, 1, 19), new Object[] { " X ", "YUY", "ZWZ", 'U', Items.REPEATER, 'W', "waferBasic", 'X', "compressedAluminum", 'Y', "compressedIron", 'Z', Items.REDSTONE }); RecipeUtil.addRecipe(new ItemStack(GCItems.wrench), new Object[] { " Y", " X ", "X ", 'X', "compressedBronze", 'Y', "compressedSteel" }); - RecipeUtil.addRecipe(new ItemStack(Blocks.lit_pumpkin), new Object[] { "P ", "T ", " ", 'P', new ItemStack(Blocks.pumpkin), 'T', new ItemStack(GCBlocks.unlitTorch) }); + RecipeUtil.addRecipe(new ItemStack(Blocks.LIT_PUMPKIN), new Object[] { "P ", "T ", " ", 'P', new ItemStack(Blocks.PUMPKIN), 'T', new ItemStack(GCBlocks.unlitTorch) }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.brightLamp), new Object[] { "XYX", "YZY", "XYX", 'X', deshIngot, 'Y', Items.glowstone_dust, 'Z', new ItemStack(GCItems.battery, 1, 0) }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.brightLamp), new Object[] { "XYX", "YZY", "XYX", 'X', deshIngot, 'Y', Items.GLOWSTONE_DUST, 'Z', new ItemStack(GCItems.battery, 1, 0) }); RecipeUtil.addRecipe(new ItemStack(GCBlocks.spinThruster), new Object[] { " ", "YWZ", "PXP", 'W', "waferAdvanced", 'X', meteoricIronIngot, 'Y', new ItemStack(GCItems.fuelCanister, 1, 1), 'Z', new ItemStack(GCItems.rocketEngine, 1, 0), 'P', "compressedSteel" }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.screen), new Object[] { "XYX", "YGY", "XYX", 'X', "compressedSteel", 'Y', "waferBasic", 'G', Blocks.glass }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.screen), new Object[] { "XYX", "YGY", "XYX", 'X', "compressedSteel", 'Y', "waferBasic", 'G', Blocks.GLASS }); RecipeUtil.addRecipe(new ItemStack(GCBlocks.telemetry), new Object[] { "XFX", "XWX", "YYY", 'W', "waferBasic", 'X', "compressedTin", 'Y', "compressedCopper", 'F', new ItemStack(GCItems.basicItem, 1, 19) }); @@ -447,7 +447,7 @@ private static void addUniversalRecipes() RecipeUtil.addRecipe(new ItemStack(GCItems.itemBasicMoon, 9, 0), new Object[] { "X", 'X', new ItemStack(GCBlocks.basicBlock, 1, 12) }); - RecipeUtil.addRecipe(new ItemStack(GCBlocks.cheeseBlock, 1), new Object[] { "YYY", "YXY", "YYY", 'X', Items.milk_bucket, 'Y', GCItems.cheeseCurd }); + RecipeUtil.addRecipe(new ItemStack(GCBlocks.cheeseBlock, 1), new Object[] { "YYY", "YXY", "YYY", 'X', Items.MILK_BUCKET, 'Y', GCItems.cheeseCurd }); // // Tin Stairs 1 RecipeUtil.addRecipe(new ItemStack(GCBlocks.tinStairs1, 4), new Object[] { " X", " XX", "XXX", 'X', new ItemStack(GCBlocks.basicBlock, 1, 4) }); @@ -479,13 +479,13 @@ private static void addUniversalRecipes() // // Dungeon Brick Wall RecipeUtil.addRecipe(new ItemStack(GCBlocks.wallGC, 6, 3), new Object[] { "XXX", "XXX", 'X', new ItemStack(GCBlocks.blockMoon, 1, 14) }); - CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(GCItems.basicItem, 1, 15), new Object[] { new ItemStack(GCItems.canister, 1, 0), Items.apple, Items.apple })); + CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(GCItems.basicItem, 1, 15), new Object[] { new ItemStack(GCItems.canister, 1, 0), Items.APPLE, Items.APPLE })); - CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(GCItems.basicItem, 1, 16), new Object[] { new ItemStack(GCItems.canister, 1, 0), Items.carrot, Items.carrot })); + CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(GCItems.basicItem, 1, 16), new Object[] { new ItemStack(GCItems.canister, 1, 0), Items.CARROT, Items.CARROT })); - CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(GCItems.basicItem, 1, 17), new Object[] { new ItemStack(GCItems.canister, 1, 0), Items.melon, Items.melon })); + CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(GCItems.basicItem, 1, 17), new Object[] { new ItemStack(GCItems.canister, 1, 0), Items.MELON, Items.MELON })); - CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(GCItems.basicItem, 1, 18), new Object[] { new ItemStack(GCItems.canister, 1, 0), Items.potato, Items.potato })); + CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(GCItems.basicItem, 1, 18), new Object[] { new ItemStack(GCItems.canister, 1, 0), Items.POTATO, Items.POTATO })); CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(new ItemStack(GCItems.meteorChunk, 3), new Object[] { GCItems.meteoricIronRaw })); @@ -508,7 +508,7 @@ private static void addUniversalRecipes() } CompressorRecipes.addShapelessRecipe(new ItemStack(GCItems.basicItem, 1, 10), new ItemStack(GCItems.basicItem, 1, 6), new ItemStack(GCItems.basicItem, 1, 7)); - CompressorRecipes.addShapelessRecipe(new ItemStack(GCItems.basicItem, 1, 11), Items.iron_ingot, Items.iron_ingot); + CompressorRecipes.addShapelessRecipe(new ItemStack(GCItems.basicItem, 1, 11), Items.IRON_INGOT, Items.IRON_INGOT); CompressorRecipes.addShapelessRecipe(new ItemStack(GCItems.itemBasicMoon, 1, 1), meteoricIronIngot); CompressorRecipes.addRecipe(new ItemStack(GCItems.heavyPlatingTier1, 2, 0), "XYZ", "XYZ", 'X', new ItemStack(GCItems.basicItem, 1, 9), 'Y', new ItemStack(GCItems.basicItem, 1, 8), 'Z', new ItemStack(GCItems.basicItem, 1, 10)); } @@ -535,9 +535,9 @@ public static void setConfigurableRecipes() { silicon = silicons.get(j - 1); } - CircuitFabricatorRecipes.addRecipe(solarPanels, new ItemStack[] { new ItemStack(Items.diamond), silicon, silicon, new ItemStack(Items.redstone), new ItemStack(Items.DYE, 1, 4) }); - CircuitFabricatorRecipes.addRecipe(basicWafers, new ItemStack[] { new ItemStack(Items.diamond), silicon, silicon, new ItemStack(Items.redstone), new ItemStack(Blocks.redstone_torch) }); - CircuitFabricatorRecipes.addRecipe(advancedWafers, new ItemStack[] { new ItemStack(Items.diamond), silicon, silicon, new ItemStack(Items.redstone), new ItemStack(Items.repeater) }); + CircuitFabricatorRecipes.addRecipe(solarPanels, new ItemStack[] { new ItemStack(Items.DIAMOND), silicon, silicon, new ItemStack(Items.REDSTONE), new ItemStack(Items.DYE, 1, 4) }); + CircuitFabricatorRecipes.addRecipe(basicWafers, new ItemStack[] { new ItemStack(Items.DIAMOND), silicon, silicon, new ItemStack(Items.REDSTONE), new ItemStack(Blocks.REDSTONE_TORCH) }); + CircuitFabricatorRecipes.addRecipe(advancedWafers, new ItemStack[] { new ItemStack(Items.DIAMOND), silicon, silicon, new ItemStack(Items.REDSTONE), new ItemStack(Items.REPEATER) }); } CompressorRecipes.removeRecipe(new ItemStack(GCItems.basicItem, 1, 9)); @@ -549,11 +549,11 @@ public static void setConfigurableRecipes() } if (!ConfigManagerCore.hardMode || !steelDone) { - CompressorRecipes.addShapelessRecipe(new ItemStack(GCItems.basicItem, 1, 9), Items.coal, new ItemStack(GCItems.basicItem, 1, 11), Items.coal); + CompressorRecipes.addShapelessRecipe(new ItemStack(GCItems.basicItem, 1, 9), Items.COAL, new ItemStack(GCItems.basicItem, 1, 11), Items.COAL); } else { - CompressorRecipes.addShapelessAdventure(new ItemStack(GCItems.basicItem, 1, 9), Items.coal, new ItemStack(GCItems.basicItem, 1, 11), Items.coal); + CompressorRecipes.addShapelessAdventure(new ItemStack(GCItems.basicItem, 1, 9), Items.COAL, new ItemStack(GCItems.basicItem, 1, 11), Items.COAL); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tick/KeyHandlerClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/tick/KeyHandlerClient.java index d44ce9f36d..a90c6271b7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tick/KeyHandlerClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tick/KeyHandlerClient.java @@ -8,7 +8,8 @@ import micdoodle8.mods.galacticraft.core.client.gui.GuiIdsCore; import micdoodle8.mods.galacticraft.core.entities.EntityBuggy; import micdoodle8.mods.galacticraft.core.entities.IControllableEntity; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsClientHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsClientCapability; import micdoodle8.mods.galacticraft.core.network.PacketSimple; import micdoodle8.mods.galacticraft.core.network.PacketSimple.EnumSimplePacket; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; @@ -76,7 +77,7 @@ public void keyDown(Type types, KeyBinding kb, boolean tickEnd, boolean isRepeat return; } - GCPlayerStatsClient stats = GCPlayerStatsClient.get(playerBase); + IStatsClientCapability stats = playerBase.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); if (kb.getKeyCode() == KeyHandlerClient.galaxyMap.getKeyCode()) { @@ -96,7 +97,7 @@ else if (kb.getKeyCode() == KeyHandlerClient.toggleAdvGoggles.getKeyCode()) { if (playerBase != null) { - stats.usingAdvancedGoggles = !stats.usingAdvancedGoggles; + stats.setUsingAdvancedGoggles(!stats.isUsingAdvancedGoggles()); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java index 748d92bee8..0906397faa 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java @@ -21,7 +21,8 @@ import micdoodle8.mods.galacticraft.core.dimension.WorldProviderMoon; import micdoodle8.mods.galacticraft.core.dimension.WorldProviderZeroGravity; import micdoodle8.mods.galacticraft.core.entities.EntityLander; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsClientHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsClientCapability; import micdoodle8.mods.galacticraft.core.fluid.FluidNetwork; import micdoodle8.mods.galacticraft.core.items.ItemSensorGlasses; import micdoodle8.mods.galacticraft.core.network.GalacticraftPacketHandler; @@ -48,9 +49,9 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.ResourceLocation; import net.minecraft.world.WorldProviderSurface; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.client.FMLClientHandler; @@ -59,7 +60,6 @@ import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent; import net.minecraftforge.fml.relauncher.Side; -import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @@ -101,7 +101,7 @@ public void worldUnloadEvent(WorldEvent.Unload event) { for (GalacticraftPacketHandler packetHandler : packetHandlers) { - packetHandler.unload(event.world); + packetHandler.unload(event.getWorld()); } } @@ -161,11 +161,11 @@ public void onRenderTick(RenderTickEvent event) final Minecraft minecraft = FMLClientHandler.instance().getClient(); final EntityPlayerSP player = minecraft.thePlayer; final EntityPlayerSP playerBaseClient = PlayerUtil.getPlayerBaseClientFromPlayer(player, false); - GCPlayerStatsClient stats = null; + IStatsClientCapability stats = null; if (player != null) { - stats = GCPlayerStatsClient.get(playerBaseClient); + stats = playerBaseClient.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); } if (event.phase == Phase.END) @@ -177,11 +177,6 @@ public void onRenderTick(RenderTickEvent event) int k = Mouse.getEventButton(); - if (Minecraft.isRunningOnMac && k == 0 && (Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157))) - { - k = 1; - } - int deltaColor = 0; if (i > minecraft.currentScreen.width - 100 && j > minecraft.currentScreen.height - 35) @@ -279,11 +274,11 @@ public void onRenderTick(RenderTickEvent event) var7 = 90; } - int thermalLevel = stats.thermalLevel + 22; - OverlayOxygenTanks.renderOxygenTankIndicator(thermalLevel, var6, var7, !ConfigManagerCore.oxygenIndicatorLeft, !ConfigManagerCore.oxygenIndicatorBottom, Math.abs(thermalLevel - 22) >= 10 && !stats.thermalLevelNormalising); + int thermalLevel = stats.getThermalLevel() + 22; + OverlayOxygenTanks.renderOxygenTankIndicator(thermalLevel, var6, var7, !ConfigManagerCore.oxygenIndicatorLeft, !ConfigManagerCore.oxygenIndicatorBottom, Math.abs(thermalLevel - 22) >= 10 && !stats.isThermalLevelNormalising()); } - if (playerBaseClient != null && player.worldObj.provider instanceof IGalacticraftWorldProvider && !stats.oxygenSetupValid && OxygenUtil.noAtmosphericCombustion(player.worldObj.provider) && minecraft.currentScreen == null && !playerBaseClient.capabilities.isCreativeMode && !playerBaseClient.isSpectator()) + if (playerBaseClient != null && player.worldObj.provider instanceof IGalacticraftWorldProvider && !stats.isOxygenSetupValid() && OxygenUtil.noAtmosphericCombustion(player.worldObj.provider) && minecraft.currentScreen == null && !playerBaseClient.capabilities.isCreativeMode && !playerBaseClient.isSpectator()) { OverlayOxygenWarning.renderOxygenWarningOverlay(); } @@ -388,7 +383,7 @@ public void onClientTick(ClientTickEvent event) IBlockState state = player.worldObj.getBlockState(pos); final Block block = state.getBlock(); - if (block.getMaterial() != Material.AIR) + if (block.getMaterial(state) != Material.AIR) { int metadata = block.getMetaFromState(state); boolean isDetectable = false; @@ -481,7 +476,8 @@ else if (world.provider instanceof WorldProviderZeroGravity) { world.provider.setSkyRenderer(new SkyProviderOrbit(new ResourceLocation(Constants.ASSET_PREFIX, "textures/gui/celestialbodies/earth.png"), true, true)); ((SkyProviderOrbit) world.provider.getSkyRenderer()).spinDeltaPerTick = ((WorldProviderZeroGravity) world.provider).getSpinManager().getSpinRate(); - GCPlayerStatsClient.get(player).inFreefallFirstCheck = false; + IStatsClientCapability stats = player.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); + stats.setInFreefallFirstCheck(false); } if (world.provider.getCloudRenderer() == null) @@ -623,8 +619,8 @@ private boolean alreadyContainsBlock(int x1, int y1, int z1) public static void zoom(float value) { - FMLClientHandler.instance().getClient().entityRenderer.thirdPersonDistance = value; - FMLClientHandler.instance().getClient().entityRenderer.thirdPersonDistanceTemp = value; +// FMLClientHandler.instance().getClient().entityRenderer.thirdPersonDistance = value; + FMLClientHandler.instance().getClient().entityRenderer.thirdPersonDistancePrev = value; } private void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java index 08ef73d387..ce6dd126ca 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java @@ -12,7 +12,8 @@ import micdoodle8.mods.galacticraft.core.dimension.WorldDataSpaceRaces; import micdoodle8.mods.galacticraft.core.energy.grid.EnergyNetwork; import micdoodle8.mods.galacticraft.core.energy.tile.TileBaseConductor; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.fluid.FluidNetwork; import micdoodle8.mods.galacticraft.core.fluid.ThreadFindSeal; import micdoodle8.mods.galacticraft.core.network.GalacticraftPacketHandler; @@ -93,7 +94,7 @@ public void worldUnloadEvent(WorldEvent.Unload event) { for (GalacticraftPacketHandler packetHandler : packetHandlers) { - packetHandler.unload(event.world); + packetHandler.unload(event.getWorld()); } } @@ -252,7 +253,7 @@ public void onServerTick(ServerTickEvent event) { try { - final GCPlayerStats stats = GCPlayerStats.get(change.getPlayer()); + IStatsCapability stats = change.getPlayer().getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); final WorldProvider provider = WorldUtil.getProviderForNameServer(change.getDimensionName()); final Integer dim = provider.getDimension(); GCLog.info("Found matching world (" + dim.toString() + ") for name: " + change.getDimensionName()); @@ -264,7 +265,7 @@ public void onServerTick(ServerTickEvent event) WorldUtil.transferEntityToDimension(change.getPlayer(), dim, world); } - stats.teleportCooldown = 10; + stats.setTeleportCooldown(10); GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_CLOSE_GUI, change.getPlayer().worldObj.provider.getDimension(), new Object[] {}), change.getPlayer()); } catch (Exception e) @@ -288,7 +289,7 @@ else if (!MapUtil.doneOverworldTexture) if (TickHandlerServer.spaceRaceData == null) { World world = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(0); - TickHandlerServer.spaceRaceData = (WorldDataSpaceRaces) world.getMapStorage().loadData(WorldDataSpaceRaces.class, WorldDataSpaceRaces.saveDataID); + TickHandlerServer.spaceRaceData = (WorldDataSpaceRaces) world.getMapStorage().getOrLoadData(WorldDataSpaceRaces.class, WorldDataSpaceRaces.saveDataID); if (TickHandlerServer.spaceRaceData == null) { @@ -306,7 +307,7 @@ else if (!MapUtil.doneOverworldTexture) for (int i = 0; i < worlds.length; i++) { WorldServer world = worlds[i]; - ChunkProviderServer chunkProviderServer = world.theChunkProviderServer; + ChunkProviderServer chunkProviderServer = world.getChunkProvider(); Map> footprintMap = TickHandlerServer.serverFootprintMap.get(world.provider.getDimension()); @@ -316,7 +317,7 @@ else if (!MapUtil.doneOverworldTexture) if (chunkProviderServer != null) { - Iterator iterator = chunkProviderServer.loadedChunks.iterator(); + Iterator iterator = chunkProviderServer.getLoadedChunks().iterator(); while (iterator.hasNext()) { @@ -395,7 +396,7 @@ else if (!MapUtil.doneOverworldTexture) { if (!playersRequestingMapData.isEmpty()) { - File baseFolder = new File(MinecraftServer.getServer().worldServerForDimension(0).getChunkSaveLocation(), "galacticraft/overworldMap"); + File baseFolder = new File(server.worldServerForDimension(0).getChunkSaveLocation(), "galacticraft/overworldMap"); if (!baseFolder.exists() && !baseFolder.mkdirs()) { @@ -407,8 +408,8 @@ else if (!MapUtil.doneOverworldTexture) BufferedImage reusable = new BufferedImage(400, 400, BufferedImage.TYPE_INT_RGB); for (EntityPlayerMP playerMP : copy) { - GCPlayerStats stats = GCPlayerStats.get(playerMP); - MapUtil.makeVanillaMap(playerMP.dimension, (int) Math.floor(stats.coordsTeleportedFromX) >> 4, (int) Math.floor(stats.coordsTeleportedFromZ) >> 4, baseFolder, reusable); + IStatsCapability stats = playerMP.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + MapUtil.makeVanillaMap(playerMP.dimension, (int) Math.floor(stats.getCoordsTeleportedFromX()) >> 4, (int) Math.floor(stats.getCoordsTeleportedFromZ()) >> 4, baseFolder, reusable); } playersRequestingMapData.removeAll(copy); } @@ -591,7 +592,7 @@ public void onWorldTick(WorldTickEvent event) int dim = 0; try { - dim = WorldUtil.getProviderForNameServer(dimension.getPlanetToOrbit()).getDimensionId(); + dim = WorldUtil.getProviderForNameServer(dimension.getPlanetToOrbit()).getDimension(); } catch (Exception ex) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java index 475b26ec91..0e9e7fcf94 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java @@ -20,7 +20,7 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.ITickable; -import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3d; import net.minecraft.world.World; import java.util.HashSet; @@ -35,7 +35,7 @@ public class TileEntityArclamp extends TileEntity implements ITickable private HashSet airToRestore = new HashSet(); private boolean isActive = false; private AxisAlignedBB thisAABB; - private Vec3 thisPos; + private Vec3d thisPos; private int facingSide = 0; public boolean updateClientFlag; @@ -144,9 +144,9 @@ else if (!this.isActive) } EntityCreature e = (EntityCreature) entry; //Check whether the mob can actually *see* the arclamp tile - //if (this.worldObj.func_147447_a(thisPos, Vec3.createVectorHelper(e.posX, e.posY, e.posZ), true, true, false) != null) continue; + //if (this.worldObj.func_147447_a(thisPos, Vec3d.createVectorHelper(e.posX, e.posY, e.posZ), true, true, false) != null) continue; - Vec3 vecNewTarget = RandomPositionGenerator.findRandomTargetBlockAwayFrom(e, 16, 7, this.thisPos); + Vec3d vecNewTarget = RandomPositionGenerator.findRandomTargetBlockAwayFrom(e, 16, 7, this.thisPos); if (vecNewTarget == null) { continue; @@ -156,16 +156,16 @@ else if (!this.isActive) { continue; } - Vec3 vecOldTarget = null; + Vec3d vecOldTarget = null; if (nav.getPath() != null && !nav.getPath().isFinished()) { vecOldTarget = nav.getPath().getPosition(e); } - double distanceNew = vecNewTarget.distanceTo(new Vec3(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ())); + double distanceNew = vecNewTarget.distanceTo(new Vec3d(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ())); if (distanceNew > e.getDistanceSq(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ())) { - if (vecOldTarget == null || distanceNew > vecOldTarget.squareDistanceTo(new Vec3(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()))) + if (vecOldTarget == null || distanceNew > vecOldTarget.squareDistanceTo(new Vec3d(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()))) { e.getNavigator().tryMoveToXYZ(vecNewTarget.xCoord, vecNewTarget.yCoord, vecNewTarget.zCoord, 0.3D); //System.out.println("Debug: Arclamp repelling entity: "+e.getClass().getSimpleName()); @@ -183,7 +183,7 @@ else if (!this.isActive) public void validate() { super.validate(); - this.thisPos = new Vec3(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D); + this.thisPos = new Vec3d(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D); this.ticks = 0; this.thisAABB = null; if (this.worldObj.isRemote) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTreasureChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTreasureChest.java index f006e65e4a..845de0c3f6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTreasureChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTreasureChest.java @@ -9,6 +9,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.SoundEvents; import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; @@ -17,11 +18,22 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.world.WorldServer; +import net.minecraft.world.storage.loot.LootContext; +import net.minecraft.world.storage.loot.LootTable; import net.minecraftforge.fml.relauncher.Side; import java.util.Iterator; import java.util.List; +import java.util.Random; public class TileEntityTreasureChest extends TileEntityAdvanced implements ITickable, IInventory, IKeyable, IPacketReceiver { @@ -32,6 +44,9 @@ public class TileEntityTreasureChest extends TileEntityAdvanced implements ITick public int numPlayersUsing; private int ticksSinceSync; + protected ResourceLocation lootTable; + protected long lootTableSeed; + @Annotations.NetworkedField(targetSide = Side.CLIENT) public boolean locked = true; public int tier = 1; @@ -177,6 +192,8 @@ public void readFromNBT(NBTTagCompound compound) this.chestContents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } + + checkLootAndRead(compound); } @Override @@ -199,6 +216,10 @@ public NBTTagCompound writeToNBT(NBTTagCompound compound) } compound.setTag("Items", nbttaglist); + + checkLootAndWrite(compound); + + return compound; } /** @@ -276,7 +297,7 @@ public void update() double d1 = (double) i + 0.5D; d2 = (double) k + 0.5D; - this.worldObj.playSoundEffect(d1, (double) j + 0.5D, d2, "random.chestopen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + this.worldObj.playSound(null, d1, (double)j + 0.5D, d2, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); } if (((this.numPlayersUsing == 0 || this.locked) && this.lidAngle > 0.0F) || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) @@ -304,7 +325,7 @@ public void update() d2 = (double) i + 0.5D; double d0 = (double) k + 0.5D; - this.worldObj.playSoundEffect(d2, (double) j + 0.5D, d0, "random.chestclosed", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + this.worldObj.playSound(null, d2, (double)j + 0.5D, d0, SoundEvents.BLOCK_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); } if (this.lidAngle < 0.0F) @@ -417,7 +438,7 @@ public void clear() @Override public ITextComponent getDisplayName() { - return (ITextComponent) (this.hasCustomName() ? new TextComponentString(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); + return (ITextComponent) (this.hasCustomName() ? new TextComponentString(this.getName()) : new TextComponentTranslation(this.getName(), new Object[0])); } @Override @@ -519,4 +540,76 @@ public static TileEntityTreasureChest findClosest(Entity entity, int tier) return chest; } + + protected boolean checkLootAndRead(NBTTagCompound compound) + { + if (compound.hasKey("LootTable", 8)) + { + this.lootTable = new ResourceLocation(compound.getString("LootTable")); + this.lootTableSeed = compound.getLong("LootTableSeed"); + return true; + } + else + { + return false; + } + } + + protected boolean checkLootAndWrite(NBTTagCompound compound) + { + if (this.lootTable != null) + { + compound.setString("LootTable", this.lootTable.toString()); + + if (this.lootTableSeed != 0L) + { + compound.setLong("LootTableSeed", this.lootTableSeed); + } + + return true; + } + else + { + return false; + } + } + + public void fillWithLoot(EntityPlayer player) + { + if (this.lootTable != null) + { + LootTable loottable = this.worldObj.getLootTableManager().getLootTableFromLocation(this.lootTable); + this.lootTable = null; + Random random; + + if (this.lootTableSeed == 0L) + { + random = new Random(); + } + else + { + random = new Random(this.lootTableSeed); + } + + LootContext.Builder builder = new LootContext.Builder((WorldServer)this.worldObj); + + if (player != null) + { + builder.withLuck(player.getLuck()); + } + + loottable.fillInventory(this, random, builder.build()); + } + } + + public ResourceLocation getLootTable() + { + return this.lootTable; + } + + public void setLootTable(ResourceLocation lootTable, long lootTableSeed) + { + this.lootTable = lootTable; + this.lootTableSeed = lootTableSeed; + } } \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java index f82f930358..9bbf193b20 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java @@ -87,7 +87,7 @@ protected int[] offsetTowerCoords(int var1, int var2, int var3, int var4, int va @Override protected int getXWithOffset(int var1, int var2) { - switch (this.coordBaseMode.getHorizontalIndex()) + switch (this.getCoordBaseMode().getHorizontalIndex()) { case 0: return this.boundingBox.minX + var1; @@ -115,7 +115,7 @@ protected int getYWithOffset(int var1) @Override protected int getZWithOffset(int var1, int var2) { - switch (this.coordBaseMode.getHorizontalIndex()) + switch (this.getCoordBaseMode().getHorizontalIndex()) { case 0: return this.boundingBox.minZ + var2; @@ -136,13 +136,13 @@ protected int getZWithOffset(int var1, int var2) protected int getXWithOffsetAsIfRotated(int var1, int var2, int var3) { - if (this.coordBaseMode.getHorizontalIndex() < 0) + if (this.getCoordBaseMode().getHorizontalIndex() < 0) { return var1; } else { - switch ((this.coordBaseMode.getHorizontalIndex() + var3) % 4) + switch ((this.getCoordBaseMode().getHorizontalIndex() + var3) % 4) { case 0: return this.boundingBox.minX + var1; @@ -164,13 +164,13 @@ protected int getXWithOffsetAsIfRotated(int var1, int var2, int var3) protected int getZWithOffsetAsIfRotated(int var1, int var2, int var3) { - if (this.coordBaseMode.getHorizontalIndex() < 0) + if (this.getCoordBaseMode().getHorizontalIndex() < 0) { return var1; } else { - switch ((this.coordBaseMode.getHorizontalIndex() + var3) % 4) + switch ((this.getCoordBaseMode().getHorizontalIndex() + var3) % 4) { case 0: return this.boundingBox.minZ + var2; @@ -229,7 +229,7 @@ protected void fillAirRotated(World var1, StructureBoundingBox var2, int var3, i protected int getStairMeta(int var1) { - switch ((this.coordBaseMode.getHorizontalIndex() + var1) % 4) + switch ((this.getCoordBaseMode().getHorizontalIndex() + var1) % 4) { case 0: return 0; @@ -250,7 +250,7 @@ protected int getStairMeta(int var1) protected int getLadderMeta(int var1) { - switch ((this.coordBaseMode.getHorizontalIndex() + var1) % 4) + switch ((this.getCoordBaseMode().getHorizontalIndex() + var1) % 4) { case 0: return 4; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java index a46c106976..8c6fc2b6b1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java @@ -53,7 +53,7 @@ protected void readStructureFromNBT(NBTTagCompound nbttagcompound) @SuppressWarnings({ "rawtypes", "unchecked" }) protected StructureComponent getNextComponentNN(StructureComponentVillageStartPiece par1ComponentVillageStartPiece, List par2List, Random par3Random, int par4, int par5) { - switch (this.coordBaseMode.getHorizontalIndex()) + switch (this.getCoordBaseMode().getHorizontalIndex()) { case 0: return StructureVillagePiecesMoon.getNextStructureComponent(par1ComponentVillageStartPiece, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY + par4, this.boundingBox.minZ + par5, EnumFacing.getHorizontal(1), this.getComponentType()); @@ -71,7 +71,7 @@ protected StructureComponent getNextComponentNN(StructureComponentVillageStartPi @SuppressWarnings({ "rawtypes", "unchecked" }) protected StructureComponent getNextComponentPP(StructureComponentVillageStartPiece par1ComponentVillageStartPiece, List par2List, Random par3Random, int par4, int par5) { - switch (this.coordBaseMode.getHorizontalIndex()) + switch (this.getCoordBaseMode().getHorizontalIndex()) { case 0: return StructureVillagePiecesMoon.getNextStructureComponent(par1ComponentVillageStartPiece, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY + par4, this.boundingBox.minZ + par5, EnumFacing.getHorizontal(3), this.getComponentType()); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java index 5a203204f1..3a3f9acc1f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java @@ -204,10 +204,10 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 6, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 5, yLevel, 1, par3StructureBoundingBox); - this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.coordBaseMode), 8, yLevel, 2, par3StructureBoundingBox); - this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.coordBaseMode.rotateY()), 14, yLevel, 8, par3StructureBoundingBox); - this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.coordBaseMode.getOpposite()), 8, yLevel, 14, par3StructureBoundingBox); - this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.coordBaseMode.rotateYCCW()), 2, yLevel, 8, par3StructureBoundingBox); + this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.getCoordBaseMode()), 8, yLevel, 2, par3StructureBoundingBox); + this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.getCoordBaseMode().rotateY()), 14, yLevel, 8, par3StructureBoundingBox); + this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.getCoordBaseMode().getOpposite()), 8, yLevel, 14, par3StructureBoundingBox); + this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.getCoordBaseMode().rotateYCCW()), 2, yLevel, 8, par3StructureBoundingBox); yLevel = 5; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java index 275cfe3fcf..399694d859 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java @@ -79,7 +79,7 @@ public void buildComponent(StructureComponent par1StructureComponent, List par2L if (var4 && par3Random.nextInt(3) > 0) { - switch (this.coordBaseMode.getHorizontalIndex()) + switch (this.getCoordBaseMode().getHorizontalIndex()) { case 0: StructureVillagePiecesMoon.getNextStructureComponentVillagePath((StructureComponentVillageStartPiece) par1StructureComponent, par2List, par3Random, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.maxZ - 2, EnumFacing.getHorizontal(1), this.getComponentType()); @@ -97,7 +97,7 @@ public void buildComponent(StructureComponent par1StructureComponent, List par2L if (var4 && par3Random.nextInt(3) > 0) { - switch (this.coordBaseMode.getHorizontalIndex()) + switch (this.getCoordBaseMode().getHorizontalIndex()) { case 0: StructureVillagePiecesMoon.getNextStructureComponentVillagePath((StructureComponentVillageStartPiece) par1StructureComponent, par2List, par3Random, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.maxZ - 2, EnumFacing.getHorizontal(3), this.getComponentType()); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java index 8ce2a6dfbf..ea5ccc8cfa 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java @@ -74,11 +74,11 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 1, 0, par3StructureBoundingBox); this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 2, 0, par3StructureBoundingBox); this.setBlockState(par1World, Blocks.wool.getStateFromMeta(15), 1, 3, 0, par3StructureBoundingBox); - boolean flag = this.coordBaseMode == EnumFacing.EAST || this.coordBaseMode == EnumFacing.NORTH; - this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.coordBaseMode.rotateY()), flag ? 2 : 0, 3, 0, par3StructureBoundingBox); - this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.coordBaseMode), 1, 3, 1, par3StructureBoundingBox); - this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.coordBaseMode.rotateYCCW()), flag ? 0 : 2, 3, 0, par3StructureBoundingBox); - this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.coordBaseMode.getOpposite()), 1, 3, -1, par3StructureBoundingBox); + boolean flag = this.getCoordBaseMode() == EnumFacing.EAST || this.getCoordBaseMode() == EnumFacing.NORTH; + this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.getCoordBaseMode().rotateY()), flag ? 2 : 0, 3, 0, par3StructureBoundingBox); + this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.getCoordBaseMode()), 1, 3, 1, par3StructureBoundingBox); + this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.getCoordBaseMode().rotateYCCW()), flag ? 0 : 2, 3, 0, par3StructureBoundingBox); + this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.getCoordBaseMode().getOpposite()), 1, 3, -1, par3StructureBoundingBox); return true; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java index 5b107aa0ab..a0e495ac61 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java @@ -23,9 +23,9 @@ public StructureComponentVillageWell() public StructureComponentVillageWell(StructureComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, int par4, int par5) { super(par1ComponentVillageStartPiece, par2); - this.coordBaseMode = EnumFacing.getFront(par3Random.nextInt(4)); + this.getCoordBaseMode() = EnumFacing.getFront(par3Random.nextInt(4)); - switch (this.coordBaseMode.getHorizontalIndex()) + switch (this.getCoordBaseMode().getHorizontalIndex()) { case 0: case 2: diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java index 46d6f14639..b126a68fce 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java @@ -203,10 +203,10 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 6, yLevel, 1, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.basicBlock.getStateFromMeta(4), 5, yLevel, 1, par3StructureBoundingBox); - this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.coordBaseMode), 8, yLevel, 2, par3StructureBoundingBox); - this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.coordBaseMode.rotateYCCW()), 14, yLevel, 8, par3StructureBoundingBox); - this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.coordBaseMode.getOpposite()), 8, yLevel, 14, par3StructureBoundingBox); - this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.coordBaseMode.rotateY()), 2, yLevel, 8, par3StructureBoundingBox); + this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.getCoordBaseMode()), 8, yLevel, 2, par3StructureBoundingBox); + this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.getCoordBaseMode().rotateYCCW()), 14, yLevel, 8, par3StructureBoundingBox); + this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.getCoordBaseMode().getOpposite()), 8, yLevel, 14, par3StructureBoundingBox); + this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.getCoordBaseMode().rotateY()), 2, yLevel, 8, par3StructureBoundingBox); yLevel = 5; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java index 05bef75036..2df0f75b1e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java @@ -1,19 +1,24 @@ package micdoodle8.mods.galacticraft.core.world.gen.dungeon; +import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.GCBlocks; import micdoodle8.mods.galacticraft.core.blocks.BlockT1TreasureChest; import micdoodle8.mods.galacticraft.core.tile.TileEntityTreasureChest; import net.minecraft.init.Blocks; +import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; import net.minecraft.world.gen.structure.StructureComponent; +import net.minecraft.world.storage.loot.LootTableList; import java.util.Random; public class RoomTreasure extends SizedPiece { + public static final ResourceLocation TABLE_TIER_1_DUNGEON = LootTableList.register(new ResourceLocation(Constants.ASSET_PREFIX, "chests/dungeon_tier_1")); + public RoomTreasure() { } @@ -26,7 +31,7 @@ public RoomTreasure(DungeonConfiguration configuration, Random rand, int blockPo public RoomTreasure(DungeonConfiguration configuration, Random rand, int blockPosX, int blockPosZ, int sizeX, int sizeY, int sizeZ, EnumFacing entranceDir) { super(configuration, sizeX, sizeY, sizeZ, entranceDir.getOpposite()); - this.coordBaseMode = EnumFacing.SOUTH; + this.setCoordBaseMode(EnumFacing.SOUTH); int yPos = configuration.getYPosition(); this.boundingBox = new StructureBoundingBox(blockPosX, yPos, blockPosZ, blockPosX + this.sizeX, yPos + this.sizeY, blockPosZ + this.sizeZ); @@ -87,7 +92,7 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else if ((i == 1 && k == 1) || (i == 1 && k == this.sizeZ - 1) || (i == this.sizeX - 1 && k == 1) || (i == this.sizeX - 1 && k == this.sizeZ - 1)) { - this.setBlockState(worldIn, Blocks.glowstone.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.GLOWSTONE.getDefaultState(), i, j, k, boundingBox); } else if (i == this.sizeX / 2 && j == 1 && k == this.sizeZ / 2) { @@ -97,6 +102,7 @@ else if (i == this.sizeX / 2 && j == 1 && k == this.sizeZ / 2) { worldIn.setTileEntity(blockpos, new TileEntityTreasureChest(1)); } + ((TileEntityTreasureChest) worldIn.getTileEntity(blockpos)).setLootTable(TABLE_TIER_1_DUNGEON, random.nextLong()); } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/SkyProviderAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/SkyProviderAsteroids.java index 4c9931294d..113ea75bff 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/SkyProviderAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/SkyProviderAsteroids.java @@ -13,7 +13,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3d; import net.minecraftforge.client.IRenderHandler; import net.minecraftforge.fml.client.FMLClientHandler; import org.lwjgl.opengl.GL11; @@ -268,9 +268,9 @@ private void renderStars() var2.draw(); } - private Vec3 getCustomSkyColor() + private Vec3d getCustomSkyColor() { - return new Vec3(0.26796875D, 0.1796875D, 0.0D); + return new Vec3d(0.26796875D, 0.1796875D, 0.0D); } public float getSkyBrightness(float par1) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderGrapple.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderGrapple.java index ef51fdd6e7..8dd1bddb8d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderGrapple.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderGrapple.java @@ -7,7 +7,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3d; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; @@ -24,7 +24,7 @@ public void doRender(EntityGrapple grapple, double x, double y, double z, float GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPushMatrix(); - Vec3 vec3 = new Vec3(0.0D, -0.2D, 0.0D); + Vec3d vec3 = new Vec3d(0.0D, -0.2D, 0.0D); EntityPlayer shootingEntity = grapple.getShootingEntity(); if (shootingEntity != null && grapple.getPullingEntity()) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java index 2bec25d4d6..08b7185ec0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java @@ -204,8 +204,8 @@ public EntityAstroMiner(World world) this.height = cWIDTH; this.setSize(cLENGTH, cWIDTH); // this.myEntitySize = Entity.EnumEntitySize.SIZE_6; -// this.dataWatcher.addObject(this.currentDamage, new Integer(0)); -// this.dataWatcher.addObject(this.timeSinceHit, new Integer(0)); +// this.dataManager.addObject(this.currentDamage, new Integer(0)); +// this.dataManager.addObject(this.timeSinceHit, new Integer(0)); this.isImmuneToFire = true; this.noClip = true; } @@ -213,7 +213,7 @@ public EntityAstroMiner(World world) @Override protected void entityInit() { - this.dataWatcher.addObject(19, new Float(0.0F)); + this.dataManager.addObject(19, new Float(0.0F)); } @Override @@ -597,14 +597,14 @@ else if (!(this.worldObj.provider instanceof WorldProviderAsteroids) && this.tic this.posY += this.motionY; this.posZ += this.motionZ; setEntityBoundingBox(getEntityBoundingBox().offset(this.motionX, this.motionY, this.motionZ)); -/* if (this.dataWatcher.getWatchableObjectInt(this.timeSinceHit) > 0) +/* if (this.dataManager.get(this.timeSinceHit) > 0) { - this.dataWatcher.updateObject(this.timeSinceHit, Integer.valueOf(this.dataWatcher.getWatchableObjectInt(this.timeSinceHit) - 1)); + this.dataManager.set(this.timeSinceHit, Integer.valueOf(this.dataManager.get(this.timeSinceHit) - 1)); } - if (this.dataWatcher.getWatchableObjectInt(this.currentDamage) > 0) + if (this.dataManager.get(this.currentDamage) > 0) { - this.dataWatcher.updateObject(this.currentDamage, Integer.valueOf(this.dataWatcher.getWatchableObjectInt(this.currentDamage) - 1)); + this.dataManager.set(this.currentDamage, Integer.valueOf(this.dataManager.get(this.currentDamage) - 1)); } */ } @@ -2072,14 +2072,14 @@ public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) else { this.setBeenAttacked(); -// this.dataWatcher.updateObject(this.timeSinceHit, Integer.valueOf(10)); -// this.dataWatcher.updateObject(this.currentDamage, Integer.valueOf((int) (this.dataWatcher.getWatchableObjectInt(this.currentDamage) + par2 * 10))); +// this.dataManager.set(this.timeSinceHit, Integer.valueOf(10)); +// this.dataManager.set(this.currentDamage, Integer.valueOf((int) (this.dataManager.get(this.currentDamage) + par2 * 10))); this.shipDamage += par2 * 10; if (e instanceof EntityPlayer) { this.shipDamage += par2 * 21; -// this.dataWatcher.updateObject(this.currentDamage, 100); +// this.dataManager.set(this.currentDamage, 100); } if (this.shipDamage > 90) @@ -2119,18 +2119,18 @@ public boolean canBeCollidedWith() @Override public void performHurtAnimation() { -// this.dataWatcher.updateObject(this.timeSinceHit, Integer.valueOf(10)); -// this.dataWatcher.updateObject(this.currentDamage, Integer.valueOf(this.dataWatcher.getWatchableObjectInt(this.currentDamage) * 5)); +// this.dataManager.set(this.timeSinceHit, Integer.valueOf(10)); +// this.dataManager.set(this.currentDamage, Integer.valueOf(this.dataManager.get(this.currentDamage) * 5)); } public float getDamage() { - return this.dataWatcher.getWatchableObjectFloat(19); + return this.dataManager.getWatchableObjectFloat(19); } public void setDamage(float p_70492_1_) { - this.dataWatcher.updateObject(19, Float.valueOf(p_70492_1_)); + this.dataManager.set(19, Float.valueOf(p_70492_1_)); } @Override @@ -2144,7 +2144,7 @@ public void setLocationAndAngles(double x, double y, double z, float rotYaw, flo @SideOnly(Side.CLIENT) @Override - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean b) + public void setPositionAndRotationDirect(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean b) { this.minecartX = x; this.minecartY = y; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java index 6c168d1801..821c46127f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java @@ -163,7 +163,7 @@ public boolean canBeCollidedWith() } @Override - public boolean interactFirst(EntityPlayer var1) + public boolean processInitialInteract(EntityPlayer player, ItemStack stack, EnumHand hand) { if (this.worldObj.isRemote) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityGrapple.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityGrapple.java index aacabbe5f6..3ade2a135c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityGrapple.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityGrapple.java @@ -14,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Items; +import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.*; @@ -81,8 +82,8 @@ public double getYOffset() @Override protected void entityInit() { - this.dataWatcher.addObject(10, 0); - this.dataWatcher.addObject(11, 0); + this.dataManager.addObject(10, 0); + this.dataManager.addObject(11, 0); } @Override @@ -109,7 +110,7 @@ public void setThrowableHeading(double par1, double par3, double par5, float par @Override @SideOnly(Side.CLIENT) - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean b) + public void setPositionAndRotationDirect(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean b) { this.setPosition(x, y, z); this.setRotation(yaw, pitch); @@ -208,7 +209,7 @@ public void onUpdate() block.setBlockBoundsBasedOnState(this.worldObj, this.hitVec); AxisAlignedBB axisalignedbb = block.getCollisionBoundingBox(this.worldObj, this.hitVec, this.worldObj.getBlockState(this.hitVec)); - if (axisalignedbb != null && axisalignedbb.isVecInside(new Vec3(this.posX, this.posY, this.posZ))) + if (axisalignedbb != null && axisalignedbb.isVecInside(new Vec3d(this.posX, this.posY, this.posZ))) { this.inGround = true; } @@ -277,15 +278,15 @@ public void onUpdate() this.setDead(); } - Vec3 vec31 = new Vec3(this.posX, this.posY, this.posZ); - Vec3 vec3 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3d vec31 = new Vec3d(this.posX, this.posY, this.posZ); + Vec3d vec3 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec31, vec3, false, true, false); - vec31 = new Vec3(this.posX, this.posY, this.posZ); - vec3 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + vec31 = new Vec3d(this.posX, this.posY, this.posZ); + vec3 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (movingobjectposition != null) { - vec3 = new Vec3(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + vec3 = new Vec3d(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); } Entity entity = null; @@ -473,7 +474,7 @@ public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) if (flag) { - this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + this.playSound(SoundEvents.ENTITY_ITEM_PICKUP, 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); par1EntityPlayer.onItemPickup(this, 1); this.setDead(); } @@ -503,13 +504,13 @@ private void updateShootingEntity() { if (this.shootingEntity != null) { - this.dataWatcher.updateObject(10, this.shootingEntity.getEntityId()); + this.dataManager.set(10, this.shootingEntity.getEntityId()); } } public EntityPlayer getShootingEntity() { - Entity entity = this.worldObj.getEntityByID(this.dataWatcher.getWatchableObjectInt(10)); + Entity entity = this.worldObj.getEntityByID(this.dataManager.get(10)); if (entity instanceof EntityPlayer) { @@ -521,11 +522,11 @@ public EntityPlayer getShootingEntity() public void updatePullingEntity(boolean pulling) { - this.dataWatcher.updateObject(11, pulling ? 1 : 0); + this.dataManager.set(11, pulling ? 1 : 0); } public boolean getPullingEntity() { - return this.dataWatcher.getWatchableObjectInt(11) == 1; + return this.dataManager.get(11) == 1; } } \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntitySmallAsteroid.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntitySmallAsteroid.java index 5ae4c4f499..94574b7ddc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntitySmallAsteroid.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntitySmallAsteroid.java @@ -69,9 +69,9 @@ else if (this.posY > 288D || this.posY < -32D || this.ticksExisted > 3000) @Override protected void entityInit() { - this.dataWatcher.addObject(10, 0.0F); - this.dataWatcher.addObject(11, 0.0F); - this.dataWatcher.addObject(12, 0); + this.dataManager.addObject(10, 0.0F); + this.dataManager.addObject(11, 0.0F); + this.dataManager.addObject(12, 0); } @Override @@ -92,31 +92,31 @@ protected void writeEntityToNBT(NBTTagCompound nbt) public float getSpinPitch() { - return this.dataWatcher.getWatchableObjectFloat(10); + return this.dataManager.getWatchableObjectFloat(10); } public float getSpinYaw() { - return this.dataWatcher.getWatchableObjectFloat(11); + return this.dataManager.getWatchableObjectFloat(11); } public void setSpinPitch(float pitch) { - this.dataWatcher.updateObject(10, pitch); + this.dataManager.set(10, pitch); } public void setSpinYaw(float yaw) { - this.dataWatcher.updateObject(11, yaw); + this.dataManager.set(11, yaw); } public int getAsteroidType() { - return this.dataWatcher.getWatchableObjectInt(12); + return this.dataManager.get(12); } public void setAsteroidType(int type) { - this.dataWatcher.updateObject(12, type); + this.dataManager.set(12, type); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java index 2da9ee29f7..8b2cbb0fd8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java @@ -44,7 +44,7 @@ public class ChunkProviderAsteroids extends ChunkProviderGenerate final byte DIRT_META = 0; final Block GRASS = Blocks.grass; final byte GRASS_META = 0; - final Block LIGHT = Blocks.glowstone; + final Block LIGHT = Blocks.GLOWSTONE; final byte LIGHT_META = 0; BlockTallGrass.EnumType GRASS_TYPE = BlockTallGrass.EnumType.GRASS; final BlockFlower FLOWER = Blocks.red_flower; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/SkyProviderMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/SkyProviderMars.java index 583aeaaad2..1231ce4593 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/SkyProviderMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/SkyProviderMars.java @@ -9,7 +9,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3d; import net.minecraftforge.client.IRenderHandler; import net.minecraftforge.fml.client.FMLClientHandler; import org.lwjgl.opengl.GL11; @@ -95,7 +95,7 @@ public void render(float partialTicks, WorldClient world, Minecraft mc) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL12.GL_RESCALE_NORMAL); - Vec3 vec3 = world.getSkyColor(mc.getRenderViewEntity(), partialTicks); + Vec3d vec3 = world.getSkyColor(mc.getRenderViewEntity(), partialTicks); float f1 = (float) vec3.xCoord; float f2 = (float) vec3.yCoord; float f3 = (float) vec3.zCoord; @@ -385,9 +385,9 @@ private void renderStars() var2.draw(); } - private Vec3 getCustomSkyColor() + private Vec3d getCustomSkyColor() { - return new Vec3(0.26796875D, 0.1796875D, 0.0D); + return new Vec3d(0.26796875D, 0.1796875D, 0.0D); } public float getSkyBrightness(float par1) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/WorldProviderMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/WorldProviderMars.java index 2928760288..93e1bab38c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/WorldProviderMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/WorldProviderMars.java @@ -98,15 +98,15 @@ public Class getBiomeProviderClass() // @SideOnly(Side.CLIENT) // @Override -// public Vec3 getFogColor(float var1, float var2) +// public Vec3d getFogColor(float var1, float var2) // { -// return Vec3.createVectorHelper((double) 210F / 255F, (double) 120F / 255F, (double) 59F / 255F); +// return Vec3d.createVectorHelper((double) 210F / 255F, (double) 120F / 255F, (double) 59F / 255F); // } // // @Override -// public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) +// public Vec3d getSkyColor(Entity cameraEntity, float partialTicks) // { -// return Vec3.createVectorHelper(154 / 255.0F, 114 / 255.0F, 66 / 255.0F); +// return Vec3d.createVectorHelper(154 / 255.0F, 114 / 255.0F, 66 / 255.0F); // } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java index 4dc95d3f6a..aa368861d8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java @@ -168,7 +168,7 @@ else if (this.getHealth() <= 2 * (this.getMaxHealth() / 3.0)) this.headsRemaining = 2; } - final EntityPlayer player = this.worldObj.getClosestPlayer(this.posX, this.posY, this.posZ, 20.0); + final EntityPlayer player = this.worldObj.getClosestPlayer(this.posX, this.posY, this.posZ, 20.0, false); if (player != null && !player.equals(this.targetEntity)) { @@ -241,7 +241,7 @@ public ItemStack getGuaranteedLoot(Random rand) List stackList = GalacticraftRegistry.getDungeonLoot(2); int range = 2; //If player seems to have Tier 3 rocket already then add Astro Miner to the loot - final EntityPlayer player = this.worldObj.getClosestPlayer(this.posX, this.posY, this.posZ, 20.0); + final EntityPlayer player = this.worldObj.getClosestPlayer(this.posX, this.posY, this.posZ, 20.0, false); if (player != null) { GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) player); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityLandingBalloons.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityLandingBalloons.java index 07a1099ee2..0217fa5887 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityLandingBalloons.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityLandingBalloons.java @@ -98,7 +98,7 @@ public boolean hasCustomName() } @Override - public boolean interactFirst(EntityPlayer var1) + public boolean processInitialInteract(EntityPlayer player, ItemStack stack, EnumHand hand) { if (this.worldObj.isRemote) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySlimeling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySlimeling.java index a1ba4fbc63..9bdaff6801 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySlimeling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySlimeling.java @@ -63,7 +63,7 @@ public EntitySlimeling(World par1World) this.aiSit = new EntityAISitGC(this); this.tasks.addTask(2, this.aiSit); this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F)); - this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true)); + this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, true)); this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F)); this.tasks.addTask(6, new EntityAIMate(this, 1.0D)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); @@ -210,24 +210,24 @@ protected void applyEntityAttributes() @Override protected void updateAITick() { - this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth())); + this.dataManager.set(18, Float.valueOf(this.getHealth())); } @Override protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(18, new Float(this.getHealth())); - this.dataWatcher.addObject(19, new Float(this.colorRed)); - this.dataWatcher.addObject(20, new Float(this.colorGreen)); - this.dataWatcher.addObject(21, new Float(this.colorBlue)); - this.dataWatcher.addObject(22, new Integer(this.age)); - this.dataWatcher.addObject(23, ""); - this.dataWatcher.addObject(24, new Integer(this.favFoodID)); - this.dataWatcher.addObject(25, new Float(this.attackDamage)); - this.dataWatcher.addObject(26, new Integer(this.kills)); - this.dataWatcher.addObject(27, new ItemStack(Blocks.stone)); - this.dataWatcher.addObject(28, ""); + this.dataManager.addObject(18, new Float(this.getHealth())); + this.dataManager.addObject(19, new Float(this.colorRed)); + this.dataManager.addObject(20, new Float(this.colorGreen)); + this.dataManager.addObject(21, new Float(this.colorBlue)); + this.dataManager.addObject(22, new Integer(this.age)); + this.dataManager.addObject(23, ""); + this.dataManager.addObject(24, new Integer(this.favFoodID)); + this.dataManager.addObject(25, new Float(this.attackDamage)); + this.dataManager.addObject(26, new Integer(this.kills)); + this.dataManager.addObject(27, new ItemStack(Blocks.stone)); + this.dataManager.addObject(28, ""); this.setName(GCCoreUtil.translate("gui.message.unnamed.name")); } @@ -513,13 +513,13 @@ public void setSittingAI(boolean sitting) public String getOwnerUsername() { - String s = this.dataWatcher.getWatchableObjectString(28); + String s = this.dataManager.getWatchableObjectString(28); return s == null || s.length() == 0 ? "" : s; } public void setOwnerUsername(String username) { - this.dataWatcher.updateObject(28, username); + this.dataManager.set(28, username); } @Override @@ -609,84 +609,84 @@ public EntityAgeable createChild(EntityAgeable par1EntityAgeable) public float getColorRed() { - return this.dataWatcher.getWatchableObjectFloat(19); + return this.dataManager.getWatchableObjectFloat(19); } public void setColorRed(float color) { - this.dataWatcher.updateObject(19, color); + this.dataManager.set(19, color); } public float getColorGreen() { - return this.dataWatcher.getWatchableObjectFloat(20); + return this.dataManager.getWatchableObjectFloat(20); } public void setColorGreen(float color) { - this.dataWatcher.updateObject(20, color); + this.dataManager.set(20, color); } public float getColorBlue() { - return this.dataWatcher.getWatchableObjectFloat(21); + return this.dataManager.getWatchableObjectFloat(21); } public void setColorBlue(float color) { - this.dataWatcher.updateObject(21, color); + this.dataManager.set(21, color); } @Override public int getAge() { - return this.dataWatcher.getWatchableObjectInt(22); + return this.dataManager.get(22); } public void setAge(int age) { - this.dataWatcher.updateObject(22, age); + this.dataManager.set(22, age); } @Override public String getName() { - return this.dataWatcher.getWatchableObjectString(23); + return this.dataManager.getWatchableObjectString(23); } public void setName(String name) { - this.dataWatcher.updateObject(23, name); + this.dataManager.set(23, name); } public Item getFavoriteFood() { - return Item.getItemById(this.dataWatcher.getWatchableObjectInt(24)); + return Item.getItemById(this.dataManager.get(24)); } public void setFavoriteFood(int foodID) { - this.dataWatcher.updateObject(24, foodID); + this.dataManager.set(24, foodID); } public float getAttackDamage() { - return this.dataWatcher.getWatchableObjectFloat(25); + return this.dataManager.getWatchableObjectFloat(25); } public void setAttackDamage(float damage) { - this.dataWatcher.updateObject(25, damage); + this.dataManager.set(25, damage); } public int getKillCount() { - return this.dataWatcher.getWatchableObjectInt(26); + return this.dataManager.get(26); } public void setKillCount(int damage) { - this.dataWatcher.updateObject(26, damage); + this.dataManager.set(26, damage); } @Override @@ -707,17 +707,17 @@ public EntityAISit getAiSit() public ItemStack getCargoSlot() { - return this.dataWatcher.getWatchableObjectItemStack(27); + return this.dataManager.getWatchableObjectItemStack(27); } public void setCargoSlot(ItemStack stack) { - ItemStack stack2 = this.dataWatcher.getWatchableObjectItemStack(27); + ItemStack stack2 = this.dataManager.getWatchableObjectItemStack(27); if (stack != stack2) { - this.dataWatcher.updateObject(27, stack); - this.dataWatcher.setObjectWatched(27); + this.dataManager.set(27, stack); + this.dataManager.setObjectWatched(27); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java index bfbd1bdae8..58ea7cd48a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java @@ -8,7 +8,7 @@ import net.minecraft.block.Block; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.EntityAIAttackOnCollide; +import net.minecraft.entity.ai.EntityAIAttackMelee; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; @@ -25,8 +25,8 @@ public EntitySludgeling(World par1World) this.setSize(0.3F, 0.2F); this.tasks.taskEntries.clear(); this.targetTasks.taskEntries.clear(); - this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 0.25F, true)); - this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); + this.tasks.addTask(1, new EntityAIAttackMelee(this, 0.25F, true)); + this.tasks.addTask(4, new EntityAIAttackMelee(this, EntityPlayer.class, 1.0D, false)); this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, false, true, null)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityEvolvedZombie.class, 0, false, true, null)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityEvolvedSkeleton.class, 0, false, true, null)); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomBossMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomBossMars.java index 5767331744..e5302349d1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomBossMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomBossMars.java @@ -86,7 +86,7 @@ else if (j == this.sizeY) { if ((i <= 2 || k <= 2 || i >= this.sizeX - 2 || k >= this.sizeZ - 2) && random.nextInt(4) == 0) { - this.setBlockState(worldIn, Blocks.glowstone.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.GLOWSTONE.getDefaultState(), i, j, k, boundingBox); } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomTreasureMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomTreasureMars.java index 50e225bbac..f4dfb613ea 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomTreasureMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/RoomTreasureMars.java @@ -84,7 +84,7 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else if ((i == 1 && k == 1) || (i == 1 && k == this.sizeZ - 1) || (i == this.sizeX - 1 && k == 1) || (i == this.sizeX - 1 && k == this.sizeZ - 1)) { - this.setBlockState(worldIn, Blocks.glowstone.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.GLOWSTONE.getDefaultState(), i, j, k, boundingBox); } else if (i == this.sizeX / 2 && j == 1 && k == this.sizeZ / 2) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java index 140eb3e6fc..0ea41557d1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java @@ -77,7 +77,7 @@ public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) } @Override - public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) { EnumWebType type = (EnumWebType)worldIn.getBlockState(pos).getValue(WEB_TYPE); float f = 0.15F; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/SkyProviderVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/SkyProviderVenus.java index dac13e997f..1df55e975c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/SkyProviderVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/SkyProviderVenus.java @@ -9,7 +9,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3d; import net.minecraftforge.client.IRenderHandler; import net.minecraftforge.fml.client.FMLClientHandler; import org.lwjgl.opengl.GL11; @@ -88,7 +88,7 @@ public void render(float partialTicks, WorldClient world, Minecraft mc) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL12.GL_RESCALE_NORMAL); - Vec3 vec3 = world.getSkyColor(mc.getRenderViewEntity(), partialTicks); + Vec3d vec3 = world.getSkyColor(mc.getRenderViewEntity(), partialTicks); float f1 = (float) vec3.xCoord; float f2 = (float) vec3.yCoord; float f3 = (float) vec3.zCoord; @@ -378,9 +378,9 @@ private void renderStars() var2.draw(); } - private Vec3 getCustomSkyColor() + private Vec3d getCustomSkyColor() { - return new Vec3(0.26796875D, 0.1796875D, 0.0D); + return new Vec3d(0.26796875D, 0.1796875D, 0.0D); } public float getSkyBrightness(float par1) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java index dfe52fae0e..23835ca914 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java @@ -189,7 +189,7 @@ public boolean canBeCollidedWith() } @Override - public boolean interactFirst(EntityPlayer var1) + public boolean processInitialInteract(EntityPlayer player, ItemStack stack, EnumHand hand) { if (this.worldObj.isRemote) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java index 6ae60886e8..af30a94d93 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java @@ -29,7 +29,7 @@ public EntityJuicer(World world) super(world); this.moveHelper = new EntityMoveHelperCeiling(this); this.setSize(1F, 0.6F); - this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0, true)); + this.tasks.addTask(4, new EntityAIAttackMelee(this, EntityPlayer.class, 1.0, true)); this.tasks.addTask(5, new EntityAIWander(this, 0.8D)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(6, new EntityAILookIdle(this)); @@ -42,28 +42,28 @@ public EntityJuicer(World world) protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(16, (byte)0); - this.dataWatcher.addObject(17, (byte)0); + this.dataManager.addObject(16, (byte)0); + this.dataManager.addObject(17, (byte)0); } public boolean isHanging() { - return this.dataWatcher.getWatchableObjectByte(16) != 0; + return this.dataManager.getWatchableObjectByte(16) != 0; } public void setHanging(boolean hanging) { - this.dataWatcher.updateObject(16, (byte)(hanging ? 1 : 0)); + this.dataManager.set(16, (byte)(hanging ? 1 : 0)); } public boolean isFalling() { - return this.dataWatcher.getWatchableObjectByte(17) != 0; + return this.dataManager.getWatchableObjectByte(17) != 0; } public void setFalling(boolean falling) { - this.dataWatcher.updateObject(17, (byte)(falling ? 1 : 0)); + this.dataManager.set(17, (byte)(falling ? 1 : 0)); } @Override @@ -142,7 +142,7 @@ public void onLivingUpdate() if (blockAbove.getBlock() == VenusBlocks.venusBlock && (blockAbove.getValue(BlockBasicVenus.BASIC_TYPE_VENUS) == BlockBasicVenus.EnumBlockBasicVenus.DUNGEON_BRICK_2 || blockAbove.getValue(BlockBasicVenus.BASIC_TYPE_VENUS) == BlockBasicVenus.EnumBlockBasicVenus.DUNGEON_BRICK_1)) { - MovingObjectPosition hit = this.worldObj.rayTraceBlocks(new Vec3(this.posX, this.posY, this.posZ), new Vec3(this.posX, this.posY + (this.isHanging() ? -10 : 10), this.posZ), false, true, false); + MovingObjectPosition hit = this.worldObj.rayTraceBlocks(new Vec3d(this.posX, this.posY, this.posZ), new Vec3d(this.posX, this.posY + (this.isHanging() ? -10 : 10), this.posZ), false, true, false); if (hit != null && hit.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java index 66bce3ae41..62f6c2a1cc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java @@ -45,7 +45,7 @@ public EntitySpiderQueen(World worldIn) { super(worldIn); this.setSize(1.4F, 0.9F); - this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0, true)); + this.tasks.addTask(4, new EntityAIAttackMelee(this, EntityPlayer.class, 1.0, true)); this.tasks.addTask(5, new EntityAIWander(this, 0.8D)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(6, new EntityAILookIdle(this)); @@ -78,17 +78,17 @@ protected PathNavigate getNewNavigator(World worldIn) protected void entityInit() { super.entityInit(); - this.dataWatcher.addObject(16, (byte)-1); + this.dataManager.addObject(16, (byte)-1); } public byte getBurrowedCount() { - return this.dataWatcher.getWatchableObjectByte(16); + return this.dataManager.getWatchableObjectByte(16); } public void setBurrowedCount(byte count) { - this.dataWatcher.updateObject(16, count); + this.dataManager.set(16, count); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityWebShot.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityWebShot.java index df49a1de22..d8d382a04a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityWebShot.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityWebShot.java @@ -116,7 +116,7 @@ public void setThrowableHeading(double x, double y, double z, float velocity, fl @Override @SideOnly(Side.CLIENT) - public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) + public void setPositionAndRotationDirect(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_) { this.setPosition(x, y, z); this.setRotation(yaw, pitch); @@ -164,15 +164,15 @@ public void onUpdate() } ++this.ticksInAir; - Vec3 vec31 = new Vec3(this.posX, this.posY, this.posZ); - Vec3 vec3 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3d vec31 = new Vec3d(this.posX, this.posY, this.posZ); + Vec3d vec3 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec31, vec3, false, true, false); - vec31 = new Vec3(this.posX, this.posY, this.posZ); - vec3 = new Vec3(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + vec31 = new Vec3d(this.posX, this.posY, this.posZ); + vec3 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); if (movingobjectposition != null) { - vec3 = new Vec3(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + vec3 = new Vec3d(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); } Entity entity = null; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java index 2f2740076d..5b57bac097 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java @@ -9,7 +9,7 @@ import net.minecraft.pathfinding.PathNavigate; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.Vec3; +import net.minecraft.util.Vec3d; import net.minecraft.world.World; public class PathNavigateCeiling extends PathNavigate @@ -35,9 +35,9 @@ protected boolean canNavigate() } @Override - protected Vec3 getEntityPosition() + protected Vec3d getEntityPosition() { - return new Vec3(this.theEntity.posX, (double)this.getPathablePosY(), this.theEntity.posZ); + return new Vec3d(this.theEntity.posX, (double)this.getPathablePosY(), this.theEntity.posZ); } private int getPathablePosY() @@ -46,7 +46,7 @@ private int getPathablePosY() } @Override - protected boolean isDirectPathBetweenPoints(Vec3 current, Vec3 target, int sizeX, int sizeY, int sizeZ) + protected boolean isDirectPathBetweenPoints(Vec3d current, Vec3d target, int sizeX, int sizeY, int sizeZ) { int i = MathHelper.floor_double(current.xCoord); int j = MathHelper.floor_double(current.zCoord); @@ -124,7 +124,7 @@ protected boolean isDirectPathBetweenPoints(Vec3 current, Vec3 target, int sizeX } } - private boolean isSafeToStandAt(int x, int y, int z, int sizeX, int sizeY, int sizeZ, Vec3 currentPos, double distanceX, double distanceZ) + private boolean isSafeToStandAt(int x, int y, int z, int sizeX, int sizeY, int sizeZ, Vec3d currentPos, double distanceX, double distanceZ) { int i = x - sizeX / 2; int j = z - sizeZ / 2; @@ -169,7 +169,7 @@ private boolean isSafeToStandAt(int x, int y, int z, int sizeX, int sizeY, int s } } - private boolean isPositionClear(int minX, int minY, int minZ, int sizeX, int sizeY, int sizeZ, Vec3 currentPos, double distanceX, double distanceZ) + private boolean isPositionClear(int minX, int minY, int minZ, int sizeX, int sizeY, int sizeZ, Vec3d currentPos, double distanceX, double distanceZ) { for (BlockPos blockpos : BlockPos.getAllInBox(new BlockPos(minX, minY, minZ), new BlockPos(minX + sizeX - 1, minY + sizeY - 1, minZ + sizeZ - 1))) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java index 2547d2f5d6..cd5de0f6be 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java @@ -88,7 +88,7 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else if ((i == 1 && k == 1) || (i == 1 && k == this.sizeZ - 1) || (i == this.sizeX - 1 && k == 1) || (i == this.sizeX - 1 && k == this.sizeZ - 1)) { - this.setBlockState(worldIn, Blocks.glowstone.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.GLOWSTONE.getDefaultState(), i, j, k, boundingBox); } else if (i == this.sizeX / 2 && j == 1 && k == this.sizeZ / 2) { From 9d96aef67c167e63cfeb9ca6590f679f4cd2be57 Mon Sep 17 00:00:00 2001 From: Mitch Date: Fri, 10 Mar 2017 03:21:52 -0500 Subject: [PATCH 005/535] Fix remaining 1.10.2 errors --- .../main/java/buildcraft/api/APIHelper.java | 79 --- .../java/buildcraft/api/ISimpleRegistry.java | 12 - .../java/buildcraft/api/ITripleRegistry.java | 30 - .../java/buildcraft/api/ObjectDefinition.java | 32 - .../api/blueprints/BlueprintDeployer.java | 30 - .../buildcraft/api/blueprints/BuilderAPI.java | 15 - .../api/blueprints/BuildingPermission.java | 21 - .../api/blueprints/IBuilderContext.java | 22 - .../api/blueprints/ISchematicHelper.java | 7 - .../api/blueprints/ISchematicRegistry.java | 19 - .../api/blueprints/ITileBuilder.java | 13 - .../blueprints/MappingNotFoundException.java | 13 - .../api/blueprints/MappingRegistry.java | 424 ------------ .../buildcraft/api/blueprints/Schematic.java | 195 ------ .../api/blueprints/SchematicBlock.java | 213 ------ .../api/blueprints/SchematicBlockBase.java | 9 - .../api/blueprints/SchematicEntity.java | 194 ------ .../api/blueprints/SchematicFactory.java | 51 -- .../api/blueprints/SchematicFluid.java | 84 --- .../api/blueprints/SchematicMask.java | 83 --- .../api/blueprints/SchematicTile.java | 114 ---- .../main/java/buildcraft/api/core/BCLog.java | 43 -- .../buildcraft/api/core/BuildCraftAPI.java | 52 -- .../buildcraft/api/core/ConfigAccessor.java | 48 -- .../java/buildcraft/api/core/EnumColor.java | 147 ---- .../buildcraft/api/core/EnumPipePart.java | 120 ---- .../buildcraft/api/core/IAreaProvider.java | 17 - .../main/java/buildcraft/api/core/IBox.java | 19 - .../buildcraft/api/core/IBuildCraftMod.java | 7 - .../java/buildcraft/api/core/ICoreProxy.java | 15 - .../buildcraft/api/core/IFluidFilter.java | 12 - .../buildcraft/api/core/IIconProvider.java | 13 - .../java/buildcraft/api/core/IInvSlot.java | 26 - .../buildcraft/api/core/INBTLoadable_BC8.java | 14 - .../buildcraft/api/core/INBTStoreable.java | 12 - .../api/core/INetworkLoadable_BC8.java | 9 - .../buildcraft/api/core/IPathProvider.java | 13 - .../buildcraft/api/core/ISerializable.java | 21 - .../buildcraft/api/core/IStackFilter.java | 14 - .../buildcraft/api/core/IWorldProperty.java | 14 - .../main/java/buildcraft/api/core/IZone.java | 26 - .../java/buildcraft/api/core/Identifier.java | 234 ------- .../java/buildcraft/api/core/JavaTools.java | 39 -- .../buildcraft/api/core/SafeTimeTracker.java | 68 -- .../java/buildcraft/api/core/StackKey.java | 125 ---- .../api/enums/EnumBlueprintType.java | 29 - .../api/enums/EnumDecoratedBlock.java | 24 - .../buildcraft/api/enums/EnumEnergyStage.java | 24 - .../buildcraft/api/enums/EnumEngineType.java | 27 - .../api/enums/EnumFillerPattern.java | 28 - .../api/enums/EnumLaserTableType.java | 24 - .../api/enums/EnumMachineState.java | 21 - .../api/enums/EnumRedstoneChipset.java | 42 -- .../java/buildcraft/api/enums/EnumSpring.java | 32 - .../buildcraft/api/filler/FillerManager.java | 13 - .../buildcraft/api/filler/IFillerPattern.java | 11 - .../api/filler/IFillerRegistry.java | 19 - .../api/fuels/BuildcraftFuelRegistry.java | 12 - .../java/buildcraft/api/fuels/ICoolant.java | 13 - .../buildcraft/api/fuels/ICoolantManager.java | 29 - .../main/java/buildcraft/api/fuels/IFuel.java | 15 - .../buildcraft/api/fuels/IFuelManager.java | 27 - .../buildcraft/api/fuels/ISolidCoolant.java | 12 - .../api/gates/GateExpansionController.java | 54 -- .../api/gates/GateExpansionModelKey.java | 36 - .../buildcraft/api/gates/GateExpansions.java | 61 -- .../buildcraft/api/gates/IExpansionBaker.java | 13 - .../main/java/buildcraft/api/gates/IGate.java | 30 - .../buildcraft/api/gates/IGateExpansion.java | 27 - .../buildcraft/api/items/IBlueprintItem.java | 9 - .../java/buildcraft/api/items/INamedItem.java | 9 - .../java/buildcraft/api/power/IEngine.java | 26 - .../buildcraft/api/power/ILaserTarget.java | 28 - .../api/power/ILaserTargetBlock.java | 12 - .../buildcraft/api/power/IRedstoneEngine.java | 7 - .../api/power/IRedstoneEngineReceiver.java | 21 - .../BuildCraftExtendedProperty.java | 65 -- .../api/properties/BuildCraftProperties.java | 83 --- .../api/properties/BuildCraftProperty.java | 129 ---- .../api/recipes/BuildcraftRecipeRegistry.java | 16 - .../api/recipes/CraftingResult.java | 20 - .../api/recipes/IAssemblyRecipeManager.java | 27 - .../IComplexRefineryRecipeManager.java | 66 -- .../api/recipes/IFlexibleCrafter.java | 24 - .../api/recipes/IFlexibleRecipe.java | 18 - .../api/recipes/IFlexibleRecipeViewable.java | 25 - .../api/recipes/IIntegrationRecipe.java | 59 -- .../recipes/IIntegrationRecipeManager.java | 13 - .../api/recipes/IProgrammingRecipe.java | 33 - .../recipes/IProgrammingRecipeManager.java | 19 - .../api/recipes/IRecipeManager.java | 29 - .../api/recipes/IRefineryRecipeManager.java | 25 - .../api/statements/ActionState.java | 9 - .../api/statements/IActionExternal.java | 12 - .../api/statements/IActionInternal.java | 15 - .../api/statements/IActionProvider.java | 19 - .../api/statements/IActionReceptor.java | 9 - .../IOverrideDefaultStatements.java | 13 - .../buildcraft/api/statements/IStatement.java | 36 - .../api/statements/IStatementContainer.java | 12 - .../api/statements/IStatementParameter.java | 36 - .../api/statements/ITriggerExternal.java | 14 - .../statements/ITriggerExternalOverride.java | 16 - .../api/statements/ITriggerInternal.java | 11 - .../api/statements/ITriggerProvider.java | 20 - .../api/statements/StatementManager.java | 181 ----- .../api/statements/StatementMouseClick.java | 23 - .../StatementParameterItemStack.java | 90 --- .../api/statements/StatementSlot.java | 42 -- .../IRedstoneStatementContainer.java | 17 - .../containers/ISidedStatementContainer.java | 10 - .../buildcraft/api/tools/IToolWrench.java | 33 - .../api/transport/ICustomPipeConnection.java | 12 - .../buildcraft/api/transport/IInjectable.java | 18 - .../buildcraft/api/transport/IItemPipe.java | 11 - .../java/buildcraft/api/transport/IPipe.java | 21 - .../api/transport/IPipeConnection.java | 24 - .../buildcraft/api/transport/IPipeTile.java | 54 -- .../api/transport/IStripesActivator.java | 14 - .../api/transport/IStripesHandler.java | 24 - .../api/transport/IStripesPipe.java | 9 - .../api/transport/PipeConnectionAPI.java | 48 -- .../buildcraft/api/transport/PipeManager.java | 71 -- .../buildcraft/api/transport/PipeWire.java | 73 -- .../pipe_bc8/BCPipeEventHandler.java | 12 - .../pipe_bc8/EnumContentsJourneyPart.java | 7 - .../transport/pipe_bc8/IConnection_BC8.java | 35 - .../pipe_bc8/IExtractionManager.java | 46 -- .../transport/pipe_bc8/IInsertionManager.java | 35 - .../transport/pipe_bc8/IPipeAddonItem.java | 8 - .../pipe_bc8/IPipeBehaviourFactory.java | 5 - .../api/transport/pipe_bc8/IPipeContents.java | 37 -- .../pipe_bc8/IPipeContentsEditable.java | 60 -- .../api/transport/pipe_bc8/IPipeHelper.java | 14 - .../transport/pipe_bc8/IPipeHolder_BC8.java | 5 - .../api/transport/pipe_bc8/IPipeListener.java | 9 - .../pipe_bc8/IPipeListenerFactory.java | 5 - .../pipe_bc8/IPipeListenerRegistry.java | 9 - .../pipe_bc8/IPipePropertyProvider.java | 48 -- .../api/transport/pipe_bc8/IPipeRegistry.java | 11 - .../api/transport/pipe_bc8/IPipeType.java | 22 - .../api/transport/pipe_bc8/IPipe_BC8.java | 50 -- .../transport/pipe_bc8/IPluggable_BC8.java | 8 - .../transport/pipe_bc8/IPropertyRegistry.java | 48 -- .../api/transport/pipe_bc8/PipeAPI_BC8.java | 58 -- .../transport/pipe_bc8/PipeBehaviour_BC8.java | 35 - .../transport/pipe_bc8/PipeConnectionAPI.java | 46 -- .../pipe_bc8/PipeDefinition_BC8.java | 86 --- .../event_bc8/IPipeEventConnection_BC8.java | 88 --- .../event_bc8/IPipeEventContents_BC8.java | 88 --- .../event_bc8/IPipeEventInteract_BC8.java | 29 - .../pipe_bc8/event_bc8/IPipeEvent_BC8.java | 26 - .../pluggable/IConnectionMatrix.java | 7 - .../transport/pluggable/IFacadePluggable.java | 11 - .../IPipePluggableDynamicRenderer.java | 13 - .../pluggable/IPipePluggableItem.java | 10 - .../pluggable/IPipePluggableState.java | 9 - .../transport/pluggable/IPipeRenderState.java | 5 - .../pluggable/IPluggableModelBaker.java | 17 - .../transport/pluggable/PipePluggable.java | 62 -- .../pluggable/PluggableModelKey.java | 45 -- .../codechicken/core/CCUpdateChecker.java | 14 +- .../codechicken/core/GuiModListScroll.java | 169 ----- .../java/codechicken/core/IStringMatcher.java | 5 - .../core/ModDescriptionEnhancer.java | 55 ++ .../asm/CodeChickenAccessTransformer.java | 70 -- .../core/asm/CodeChickenCoreModContainer.java | 83 --- .../asm/DefaultImplementationTransformer.java | 94 --- .../core/asm/DelegatedTransformer.java | 137 ---- .../core/asm/DependancyLister.java | 79 --- .../core/asm/InterfaceDependancies.java | 12 - .../asm/InterfaceDependancyTransformer.java | 51 -- .../core/asm/MCPDeobfuscationTransformer.java | 234 ------- .../core/asm/TweakTransformer.java | 70 -- .../core/commands/CoreCommand.java | 31 +- .../core/commands/PlayerCommand.java | 7 +- .../core/commands/ServerCommand.java | 10 +- .../core/featurehack/GameDataManipulator.java | 23 - .../core/featurehack/LiquidTextures.java | 51 -- .../featurehack/TweakTransformerHelper.java | 32 - .../core/featurehack/mc/TextureLavaFX.java | 99 --- .../featurehack/mc/TextureLavaFlowFX.java | 116 ---- .../core/featurehack/mc/TextureWaterFX.java | 114 ---- .../featurehack/mc/TextureWaterFlowFX.java | 116 ---- .../core/fluid/ExtendedFluidTank.java | 11 +- .../codechicken/core/fluid/FluidUtils.java | 22 +- .../codechicken/core/fluid/TankAccess.java | 1 + .../codechicken/core/gui/GuiCCButton.java | 4 +- .../core/gui/IGuiActionListener.java | 2 +- .../core/internal/CCCEventHandler.java | 23 - .../core/inventory/ContainerExtended.java | 37 +- .../core/inventory/IContainerSyncVar.java | 8 +- .../core/inventory/MappedInventoryAccess.java | 6 +- .../codechicken/core/inventory/SlotDummy.java | 5 +- .../core/inventory/SlotDummyOutput.java | 3 +- .../core/inventory/SlotHandleClicks.java | 3 +- .../core/launch/CodeChickenCorePlugin.java | 167 +---- .../codechicken/core/launch/DepLoader.java | 127 +++- .../core/launch/FingerprintChecker.java | 86 +++ .../java/codechicken/lib/CodeChickenLib.java | 50 ++ .../java/codechicken/lib/asm/ASMBlock.java | 47 +- .../java/codechicken/lib/asm/ASMHelper.java | 14 +- .../java/codechicken/lib/asm/ASMReader.java | 117 ++-- .../codechicken/lib/asm/CCLCorePlugin.java | 77 ++- .../lib/asm/CCL_ASMTransformer.java | 31 + .../codechicken/lib/asm/CC_ClassWriter.java | 1 + .../lib/asm/ClassHeirachyManager.java | 2 + .../lib/asm/ImportantInsnVisitor.java | 2 + .../codechicken/lib/asm/InsnComparator.java | 84 +-- .../codechicken/lib/asm/InsnListSection.java | 71 +- .../lib/asm/LocalVariablesSorterVisitor.java | 2 +- .../{core => lib}/asm/MethodASMifier.java | 4 +- .../lib/asm/ModularASMTransformer.java | 61 +- .../java/codechicken/lib/asm/ObfMapping.java | 43 +- .../lib/asm/RenderHookTransformer.java | 20 - .../asm/discovery}/ClassDiscoverer.java | 18 +- .../lib/asm/discovery/IStringMatcher.java | 7 + .../codechicken/lib/block/BlockMultiTile.java | 55 ++ .../lib/block/IParticleProvider.java | 10 + .../java/codechicken/lib/block/IType.java | 15 + .../lib/block/ItemBlockMultiType.java | 55 ++ .../codechicken/lib/block/StateReference.java | 14 + .../block/property/PropertyEnumFacingAll.java | 21 + .../block/property/PropertyEnumFacingHoz.java | 22 + .../lib/block/property/PropertyInteger.java | 48 ++ .../lib/block/property/PropertyString.java | 52 ++ .../block/property/TileEntityProperty.java | 39 ++ .../unlisted/UnlistedBooleanProperty.java | 21 + .../unlisted/UnlistedByteArrayProperty.java | 31 + .../unlisted/UnlistedByteProperty.java | 21 + .../unlisted/UnlistedEnumFacingProperty.java | 23 + .../unlisted/UnlistedFluidStackProperty.java | 24 + .../unlisted/UnlistedIntArrayProperty.java | 31 + .../unlisted/UnlistedIntegerProperty.java | 21 + .../unlisted/UnlistedMapProperty.java | 41 ++ .../unlisted/UnlistedPropertyBase.java | 25 + .../UnlistedResourceLocationProperty.java | 23 + .../unlisted/UnlistedSpriteProperty.java | 27 + .../unlisted/UnlistedStringProperty.java | 21 + .../unlisted/UnlistedTileEntityProperty.java | 23 + .../java/codechicken/lib/colour/Colour.java | 57 +- .../codechicken/lib/colour/ColourARGB.java | 10 + .../codechicken/lib/colour/ColourRGBA.java | 14 + .../lib/colour/CustomGradient.java | 3 +- .../codechicken/lib/colour/EnumColour.java | 193 ++++++ .../codechicken/lib/config/ConfigFile.java | 3 +- .../codechicken/lib/config/ConfigTag.java | 26 +- .../lib/config/ConfigTagParent.java | 28 +- .../lib/config/DefaultingConfigFile.java | 1 + .../lib/config/SimpleProperties.java | 1 + .../codechicken/lib/data/MCDataHandler.java | 8 + .../java/codechicken/lib/data/MCDataIO.java | 13 +- .../codechicken/lib/data/MCDataInput.java | 41 +- .../lib/data/MCDataInputStream.java | 1 + .../codechicken/lib/data/MCDataOutput.java | 35 +- .../lib/data/MCDataOutputStream.java | 1 + .../lib/data/MCDataOutputWrapper.java | 19 +- .../java/codechicken/lib/data/NBTHelper.java | 33 + .../lib/fingerprint/FingerprintChecker.java | 85 +++ .../FingerprintViolatedCrashCallable.java | 37 ++ .../java/codechicken/lib/gui/GuiDraw.java | 220 +++++- .../{core => lib/gui}/IGuiPacketSender.java | 3 +- .../lib/gui/SimpleCreativeTab.java | 81 +++ .../lib/internal/command/DevEnvCommand.java | 90 +++ .../client/DumpModelLocationsCommand.java | 76 +++ .../client/NukeCCModelCacheCommand.java | 60 ++ .../lib/internal/proxy/ClientProxy.java | 37 ++ .../lib/internal/proxy/CommonProxy.java | 24 + .../lib/inventory/InventoryCopy.java | 9 +- .../lib/inventory/InventoryNBT.java | 9 +- .../lib/inventory/InventoryRange.java | 10 +- .../lib/inventory/InventorySimple.java | 33 +- .../lib/inventory/InventoryUtils.java | 51 +- .../codechicken/lib/inventory/ItemKey.java | 5 +- .../codechicken/lib/item/ItemMultiType.java | 147 ++++ .../lib/item/ItemStackRegistry.java | 52 ++ .../lib/item/filtering/IItemFilter.java | 20 + .../item/filtering/IItemFilterProvider.java | 13 + .../java/codechicken/lib/lighting/LC.java | 43 +- .../codechicken/lib/lighting/LightMatrix.java | 70 +- .../codechicken/lib/lighting/LightModel.java | 17 +- .../lib/lighting/PlanarLightMatrix.java | 25 +- .../lib/lighting/PlanarLightModel.java | 16 +- .../lib/lighting/SimpleBrightnessModel.java | 33 +- .../java/codechicken/lib/math/MathHelper.java | 162 ++++- .../lib/model/BakedModelProperties.java | 60 ++ .../codechicken/lib/model/CCMultiModel.java | 91 +++ .../lib/model/CCOverrideBakedBlockModel.java | 83 +++ .../lib/model/CCOverrideBakedModel.java | 13 + .../lib/model/CCOverrideListHandler.java | 32 + .../lib/model/DummyBakedModel.java | 56 ++ .../lib/model/ModelRegistryHelper.java | 107 +++ .../PerspectiveAwareModelProperties.java | 34 + .../lib/model/SimpleBakedBlockModel.java | 66 ++ .../lib/model/SimpleBakedItemModel.java | 100 +++ .../lib/model/SimpleOverrideBakedModel.java | 61 ++ .../SimplePerspectiveAwareBakedModel.java | 91 +++ .../lib/model/StateOverrideIModel.java | 77 +++ .../AbstractBakedPropertiesModel.java | 43 ++ .../PerspectiveAwareBakedModel.java | 94 +++ .../PerspectiveAwareLayeredModel.java | 100 +++ .../PerspectiveAwareLayeredModelWrapper.java | 87 +++ .../PerspectiveAwareMultiModel.java | 84 +++ .../PerspectiveAwareOverrideModel.java | 59 ++ .../lib/model/bakery/BlockModelBakery.java | 628 ++++++++++++++++++ .../lib/model/bakery/CCModelBakery.java | 96 +++ .../codechicken/lib/model/bakery/CCQuad.java | 309 +++++++++ .../lib/model/bakery/CCQuadBakery.java | 202 ++++++ .../lib/model/bakery/ItemModelBakery.java | 42 ++ .../lib/model/bakery/PlanarFaceBakery.java | 227 +++++++ ...implePerspectiveAwareLayerModelBakery.java | 40 ++ .../model/bakery/UnpackingVertexConsumer.java | 66 ++ .../lib/model/blockbakery/BlockBakery.java | 343 ++++++++++ .../blockbakery/BlockBakeryProperties.java | 38 ++ .../lib/model/blockbakery/CCBakeryModel.java | 71 ++ .../lib/model/blockbakery/IBakeryBlock.java | 18 + .../lib/model/blockbakery/IBakeryItem.java | 18 + .../blockbakery/IBlockStateKeyGenerator.java | 13 + .../model/blockbakery/ICustomBlockBakery.java | 27 + .../lib/model/blockbakery/IItemBakery.java | 29 + .../blockbakery/IItemStackKeyGenerator.java | 13 + .../blockbakery/ILayeredBlockBakery.java | 21 + .../model/blockbakery/ISimpleBlockBakery.java | 19 + .../blockbakery/SimpleBlockRenderer.java | 90 +++ .../model/blockbakery/loader/BakeryModel.java | 44 ++ .../loader/CCBakeryModelLoader.java | 30 + .../model/blockbakery/sub/SubBlockBakery.java | 121 ++++ .../sub/SubBlockStateKeyGenerator.java | 31 + .../sub/SubItemStackKeyGenerator.java | 31 + .../model/blockstate/CCBlockStateLoader.java | 279 ++++++++ .../model/blockstate/CCFinalMultiVariant.java | 72 ++ .../lib/model/blockstate/CCFinalVariant.java | 72 ++ .../lib/model/blockstate/CCVariant.java | 210 ++++++ .../lib/model/cube/CCCubeLoader.java | 29 + .../lib/model/cube/CCModelCube.java | 158 +++++ .../lib/model/loader/CCBakedModelLoader.java | 215 ++++++ .../lib/model/loader/IBakedModelLoader.java | 77 +++ .../lib/model/modelbase/CCModelBase.java | 74 +++ .../lib/model/modelbase/CCModelBox.java | 130 ++++ .../lib/model/modelbase/CCModelRenderer.java | 279 ++++++++ .../lib/packet/ICustomPacketTile.java | 9 +- .../codechicken/lib/packet/PacketCustom.java | 159 +++-- .../lib/raytracer/CuboidRayTraceResult.java | 54 ++ .../lib/raytracer/DistanceRayTraceResult.java | 60 ++ .../lib/raytracer/ExtendedMOP.java | 38 -- .../lib/raytracer/ICuboidProvider.java | 19 + .../lib/raytracer/IndexedCuboid6.java | 84 ++- .../codechicken/lib/raytracer/RayTracer.java | 309 +++++---- .../codechicken/lib/render/BlockRenderer.java | 180 ++--- .../lib/render/CCIconRegister.java | 52 ++ .../java/codechicken/lib/render/CCModel.java | 525 +++++---------- .../lib/render/CCModelLibrary.java | 10 +- .../codechicken/lib/render/CCModelState.java | 79 +++ .../codechicken/lib/render/CCOBJParser.java | 289 ++++++++ .../codechicken/lib/render/CCRSConsumer.java | 86 +++ .../lib/render/CCRenderEventHandler.java | 56 ++ .../codechicken/lib/render/CCRenderState.java | 520 +++++---------- .../lib/render/DigIconParticle.java | 92 +++ .../lib/render/EntityDigIconFX.java | 120 ---- .../codechicken/lib/render/IFaceRenderer.java | 5 - .../codechicken/lib/render/IItemRenderer.java | 12 - .../lib/render/ModelRegistryHelper.java | 59 -- .../codechicken/lib/render/QBImporter.java | 31 +- .../codechicken/lib/render/RenderUtils.java | 340 ++++++---- .../codechicken/lib/render/TextureUtils.java | 155 ----- .../render/block/BlockRenderingRegistry.java | 110 +++ .../block/CCBlockRendererDispatcher.java | 91 +++ .../CCExtendedBlockRendererDispatcher.java | 94 +++ .../lib/render/block/ICCBlockRenderer.java | 23 + .../lib/render/block/IExtendedModel.java | 26 + .../lib/render/buffer/BakingVertexBuffer.java | 176 +++++ .../lib/render/item/CCRenderItem.java | 306 +++++++++ .../lib/render/item/EntityRendererHooks.java | 129 ++++ .../lib/render/item/IGLTransform.java | 13 + .../lib/render/item/IItemRenderer.java | 20 + .../lib/render/item/IMatrixTransform.java | 14 + .../item/IStackPerspectiveAwareModel.java | 17 + .../lib/render/item/map/IMapRenderer.java | 34 + .../render/item/map/MapRenderRegistry.java | 50 ++ .../particle/CustomParticleHandler.java | 85 +++ .../{ => pipeline}/CCRenderPipeline.java | 57 +- .../{ => pipeline}/ColourMultiplier.java | 14 +- .../lib/render/pipeline/IVertexOperation.java | 26 + .../lib/render/pipeline/IVertexSource.java | 32 + .../lib/render/pipeline/VertexAttribute.java | 39 ++ .../pipeline/attribute/AttributeKey.java | 40 ++ .../pipeline/attribute/ColourAttribute.java | 45 ++ .../attribute/LightCoordAttribute.java | 56 ++ .../pipeline/attribute/LightingAttribute.java | 49 ++ .../pipeline/attribute/NormalAttribute.java | 54 ++ .../pipeline/attribute/SideAttribute.java | 50 ++ .../render/{ => shader}/ShaderProgram.java | 100 ++- .../shader/pipeline/CCShaderPipeline.java | 135 ++++ .../pipeline/attribute/IShaderOperation.java | 15 + .../attribute/ShaderRenderTimeOperation.java | 37 ++ .../render/state/GlStateManagerHelper.java | 356 ++++++++++ .../lib/texture/CustomIResource.java | 69 ++ .../texture/IItemBlockTextureProvider.java | 15 + .../texture/IWorldBlockTextureProvider.java | 27 + .../{render => texture}/ManagedTextureFX.java | 3 +- .../PlaceholderTexture.java | 3 +- .../SpriteSheetManager.java | 8 +- .../TextureDataHolder.java | 3 +- .../lib/{render => texture}/TextureFX.java | 7 +- .../{render => texture}/TextureSpecial.java | 58 +- .../codechicken/lib/texture/TextureUtils.java | 311 +++++++++ .../{core => lib/thread}/ProfileTimer.java | 3 +- .../{core => lib/thread}/ReentrantCheck.java | 3 +- .../{nei => lib/thread}/RestartableTask.java | 24 +- .../{core => lib/thread}/TaskProfiler.java | 17 +- .../thread}/ThreadOperationTimer.java | 17 +- .../codechicken/lib/tile/IActiveTile.java | 12 + .../lib/tile/IDisplayTickTile.java | 19 + .../java/codechicken/lib/tile/IGuiTile.java | 13 + .../codechicken/lib/tile/IHarvestTile.java | 13 + .../lib/tile/IPlacingTypeTile.java | 13 + .../lib/tile/IRedstoneActiveTile.java | 12 + .../codechicken/lib/tile/IRotatableTile.java | 13 + .../codechicken/lib/tool/LibDownloader.java | 5 +- .../lib/tool/MCStripTransformer.java | 2 + .../main/java/codechicken/lib/tool/Main.java | 1 + .../lib/tool/StripClassLoader.java | 1 + .../java/codechicken/lib/tool/ToolMain.java | 10 +- .../lib/tool/module/JOptModule.java | 1 + .../lib/tool/module/ModuleQBConverter.java | 1 + .../java/codechicken/lib/util/ArrayUtils.java | 234 +++++++ .../codechicken/lib/util/BlockStateUtils.java | 41 ++ .../java/codechicken/lib/util/BlockUtils.java | 81 +++ .../codechicken/lib/util/CCDirection.java | 103 +++ .../{core => lib/util}/ClientUtils.java | 31 +- .../{core => lib/util}/CommonUtils.java | 21 +- .../codechicken/lib/util/ContainerUtils.java | 37 ++ .../java/codechicken/lib/util/Copyable.java | 3 +- .../codechicken/lib/util/EntityUtils.java | 32 + .../lib/{render => util}/FontUtils.java | 45 +- .../java/codechicken/lib/util/FuelUtils.java | 37 ++ .../codechicken/lib/util/ItemNBTUtils.java | 389 +++++++++++ .../java/codechicken/lib/util/ItemUtils.java | 188 ++++++ .../java/codechicken/lib/util/LangProxy.java | 7 +- .../{core => lib/util}/ReflectionManager.java | 69 +- .../codechicken/lib/util/RotationUtils.java | 177 +++++ .../{core => lib/util}/ServerUtils.java | 41 +- .../java/codechicken/lib/util/SoundUtils.java | 42 ++ .../codechicken/lib/util/TileEntityUtils.java | 62 ++ .../codechicken/lib/util/TransformUtils.java | 229 +++++++ .../java/codechicken/lib/util/TripleABC.java | 30 + .../codechicken/lib/util/VectorUtils.java | 78 +++ .../codechicken/lib/util/VertexDataUtils.java | 145 ++++ .../java/codechicken/lib/vec/AxisCycle.java | 1 + .../java/codechicken/lib/vec/BlockCoord.java | 65 +- .../java/codechicken/lib/vec/Cuboid6.java | 263 ++++---- .../java/codechicken/lib/vec/CuboidCoord.java | 241 +++---- .../codechicken/lib/vec/ITransformation.java | 1 + .../IrreversibleTransformationException.java | 3 +- .../main/java/codechicken/lib/vec/Line3.java | 8 +- .../java/codechicken/lib/vec/Matrix4.java | 65 +- .../main/java/codechicken/lib/vec/Quat.java | 1 + .../java/codechicken/lib/vec/Rectangle4i.java | 6 +- .../lib/vec/RedundantTransformation.java | 3 +- .../java/codechicken/lib/vec/Rotation.java | 6 +- .../main/java/codechicken/lib/vec/Scale.java | 3 +- .../main/java/codechicken/lib/vec/SwapYZ.java | 1 + .../codechicken/lib/vec/Transformation.java | 18 +- .../lib/vec/TransformationList.java | 3 +- .../java/codechicken/lib/vec/Translation.java | 4 +- .../lib/vec/VariableTransformation.java | 5 +- .../java/codechicken/lib/vec/Vector3.java | 372 ++++++----- .../lib/{render => vec}/Vertex5.java | 12 +- .../uv/IconTransformation.java | 10 +- .../vec/uv/IconVertexRangeUVTransform.java | 112 ++++ .../uv/MultiIconTransformation.java | 13 +- .../lib/vec/uv/ScaledIconTransformation.java | 29 + .../lib/{render => vec}/uv/UV.java | 5 +- .../lib/{render => vec}/uv/UVRotation.java | 3 +- .../lib/{render => vec}/uv/UVScale.java | 3 +- .../{render => vec}/uv/UVTransformation.java | 13 +- .../uv/UVTransformationList.java | 3 +- .../lib/{render => vec}/uv/UVTranslation.java | 3 +- .../codechicken/lib/world/ChunkExtension.java | 11 +- .../codechicken/lib/world/IChunkLoadTile.java | 3 +- .../lib/world/TileChunkLoadHook.java | 3 +- .../codechicken/lib/world/WorldExtension.java | 33 +- .../lib/world/WorldExtensionInstantiator.java | 1 + .../lib/world/WorldExtensionManager.java | 64 +- .../placement/BlockPlacementBatcher.java | 184 +++++ .../BlockPlacementLightingManager.java | 93 +++ .../placement/lighting/LightingCalcEntry.java | 34 + .../lighting/LightingCalcEntryBuilder.java | 65 ++ .../java/codechicken/nei/ButtonCycled.java | 2 + .../java/codechicken/nei/ClientHandler.java | 33 +- .../nei/ContainerEnchantmentModifier.java | 41 +- .../nei/ContainerPotionCreator.java | 26 +- .../nei/DefaultHighlightHandler.java | 11 +- .../codechicken/nei/FastTransferManager.java | 16 +- .../codechicken/nei/FingerprintChecker.java | 86 +++ .../nei/GuiEnchantmentModifier.java | 10 +- .../nei/GuiExtendedCreativeInv.java | 7 +- .../codechicken/nei/GuiPotionCreator.java | 42 +- .../java/codechicken/nei/HUDRenderer.java | 20 +- .../nei/InfiniteStackSizeHandler.java | 1 + .../main/java/codechicken/nei/ItemList.java | 67 +- .../java/codechicken/nei/ItemMobSpawner.java | 25 +- .../codechicken/nei/ItemQuantityField.java | 2 + .../main/java/codechicken/nei/ItemSorter.java | 9 +- .../java/codechicken/nei/ItemStackSet.java | 4 +- .../main/java/codechicken/nei/KeyManager.java | 31 +- .../java/codechicken/nei/LayoutManager.java | 68 +- .../codechicken/nei/NEIChestGuiHandler.java | 1 + .../java/codechicken/nei/NEIClientConfig.java | 105 +-- .../java/codechicken/nei/NEIController.java | 30 +- .../nei/NEICreativeGuiHandler.java | 6 +- .../codechicken/nei/NEIDummySlotHandler.java | 4 +- .../java/codechicken/nei/NEIModContainer.java | 22 +- .../java/codechicken/nei/NEIServerConfig.java | 28 +- .../codechicken/nei/OffsetPositioner.java | 1 + .../main/java/codechicken/nei/PlayerSave.java | 19 +- .../codechicken/nei/PopupInputHandler.java | 11 +- .../java/codechicken/nei/SaveLoadButton.java | 4 +- .../java/codechicken/nei/SearchField.java | 38 +- .../java/codechicken/nei/ServerHandler.java | 18 +- .../java/codechicken/nei/SpawnerRenderer.java | 68 +- .../java/codechicken/nei/SubsetWidget.java | 31 +- .../main/java/codechicken/nei/TextField.java | 23 +- ...VisiblityData.java => VisibilityData.java} | 15 +- .../java/codechicken/nei/WidgetZOrder.java | 10 +- .../codechicken/nei/WorldOverlayRenderer.java | 16 +- .../main/java/codechicken/nei/api/API.java | 32 +- .../nei/api/DefaultOverlayRenderer.java | 2 +- .../codechicken/nei/api/IConfigureNEI.java | 6 +- .../nei/api/IGuiContainerOverlay.java | 2 +- .../nei/api/IHighlightHandler.java | 7 +- .../nei/api/IInfiniteItemHandler.java | 4 +- .../codechicken/nei/api/INEIGuiAdapter.java | 4 +- .../codechicken/nei/api/INEIGuiHandler.java | 12 +- .../codechicken/nei/api/INEIModeHandler.java | 2 +- .../codechicken/nei/api/IOverlayHandler.java | 2 +- .../nei/api/IRecipeOverlayRenderer.java | 2 +- .../codechicken/nei/api/IStackPositioner.java | 4 +- .../java/codechicken/nei/api/ItemFilter.java | 14 - .../java/codechicken/nei/api/ItemInfo.java | 250 ++++--- .../nei/api/{ => layout}/LayoutStyle.java | 10 +- .../nei/{ => api/stack}/PositionedStack.java | 8 +- .../codechicken/nei/asm/NEICorePlugin.java | 22 +- .../codechicken/nei/asm/NEITransformer.java | 62 +- .../codechicken/nei/config/ConfigSet.java | 2 +- .../codechicken/nei/config/DataDumper.java | 14 +- .../nei/config/GuiHighlightTips.java | 7 +- .../nei/config/GuiItemIconDumper.java | 20 +- .../nei/config/GuiNEIOptionList.java | 4 +- .../codechicken/nei/config/GuiOptionList.java | 2 +- .../codechicken/nei/config/GuiOptionPane.java | 4 +- .../nei/config/ItemPanelDumper.java | 14 +- .../codechicken/nei/config/KeyBindings.java | 79 +++ .../java/codechicken/nei/config/Option.java | 8 +- .../codechicken/nei/config/OptionButton.java | 8 +- .../codechicken/nei/config/OptionKeyBind.java | 83 --- .../codechicken/nei/config/OptionList.java | 4 +- .../codechicken/nei/config/OptionOpenGui.java | 4 +- .../nei/config/OptionScrollPane.java | 27 +- .../nei/config/OptionUtilities.java | 8 +- .../codechicken/nei/config/PatreonButton.java | 4 +- .../nei/config/RegistryDumper.java | 5 +- .../nei/config/dumps/FluidRegistryDumper.java | 43 ++ .../nei/config/dumps/ForgeRegistryDumper.java | 42 ++ .../{ => container}/ContainerCreativeInv.java | 54 +- .../{ => container}/ExtendedCreativeInv.java | 6 +- .../InventoryCraftingDummy.java | 2 +- .../VanillaCreativeTabSearchHooks.java | 141 ++++ .../nei/guihook/DefaultSlotClickHandler.java | 13 +- .../nei/guihook/GuiContainerManager.java | 40 +- .../nei/guihook/IContainerDrawHandler.java | 10 +- .../nei/guihook/IContainerInputHandler.java | 18 +- .../nei/guihook/IContainerObjectHandler.java | 12 +- .../guihook/IContainerSlotClickHandler.java | 7 +- .../nei/guihook/IContainerTooltipHandler.java | 6 +- .../nei/guihook/IGuiHandleMouseWheel.java | 2 +- .../codechicken/nei/guihook/IGuiSlotDraw.java | 2 +- .../nei/{ => layout}/LayoutStyleDefault.java | 15 +- .../{ => layout}/LayoutStyleMinecraft.java | 5 +- .../nei/{ => layout}/LayoutStyleTMIOld.java | 5 +- .../NEIClientPacketHandler.java} | 24 +- .../NEIServerPacketHandler.java} | 28 +- .../nei/recipe/BrewingOverlayHandler.java | 4 +- .../nei/recipe/BrewingRecipeHandler.java | 190 +++--- .../nei/recipe/ContainerRecipe.java | 18 +- .../nei/recipe/DefaultOverlayHandler.java | 13 +- .../nei/recipe/FireworkRecipeHandler.java | 26 +- .../nei/recipe/FuelRecipeHandler.java | 8 +- .../nei/recipe/FurnaceRecipeHandler.java | 16 +- .../nei/recipe/GuiCraftingRecipe.java | 2 +- .../codechicken/nei/recipe/GuiRecipe.java | 13 +- .../nei/recipe/GuiUsageRecipe.java | 2 +- .../nei/recipe/ICraftingHandler.java | 2 +- .../nei/recipe/IRecipeHandler.java | 34 +- .../codechicken/nei/recipe/IUsageHandler.java | 2 +- .../nei/recipe/ProfilerRecipeHandler.java | 8 +- .../nei/recipe/RecipeItemInputHandler.java | 19 +- .../nei/recipe/ShapedRecipeHandler.java | 18 +- .../nei/recipe/ShapelessRecipeHandler.java | 6 +- .../nei/recipe/TemplateRecipeHandler.java | 16 +- .../nei/recipe/potion/IPotionRecipe.java | 14 + .../nei/recipe/potion/PotionRecipeHelper.java | 89 +++ .../nei/recipe/potion/PotionTypeRecipe.java | 37 ++ .../recipe/potion/PotionUpgradeRecipe.java | 41 ++ .../colossalchests/ColossalChestsConfig.java | 34 + .../java/codechicken/nei/util/LogHelper.java | 240 +++++++ .../nei/{ => util}/NEIClientUtils.java | 37 +- .../nei/{ => util}/NEIServerUtils.java | 57 +- .../codechicken/nei/{ => widget}/Button.java | 6 +- .../nei/{ => widget}/ItemPanel.java | 30 +- .../codechicken/nei/{ => widget}/Label.java | 4 +- .../codechicken/nei/{ => widget}/Widget.java | 2 +- .../obfuscator/IHeirachyEvaluator.java | 4 +- .../codechicken/obfuscator/ILogStreams.java | 4 +- .../cofh/api/energy/TileEnergyHandler.java | 3 +- .../main/java/ic2/api/Direction.class | Bin 4271 -> 0 bytes dependencies/main/java/ic2/api/Direction.java | 132 ---- .../main/java/ic2/api/energy/EnergyNet.class | Bin 331 -> 0 bytes .../main/java/ic2/api/energy/IEnergyNet.class | Bin 572 -> 0 bytes .../main/java/ic2/api/energy/IEnergyNet.java | 4 +- .../main/java/ic2/api/energy/NodeStats.class | Bin 675 -> 0 bytes .../api/energy/event/EnergyTileEvent.class | Bin 929 -> 0 bytes .../ic2/api/energy/event/EnergyTileEvent.java | 2 +- .../energy/event/EnergyTileLoadEvent.class | Bin 442 -> 0 bytes .../energy/event/EnergyTileUnloadEvent.class | Bin 448 -> 0 bytes .../ic2/api/energy/event/package-info.class | Bin 272 -> 0 bytes .../ic2/api/energy/event/package-info.java | 4 - .../java/ic2/api/energy/package-info.class | Bin 266 -> 0 bytes .../java/ic2/api/energy/package-info.java | 4 - .../java/ic2/api/energy/prefab/BasicSink.java | 374 +++++++++++ .../ic2/api/energy/prefab/BasicSource.java | 376 +++++++++++ .../ic2/api/energy/tile/IChargingSlot.java | 16 + .../api/energy/tile/IColoredEnergyTile.java | 21 + .../ic2/api/energy/tile/IDischargingSlot.java | 17 + .../ic2/api/energy/tile/IEnergyAcceptor.class | Bin 271 -> 0 bytes .../api/energy/tile/IEnergyConductor.class | Bin 428 -> 0 bytes .../ic2/api/energy/tile/IEnergyEmitter.class | Bin 266 -> 0 bytes .../ic2/api/energy/tile/IEnergySink.class | Bin 290 -> 0 bytes .../ic2/api/energy/tile/IEnergySource.class | Bin 260 -> 0 bytes .../ic2/api/energy/tile/IEnergyTile.class | Bin 123 -> 0 bytes .../energy/tile/IExplosionPowerOverride.class | Bin 213 -> 0 bytes .../ic2/api/energy/tile/IHeatSource.class | Bin 249 -> 0 bytes .../ic2/api/energy/tile/IKineticSource.class | Bin 273 -> 0 bytes .../ic2/api/energy/tile/IMetaDelegate.class | Bin 285 -> 0 bytes .../api/energy/tile/IMultiEnergySource.class | Bin 266 -> 0 bytes .../api/energy/tile/IOverloadHandler.class | Bin 161 -> 0 bytes .../ic2/api/energy/tile/IOverloadHandler.java | 4 +- .../ic2/api/energy/tile/package-info.class | Bin 271 -> 0 bytes .../ic2/api/energy/tile/package-info.java | 4 - .../main/java/ic2/api/energy/usage.txt | 4 + .../java/ic2/api/info/IInfoProvider.class | Bin 241 -> 0 bytes .../main/java/ic2/api/info/ILocatable.java | 24 + .../main/java/ic2/api/info/ITeBlock.java | 343 ++++++++++ .../main/java/ic2/api/info/Info.class | Bin 1267 -> 0 bytes .../main/java/ic2/api/info/package-info.class | Bin 264 -> 0 bytes .../main/java/ic2/api/info/package-info.java | 4 - .../main/java/ic2/api/item/ElectricItem.class | Bin 1369 -> 0 bytes .../main/java/ic2/api/item/HudMode.java | 37 ++ .../api/item/IBackupElectricItemManager.class | Bin 241 -> 0 bytes .../ic2/api/item/IBlockCuttingBlade.class | Bin 188 -> 0 bytes .../main/java/ic2/api/item/IBoxable.class | Bin 177 -> 0 bytes .../main/java/ic2/api/item/IC2Items.class | Bin 1446 -> 0 bytes .../main/java/ic2/api/item/IC2Items.java | 46 +- .../java/ic2/api/item/ICustomDamageItem.class | Bin 386 -> 0 bytes .../main/java/ic2/api/item/IDebuggable.class | Bin 191 -> 0 bytes .../java/ic2/api/item/IElectricItem.class | Bin 323 -> 0 bytes .../ic2/api/item/IElectricItemManager.class | Bin 704 -> 0 bytes .../main/java/ic2/api/item/IItemAPI.class | Bin 339 -> 0 bytes .../main/java/ic2/api/item/IItemAPI.java | 12 + .../main/java/ic2/api/item/IItemHudInfo.class | Bin 281 -> 0 bytes .../main/java/ic2/api/item/IItemHudInfo.java | 41 +- .../java/ic2/api/item/IItemHudProvider.java | 46 ++ .../api/item/IKineticRotor$GearboxType.class | Bin 1125 -> 0 bytes .../java/ic2/api/item/IKineticRotor.class | Bin 590 -> 0 bytes .../main/java/ic2/api/item/IMetalArmor.class | Bin 217 -> 0 bytes .../ic2/api/item/ISpecialElectricItem.class | Bin 259 -> 0 bytes .../ic2/api/item/ISpecialElectricItem.java | 4 +- .../ic2/api/item/ITeBlockSpecialItem.java | 35 + .../java/ic2/api/item/ITerraformingBP.class | Bin 502 -> 0 bytes .../java/ic2/api/item/ITerraformingBP.java | 2 +- .../main/java/ic2/api/item/ItemWrapper.class | Bin 2403 -> 0 bytes .../main/java/ic2/api/item/package-info.class | Bin 264 -> 0 bytes .../main/java/ic2/api/item/package-info.java | 4 - .../main/java/ic2/api/package-info.class | Bin 259 -> 0 bytes .../main/java/ic2/api/package-info.java | 4 - .../ic2/api/tile/ExplosionWhitelist.class | Bin 1086 -> 0 bytes .../java/ic2/api/tile/IEnergyStorage.class | Bin 358 -> 0 bytes .../java/ic2/api/tile/IRotorProvider.java | 33 + .../main/java/ic2/api/tile/IWrenchable.class | Bin 982 -> 0 bytes .../main/java/ic2/api/tile/IWrenchable.java | 3 +- .../main/java/ic2/api/tile/RotorRegistry.java | 43 ++ .../main/java/ic2/api/tile/package-info.class | Bin 264 -> 0 bytes .../main/java/ic2/api/tile/package-info.java | 4 - .../main/java/ic2/api/util/IKeyboard.class | Bin 374 -> 0 bytes .../main/java/ic2/api/util/Keys.class | Bin 309 -> 0 bytes .../main/java/ic2/api/util/package-info.class | Bin 264 -> 0 bytes .../main/java/ic2/api/util/package-info.java | 4 - .../main/java/mekanism/api/gas/Gas.java | 4 +- .../api/GalacticraftRegistry.java | 48 +- .../api/client/tabs/AbstractTab.java | 2 +- .../api/client/tabs/InventoryTabVanilla.java | 2 +- .../api/client/tabs/TabRegistry.java | 12 +- .../galacticraft/api/entity/IRocketType.java | 10 +- .../api/galaxies/CelestialBody.java | 17 +- .../api/galaxies/SolarSystem.java | 6 +- .../api/prefab/entity/EntityAutoRocket.java | 54 +- .../prefab/entity/EntitySpaceshipBase.java | 66 +- .../api/prefab/entity/EntityTieredRocket.java | 93 ++- .../prefab/world/gen/ChunkProviderSpace.java | 89 +-- .../galacticraft/api/vector/BlockVec3.java | 34 +- .../galacticraft/api/vector/BlockVec3Dim.java | 18 +- .../mods/galacticraft/api/vector/Vector3.java | 17 +- .../mods/galacticraft/core/GCFluids.java | 10 +- .../mods/galacticraft/core/GCItems.java | 15 +- .../galacticraft/core/GalacticraftCore.java | 13 +- .../galacticraft/core/TransformerHooks.java | 33 +- .../core/blocks/BlockAirLockFrame.java | 2 +- .../core/blocks/BlockAluminumWire.java | 2 +- .../galacticraft/core/blocks/BlockBasic.java | 2 +- .../core/blocks/BlockBasicMoon.java | 3 +- .../core/blocks/BlockBrightLamp.java | 2 +- .../core/blocks/BlockGlowstoneTorch.java | 2 +- .../galacticraft/core/blocks/BlockMulti.java | 2 +- .../core/blocks/BlockNasaWorkbench.java | 4 +- .../galacticraft/core/blocks/BlockScreen.java | 2 +- .../galacticraft/core/blocks/BlockSlabGC.java | 6 +- .../core/blocks/BlockSpinThruster.java | 2 +- .../core/blocks/BlockUnlitTorch.java | 2 +- .../galacticraft/core/blocks/BlockWallGC.java | 21 +- .../core/client/sounds/GCSounds.java | 8 + .../core/energy/item/ItemElectricBase.java | 4 +- .../tile/TileBaseUniversalElectrical.java | 7 +- .../core/entities/player/GCPlayerHandler.java | 2 +- .../core/fluid/ThreadFindSeal.java | 101 +-- .../core/nei/BuggyRecipeHandler.java | 4 +- .../nei/CircuitFabricatorRecipeHandler.java | 9 +- .../ElectricIngotCompressorRecipeHandler.java | 9 +- .../core/nei/GCNEIHighlightHandler.java | 8 +- .../nei/IngotCompressorRecipeHandler.java | 14 +- .../core/nei/NEIGalacticraftConfig.java | 46 +- .../core/nei/RefineryRecipeHandler.java | 4 +- .../core/nei/RocketT1RecipeHandler.java | 4 +- .../core/network/ConnectionEvents.java | 2 +- .../core/recipe/RecipeManagerGC.java | 8 +- .../core/tick/TickHandlerServer.java | 2 +- .../tile/TileEntityAirLockController.java | 39 +- .../core/tile/TileEntityAluminumWire.java | 1 + .../core/tile/TileEntityArclamp.java | 36 +- .../core/tile/TileEntityCargoLoader.java | 21 +- .../core/tile/TileEntityCargoUnloader.java | 13 +- .../tile/TileEntityCircuitFabricator.java | 21 +- .../core/tile/TileEntityCoalGenerator.java | 33 +- .../core/tile/TileEntityDish.java | 12 +- .../core/tile/TileEntityDungeonSpawner.java | 1 + .../core/tile/TileEntityElectricFurnace.java | 17 +- .../TileEntityElectricIngotCompressor.java | 25 +- .../tile/TileEntityEnergyStorageModule.java | 19 +- .../core/tile/TileEntityFallenMeteor.java | 1 + .../core/tile/TileEntityFluidPipe.java | 3 +- .../core/tile/TileEntityFluidTank.java | 26 +- .../core/tile/TileEntityFuelLoader.java | 11 +- .../core/tile/TileEntityIngotCompressor.java | 17 +- .../core/tile/TileEntityMulti.java | 2 + .../core/tile/TileEntityOxygen.java | 1 + .../core/tile/TileEntityOxygenCollector.java | 24 +- .../core/tile/TileEntityOxygenCompressor.java | 13 +- .../tile/TileEntityOxygenDecompressor.java | 13 +- .../tile/TileEntityOxygenDistributor.java | 10 +- .../core/tile/TileEntityOxygenSealer.java | 21 +- .../tile/TileEntityOxygenStorageModule.java | 7 +- .../core/tile/TileEntityParaChest.java | 7 +- .../core/tile/TileEntityRefinery.java | 3 +- .../core/tile/TileEntityScreen.java | 1 + .../core/tile/TileEntitySolar.java | 23 +- .../core/tile/TileEntitySpaceStationBase.java | 13 +- .../core/tile/TileEntityTelemetry.java | 14 +- .../core/util/ConfigManagerCore.java | 166 ++--- .../galacticraft/core/util/CreativeTabGC.java | 4 +- .../galacticraft/core/util/FluidUtil.java | 2 +- .../galacticraft/core/util/GCCoreUtil.java | 32 +- .../mods/galacticraft/core/util/MapGen.java | 35 +- .../mods/galacticraft/core/util/MapUtil.java | 68 +- .../galacticraft/core/util/OxygenUtil.java | 35 +- .../galacticraft/core/util/PlayerUtil.java | 11 +- .../galacticraft/core/util/RedstoneUtil.java | 4 +- .../core/util/ThreadVersionCheck.java | 2 +- .../galacticraft/core/util/WorldUtil.java | 168 +++-- .../core/world/ChunkLoadingCallback.java | 7 +- .../core/world/gen/BiomeDecoratorMoon.java | 16 +- ...omeGenFlatMoon.java => BiomeFlatMoon.java} | 8 +- .../{BiomeGenBaseMoon.java => BiomeMoon.java} | 16 +- ...BiomeGenBaseOrbit.java => BiomeOrbit.java} | 14 +- .../core/world/gen/MapGenCavesMoon.java | 8 +- .../core/world/gen/OverworldGenerator.java | 11 +- .../core/world/gen/StructureComponentGC.java | 14 +- .../world/gen/StructureComponentMoon.java | 4 +- .../world/gen/StructureComponentVillage.java | 8 +- .../gen/StructureComponentVillageField.java | 28 +- .../gen/StructureComponentVillageField2.java | 32 +- .../gen/StructureComponentVillageHouse.java | 4 +- .../gen/StructureComponentVillagePathGen.java | 4 +- .../StructureComponentVillageStartPiece.java | 14 +- .../gen/StructureComponentVillageTorch.java | 10 +- .../gen/StructureComponentVillageWell.java | 22 +- .../gen/StructureComponentVillageWoodHut.java | 4 +- .../world/gen/StructureVillageStartMoon.java | 2 +- .../core/world/gen/WorldGenMinableMeta.java | 4 +- .../core/world/gen/WorldGenSpaceStation.java | 12 +- .../core/world/gen/dungeon/Corridor.java | 2 +- .../gen/dungeon/DungeonConfiguration.java | 1 + .../core/world/gen/dungeon/RoomBoss.java | 8 +- .../core/world/gen/dungeon/RoomChest.java | 17 +- .../core/world/gen/dungeon/RoomEmpty.java | 2 +- .../core/world/gen/dungeon/RoomEntrance.java | 2 +- .../core/world/gen/dungeon/RoomSpawner.java | 6 +- .../GenLayerAddMushroomIsland.java | 3 +- .../gen/layer_mapping/GenLayerBiome.java | 41 +- .../gen/layer_mapping/GenLayerBiomeEdge.java | 19 +- .../gen/layer_mapping/GenLayerDeepOcean.java | 3 +- .../gen/layer_mapping/GenLayerGCMap.java | 31 +- .../gen/layer_mapping/GenLayerHills.java | 69 +- .../gen/layer_mapping/GenLayerRareBiome.java | 5 +- .../gen/layer_mapping/GenLayerRiver.java | 3 +- .../gen/layer_mapping/GenLayerRiverMix.java | 13 +- .../gen/layer_mapping/GenLayerShore.java | 37 +- .../core/wrappers/ScheduledBlockChange.java | 26 +- .../planets/GCPlanetDimensions.java | 16 + .../planets/GalacticraftPlanets.java | 2 +- .../planets/PlanetsProxyClient.java | 2 +- .../planets/asteroids/AsteroidsModule.java | 28 +- .../asteroids/AsteroidsModuleClient.java | 19 +- .../asteroids/ConfigManagerAsteroids.java | 28 +- .../asteroids/blocks/BlockBasicAsteroids.java | 4 +- .../asteroids/blocks/BlockBeamReceiver.java | 97 +-- .../asteroids/blocks/BlockBeamReflector.java | 41 +- .../asteroids/blocks/BlockIceAsteroids.java | 33 +- .../asteroids/blocks/BlockMinerBase.java | 4 +- .../asteroids/blocks/BlockMinerBaseFull.java | 15 +- .../blocks/BlockShortRangeTelepad.java | 44 +- .../asteroids/blocks/BlockTelepadFake.java | 142 ++-- .../asteroids/blocks/BlockWalkway.java | 254 +++---- .../client/SkyProviderAsteroids.java | 4 +- .../asteroids/client/fx/EntityFXTeleport.java | 25 +- .../client/render/entity/RenderGrapple.java | 2 +- .../render/entity/RenderTier3Rocket.java | 10 +- .../render/item/ItemModelAstroMiner.java | 6 +- .../render/item/ItemModelBeamReceiver.java | 6 +- .../render/item/ItemModelBeamReflector.java | 6 +- .../render/item/ItemModelCargoRocket.java | 6 +- .../client/render/item/ItemModelGrapple.java | 6 +- .../client/render/item/ItemModelRocketT3.java | 6 +- .../client/render/item/ItemModelTelepad.java | 2 +- .../tile/TileEntityMinerBaseRenderer.java | 6 +- .../client/sounds/SoundUpdaterMiner.java | 6 +- .../asteroids/dimension/AsteroidSaveData.java | 1 + .../dimension/ShortRangeTelepadHandler.java | 1 + .../dimension/TeleportTypeAsteroids.java | 71 +- .../dimension/WorldProviderAsteroids.java | 30 +- .../asteroids/entities/EntityAstroMiner.java | 78 ++- .../asteroids/entities/EntityEntryPod.java | 18 +- .../asteroids/entities/EntityGrapple.java | 68 +- .../entities/EntitySmallAsteroid.java | 24 +- .../asteroids/entities/EntityTier3Rocket.java | 22 +- .../player/AsteroidsPlayerHandler.java | 18 +- .../ContainerSchematicTier3Rocket.java | 2 +- .../inventory/SlotSchematicAstroMiner.java | 2 +- .../asteroids/items/AsteroidsItems.java | 12 +- .../asteroids/items/ItemArmorAsteroids.java | 5 +- .../asteroids/items/ItemAstroMiner.java | 32 +- .../items/ItemCanisterLiquidNitrogen.java | 45 +- .../asteroids/items/ItemGrappleHook.java | 75 ++- .../asteroids/items/ItemThermalPadding.java | 28 +- .../asteroids/items/ItemTier3Rocket.java | 14 +- .../nei/AstroMinerRecipeHandler.java | 7 +- .../nei/NEIGalacticraftAsteroidsConfig.java | 26 +- .../asteroids/nei/RocketT3RecipeHandler.java | 4 +- .../recipe/RecipeManagerAsteroids.java | 64 +- .../tick/AsteroidsTickHandlerServer.java | 2 +- .../asteroids/tile/TileEntityBeamOutput.java | 8 +- .../tile/TileEntityBeamReceiver.java | 1 + .../asteroids/tile/TileEntityMinerBase.java | 3 +- .../tile/TileEntityShortRangeTelepad.java | 12 +- .../asteroids/tile/TileEntityTelepadFake.java | 8 +- ...BaseAsteroids.java => BiomeAsteroids.java} | 13 +- .../world/gen/ChunkProviderAsteroids.java | 122 ++-- .../planets/mars/ConfigManagerMars.java | 26 +- .../planets/mars/EventHandlerMars.java | 43 +- .../galacticraft/planets/mars/MarsModule.java | 21 +- .../planets/mars/MarsModuleClient.java | 23 +- .../planets/mars/blocks/BlockBasicMars.java | 32 +- .../mars/blocks/BlockCavernousVine.java | 33 +- .../planets/mars/blocks/BlockCreeperEgg.java | 12 +- .../planets/mars/blocks/BlockMachineMars.java | 28 +- .../mars/blocks/BlockMachineMarsT2.java | 16 +- .../mars/blocks/BlockSlimelingEgg.java | 32 +- .../planets/mars/client/SkyProviderMars.java | 4 +- .../planets/mars/client/fx/EntityCryoFX.java | 12 +- ...BacterialDripFX.java => ParticleDrip.java} | 20 +- .../planets/mars/client/gui/GuiSlimeling.java | 5 +- .../client/gui/GuiSlimelingInventory.java | 8 +- .../render/entity/RenderCargoRocket.java | 8 +- .../render/entity/RenderCreeperBoss.java | 10 - .../render/entity/RenderProjectileTNT.java | 4 +- .../render/entity/RenderTier2Rocket.java | 19 +- .../client/render/item/ItemModelRocketT2.java | 6 +- .../mars/dimension/TeleportTypeMars.java | 12 +- .../mars/dimension/WorldProviderMars.java | 26 +- .../mars/entities/EntityCargoRocket.java | 13 +- .../mars/entities/EntityCreeperBoss.java | 59 +- .../mars/entities/EntityLandingBalloons.java | 36 +- .../mars/entities/EntityProjectileTNT.java | 4 +- .../mars/entities/EntitySlimeling.java | 210 +++--- .../mars/entities/EntitySludgeling.java | 25 +- .../mars/entities/EntityTier2Rocket.java | 21 +- .../ContainerSchematicCargoRocket.java | 6 +- .../ContainerSchematicTier2Rocket.java | 6 +- .../mars/inventory/ContainerSlimeling.java | 2 +- .../mars/inventory/ContainerTerraformer.java | 8 +- .../planets/mars/items/ItemArmorMars.java | 5 +- .../planets/mars/items/ItemBlockMachine.java | 20 +- .../mars/items/ItemBlockTintedGlassPane.java | 2 +- .../planets/mars/items/ItemTier2Rocket.java | 14 +- .../planets/mars/items/MarsItems.java | 12 +- .../mars/nei/CargoRocketRecipeHandler.java | 4 +- .../mars/nei/GCMarsNEIHighlightHandler.java | 8 +- .../mars/nei/GasLiquefierRecipeHandler.java | 4 +- .../nei/MethaneSynthesizerRecipeHandler.java | 4 +- .../mars/nei/NEIGalacticraftMarsConfig.java | 50 +- .../mars/nei/RocketT2RecipeHandler.java | 4 +- .../mars/network/PacketSimpleMars.java | 7 +- .../mars/recipe/RecipeManagerMars.java | 60 +- .../mars/tile/TileEntityCryogenicChamber.java | 33 +- .../tile/TileEntityDungeonSpawnerMars.java | 5 +- .../mars/tile/TileEntityElectrolyzer.java | 8 +- .../mars/tile/TileEntityGasLiquefier.java | 10 +- .../mars/tile/TileEntityLaunchController.java | 5 +- .../mars/tile/TileEntitySlimelingEgg.java | 7 +- .../mars/tile/TileEntityTerraformer.java | 19 +- .../planets/mars/util/MarsUtil.java | 6 +- .../mars/world/gen/BiomeDecoratorMars.java | 2 +- .../mars/world/gen/BiomeGenFlatMars.java | 6 +- .../{BiomeGenBaseMars.java => BiomeMars.java} | 14 +- .../mars/world/gen/ChunkProviderMars.java | 11 +- .../mars/world/gen/MapGenCaveMars.java | 8 +- .../mars/world/gen/MapGenCavernMars.java | 22 +- .../mars/world/gen/WorldGenTerraformTree.java | 46 +- .../planets/venus/ConfigManagerVenus.java | 6 +- .../planets/venus/VenusModule.java | 21 +- .../planets/venus/VenusModuleClient.java | 25 +- .../planets/venus/blocks/BlockBasicVenus.java | 21 +- .../venus/blocks/BlockCrashedProbe.java | 33 +- .../blocks/BlockGeothermalGenerator.java | 11 +- .../planets/venus/blocks/BlockTorchWeb.java | 56 +- .../venus/client/SkyProviderVenus.java | 4 +- .../venus/client/TickHandlerClientVenus.java | 4 +- ...xhaustFX.java => ParticleAcidExhaust.java} | 12 +- ...cidVaporFX.java => ParticleAcidVapor.java} | 12 +- .../render/entity/RenderSpiderQueen.java | 2 - .../client/render/entity/RenderWebShot.java | 2 +- .../venus/dimension/TeleportTypeVenus.java | 13 +- .../venus/dimension/WorldProviderVenus.java | 26 +- .../venus/entities/EntityEntryPodVenus.java | 18 +- .../planets/venus/entities/EntityJuicer.java | 57 +- .../venus/entities/EntitySpiderQueen.java | 56 +- .../planets/venus/entities/EntityWebShot.java | 30 +- .../entities/ai/EntityMoveHelperCeiling.java | 6 +- .../entities/ai/PathNavigateCeiling.java | 9 +- .../entities/ai/WalkNodeProcessorCeiling.java | 430 +++++++++--- .../planets/venus/items/ItemBasicVenus.java | 16 +- .../venus/items/ItemThermalPaddingTier2.java | 28 +- .../venus/items/ItemVolcanicPickaxe.java | 21 +- .../venus/tile/TileEntityCrashedProbe.java | 1 + .../tile/TileEntityDungeonSpawnerVenus.java | 5 +- .../tile/TileEntityGeothermalGenerator.java | 9 +- .../planets/venus/tile/TileEntitySpout.java | 2 +- .../venus/world/gen/BiomeDecoratorVenus.java | 30 +- .../venus/world/gen/BiomeGenFlatVenus.java | 6 +- .../world/gen/BiomeGenVenusMountain.java | 6 +- .../venus/world/gen/BiomeGenVenusValley.java | 10 +- ...agerVenus.java => BiomeProviderVenus.java} | 38 +- ...BiomeGenBaseVenus.java => BiomeVenus.java} | 18 +- .../venus/world/gen/ChunkProviderVenus.java | 92 +-- .../venus/world/gen/MapGenCaveVenus.java | 6 +- .../venus/world/gen/MapGenLavaVenus.java | 18 +- .../venus/world/gen/WorldGenCrashedProbe.java | 12 +- .../venus/world/gen/WorldGenLakesVenus.java | 21 +- .../world/gen/dungeon/CorridorVenus.java | 10 +- .../world/gen/dungeon/RoomBossVenus.java | 2 +- .../world/gen/dungeon/RoomChestVenus.java | 17 +- .../world/gen/dungeon/RoomEmptyVenus.java | 2 +- .../world/gen/dungeon/RoomEntranceVenus.java | 2 +- .../world/gen/dungeon/RoomSpawnerVenus.java | 6 +- .../world/gen/dungeon/RoomTreasureVenus.java | 2 +- .../world/gen/layer/GenLayerVenusBiomes.java | 2 +- 994 files changed, 23565 insertions(+), 15017 deletions(-) delete mode 100644 dependencies/main/java/buildcraft/api/APIHelper.java delete mode 100644 dependencies/main/java/buildcraft/api/ISimpleRegistry.java delete mode 100644 dependencies/main/java/buildcraft/api/ITripleRegistry.java delete mode 100644 dependencies/main/java/buildcraft/api/ObjectDefinition.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/BlueprintDeployer.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/BuilderAPI.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/BuildingPermission.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/IBuilderContext.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/ISchematicHelper.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/ISchematicRegistry.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/ITileBuilder.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/MappingNotFoundException.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/MappingRegistry.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/Schematic.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/SchematicBlock.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/SchematicBlockBase.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/SchematicEntity.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/SchematicFactory.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/SchematicFluid.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/SchematicMask.java delete mode 100644 dependencies/main/java/buildcraft/api/blueprints/SchematicTile.java delete mode 100644 dependencies/main/java/buildcraft/api/core/BCLog.java delete mode 100644 dependencies/main/java/buildcraft/api/core/BuildCraftAPI.java delete mode 100644 dependencies/main/java/buildcraft/api/core/ConfigAccessor.java delete mode 100644 dependencies/main/java/buildcraft/api/core/EnumColor.java delete mode 100644 dependencies/main/java/buildcraft/api/core/EnumPipePart.java delete mode 100644 dependencies/main/java/buildcraft/api/core/IAreaProvider.java delete mode 100644 dependencies/main/java/buildcraft/api/core/IBox.java delete mode 100644 dependencies/main/java/buildcraft/api/core/IBuildCraftMod.java delete mode 100644 dependencies/main/java/buildcraft/api/core/ICoreProxy.java delete mode 100644 dependencies/main/java/buildcraft/api/core/IFluidFilter.java delete mode 100644 dependencies/main/java/buildcraft/api/core/IIconProvider.java delete mode 100644 dependencies/main/java/buildcraft/api/core/IInvSlot.java delete mode 100644 dependencies/main/java/buildcraft/api/core/INBTLoadable_BC8.java delete mode 100644 dependencies/main/java/buildcraft/api/core/INBTStoreable.java delete mode 100644 dependencies/main/java/buildcraft/api/core/INetworkLoadable_BC8.java delete mode 100644 dependencies/main/java/buildcraft/api/core/IPathProvider.java delete mode 100644 dependencies/main/java/buildcraft/api/core/ISerializable.java delete mode 100644 dependencies/main/java/buildcraft/api/core/IStackFilter.java delete mode 100644 dependencies/main/java/buildcraft/api/core/IWorldProperty.java delete mode 100644 dependencies/main/java/buildcraft/api/core/IZone.java delete mode 100644 dependencies/main/java/buildcraft/api/core/Identifier.java delete mode 100644 dependencies/main/java/buildcraft/api/core/JavaTools.java delete mode 100644 dependencies/main/java/buildcraft/api/core/SafeTimeTracker.java delete mode 100644 dependencies/main/java/buildcraft/api/core/StackKey.java delete mode 100644 dependencies/main/java/buildcraft/api/enums/EnumBlueprintType.java delete mode 100644 dependencies/main/java/buildcraft/api/enums/EnumDecoratedBlock.java delete mode 100644 dependencies/main/java/buildcraft/api/enums/EnumEnergyStage.java delete mode 100644 dependencies/main/java/buildcraft/api/enums/EnumEngineType.java delete mode 100644 dependencies/main/java/buildcraft/api/enums/EnumFillerPattern.java delete mode 100644 dependencies/main/java/buildcraft/api/enums/EnumLaserTableType.java delete mode 100644 dependencies/main/java/buildcraft/api/enums/EnumMachineState.java delete mode 100644 dependencies/main/java/buildcraft/api/enums/EnumRedstoneChipset.java delete mode 100644 dependencies/main/java/buildcraft/api/enums/EnumSpring.java delete mode 100644 dependencies/main/java/buildcraft/api/filler/FillerManager.java delete mode 100644 dependencies/main/java/buildcraft/api/filler/IFillerPattern.java delete mode 100644 dependencies/main/java/buildcraft/api/filler/IFillerRegistry.java delete mode 100644 dependencies/main/java/buildcraft/api/fuels/BuildcraftFuelRegistry.java delete mode 100644 dependencies/main/java/buildcraft/api/fuels/ICoolant.java delete mode 100644 dependencies/main/java/buildcraft/api/fuels/ICoolantManager.java delete mode 100644 dependencies/main/java/buildcraft/api/fuels/IFuel.java delete mode 100644 dependencies/main/java/buildcraft/api/fuels/IFuelManager.java delete mode 100644 dependencies/main/java/buildcraft/api/fuels/ISolidCoolant.java delete mode 100644 dependencies/main/java/buildcraft/api/gates/GateExpansionController.java delete mode 100644 dependencies/main/java/buildcraft/api/gates/GateExpansionModelKey.java delete mode 100644 dependencies/main/java/buildcraft/api/gates/GateExpansions.java delete mode 100644 dependencies/main/java/buildcraft/api/gates/IExpansionBaker.java delete mode 100644 dependencies/main/java/buildcraft/api/gates/IGate.java delete mode 100644 dependencies/main/java/buildcraft/api/gates/IGateExpansion.java delete mode 100644 dependencies/main/java/buildcraft/api/items/IBlueprintItem.java delete mode 100644 dependencies/main/java/buildcraft/api/items/INamedItem.java delete mode 100644 dependencies/main/java/buildcraft/api/power/IEngine.java delete mode 100644 dependencies/main/java/buildcraft/api/power/ILaserTarget.java delete mode 100644 dependencies/main/java/buildcraft/api/power/ILaserTargetBlock.java delete mode 100644 dependencies/main/java/buildcraft/api/power/IRedstoneEngine.java delete mode 100644 dependencies/main/java/buildcraft/api/power/IRedstoneEngineReceiver.java delete mode 100644 dependencies/main/java/buildcraft/api/properties/BuildCraftExtendedProperty.java delete mode 100644 dependencies/main/java/buildcraft/api/properties/BuildCraftProperties.java delete mode 100644 dependencies/main/java/buildcraft/api/properties/BuildCraftProperty.java delete mode 100644 dependencies/main/java/buildcraft/api/recipes/BuildcraftRecipeRegistry.java delete mode 100644 dependencies/main/java/buildcraft/api/recipes/CraftingResult.java delete mode 100644 dependencies/main/java/buildcraft/api/recipes/IAssemblyRecipeManager.java delete mode 100644 dependencies/main/java/buildcraft/api/recipes/IComplexRefineryRecipeManager.java delete mode 100644 dependencies/main/java/buildcraft/api/recipes/IFlexibleCrafter.java delete mode 100644 dependencies/main/java/buildcraft/api/recipes/IFlexibleRecipe.java delete mode 100644 dependencies/main/java/buildcraft/api/recipes/IFlexibleRecipeViewable.java delete mode 100644 dependencies/main/java/buildcraft/api/recipes/IIntegrationRecipe.java delete mode 100644 dependencies/main/java/buildcraft/api/recipes/IIntegrationRecipeManager.java delete mode 100644 dependencies/main/java/buildcraft/api/recipes/IProgrammingRecipe.java delete mode 100644 dependencies/main/java/buildcraft/api/recipes/IProgrammingRecipeManager.java delete mode 100644 dependencies/main/java/buildcraft/api/recipes/IRecipeManager.java delete mode 100644 dependencies/main/java/buildcraft/api/recipes/IRefineryRecipeManager.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/ActionState.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/IActionExternal.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/IActionInternal.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/IActionProvider.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/IActionReceptor.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/IOverrideDefaultStatements.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/IStatement.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/IStatementContainer.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/IStatementParameter.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/ITriggerExternal.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/ITriggerExternalOverride.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/ITriggerInternal.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/ITriggerProvider.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/StatementManager.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/StatementMouseClick.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/StatementParameterItemStack.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/StatementSlot.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/containers/IRedstoneStatementContainer.java delete mode 100644 dependencies/main/java/buildcraft/api/statements/containers/ISidedStatementContainer.java delete mode 100644 dependencies/main/java/buildcraft/api/tools/IToolWrench.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/ICustomPipeConnection.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/IInjectable.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/IItemPipe.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/IPipe.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/IPipeConnection.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/IPipeTile.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/IStripesActivator.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/IStripesHandler.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/IStripesPipe.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/PipeConnectionAPI.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/PipeManager.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/PipeWire.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/BCPipeEventHandler.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/EnumContentsJourneyPart.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IConnection_BC8.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IExtractionManager.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IInsertionManager.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeAddonItem.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeBehaviourFactory.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeContents.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeContentsEditable.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeHelper.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeHolder_BC8.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeListener.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeListenerFactory.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeListenerRegistry.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipePropertyProvider.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeRegistry.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeType.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipe_BC8.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPluggable_BC8.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPropertyRegistry.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeAPI_BC8.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeBehaviour_BC8.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeConnectionAPI.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeDefinition_BC8.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventConnection_BC8.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventContents_BC8.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventInteract_BC8.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEvent_BC8.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pluggable/IConnectionMatrix.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pluggable/IFacadePluggable.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pluggable/IPipePluggableDynamicRenderer.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pluggable/IPipePluggableItem.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pluggable/IPipePluggableState.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pluggable/IPipeRenderState.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pluggable/IPluggableModelBaker.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pluggable/PipePluggable.java delete mode 100644 dependencies/main/java/buildcraft/api/transport/pluggable/PluggableModelKey.java delete mode 100644 dependencies/main/java/codechicken/core/GuiModListScroll.java delete mode 100644 dependencies/main/java/codechicken/core/IStringMatcher.java create mode 100644 dependencies/main/java/codechicken/core/ModDescriptionEnhancer.java delete mode 100644 dependencies/main/java/codechicken/core/asm/CodeChickenAccessTransformer.java delete mode 100644 dependencies/main/java/codechicken/core/asm/CodeChickenCoreModContainer.java delete mode 100644 dependencies/main/java/codechicken/core/asm/DefaultImplementationTransformer.java delete mode 100644 dependencies/main/java/codechicken/core/asm/DelegatedTransformer.java delete mode 100644 dependencies/main/java/codechicken/core/asm/DependancyLister.java delete mode 100644 dependencies/main/java/codechicken/core/asm/InterfaceDependancies.java delete mode 100644 dependencies/main/java/codechicken/core/asm/InterfaceDependancyTransformer.java delete mode 100644 dependencies/main/java/codechicken/core/asm/MCPDeobfuscationTransformer.java delete mode 100644 dependencies/main/java/codechicken/core/asm/TweakTransformer.java delete mode 100644 dependencies/main/java/codechicken/core/featurehack/GameDataManipulator.java delete mode 100644 dependencies/main/java/codechicken/core/featurehack/LiquidTextures.java delete mode 100644 dependencies/main/java/codechicken/core/featurehack/TweakTransformerHelper.java delete mode 100644 dependencies/main/java/codechicken/core/featurehack/mc/TextureLavaFX.java delete mode 100644 dependencies/main/java/codechicken/core/featurehack/mc/TextureLavaFlowFX.java delete mode 100644 dependencies/main/java/codechicken/core/featurehack/mc/TextureWaterFX.java delete mode 100644 dependencies/main/java/codechicken/core/featurehack/mc/TextureWaterFlowFX.java create mode 100644 dependencies/main/java/codechicken/core/launch/FingerprintChecker.java create mode 100644 dependencies/main/java/codechicken/lib/CodeChickenLib.java create mode 100644 dependencies/main/java/codechicken/lib/asm/CCL_ASMTransformer.java rename dependencies/main/java/codechicken/{core => lib}/asm/MethodASMifier.java (96%) delete mode 100644 dependencies/main/java/codechicken/lib/asm/RenderHookTransformer.java rename dependencies/main/java/codechicken/{core => lib/asm/discovery}/ClassDiscoverer.java (84%) create mode 100644 dependencies/main/java/codechicken/lib/asm/discovery/IStringMatcher.java create mode 100644 dependencies/main/java/codechicken/lib/block/BlockMultiTile.java create mode 100644 dependencies/main/java/codechicken/lib/block/IParticleProvider.java create mode 100644 dependencies/main/java/codechicken/lib/block/IType.java create mode 100644 dependencies/main/java/codechicken/lib/block/ItemBlockMultiType.java create mode 100644 dependencies/main/java/codechicken/lib/block/StateReference.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingAll.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingHoz.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/PropertyInteger.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/PropertyString.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/TileEntityProperty.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedBooleanProperty.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteArrayProperty.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteProperty.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedEnumFacingProperty.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedFluidStackProperty.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntArrayProperty.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntegerProperty.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedMapProperty.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedPropertyBase.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedResourceLocationProperty.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedSpriteProperty.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedStringProperty.java create mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedTileEntityProperty.java create mode 100644 dependencies/main/java/codechicken/lib/colour/EnumColour.java create mode 100644 dependencies/main/java/codechicken/lib/data/MCDataHandler.java create mode 100644 dependencies/main/java/codechicken/lib/data/NBTHelper.java create mode 100644 dependencies/main/java/codechicken/lib/fingerprint/FingerprintChecker.java create mode 100644 dependencies/main/java/codechicken/lib/fingerprint/FingerprintViolatedCrashCallable.java rename dependencies/main/java/codechicken/{core => lib/gui}/IGuiPacketSender.java (83%) create mode 100644 dependencies/main/java/codechicken/lib/gui/SimpleCreativeTab.java create mode 100644 dependencies/main/java/codechicken/lib/internal/command/DevEnvCommand.java create mode 100644 dependencies/main/java/codechicken/lib/internal/command/client/DumpModelLocationsCommand.java create mode 100644 dependencies/main/java/codechicken/lib/internal/command/client/NukeCCModelCacheCommand.java create mode 100644 dependencies/main/java/codechicken/lib/internal/proxy/ClientProxy.java create mode 100644 dependencies/main/java/codechicken/lib/internal/proxy/CommonProxy.java create mode 100644 dependencies/main/java/codechicken/lib/item/ItemMultiType.java create mode 100644 dependencies/main/java/codechicken/lib/item/ItemStackRegistry.java create mode 100644 dependencies/main/java/codechicken/lib/item/filtering/IItemFilter.java create mode 100644 dependencies/main/java/codechicken/lib/item/filtering/IItemFilterProvider.java create mode 100644 dependencies/main/java/codechicken/lib/model/BakedModelProperties.java create mode 100644 dependencies/main/java/codechicken/lib/model/CCMultiModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/CCOverrideBakedBlockModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/CCOverrideBakedModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/CCOverrideListHandler.java create mode 100644 dependencies/main/java/codechicken/lib/model/DummyBakedModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/ModelRegistryHelper.java create mode 100644 dependencies/main/java/codechicken/lib/model/PerspectiveAwareModelProperties.java create mode 100644 dependencies/main/java/codechicken/lib/model/SimpleBakedBlockModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/SimpleBakedItemModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/SimpleOverrideBakedModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/SimplePerspectiveAwareBakedModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/StateOverrideIModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/bakedmodels/AbstractBakedPropertiesModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareBakedModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModelWrapper.java create mode 100644 dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareMultiModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareOverrideModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/bakery/BlockModelBakery.java create mode 100644 dependencies/main/java/codechicken/lib/model/bakery/CCModelBakery.java create mode 100644 dependencies/main/java/codechicken/lib/model/bakery/CCQuad.java create mode 100644 dependencies/main/java/codechicken/lib/model/bakery/CCQuadBakery.java create mode 100644 dependencies/main/java/codechicken/lib/model/bakery/ItemModelBakery.java create mode 100644 dependencies/main/java/codechicken/lib/model/bakery/PlanarFaceBakery.java create mode 100644 dependencies/main/java/codechicken/lib/model/bakery/SimplePerspectiveAwareLayerModelBakery.java create mode 100644 dependencies/main/java/codechicken/lib/model/bakery/UnpackingVertexConsumer.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakery.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakeryProperties.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/CCBakeryModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryBlock.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryItem.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/IBlockStateKeyGenerator.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/ICustomBlockBakery.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/IItemBakery.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/IItemStackKeyGenerator.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/ILayeredBlockBakery.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/ISimpleBlockBakery.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/SimpleBlockRenderer.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/loader/BakeryModel.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/loader/CCBakeryModelLoader.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockBakery.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockStateKeyGenerator.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubItemStackKeyGenerator.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockstate/CCBlockStateLoader.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockstate/CCFinalMultiVariant.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockstate/CCFinalVariant.java create mode 100644 dependencies/main/java/codechicken/lib/model/blockstate/CCVariant.java create mode 100644 dependencies/main/java/codechicken/lib/model/cube/CCCubeLoader.java create mode 100644 dependencies/main/java/codechicken/lib/model/cube/CCModelCube.java create mode 100644 dependencies/main/java/codechicken/lib/model/loader/CCBakedModelLoader.java create mode 100644 dependencies/main/java/codechicken/lib/model/loader/IBakedModelLoader.java create mode 100644 dependencies/main/java/codechicken/lib/model/modelbase/CCModelBase.java create mode 100644 dependencies/main/java/codechicken/lib/model/modelbase/CCModelBox.java create mode 100644 dependencies/main/java/codechicken/lib/model/modelbase/CCModelRenderer.java create mode 100644 dependencies/main/java/codechicken/lib/raytracer/CuboidRayTraceResult.java create mode 100644 dependencies/main/java/codechicken/lib/raytracer/DistanceRayTraceResult.java delete mode 100644 dependencies/main/java/codechicken/lib/raytracer/ExtendedMOP.java create mode 100644 dependencies/main/java/codechicken/lib/raytracer/ICuboidProvider.java create mode 100644 dependencies/main/java/codechicken/lib/render/CCIconRegister.java create mode 100644 dependencies/main/java/codechicken/lib/render/CCModelState.java create mode 100644 dependencies/main/java/codechicken/lib/render/CCOBJParser.java create mode 100644 dependencies/main/java/codechicken/lib/render/CCRSConsumer.java create mode 100644 dependencies/main/java/codechicken/lib/render/CCRenderEventHandler.java create mode 100644 dependencies/main/java/codechicken/lib/render/DigIconParticle.java delete mode 100644 dependencies/main/java/codechicken/lib/render/EntityDigIconFX.java delete mode 100644 dependencies/main/java/codechicken/lib/render/IFaceRenderer.java delete mode 100644 dependencies/main/java/codechicken/lib/render/IItemRenderer.java delete mode 100644 dependencies/main/java/codechicken/lib/render/ModelRegistryHelper.java delete mode 100644 dependencies/main/java/codechicken/lib/render/TextureUtils.java create mode 100644 dependencies/main/java/codechicken/lib/render/block/BlockRenderingRegistry.java create mode 100644 dependencies/main/java/codechicken/lib/render/block/CCBlockRendererDispatcher.java create mode 100644 dependencies/main/java/codechicken/lib/render/block/CCExtendedBlockRendererDispatcher.java create mode 100644 dependencies/main/java/codechicken/lib/render/block/ICCBlockRenderer.java create mode 100644 dependencies/main/java/codechicken/lib/render/block/IExtendedModel.java create mode 100644 dependencies/main/java/codechicken/lib/render/buffer/BakingVertexBuffer.java create mode 100644 dependencies/main/java/codechicken/lib/render/item/CCRenderItem.java create mode 100644 dependencies/main/java/codechicken/lib/render/item/EntityRendererHooks.java create mode 100644 dependencies/main/java/codechicken/lib/render/item/IGLTransform.java create mode 100644 dependencies/main/java/codechicken/lib/render/item/IItemRenderer.java create mode 100644 dependencies/main/java/codechicken/lib/render/item/IMatrixTransform.java create mode 100644 dependencies/main/java/codechicken/lib/render/item/IStackPerspectiveAwareModel.java create mode 100644 dependencies/main/java/codechicken/lib/render/item/map/IMapRenderer.java create mode 100644 dependencies/main/java/codechicken/lib/render/item/map/MapRenderRegistry.java create mode 100644 dependencies/main/java/codechicken/lib/render/particle/CustomParticleHandler.java rename dependencies/main/java/codechicken/lib/render/{ => pipeline}/CCRenderPipeline.java (73%) rename dependencies/main/java/codechicken/lib/render/{ => pipeline}/ColourMultiplier.java (63%) create mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/IVertexOperation.java create mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/IVertexSource.java create mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/VertexAttribute.java create mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/attribute/AttributeKey.java create mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/attribute/ColourAttribute.java create mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightCoordAttribute.java create mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightingAttribute.java create mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/attribute/NormalAttribute.java create mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/attribute/SideAttribute.java rename dependencies/main/java/codechicken/lib/render/{ => shader}/ShaderProgram.java (64%) create mode 100644 dependencies/main/java/codechicken/lib/render/shader/pipeline/CCShaderPipeline.java create mode 100644 dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/IShaderOperation.java create mode 100644 dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/ShaderRenderTimeOperation.java create mode 100644 dependencies/main/java/codechicken/lib/render/state/GlStateManagerHelper.java create mode 100644 dependencies/main/java/codechicken/lib/texture/CustomIResource.java create mode 100644 dependencies/main/java/codechicken/lib/texture/IItemBlockTextureProvider.java create mode 100644 dependencies/main/java/codechicken/lib/texture/IWorldBlockTextureProvider.java rename dependencies/main/java/codechicken/lib/{render => texture}/ManagedTextureFX.java (93%) rename dependencies/main/java/codechicken/lib/{render => texture}/PlaceholderTexture.java (94%) rename dependencies/main/java/codechicken/lib/{render => texture}/SpriteSheetManager.java (97%) rename dependencies/main/java/codechicken/lib/{render => texture}/TextureDataHolder.java (95%) rename dependencies/main/java/codechicken/lib/{render => texture}/TextureFX.java (92%) rename dependencies/main/java/codechicken/lib/{render => texture}/TextureSpecial.java (74%) create mode 100644 dependencies/main/java/codechicken/lib/texture/TextureUtils.java rename dependencies/main/java/codechicken/{core => lib/thread}/ProfileTimer.java (96%) rename dependencies/main/java/codechicken/{core => lib/thread}/ReentrantCheck.java (94%) rename dependencies/main/java/codechicken/{nei => lib/thread}/RestartableTask.java (70%) rename dependencies/main/java/codechicken/{core => lib/thread}/TaskProfiler.java (80%) rename dependencies/main/java/codechicken/{nei => lib/thread}/ThreadOperationTimer.java (86%) create mode 100644 dependencies/main/java/codechicken/lib/tile/IActiveTile.java create mode 100644 dependencies/main/java/codechicken/lib/tile/IDisplayTickTile.java create mode 100644 dependencies/main/java/codechicken/lib/tile/IGuiTile.java create mode 100644 dependencies/main/java/codechicken/lib/tile/IHarvestTile.java create mode 100644 dependencies/main/java/codechicken/lib/tile/IPlacingTypeTile.java create mode 100644 dependencies/main/java/codechicken/lib/tile/IRedstoneActiveTile.java create mode 100644 dependencies/main/java/codechicken/lib/tile/IRotatableTile.java create mode 100644 dependencies/main/java/codechicken/lib/util/ArrayUtils.java create mode 100644 dependencies/main/java/codechicken/lib/util/BlockStateUtils.java create mode 100644 dependencies/main/java/codechicken/lib/util/BlockUtils.java create mode 100644 dependencies/main/java/codechicken/lib/util/CCDirection.java rename dependencies/main/java/codechicken/{core => lib/util}/ClientUtils.java (59%) rename dependencies/main/java/codechicken/{core => lib/util}/CommonUtils.java (74%) create mode 100644 dependencies/main/java/codechicken/lib/util/ContainerUtils.java create mode 100644 dependencies/main/java/codechicken/lib/util/EntityUtils.java rename dependencies/main/java/codechicken/lib/{render => util}/FontUtils.java (65%) create mode 100644 dependencies/main/java/codechicken/lib/util/FuelUtils.java create mode 100644 dependencies/main/java/codechicken/lib/util/ItemNBTUtils.java create mode 100644 dependencies/main/java/codechicken/lib/util/ItemUtils.java rename dependencies/main/java/codechicken/{core => lib/util}/ReflectionManager.java (81%) create mode 100644 dependencies/main/java/codechicken/lib/util/RotationUtils.java rename dependencies/main/java/codechicken/{core => lib/util}/ServerUtils.java (68%) create mode 100644 dependencies/main/java/codechicken/lib/util/SoundUtils.java create mode 100644 dependencies/main/java/codechicken/lib/util/TileEntityUtils.java create mode 100644 dependencies/main/java/codechicken/lib/util/TransformUtils.java create mode 100644 dependencies/main/java/codechicken/lib/util/TripleABC.java create mode 100644 dependencies/main/java/codechicken/lib/util/VectorUtils.java create mode 100644 dependencies/main/java/codechicken/lib/util/VertexDataUtils.java rename dependencies/main/java/codechicken/lib/{render => vec}/Vertex5.java (84%) rename dependencies/main/java/codechicken/lib/{render => vec}/uv/IconTransformation.java (74%) create mode 100644 dependencies/main/java/codechicken/lib/vec/uv/IconVertexRangeUVTransform.java rename dependencies/main/java/codechicken/lib/{render => vec}/uv/MultiIconTransformation.java (67%) create mode 100644 dependencies/main/java/codechicken/lib/vec/uv/ScaledIconTransformation.java rename dependencies/main/java/codechicken/lib/{render => vec}/uv/UV.java (97%) rename dependencies/main/java/codechicken/lib/{render => vec}/uv/UVRotation.java (97%) rename dependencies/main/java/codechicken/lib/{render => vec}/uv/UVScale.java (95%) rename dependencies/main/java/codechicken/lib/{render => vec}/uv/UVTransformation.java (71%) rename dependencies/main/java/codechicken/lib/{render => vec}/uv/UVTransformationList.java (98%) rename dependencies/main/java/codechicken/lib/{render => vec}/uv/UVTranslation.java (97%) create mode 100644 dependencies/main/java/codechicken/lib/world/placement/BlockPlacementBatcher.java create mode 100644 dependencies/main/java/codechicken/lib/world/placement/BlockPlacementLightingManager.java create mode 100644 dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntry.java create mode 100644 dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntryBuilder.java create mode 100644 dependencies/main/java/codechicken/nei/FingerprintChecker.java rename dependencies/main/java/codechicken/nei/{VisiblityData.java => VisibilityData.java} (68%) delete mode 100644 dependencies/main/java/codechicken/nei/api/ItemFilter.java rename dependencies/main/java/codechicken/nei/api/{ => layout}/LayoutStyle.java (61%) rename dependencies/main/java/codechicken/nei/{ => api/stack}/PositionedStack.java (93%) create mode 100644 dependencies/main/java/codechicken/nei/config/KeyBindings.java delete mode 100644 dependencies/main/java/codechicken/nei/config/OptionKeyBind.java create mode 100644 dependencies/main/java/codechicken/nei/config/dumps/FluidRegistryDumper.java create mode 100644 dependencies/main/java/codechicken/nei/config/dumps/ForgeRegistryDumper.java rename dependencies/main/java/codechicken/nei/{ => container}/ContainerCreativeInv.java (59%) rename dependencies/main/java/codechicken/nei/{ => container}/ExtendedCreativeInv.java (94%) rename dependencies/main/java/codechicken/nei/{ => container}/InventoryCraftingDummy.java (92%) create mode 100644 dependencies/main/java/codechicken/nei/featurehack/VanillaCreativeTabSearchHooks.java rename dependencies/main/java/codechicken/nei/{ => layout}/LayoutStyleDefault.java (93%) rename dependencies/main/java/codechicken/nei/{ => layout}/LayoutStyleMinecraft.java (95%) rename dependencies/main/java/codechicken/nei/{ => layout}/LayoutStyleTMIOld.java (96%) rename dependencies/main/java/codechicken/nei/{NEICPH.java => network/NEIClientPacketHandler.java} (91%) rename dependencies/main/java/codechicken/nei/{NEISPH.java => network/NEIServerPacketHandler.java} (91%) create mode 100644 dependencies/main/java/codechicken/nei/recipe/potion/IPotionRecipe.java create mode 100644 dependencies/main/java/codechicken/nei/recipe/potion/PotionRecipeHelper.java create mode 100644 dependencies/main/java/codechicken/nei/recipe/potion/PotionTypeRecipe.java create mode 100644 dependencies/main/java/codechicken/nei/recipe/potion/PotionUpgradeRecipe.java create mode 100644 dependencies/main/java/codechicken/nei/thirdparty/colossalchests/ColossalChestsConfig.java create mode 100644 dependencies/main/java/codechicken/nei/util/LogHelper.java rename dependencies/main/java/codechicken/nei/{ => util}/NEIClientUtils.java (89%) rename dependencies/main/java/codechicken/nei/{ => util}/NEIServerUtils.java (89%) rename dependencies/main/java/codechicken/nei/{ => widget}/Button.java (91%) rename dependencies/main/java/codechicken/nei/{ => widget}/ItemPanel.java (90%) rename dependencies/main/java/codechicken/nei/{ => widget}/Label.java (91%) rename dependencies/main/java/codechicken/nei/{ => widget}/Widget.java (97%) delete mode 100644 dependencies/main/java/ic2/api/Direction.class delete mode 100644 dependencies/main/java/ic2/api/Direction.java delete mode 100644 dependencies/main/java/ic2/api/energy/EnergyNet.class delete mode 100644 dependencies/main/java/ic2/api/energy/IEnergyNet.class delete mode 100644 dependencies/main/java/ic2/api/energy/NodeStats.class delete mode 100644 dependencies/main/java/ic2/api/energy/event/EnergyTileEvent.class delete mode 100644 dependencies/main/java/ic2/api/energy/event/EnergyTileLoadEvent.class delete mode 100644 dependencies/main/java/ic2/api/energy/event/EnergyTileUnloadEvent.class delete mode 100644 dependencies/main/java/ic2/api/energy/event/package-info.class delete mode 100644 dependencies/main/java/ic2/api/energy/event/package-info.java delete mode 100644 dependencies/main/java/ic2/api/energy/package-info.class delete mode 100644 dependencies/main/java/ic2/api/energy/package-info.java create mode 100644 dependencies/main/java/ic2/api/energy/prefab/BasicSink.java create mode 100644 dependencies/main/java/ic2/api/energy/prefab/BasicSource.java create mode 100644 dependencies/main/java/ic2/api/energy/tile/IChargingSlot.java create mode 100644 dependencies/main/java/ic2/api/energy/tile/IColoredEnergyTile.java create mode 100644 dependencies/main/java/ic2/api/energy/tile/IDischargingSlot.java delete mode 100644 dependencies/main/java/ic2/api/energy/tile/IEnergyAcceptor.class delete mode 100644 dependencies/main/java/ic2/api/energy/tile/IEnergyConductor.class delete mode 100644 dependencies/main/java/ic2/api/energy/tile/IEnergyEmitter.class delete mode 100644 dependencies/main/java/ic2/api/energy/tile/IEnergySink.class delete mode 100644 dependencies/main/java/ic2/api/energy/tile/IEnergySource.class delete mode 100644 dependencies/main/java/ic2/api/energy/tile/IEnergyTile.class delete mode 100644 dependencies/main/java/ic2/api/energy/tile/IExplosionPowerOverride.class delete mode 100644 dependencies/main/java/ic2/api/energy/tile/IHeatSource.class delete mode 100644 dependencies/main/java/ic2/api/energy/tile/IKineticSource.class delete mode 100644 dependencies/main/java/ic2/api/energy/tile/IMetaDelegate.class delete mode 100644 dependencies/main/java/ic2/api/energy/tile/IMultiEnergySource.class delete mode 100644 dependencies/main/java/ic2/api/energy/tile/IOverloadHandler.class delete mode 100644 dependencies/main/java/ic2/api/energy/tile/package-info.class delete mode 100644 dependencies/main/java/ic2/api/energy/tile/package-info.java delete mode 100644 dependencies/main/java/ic2/api/info/IInfoProvider.class create mode 100644 dependencies/main/java/ic2/api/info/ILocatable.java create mode 100644 dependencies/main/java/ic2/api/info/ITeBlock.java delete mode 100644 dependencies/main/java/ic2/api/info/Info.class delete mode 100644 dependencies/main/java/ic2/api/info/package-info.class delete mode 100644 dependencies/main/java/ic2/api/info/package-info.java delete mode 100644 dependencies/main/java/ic2/api/item/ElectricItem.class create mode 100644 dependencies/main/java/ic2/api/item/HudMode.java delete mode 100644 dependencies/main/java/ic2/api/item/IBackupElectricItemManager.class delete mode 100644 dependencies/main/java/ic2/api/item/IBlockCuttingBlade.class delete mode 100644 dependencies/main/java/ic2/api/item/IBoxable.class delete mode 100644 dependencies/main/java/ic2/api/item/IC2Items.class delete mode 100644 dependencies/main/java/ic2/api/item/ICustomDamageItem.class delete mode 100644 dependencies/main/java/ic2/api/item/IDebuggable.class delete mode 100644 dependencies/main/java/ic2/api/item/IElectricItem.class delete mode 100644 dependencies/main/java/ic2/api/item/IElectricItemManager.class delete mode 100644 dependencies/main/java/ic2/api/item/IItemAPI.class delete mode 100644 dependencies/main/java/ic2/api/item/IItemHudInfo.class create mode 100644 dependencies/main/java/ic2/api/item/IItemHudProvider.java delete mode 100644 dependencies/main/java/ic2/api/item/IKineticRotor$GearboxType.class delete mode 100644 dependencies/main/java/ic2/api/item/IKineticRotor.class delete mode 100644 dependencies/main/java/ic2/api/item/IMetalArmor.class delete mode 100644 dependencies/main/java/ic2/api/item/ISpecialElectricItem.class create mode 100644 dependencies/main/java/ic2/api/item/ITeBlockSpecialItem.java delete mode 100644 dependencies/main/java/ic2/api/item/ITerraformingBP.class delete mode 100644 dependencies/main/java/ic2/api/item/ItemWrapper.class delete mode 100644 dependencies/main/java/ic2/api/item/package-info.class delete mode 100644 dependencies/main/java/ic2/api/item/package-info.java delete mode 100644 dependencies/main/java/ic2/api/package-info.class delete mode 100644 dependencies/main/java/ic2/api/package-info.java delete mode 100644 dependencies/main/java/ic2/api/tile/ExplosionWhitelist.class delete mode 100644 dependencies/main/java/ic2/api/tile/IEnergyStorage.class create mode 100644 dependencies/main/java/ic2/api/tile/IRotorProvider.java delete mode 100644 dependencies/main/java/ic2/api/tile/IWrenchable.class create mode 100644 dependencies/main/java/ic2/api/tile/RotorRegistry.java delete mode 100644 dependencies/main/java/ic2/api/tile/package-info.class delete mode 100644 dependencies/main/java/ic2/api/tile/package-info.java delete mode 100644 dependencies/main/java/ic2/api/util/IKeyboard.class delete mode 100644 dependencies/main/java/ic2/api/util/Keys.class delete mode 100644 dependencies/main/java/ic2/api/util/package-info.class delete mode 100644 dependencies/main/java/ic2/api/util/package-info.java rename src/main/java/micdoodle8/mods/galacticraft/core/world/gen/{BiomeGenFlatMoon.java => BiomeFlatMoon.java} (68%) rename src/main/java/micdoodle8/mods/galacticraft/core/world/gen/{BiomeGenBaseMoon.java => BiomeMoon.java} (77%) rename src/main/java/micdoodle8/mods/galacticraft/core/world/gen/{BiomeGenBaseOrbit.java => BiomeOrbit.java} (67%) create mode 100644 src/main/java/micdoodle8/mods/galacticraft/planets/GCPlanetDimensions.java rename src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/{BiomeGenBaseAsteroids.java => BiomeAsteroids.java} (83%) rename src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/{EntityBacterialDripFX.java => ParticleDrip.java} (82%) rename src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/{BiomeGenBaseMars.java => BiomeMars.java} (75%) rename src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/fx/{EntityAcidExhaustFX.java => ParticleAcidExhaust.java} (91%) rename src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/fx/{EntityAcidVaporFX.java => ParticleAcidVapor.java} (91%) rename src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/{WorldChunkManagerVenus.java => BiomeProviderVenus.java} (79%) rename src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/{BiomeGenBaseVenus.java => BiomeVenus.java} (87%) diff --git a/dependencies/main/java/buildcraft/api/APIHelper.java b/dependencies/main/java/buildcraft/api/APIHelper.java deleted file mode 100644 index dd47dcc7c8..0000000000 --- a/dependencies/main/java/buildcraft/api/APIHelper.java +++ /dev/null @@ -1,79 +0,0 @@ -package buildcraft.api; - -import java.util.Arrays; - -import org.apache.commons.lang3.StringUtils; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.LoaderState; - -import buildcraft.api.core.BCLog; - -public class APIHelper { - public static T getInstance(String clsName, Class baseVersion) { - return getNamedInstance(clsName, "INSTANCE", baseVersion); - } - - public static T getInstance(String clsName, Class baseVersion, T nullVersion) { - return getNamedInstance(clsName, "INSTANCE", baseVersion, nullVersion); - } - - @SuppressWarnings("unchecked") - public static T getNamedInstance(String clsName, String enumName, Class baseVersion) { - T instance = getNamedInstance(clsName, enumName, baseVersion, null); - if (instance != null) return instance; - - Class[] types = baseVersion.getClasses(); - Class voidType = null; - for (Class class1 : types) { - if (baseVersion.isAssignableFrom(class1)) voidType = class1; - } - if (voidType != null) { - Object[] arr = voidType.getEnumConstants(); - if (arr == null) return null; - Enum[] eArr = ((Class>) voidType).getEnumConstants(); - for (Enum e : eArr) { - if (e.name().equals(enumName) && baseVersion.isInstance(e)) return (T) e; - } - } - return null; - } - - @SuppressWarnings("unchecked") - public static T getNamedInstance(String clsName, String enumName, Class baseVersion, T nullVersion) { - if (!Loader.instance().hasReachedState(LoaderState.PREINITIALIZATION)) throw new IllegalStateException( - "Called this API too early, you are not allowed to use BC api before pre init!"); - try { - Class cls = Class.forName(clsName); - Object[] arr = cls.getEnumConstants(); - if (arr == null) { - return fail(clsName, nullVersion); - } - Enum[] enumArr = ((Class>) cls).getEnumConstants(); - - for (Enum e : enumArr) { - if (e.name().equals(enumName) && baseVersion.isInstance(e)) return (T) e; - } - return fail(clsName, nullVersion); - } catch (ClassNotFoundException e) { - return fail(clsName, nullVersion); - } - } - - private static M fail(String clsName, M failure) { - String[] split = clsName.split("\\."); - String module; - if (split.length < 2) { - BCLog.logger.warn("Tried and failed to get the module name from " + Arrays.toString(split) + " (" + clsName + ")!"); - module = "invalid"; - } else { - module = split[1]; - } - module = StringUtils.capitalize(module); - String bcMod = "BuildCraft|" + module; - if (Loader.isModLoaded(bcMod)) { - BCLog.logger.warn("Failed to load the " + clsName + " dispite the appropriate buildcraft module being installed (" + module + ")"); - } - return failure; - } -} diff --git a/dependencies/main/java/buildcraft/api/ISimpleRegistry.java b/dependencies/main/java/buildcraft/api/ISimpleRegistry.java deleted file mode 100644 index 9227214f42..0000000000 --- a/dependencies/main/java/buildcraft/api/ISimpleRegistry.java +++ /dev/null @@ -1,12 +0,0 @@ -package buildcraft.api; - -interface ISimpleRegistry { - /** @param uniqueTag The tag to look up. Can be null. - * @return The unique definition associated with the unique tag, or null if the tag was not mapped */ - T getDefinition(String uniqueTag); - - /** @param definition The definition to look up. Can be null. - * @return The unique to for that definition. Will never be null, but will be an empty string if the definition did - * not exist. */ - String getTag(T definition); -} diff --git a/dependencies/main/java/buildcraft/api/ITripleRegistry.java b/dependencies/main/java/buildcraft/api/ITripleRegistry.java deleted file mode 100644 index ea29b613c6..0000000000 --- a/dependencies/main/java/buildcraft/api/ITripleRegistry.java +++ /dev/null @@ -1,30 +0,0 @@ -package buildcraft.api; - -import java.util.Set; - -import org.apache.commons.lang3.tuple.Triple; - -import net.minecraft.item.Item; - -public interface ITripleRegistry extends ISimpleRegistry { - /** @return An unmodifiable set containing all the current mappings of the registry */ - Set> getDefinitions(); - - // Specifics - - /** @param definition The pipe definition to look up. Can be null. - * @return The item the has been mapped to the definition, or null if the definition was not mapped */ - Item getItem(T definition); - - /** @param item The item to look up the definition of. Can be null. - * @return The definition associated with that item, or null if the item was not mapped. */ - T getDefinition(Item item); - - /** @param item The item to look up the tag of. Can be null. - * @return The unique tag associated with that item, or null if the item was not mapped. */ - String getUniqueTag(Item item); - - /** @param tag The tag to look up the item with. - * @return The item associated with that tag, or null if the tag was not mapped. */ - Item getItem(String tag); -} diff --git a/dependencies/main/java/buildcraft/api/ObjectDefinition.java b/dependencies/main/java/buildcraft/api/ObjectDefinition.java deleted file mode 100644 index 439462dd4d..0000000000 --- a/dependencies/main/java/buildcraft/api/ObjectDefinition.java +++ /dev/null @@ -1,32 +0,0 @@ -package buildcraft.api; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; - -/* Note that neither this class (Or any of its subtypes) overrides equals or hash code, despite it being used as a key - * in a hash table. This is to speed up comparisons as no two ObjectDefinitions instances should be created with the - * same values. */ -public class ObjectDefinition { - /** A globally unique tag for the pipe */ - public final String globalUniqueTag; - /** A mod unique tag for the pipe. WARNING: this should only be used to register other mod-unique things, such as - * the pipe or gate item. For general use, use {@link #globalUniqueTag} */ - public final String modUniqueTag; - - protected static String getCurrentMod() { - ModContainer container = Loader.instance().activeModContainer(); - if (container == null) { - throw new IllegalStateException("Pipes MUST be registered inside a mod"); - } - return container.getModId(); - } - - private ObjectDefinition(String mod, String modUniqueTag) { - this.globalUniqueTag = mod + ":" + modUniqueTag; - this.modUniqueTag = modUniqueTag; - } - - public ObjectDefinition(String tag) { - this(getCurrentMod(), tag); - } -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/BlueprintDeployer.java b/dependencies/main/java/buildcraft/api/blueprints/BlueprintDeployer.java deleted file mode 100644 index e0d4216811..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/BlueprintDeployer.java +++ /dev/null @@ -1,30 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.io.File; - -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -/** This class is provided as a utility class for third-party mods that would like to easily deploy structures that are - * written in blueprints. It does not offer control on material that needs to get in, or how the structure is deployed, - * but allows to create contents of a blueprint in one cycle. Note that these functionalities will only work if - * BuildCraft is installed. */ -public abstract class BlueprintDeployer { - - /** The deployed instantiated by BuildCraft. This is set by the BuildCraft builder mod. Mods that want to work with - * BuildCraft not installed should check for this value to be not null. */ - public static BlueprintDeployer instance; - - /** Deploy the contents of the blueprints as if the builder was located at {pos} facing the direction dir. */ - public abstract void deployBlueprint(World world, BlockPos pos, EnumFacing facing, File file); - - /** Deploy the contents of the byte array as if the builder was located at {pos} facing the direction dir. */ - - public abstract void deployBlueprintFromFileStream(World world, BlockPos pos, EnumFacing dir, byte[] data); - -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/BuilderAPI.java b/dependencies/main/java/buildcraft/api/blueprints/BuilderAPI.java deleted file mode 100644 index bbe10af371..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/BuilderAPI.java +++ /dev/null @@ -1,15 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -public final class BuilderAPI { - public static ISchematicRegistry schematicRegistry; - public static ISchematicHelper schematicHelper; - - public static final int BREAK_ENERGY = 160; - public static final int BUILD_ENERGY = 240; - - private BuilderAPI() {} -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/BuildingPermission.java b/dependencies/main/java/buildcraft/api/blueprints/BuildingPermission.java deleted file mode 100644 index 8661240c46..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/BuildingPermission.java +++ /dev/null @@ -1,21 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -/** Schematics recorded in the blueprints can restrict situations where a blueprint can be used. A same schematic class - * can have different permissions depending on its contents. It's particularly useful when fixing a schematic, if - * blueprints that saved the previous version should not be built because of a bug (such as dupe bug on inventories). */ -public enum BuildingPermission { - /** No restrictions, blueprints using this schematic are good in all contexts. */ - ALL, - - /** This blueprints containing this schematic can only be used in creative. Maybe the block can't be crafted in - * survival in the first place, or the content of the schematic is known to have dupe bugs. */ - CREATIVE_ONLY, - - /** Blueprints containing this schematic should not be built. This is typically used when a critical problems have - * been fixed, but older versions of the schematic are too badly broken to be retreived. */ - NONE, -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/IBuilderContext.java b/dependencies/main/java/buildcraft/api/blueprints/IBuilderContext.java deleted file mode 100644 index aa93d4bf96..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/IBuilderContext.java +++ /dev/null @@ -1,22 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import net.minecraft.util.Vec3; -import net.minecraft.world.World; - -import buildcraft.api.core.IBox; - -/** This interface provide contextual information when building or initializing blueprint slots. */ -public interface IBuilderContext { - - Vec3 rotatePositionLeft(Vec3 pos); - - IBox surroundingBox(); - - World world(); - - MappingRegistry getMappingRegistry(); -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/ISchematicHelper.java b/dependencies/main/java/buildcraft/api/blueprints/ISchematicHelper.java deleted file mode 100644 index 7327f2e204..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/ISchematicHelper.java +++ /dev/null @@ -1,7 +0,0 @@ -package buildcraft.api.blueprints; - -import net.minecraft.item.ItemStack; - -public interface ISchematicHelper { - boolean isEqualItem(ItemStack a, ItemStack b); -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/ISchematicRegistry.java b/dependencies/main/java/buildcraft/api/blueprints/ISchematicRegistry.java deleted file mode 100644 index 503c315d5c..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/ISchematicRegistry.java +++ /dev/null @@ -1,19 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.Entity; - -public interface ISchematicRegistry { - void registerSchematicBlock(Block block, Class clazz, Object... params); - - void registerSchematicBlock(IBlockState state, Class clazz, Object... params); - - void registerSchematicEntity(Class entityClass, Class schematicClass, Object... params); - - boolean isSupported(IBlockState state); -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/ITileBuilder.java b/dependencies/main/java/buildcraft/api/blueprints/ITileBuilder.java deleted file mode 100644 index 2c06f64c36..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/ITileBuilder.java +++ /dev/null @@ -1,13 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import net.minecraft.inventory.IInventory; - -public interface ITileBuilder extends IInventory { - - boolean isBuildingMaterialSlot(int i); - -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/MappingNotFoundException.java b/dependencies/main/java/buildcraft/api/blueprints/MappingNotFoundException.java deleted file mode 100644 index f84cee6278..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/MappingNotFoundException.java +++ /dev/null @@ -1,13 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -public class MappingNotFoundException extends Exception { - private static final long serialVersionUID = 1L; - - public MappingNotFoundException(String msg) { - super(msg); - } -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/MappingRegistry.java b/dependencies/main/java/buildcraft/api/blueprints/MappingRegistry.java deleted file mode 100644 index dbe66e320b..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/MappingRegistry.java +++ /dev/null @@ -1,424 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map.Entry; - -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.ListMultimap; - -import org.apache.logging.log4j.Level; - -import net.minecraft.block.Block; -import net.minecraft.crash.CrashReportCategory; -import net.minecraft.entity.Entity; -import net.minecraft.item.Item; -import net.minecraft.nbt.NBTTagByte; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagShort; -import net.minecraft.util.ResourceLocation; - -import net.minecraftforge.common.util.Constants; -import net.minecraftforge.fml.common.FMLModContainer; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; -import net.minecraftforge.fml.common.registry.GameRegistry; - -import buildcraft.api.core.BCLog; - -public class MappingRegistry { - - public HashMap blockToId = new HashMap(); - public ArrayList idToBlock = new ArrayList(); - - public HashMap itemToId = new HashMap(); - public ArrayList idToItem = new ArrayList(); - - public HashMap, Integer> entityToId = new HashMap, Integer>(); - public ArrayList> idToEntity = new ArrayList>(); - - private void registerItem(Item item) { - if (item == null) throw new IllegalArgumentException("Cannot register a null item!"); - if (!itemToId.containsKey(item)) { - idToItem.add(item); - itemToId.put(item, idToItem.size() - 1); - } - } - - private void registerBlock(Block block) { - if (block == null) throw new IllegalArgumentException("Cannot register a null block!"); - if (!blockToId.containsKey(block)) { - idToBlock.add(block); - blockToId.put(block, idToBlock.size() - 1); - } - } - - private void registerEntity(Class entityClass) { - if (entityClass == null) throw new IllegalArgumentException("Cannot register a null entityClass!"); - if (!entityToId.containsKey(entityClass)) { - idToEntity.add(entityClass); - entityToId.put(entityClass, idToEntity.size() - 1); - } - } - - public Item getItemForId(int id) throws MappingNotFoundException { - if (id >= idToItem.size()) { - throw new MappingNotFoundException("no item mapping at position " + id); - } - - Item result = idToItem.get(id); - - if (result == null) { - throw new MappingNotFoundException("no item mapping at position " + id); - } else { - return result; - } - } - - public int getIdForItem(Item item) { - if (item == null) throw new NullPointerException("item"); - if (!itemToId.containsKey(item)) { - registerItem(item); - } - - return itemToId.get(item); - } - - public int itemIdToRegistry(int id) { - Item item = Item.getItemById(id); - - return getIdForItem(item); - } - - public ResourceLocation itemIdToWorld(int id) throws MappingNotFoundException { - Item item = getItemForId(id); - - return Item.itemRegistry.getNameForObject(item); - } - - public Block getBlockForId(int id) throws MappingNotFoundException { - if (id >= idToBlock.size()) { - throw new MappingNotFoundException("no block mapping at position " + id); - } - - Block result = idToBlock.get(id); - - if (result == null) { - throw new MappingNotFoundException("no block mapping at position " + id); - } else { - return result; - } - } - - public int getIdForBlock(Block block) { - if (!blockToId.containsKey(block)) { - registerBlock(block); - } - - return blockToId.get(block); - } - - public int blockIdToRegistry(int id) { - Block block = Block.getBlockById(id); - - return getIdForBlock(block); - } - - public ResourceLocation blockIdToWorld(int id) throws MappingNotFoundException { - Block block = getBlockForId(id); - - return Block.blockRegistry.getNameForObject(block); - } - - public Class getEntityForId(int id) throws MappingNotFoundException { - if (id >= idToEntity.size()) { - throw new MappingNotFoundException("no entity mapping at position " + id); - } - - Class result = idToEntity.get(id); - - if (result == null) { - throw new MappingNotFoundException("no entity mapping at position " + id); - } else { - return result; - } - } - - public int getIdForEntity(Class entity) { - if (!entityToId.containsKey(entity)) { - registerEntity(entity); - } - - return entityToId.get(entity); - } - - /** Relocates a stack nbt from the registry referential to the world referential. */ - public void stackToWorld(NBTTagCompound nbt) throws MappingNotFoundException { - // 1.7.10 back-compat - if (nbt.hasKey("id", Constants.NBT.TAG_SHORT)) { - Item item = getItemForId(nbt.getShort("id")); - nbt.setString("id", (Item.itemRegistry.getNameForObject(item).toString())); - } - } - - // versions before 1.8 saved stacks with an Item ID as a short - private boolean isOldStackLayout(NBTTagCompound nbt) { - return nbt.hasKey("id") && nbt.hasKey("Count") && nbt.hasKey("Damage") && nbt.getTag("id") instanceof NBTTagShort && nbt.getTag( - "Count") instanceof NBTTagByte && nbt.getTag("Damage") instanceof NBTTagShort; - } - - // 1.7.10 Back compat - public void scanAndTranslateStacksToWorld(NBTTagCompound nbt) throws MappingNotFoundException { - // First, check if this nbt is itself a stack - - if (isOldStackLayout(nbt)) { - stackToWorld(nbt); - } - - // Then, look at the nbt compound contained in this nbt (even if it's a - // stack) and checks for stacks in it. - for (String key : (Collection) nbt.getKeySet()) { - if (nbt.getTag(key) instanceof NBTTagCompound) { - try { - scanAndTranslateStacksToWorld(nbt.getCompoundTag(key)); - } catch (MappingNotFoundException e) { - nbt.removeTag(key); - } - } - - if (nbt.getTag(key) instanceof NBTTagList) { - NBTTagList list = (NBTTagList) nbt.getTag(key); - - if (list.getTagType() == Constants.NBT.TAG_COMPOUND) { - for (int i = list.tagCount() - 1; i >= 0; --i) { - try { - scanAndTranslateStacksToWorld(list.getCompoundTagAt(i)); - } catch (MappingNotFoundException e) { - list.removeTag(i); - } - } - } - } - } - } - - public void write(NBTTagCompound nbt) { - NBTTagList blocksMapping = new NBTTagList(); - - for (Block b : idToBlock) { - NBTTagCompound sub = new NBTTagCompound(); - if (b != null) { - Object obj = Block.blockRegistry.getNameForObject(b); - if (obj == null) { - BCLog.logger.error("Block " + b.getUnlocalizedName() + " (" + b.getClass().getName() - + ") does not have a registry name! This is a bug!"); - } else { - String name = obj.toString(); - if (name == null || name.length() == 0) { - BCLog.logger.error("Block " + b.getUnlocalizedName() + " (" + b.getClass().getName() - + ") has an empty registry name! This is a bug!"); - } else { - sub.setString("name", name); - } - } - } else { - throw new IllegalArgumentException("Found a null block!"); - } - blocksMapping.appendTag(sub); - } - - nbt.setTag("blocksMapping", blocksMapping); - - NBTTagList itemsMapping = new NBTTagList(); - - for (Item i : idToItem) { - NBTTagCompound sub = new NBTTagCompound(); - if (i != null) { - ResourceLocation obj = Item.itemRegistry.getNameForObject(i); - if (obj == null) { - BCLog.logger.error("Item " + i.getUnlocalizedName() + " (" + i.getClass().getName() - + ") does not have a registry name! This is a bug!"); - } else { - String name = obj.toString(); - if (name == null || name.length() == 0) { - BCLog.logger.error("Item " + i.getUnlocalizedName() + " (" + i.getClass().getName() - + ") has an empty registry name! This is a bug!"); - } else { - sub.setString("name", name); - } - } - } else { - throw new IllegalArgumentException("Found a null item!"); - } - itemsMapping.appendTag(sub); - } - - nbt.setTag("itemsMapping", itemsMapping); - - NBTTagList entitiesMapping = new NBTTagList(); - - for (Class e : idToEntity) { - NBTTagCompound sub = new NBTTagCompound(); - sub.setString("name", e.getCanonicalName()); - entitiesMapping.appendTag(sub); - } - - nbt.setTag("entitiesMapping", entitiesMapping); - - // System.out.println("[W] idToItem size : " + idToItem.size()); - // for (Item i : idToItem) { - // System.out.println("- " + (i != null ? i.toString() : "null")); - // } - } - - private Object getMissingMappingFromFML(boolean isBlock, String name, int i) { - ResourceLocation location = new ResourceLocation(name); - String modName = name.split(":")[0]; - if (Loader.isModLoaded(modName)) { - try { - FMLMissingMappingsEvent.MissingMapping mapping = new FMLMissingMappingsEvent.MissingMapping(isBlock ? GameRegistry.Type.BLOCK - : GameRegistry.Type.ITEM, location, i); - ListMultimap missingMapping = ArrayListMultimap.create(); - missingMapping.put(modName, mapping); - FMLMissingMappingsEvent event = new FMLMissingMappingsEvent(missingMapping); - for (ModContainer container : Loader.instance().getModList()) { - if (container instanceof FMLModContainer) { - event.applyModContainer(container); - ((FMLModContainer) container).handleModStateEvent(event); - if (mapping.getAction() != FMLMissingMappingsEvent.Action.DEFAULT) { - break; - } - } - } - if (mapping.getAction() == FMLMissingMappingsEvent.Action.REMAP) { - return mapping.getTarget(); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - return null; - } - - public void read(NBTTagCompound nbt) { - NBTTagList blocksMapping = nbt.getTagList("blocksMapping", Constants.NBT.TAG_COMPOUND); - - for (int i = 0; i < blocksMapping.tagCount(); ++i) { - NBTTagCompound sub = blocksMapping.getCompoundTagAt(i); - if (!sub.hasKey("name")) { - // Keeping the order correct - idToBlock.add(null); - BCLog.logger.log(Level.WARN, "Can't load a block - corrupt blueprint!"); - continue; - } - String name = sub.getString("name"); - ResourceLocation location = new ResourceLocation(name); - Block b = null; - - if (!Block.blockRegistry.containsKey(location) && name.contains(":")) { - b = (Block) getMissingMappingFromFML(true, name, i); - if (b != null) { - BCLog.logger.info("Remapped " + name + " to " + Block.blockRegistry.getNameForObject(b)); - } - } - - if (b == null && Block.blockRegistry.containsKey(location)) { - b = (Block) Block.blockRegistry.getObject(location); - } - - if (b != null) { - registerBlock(b); - } else { - // Keeping the order correct - idToBlock.add(null); - BCLog.logger.log(Level.WARN, "Can't load block " + name); - } - } - - NBTTagList itemsMapping = nbt.getTagList("itemsMapping", Constants.NBT.TAG_COMPOUND); - - for (int i = 0; i < itemsMapping.tagCount(); ++i) { - NBTTagCompound sub = itemsMapping.getCompoundTagAt(i); - if (!sub.hasKey("name")) { - // Keeping the order correct - idToItem.add(null); - BCLog.logger.log(Level.WARN, "Can't load an item - corrupt blueprint!"); - continue; - } - - String name = sub.getString("name"); - ResourceLocation location = new ResourceLocation(name); - Item item = null; - - if (!Item.itemRegistry.containsKey(location) && name.contains(":")) { - item = (Item) getMissingMappingFromFML(false, name, i); - if (item != null) { - BCLog.logger.info("Remapped " + name + " to " + Item.itemRegistry.getNameForObject(item)); - } - } - - if (item == null && Item.itemRegistry.containsKey(location)) { - item = (Item) Item.itemRegistry.getObject(location); - } - - if (item != null) { - registerItem(item); - } else { - // Keeping the order correct - idToItem.add(null); - BCLog.logger.log(Level.WARN, "Can't load item " + name); - } - } - - NBTTagList entitiesMapping = nbt.getTagList("entitiesMapping", Constants.NBT.TAG_COMPOUND); - - for (int i = 0; i < entitiesMapping.tagCount(); ++i) { - NBTTagCompound sub = entitiesMapping.getCompoundTagAt(i); - String name = sub.getString("name"); - Class e = null; - - try { - e = (Class) Class.forName(name); - } catch (ClassNotFoundException e1) { - e1.printStackTrace(); - } - - if (e != null) { - registerEntity(e); - } else { - // Keeping the order correct - idToEntity.add(null); - BCLog.logger.log(Level.WARN, "Can't load entity " + name); - } - } - - // System.out.println("[R] idToItem size : " + idToItem.size()); - // for (Item i : idToItem) { - // System.out.println("- " + (i != null ? i.toString() : "null")); - // } - } - - public void addToCrashReport(CrashReportCategory cat) { - cat.addCrashSection("Item Map Count", itemToId.size()); - for (Entry e : itemToId.entrySet()) { - cat.addCrashSection(" - ID " + e.getValue(), Item.itemRegistry.getNameForObject(e.getKey())); - } - - cat.addCrashSection("Block Map Count", blockToId.size()); - for (Entry e : blockToId.entrySet()) { - cat.addCrashSection(" - ID " + e.getValue(), Block.blockRegistry.getNameForObject(e.getKey())); - } - - cat.addCrashSection("Entity Map Count", entityToId.size()); - for (Entry, Integer> e : entityToId.entrySet()) { - cat.addCrashSection(" - ID " + e.getValue(), e.getKey()); - } - } -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/Schematic.java b/dependencies/main/java/buildcraft/api/blueprints/Schematic.java deleted file mode 100644 index a433588019..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/Schematic.java +++ /dev/null @@ -1,195 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; - -import buildcraft.api.core.IInvSlot; - -/** A schematic is a piece of a blueprint. It allows to stock blocks or entities to blueprints, and can have a state - * that moves from a blueprint referential to a world referential. Although default schematic behavior will be OK for a - * lot of objects, specific blocks and entities may be associated with a dedicated schematic class, which will be - * instantiated automatically. - * - * Schematic perform "id translation" in case the block ids between a blueprint and the world installation are - * different. Mapping is done through the builder context. - * - * Detailed documentation on the schematic behavior can be found on - * http://www.mod-buildcraft.com/wiki/doku.php?id=builder_support - * - * Example of schematics for minecraft blocks are available in the package buildcraft.core.schematics. */ -public abstract class Schematic { - /** Blocks are build in various stages, in order to make sure that a block can indeed be placed, and that it's - * unlikely to disturb other blocks. */ - public enum BuildingStage { - /** Standalone blocks do not change once placed. */ - STANDALONE, - - /** Expanding blocks will grow and may disturb other block locations, like liquids. */ - EXPANDING - } - - /** This is called to verify whether the required item is equal to the supplied item. - * - * Primarily rely on this for checking metadata/NBT - the item ID itself might have been filtered out by previously - * running code. */ - public boolean isItemMatchingRequirement(ItemStack suppliedStack, ItemStack requiredStack) { - return BuilderAPI.schematicHelper.isEqualItem(suppliedStack, requiredStack); - } - - /** This is called each time an item matches a requirement. By default, it will increase damage of items that can be - * damaged by the amount of the requirement, and remove the intended amount of items that can't be damaged. - * - * Client may override this behavior. Note that this subprogram may be called twice with the same parameters, once - * with a copy of requirements and stack to check if the entire requirements can be fulfilled, and once with the - * real inventory. Implementer is responsible for updating req (with the remaining requirements if any) and slot - * (after usage). - * - * returns what was used (similar to req, but created from slot, so that any NBT based differences are drawn from - * the correct source) */ - public ItemStack useItem(IBuilderContext context, ItemStack req, IInvSlot slot) { - ItemStack stack = slot.getStackInSlot(); - ItemStack result = stack.copy(); - - if (stack.isItemStackDamageable()) { - if (req.getItemDamage() + stack.getItemDamage() <= stack.getMaxDamage()) { - stack.setItemDamage(req.getItemDamage() + stack.getItemDamage()); - result.setItemDamage(req.getItemDamage()); - req.stackSize = 0; - } - - if (stack.getItemDamage() >= stack.getMaxDamage()) { - slot.decreaseStackInSlot(1); - } - } else { - if (stack.stackSize >= req.stackSize) { - result.stackSize = req.stackSize; - stack.stackSize -= req.stackSize; - req.stackSize = 0; - } else { - req.stackSize -= stack.stackSize; - stack.stackSize = 0; - } - } - - if (stack.stackSize == 0) { - stack.stackSize = 1; - if (stack.getItem().hasContainerItem(stack)) { - ItemStack newStack = stack.getItem().getContainerItem(stack); - slot.setStackInSlot(newStack); - } else { - slot.setStackInSlot(null); - } - } - - return result; - } - - /** Perform a 90 degree rotation to the slot. */ - public void rotateLeft(IBuilderContext context) { - - } - - /** Applies translations to all positions in the schematic to center in the blueprint referential */ - public void translateToBlueprint(Vec3 transform) { - - } - - /** Apply translations to all positions in the schematic to center in the builder referential */ - public void translateToWorld(Vec3 transform) {} - - /** Translates blocks and item ids to the blueprint referential */ - public void idsToBlueprint(MappingRegistry registry) {} - - /** Translates blocks and item ids to the world referential */ - public void idsToWorld(MappingRegistry registry) {} - - /** Initializes a schematic for blueprint according to an objet placed on {x, y, z} on the world. For blocks, block - * and meta fields will be initialized automatically. */ - public void initializeFromObjectAt(IBuilderContext context, BlockPos pos) {} - - /** Places the block in the world, at the location specified in the slot, using the stack in parameters */ - public void placeInWorld(IBuilderContext context, BlockPos pos, List stacks) {} - - /** Write specific requirements coming from the world to the blueprint. */ - public void storeRequirements(IBuilderContext context, BlockPos pos) {} - - /** Returns the requirements needed to build this block. When the requirements are met, they will be removed all at - * once from the builder, before calling writeToWorld. */ - public void getRequirementsForPlacement(IBuilderContext context, List requirements) {} - - /** Returns the amount of energy required to build this slot, depends on the stacks selected for the build. */ - public int getEnergyRequirement(List stacksUsed) { - int result = 0; - - if (stacksUsed != null) { - for (ItemStack s : stacksUsed) { - result += s.stackSize * BuilderAPI.BUILD_ENERGY; - } - } - - return result; - } - - /** Returns the flying stacks to display in the builder animation. */ - public List getStacksToDisplay(List stackConsumed) { - return stackConsumed; - } - - /** Return the stage where this schematic has to be built. */ - public BuildingStage getBuildStage() { - return BuildingStage.STANDALONE; - } - - /** Return true if the block on the world correspond to the block stored in the blueprint at the location given by - * the slot. By default, this subprogram is permissive and doesn't take into account metadata. - * - * Post processing will be called on these blocks. */ - public boolean isAlreadyBuilt(IBuilderContext context, BlockPos pos) { - return true; - } - - /** Return true if the block should not be placed to the world. Requirements will not be asked on such a block, and - * building will not be called. - * - * Post processing will be called on these blocks. */ - public boolean doNotBuild() { - return false; - } - - /** Return true if the schematic should not be used at all. This is computed straight after readFromNBT can be used - * to deactivate schematics in which an inconsistency is detected. It will be considered as a block of air instead. - * - * Post processing will *not* be called on these blocks. */ - public boolean doNotUse() { - return false; - } - - /** Return the maximium building permission for blueprint containing this schematic. */ - public BuildingPermission getBuildingPermission() { - return BuildingPermission.ALL; - } - - /** Called on a block when the blueprint has finished to place all the blocks. This may be useful to adjust variable - * depending on surrounding blocks that may not be there already at initial building. */ - public void postProcessing(IBuilderContext context, BlockPos pos) {} - - /** Saves this schematic to the blueprint NBT. */ - public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) {} - - /** Loads this schematic from the blueprint NBT. */ - public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) {} - - /** Returns the number of cycles to wait after building this schematic. Tiles and entities typically require more - * wait, around 5 cycles. */ - public int buildTime() { - return 1; - } -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/SchematicBlock.java b/dependencies/main/java/buildcraft/api/blueprints/SchematicBlock.java deleted file mode 100644 index 68385343af..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/SchematicBlock.java +++ /dev/null @@ -1,213 +0,0 @@ -/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.*; - -import com.google.gson.GsonBuilder; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockFalling; -import net.minecraft.block.BlockLiquid; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumFacing.Axis; - -import net.minecraftforge.common.util.Constants; -import net.minecraftforge.fluids.BlockFluidBase; - -import buildcraft.api.core.BCLog; - -public class SchematicBlock extends SchematicBlockBase { - public IBlockState state = null; - public BuildingPermission defaultPermission = BuildingPermission.ALL; - - /** This field contains requirements for a given block when stored in the blueprint. Modders can either rely on this - * list or compute their own int Schematic. */ - public ItemStack[] storedRequirements = new ItemStack[0]; - - private boolean doNotUse = false; - - @Override - public void getRequirementsForPlacement(IBuilderContext context, List requirements) { - if (state != null) { - if (storedRequirements.length != 0) { - Collections.addAll(requirements, storedRequirements); - } else { - requirements.add(getItemStack(state)); - } - } - } - - @Override - public boolean isAlreadyBuilt(IBuilderContext context, BlockPos pos) { - IBlockState placed = context.world().getBlockState(pos); - if (state == placed) return true; - if (state.getBlock() != placed.getBlock()) return false; - // This fixes bugs with blocks like stairs that return extra properties that were not visible from the meta. - if (state.getBlock().getMetaFromState(state) == placed.getBlock().getMetaFromState(placed)) return true; - return false; - } - - @Override - public void placeInWorld(IBuilderContext context, BlockPos pos, List stacks) { - super.placeInWorld(context, pos, stacks); - - this.setBlockInWorld(context, pos); - } - - @Override - public void storeRequirements(IBuilderContext context, BlockPos pos) { - super.storeRequirements(context, pos); - - if (state != null) { - List req = state.getBlock().getDrops(context.world(), pos, state, 0); - - if (req != null) { - storedRequirements = new ItemStack[req.size()]; - req.toArray(storedRequirements); - } - } - } - - @Override - public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) { - super.writeSchematicToNBT(nbt, registry); - - writeBlockToNBT(nbt, registry); - writeRequirementsToNBT(nbt, registry); - } - - @Override - public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) { - super.readSchematicFromNBT(nbt, registry); - - readBlockFromNBT(nbt, registry); - if (!doNotUse()) { - readRequirementsFromNBT(nbt, registry); - } - } - - /** Get a list of relative block coordinates which have to be built before this block can be placed. */ - public Set getPrerequisiteBlocks(IBuilderContext context) { - Set indexes = new HashSet(); - if (state.getBlock() instanceof BlockFalling) { - indexes.add(new BlockPos(0, -1, 0)); - } - return indexes; - } - - @Override - public BuildingStage getBuildStage() { - if (state.getBlock() instanceof BlockFluidBase || state.getBlock() instanceof BlockLiquid) { - return BuildingStage.EXPANDING; - } else { - return BuildingStage.STANDALONE; - } - } - - @Override - public BuildingPermission getBuildingPermission() { - return defaultPermission; - } - - // Utility functions - protected void setBlockInWorld(IBuilderContext context, BlockPos pos) { - context.world().setBlockState(pos, state, 3); - } - - @Override - public boolean doNotUse() { - return doNotUse; - } - - protected void readBlockFromNBT(NBTTagCompound nbt, MappingRegistry registry) { - try { - Block block = registry.getBlockForId(nbt.getInteger("blockId")); - state = block.getStateFromMeta(nbt.getInteger("blockMeta")); - } catch (MappingNotFoundException e) { - BCLog.logger.info(e); - doNotUse = true; - } - } - - protected void readRequirementsFromNBT(NBTTagCompound nbt, MappingRegistry registry) { - if (nbt.hasKey("rq")) { - NBTTagList rq = nbt.getTagList("rq", Constants.NBT.TAG_COMPOUND); - - ArrayList rqs = new ArrayList(); - for (int i = 0; i < rq.tagCount(); ++i) { - try { - NBTTagCompound sub = rq.getCompoundTagAt(i); - registry.stackToWorld(sub); - rqs.add(ItemStack.loadItemStackFromNBT(sub)); - } catch (MappingNotFoundException e) { - defaultPermission = BuildingPermission.CREATIVE_ONLY; - } catch (Throwable t) { - t.printStackTrace(); - defaultPermission = BuildingPermission.CREATIVE_ONLY; - } - } - - storedRequirements = rqs.toArray(new ItemStack[rqs.size()]); - } else { - storedRequirements = new ItemStack[0]; - } - } - - protected void writeBlockToNBT(NBTTagCompound nbt, MappingRegistry registry) { - nbt.setInteger("blockId", registry.getIdForBlock(state.getBlock())); - nbt.setInteger("blockMeta", state.getBlock().getMetaFromState(state)); - } - - protected void writeRequirementsToNBT(NBTTagCompound nbt, MappingRegistry registry) { - if (storedRequirements.length > 0) { - NBTTagList rq = new NBTTagList(); - - for (ItemStack stack : storedRequirements) { - if (stack == null || stack.getItem() == null) throw new IllegalStateException("Found a null requirement! " + getClass()); - NBTTagCompound sub = new NBTTagCompound(); - stack.writeToNBT(sub); - rq.appendTag(sub); - } - - nbt.setTag("rq", rq); - } - } - - protected ItemStack getItemStack(IBlockState state, int quantity) { - return new ItemStack(state.getBlock(), quantity, state.getBlock().damageDropped(state)); - } - - protected ItemStack getItemStack(IBlockState state) { - return getItemStack(state, 1); - } - - // Pretty much all blocks (that rotate) rotate this way now - @Override - public void rotateLeft(IBuilderContext context) { - IProperty facingProp = getFacingProp(); - if (facingProp != null) { - EnumFacing face = state.getValue(facingProp); - if (face.getAxis() == Axis.Y) return; - state = state.withProperty(facingProp, face.rotateY()); - } - } - - protected IProperty getFacingProp() { - Collection props = state.getPropertyNames(); - for (IProperty prop : props) { - if ("facing".equals(prop.getName()) && state.getValue(prop) instanceof EnumFacing) { - return prop; - } - } - return null; - } -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/SchematicBlockBase.java b/dependencies/main/java/buildcraft/api/blueprints/SchematicBlockBase.java deleted file mode 100644 index 69f18a2ebe..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/SchematicBlockBase.java +++ /dev/null @@ -1,9 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -public abstract class SchematicBlockBase extends Schematic { - -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/SchematicEntity.java b/dependencies/main/java/buildcraft/api/blueprints/SchematicEntity.java deleted file mode 100644 index 2057bd6d53..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/SchematicEntity.java +++ /dev/null @@ -1,194 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityList; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagDouble; -import net.minecraft.nbt.NBTTagFloat; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.Vec3; - -import net.minecraftforge.common.util.Constants; - -public class SchematicEntity extends Schematic { - public Class entity; - - /** This tree contains additional data to be stored in the blueprint. By default, it will be initialized from - * Schematic.readFromWord with the standard readNBT function of the corresponding tile (if any) and will be loaded - * from BptBlock.writeToWorld using the standard writeNBT function. */ - public NBTTagCompound entityNBT = new NBTTagCompound(); - - /** This field contains requirements for a given block when stored in the blueprint. Modders can either rely on this - * list or compute their own int Schematic. */ - public ItemStack[] storedRequirements = new ItemStack[0]; - public BuildingPermission defaultPermission = BuildingPermission.ALL; - - @Override - public void getRequirementsForPlacement(IBuilderContext context, List requirements) { - Collections.addAll(requirements, storedRequirements); - } - - public void writeToWorld(IBuilderContext context) { - Entity e = EntityList.createEntityFromNBT(entityNBT, context.world()); - context.world().spawnEntityInWorld(e); - } - - public void readFromWorld(IBuilderContext context, Entity entity) { - entity.writeToNBTOptional(entityNBT); - } - - @Override - public void translateToBlueprint(Vec3 transform) { - NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); - Vec3 pos = new Vec3(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); - pos = pos.add(transform); - entityNBT.setTag("Pos", this.newDoubleNBTList(pos.xCoord, pos.yCoord, pos.zCoord)); - } - - @Override - public void translateToWorld(Vec3 transform) { - NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); - Vec3 pos = new Vec3(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); - pos = pos.add(transform); - - entityNBT.setTag("Pos", this.newDoubleNBTList(pos.xCoord, pos.yCoord, pos.zCoord)); - } - - @Override - public void idsToBlueprint(MappingRegistry registry) {} - - @Override - public void idsToWorld(MappingRegistry registry) { - try { - registry.scanAndTranslateStacksToWorld(entityNBT); - } catch (MappingNotFoundException e) { - entityNBT = new NBTTagCompound(); - } - } - - @Override - public void rotateLeft(IBuilderContext context) { - NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); - Vec3 pos = new Vec3(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); - pos = context.rotatePositionLeft(pos); - entityNBT.setTag("Pos", this.newDoubleNBTList(pos.xCoord, pos.yCoord, pos.zCoord)); - - nbttaglist = entityNBT.getTagList("Rotation", 5); - float yaw = nbttaglist.getFloatAt(0); - yaw += 90; - entityNBT.setTag("Rotation", this.newFloatNBTList(yaw, nbttaglist.getFloatAt(1))); - } - - @Override - public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) { - super.writeSchematicToNBT(nbt, registry); - - nbt.setInteger("entityId", registry.getIdForEntity(entity)); - nbt.setTag("entity", entityNBT); - - NBTTagList rq = new NBTTagList(); - - for (ItemStack stack : storedRequirements) { - NBTTagCompound sub = new NBTTagCompound(); - stack.writeToNBT(stack.writeToNBT(sub)); - sub.setInteger("id", registry.getIdForItem(stack.getItem())); - rq.appendTag(sub); - } - - nbt.setTag("rq", rq); - } - - @Override - public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) { - super.readSchematicFromNBT(nbt, registry); - - entityNBT = nbt.getCompoundTag("entity"); - - NBTTagList rq = nbt.getTagList("rq", Constants.NBT.TAG_COMPOUND); - - ArrayList rqs = new ArrayList(); - - for (int i = 0; i < rq.tagCount(); ++i) { - try { - NBTTagCompound sub = rq.getCompoundTagAt(i); - - if (sub.getInteger("id") >= 0) { - // Maps the id in the blueprint to the id in the world - sub.setInteger("id", Item.itemRegistry.getIDForObject(registry.getItemForId(sub.getInteger("id")))); - - rqs.add(ItemStack.loadItemStackFromNBT(sub)); - } else { - defaultPermission = BuildingPermission.CREATIVE_ONLY; - } - } catch (Throwable t) { - t.printStackTrace(); - defaultPermission = BuildingPermission.CREATIVE_ONLY; - } - } - - storedRequirements = rqs.toArray(new ItemStack[rqs.size()]); - } - - protected NBTTagList newDoubleNBTList(double... par1ArrayOfDouble) { - NBTTagList nbttaglist = new NBTTagList(); - double[] adouble = par1ArrayOfDouble; - int i = par1ArrayOfDouble.length; - - for (int j = 0; j < i; ++j) { - double d1 = adouble[j]; - nbttaglist.appendTag(new NBTTagDouble(d1)); - } - - return nbttaglist; - } - - protected NBTTagList newFloatNBTList(float... par1ArrayOfFloat) { - NBTTagList nbttaglist = new NBTTagList(); - float[] afloat = par1ArrayOfFloat; - int i = par1ArrayOfFloat.length; - - for (int j = 0; j < i; ++j) { - float f1 = afloat[j]; - nbttaglist.appendTag(new NBTTagFloat(f1)); - } - - return nbttaglist; - } - - public boolean isAlreadyBuilt(IBuilderContext context) { - NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); - Vec3 newPosition = new Vec3(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); - - for (Object o : context.world().loadedEntityList) { - Entity e = (Entity) o; - - Vec3 existingPositon = new Vec3(e.posX, e.posY, e.posZ); - - if (existingPositon.distanceTo(newPosition) <= 0.1) { - return true; - } - } - - return false; - } - - @Override - public int buildTime() { - return 5; - } - - @Override - public BuildingPermission getBuildingPermission() { - return defaultPermission; - } -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/SchematicFactory.java b/dependencies/main/java/buildcraft/api/blueprints/SchematicFactory.java deleted file mode 100644 index 878b157143..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/SchematicFactory.java +++ /dev/null @@ -1,51 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.HashMap; - -import net.minecraft.nbt.NBTTagCompound; - -public abstract class SchematicFactory { - - private static final HashMap> factories = new HashMap>(); - - private static final HashMap, SchematicFactory> schematicToFactory = - new HashMap, SchematicFactory>(); - - protected abstract S loadSchematicFromWorldNBT(NBTTagCompound nbt, MappingRegistry registry) throws MappingNotFoundException; - - public void saveSchematicToWorldNBT(NBTTagCompound nbt, S object, MappingRegistry registry) { - nbt.setString("factoryID", getClass().getCanonicalName()); - } - - public static Schematic createSchematicFromWorldNBT(NBTTagCompound nbt, MappingRegistry registry) throws MappingNotFoundException { - String factoryName = nbt.getString("factoryID"); - - if (factories.containsKey(factoryName)) { - return factories.get(factoryName).loadSchematicFromWorldNBT(nbt, registry); - } else { - return null; - } - } - - public static void registerSchematicFactory(Class clas, SchematicFactory factory) { - schematicToFactory.put(clas, factory); - factories.put(factory.getClass().getCanonicalName(), factory); - } - - public static SchematicFactory getFactory(Class clas) { - Class superClass = clas.getSuperclass(); - - if (schematicToFactory.containsKey(clas)) { - return schematicToFactory.get(clas); - } else if (superClass != null) { - return getFactory(superClass); - } else { - return null; - } - } - -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/SchematicFluid.java b/dependencies/main/java/buildcraft/api/blueprints/SchematicFluid.java deleted file mode 100644 index 798f017281..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/SchematicFluid.java +++ /dev/null @@ -1,84 +0,0 @@ -/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.BlockLiquid; -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; - -import net.minecraftforge.fluids.FluidStack; - -public class SchematicFluid extends SchematicBlock { - - private final ItemStack fluidItem; - - public SchematicFluid(FluidStack fluidStack) { - this.fluidItem = new ItemStack(fluidStack.getFluid().getBlock(), 1); - } - - @Override - public void getRequirementsForPlacement(IBuilderContext context, List requirements) { - if (getLevel() == 0) { - requirements.add(fluidItem); - } - } - - @Override - public void storeRequirements(IBuilderContext context, BlockPos pos) { - // cancel requirements reading - } - - @Override - public boolean isAlreadyBuilt(IBuilderContext context, BlockPos pos) { - if (getLevel() == 0) { - return state == context.world().getBlockState(pos) && ((Integer) context.world().getBlockState(pos).getValue(BlockLiquid.LEVEL)) == 0; - } else { - return state == context.world().getBlockState(pos); - } - } - - @Override - public void rotateLeft(IBuilderContext context) { - - } - - @Override - public boolean doNotBuild() { - return getLevel() != 0; - } - - @Override - public void placeInWorld(IBuilderContext context, BlockPos pos, List stacks) { - if (getLevel() == 0) { - context.world().setBlockState(pos, state, 3); - } - } - - @Override - public void postProcessing(IBuilderContext context, BlockPos pos) { - if (getLevel() != 0) { - context.world().setBlockState(pos, state, 3); - } - } - - @Override - public List getStacksToDisplay(List stackConsumed) { - List result = new ArrayList(); - result.add(fluidItem); - return result; - } - - @Override - public int getEnergyRequirement(List stacksUsed) { - return 1 * BuilderAPI.BUILD_ENERGY; - } - - public int getLevel() { - return (Integer) state.getValue(BlockLiquid.LEVEL); - } -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/SchematicMask.java b/dependencies/main/java/buildcraft/api/blueprints/SchematicMask.java deleted file mode 100644 index 757199055b..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/SchematicMask.java +++ /dev/null @@ -1,83 +0,0 @@ -/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.List; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.WorldServer; - -import buildcraft.api.core.BuildCraftAPI; - -public class SchematicMask extends SchematicBlockBase { - /** True of the block should be a solid block (stone, grass or a furnace) and false if it shouldn't (flowers, air or - * vines) */ - public boolean isConcrete = true; - - public SchematicMask() { - - } - - public SchematicMask(boolean isConcrete) { - this.isConcrete = isConcrete; - } - - @Override - public void placeInWorld(IBuilderContext context, BlockPos pos, List stacks) { - if (isConcrete) { - if (stacks.size() == 0 || !BuildCraftAPI.isSoftBlock(context.world(), pos)) { - return; - } else { - ItemStack stack = stacks.get(0); - EntityPlayer player = BuildCraftAPI.proxy.getBuildCraftPlayer((WorldServer) context.world(), pos).get(); - - // force the block to be air block, in case it's just a soft - // block which replacement is not straightforward - context.world().setBlockToAir(pos); - - // Find nearest solid surface to place on - EnumFacing solidFace = null; - for (EnumFacing face : EnumFacing.values()) { - BlockPos offset = pos.offset(face); - if (!BuildCraftAPI.isSoftBlock(context.world(), offset)) { - solidFace = face; - break; - } - } - ItemBlock itemBlock = (ItemBlock) stack.getItem(); - IBlockState state = itemBlock.block.onBlockPlaced(context.world(), pos, solidFace, 0, 0, 0, stack.getMetadata(), player); - itemBlock.placeBlockAt(stack, player, context.world(), pos, solidFace, 0, 0, 0, state); - - } - } else { - context.world().setBlockToAir(pos); - } - } - - @Override - public boolean isAlreadyBuilt(IBuilderContext context, BlockPos pos) { - if (isConcrete) { - return !BuildCraftAPI.getWorldProperty("replaceable").get(context.world(), pos); - } else { - return BuildCraftAPI.getWorldProperty("replaceable").get(context.world(), pos); - } - } - - @Override - public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) { - nbt.setBoolean("isConcrete", isConcrete); - } - - @Override - public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) { - isConcrete = nbt.getBoolean("isConcrete"); - } -} diff --git a/dependencies/main/java/buildcraft/api/blueprints/SchematicTile.java b/dependencies/main/java/buildcraft/api/blueprints/SchematicTile.java deleted file mode 100644 index f70fd19ced..0000000000 --- a/dependencies/main/java/buildcraft/api/blueprints/SchematicTile.java +++ /dev/null @@ -1,114 +0,0 @@ -/** Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.blueprints; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; - -import buildcraft.api.core.JavaTools; - -public class SchematicTile extends SchematicBlock { - - /** This tree contains additional data to be stored in the blueprint. By default, it will be initialized from - * Schematic.readFromWord with the standard readNBT function of the corresponding tile (if any) and will be loaded - * from BptBlock.writeToWorld using the standard writeNBT function. */ - public NBTTagCompound tileNBT = new NBTTagCompound(); - - @Override - public void idsToBlueprint(MappingRegistry registry) {} - - @Override - public void idsToWorld(MappingRegistry registry) { - try { - registry.scanAndTranslateStacksToWorld(tileNBT); - } catch (MappingNotFoundException e) { - tileNBT = new NBTTagCompound(); - } - } - - public void onNBTLoaded() { - - } - - /** Places the block in the world, at the location specified in the slot. */ - @Override - public void placeInWorld(IBuilderContext context, BlockPos pos, List stacks) { - super.placeInWorld(context, pos, stacks); - - if (state.getBlock().hasTileEntity(state)) { - tileNBT.setInteger("x", pos.getX()); - tileNBT.setInteger("y", pos.getY()); - tileNBT.setInteger("z", pos.getZ()); - TileEntity tile = TileEntity.createAndLoadEntity(tileNBT); - tile.setWorldObj(context.world()); - context.world().setTileEntity(pos, tile); - } - } - - @Override - public void initializeFromObjectAt(IBuilderContext context, BlockPos pos) { - super.initializeFromObjectAt(context, pos); - - if (state.getBlock().hasTileEntity(state)) { - TileEntity tile = context.world().getTileEntity(pos); - - if (tile != null) { - tile.writeToNBT(tileNBT); - } - - tileNBT = (NBTTagCompound) tileNBT.copy(); - onNBTLoaded(); - } - } - - @Override - public void storeRequirements(IBuilderContext context, BlockPos pos) { - super.storeRequirements(context, pos); - - if (state.getBlock().hasTileEntity(state)) { - TileEntity tile = context.world().getTileEntity(pos); - - if (tile instanceof IInventory) { - IInventory inv = (IInventory) tile; - - ArrayList rqs = new ArrayList(); - - for (int i = 0; i < inv.getSizeInventory(); ++i) { - if (inv.getStackInSlot(i) != null) { - rqs.add(inv.getStackInSlot(i)); - } - } - - storedRequirements = JavaTools.concat(storedRequirements, rqs.toArray(new ItemStack[rqs.size()])); - } - } - } - - @Override - public void writeSchematicToNBT(NBTTagCompound nbt, MappingRegistry registry) { - super.writeSchematicToNBT(nbt, registry); - - nbt.setTag("blockCpt", tileNBT); - } - - @Override - public void readSchematicFromNBT(NBTTagCompound nbt, MappingRegistry registry) { - super.readSchematicFromNBT(nbt, registry); - - tileNBT = nbt.getCompoundTag("blockCpt"); - onNBTLoaded(); - } - - @Override - public int buildTime() { - return 5; - } -} diff --git a/dependencies/main/java/buildcraft/api/core/BCLog.java b/dependencies/main/java/buildcraft/api/core/BCLog.java deleted file mode 100644 index f74509173b..0000000000 --- a/dependencies/main/java/buildcraft/api/core/BCLog.java +++ /dev/null @@ -1,43 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public final class BCLog { - public static final Logger logger = LogManager.getLogger("BuildCraft"); - - /** Deactivate constructor */ - private BCLog() {} - - @Deprecated - public static void logErrorAPI(String mod, Throwable error, Class classFile) { - logErrorAPI(error, classFile); - } - - public static void logErrorAPI(Throwable error, Class classFile) { - StringBuilder msg = new StringBuilder("API error! Please update your mods. Error: "); - msg.append(error); - StackTraceElement[] stackTrace = error.getStackTrace(); - if (stackTrace.length > 0) { - msg.append(", ").append(stackTrace[0]); - } - - logger.log(Level.ERROR, msg.toString()); - - if (classFile != null) { - msg.append("API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain() - .getCodeSource().getLocation()); - logger.log(Level.ERROR, msg.toString()); - } - } - - @Deprecated - public static String getVersion() { - return BuildCraftAPI.getVersion(); - } -} diff --git a/dependencies/main/java/buildcraft/api/core/BuildCraftAPI.java b/dependencies/main/java/buildcraft/api/core/BuildCraftAPI.java deleted file mode 100644 index 6e43e6d8c1..0000000000 --- a/dependencies/main/java/buildcraft/api/core/BuildCraftAPI.java +++ /dev/null @@ -1,52 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Set; - -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; - -import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; -import net.minecraft.world.World; - -public final class BuildCraftAPI { - - public static ICoreProxy proxy; - - public static final Set softBlocks = Sets.newHashSet(); - public static final HashMap worldProperties = Maps.newHashMap(); - - /** Deactivate constructor */ - private BuildCraftAPI() {} - - public static String getVersion() { - try { - Class clazz = Class.forName("buildcraft.core.Version"); - Method method = clazz.getDeclaredMethod("getVersion"); - return String.valueOf(method.invoke(null)); - } catch (Exception e) { - return "UNKNOWN VERSION"; - } - } - - public static IWorldProperty getWorldProperty(String name) { - return worldProperties.get(name); - } - - public static void registerWorldProperty(String name, IWorldProperty property) { - if (worldProperties.containsKey(name)) { - BCLog.logger.warn("The WorldProperty key '" + name + "' is being overidden with " + property.getClass().getSimpleName() + "!"); - } - worldProperties.put(name, property); - } - - public static boolean isSoftBlock(World world, BlockPos pos) { - return worldProperties.get("soft").get(world, pos); - } -} diff --git a/dependencies/main/java/buildcraft/api/core/ConfigAccessor.java b/dependencies/main/java/buildcraft/api/core/ConfigAccessor.java deleted file mode 100644 index a66346ac57..0000000000 --- a/dependencies/main/java/buildcraft/api/core/ConfigAccessor.java +++ /dev/null @@ -1,48 +0,0 @@ -package buildcraft.api.core; - -import java.util.Map; - -import com.google.common.collect.Maps; - -import net.minecraftforge.common.config.Property; - -/** Use this to access the various config options. It is recommended that you use this as opposed to the variables in - * the mod, as users may only install the modules that they want, and not the one you may have refereed to. */ -@Deprecated -public final class ConfigAccessor { - public enum EMod { - CORE, - BUILDERS, - ENERGY, - FACTORY, - ROBITICS, - SILICON, - TRANSPORT - } - - private static Map mods = Maps.newHashMap(); - - private ConfigAccessor() {} - - public static Property getOption(EMod mod, String name) { - if (mods.containsKey(mod)) { - return mods.get(mod).getOption(name); - } else { - return null; - } - } - - public static boolean getBoolean(EMod mod, String name, boolean defaultBoolean) { - Property prop = getOption(mod, name); - if (prop == null) { - return defaultBoolean; - } else { - return prop.getBoolean(defaultBoolean); - } - } - - /** WARNING: INTERNAL USE ONLY! */ - public static void addMod(EMod mod, IBuildCraftMod actual) { - mods.put(mod, actual); - } -} diff --git a/dependencies/main/java/buildcraft/api/core/EnumColor.java b/dependencies/main/java/buildcraft/api/core/EnumColor.java deleted file mode 100644 index 852eea1ba6..0000000000 --- a/dependencies/main/java/buildcraft/api/core/EnumColor.java +++ /dev/null @@ -1,147 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import java.util.Locale; -import java.util.Random; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.IStringSerializable; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** Use minecraft's EnumDyeColor in as many places as possible. */ -@Deprecated -public enum EnumColor implements IStringSerializable { - - BLACK, - RED, - GREEN, - BROWN, - BLUE, - PURPLE, - CYAN, - LIGHT_GRAY, - GRAY, - PINK, - LIME, - YELLOW, - LIGHT_BLUE, - MAGENTA, - ORANGE, - WHITE; - - public static final EnumColor[] VALUES = values(); - public static final String[] DYES = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", - "dyePink", "dyeLime", "dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite" }; - public static final String[] NAMES = { "Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime", "Yellow", - "LightBlue", "Magenta", "Orange", "White" }; - public static final int[] DARK_HEX = { 0x2D2D2D, 0xA33835, 0x394C1E, 0x5C3A24, 0x3441A2, 0x843FBF, 0x36809E, 0x888888, 0x444444, 0xE585A0, - 0x3FAA36, 0xCFC231, 0x7F9AD1, 0xFF64FF, 0xFF6A00, 0xFFFFFF }; - public static final int[] LIGHT_HEX = { 0x181414, 0xBE2B27, 0x007F0E, 0x89502D, 0x253193, 0x7e34bf, 0x299799, 0xa0a7a7, 0x7A7A7A, 0xD97199, - 0x39D52E, 0xFFD91C, 0x66AAFF, 0xD943C6, 0xEA7835, 0xe4e4e4 }; - - @SideOnly(Side.CLIENT) - private static ResourceLocation iconSheet; - - @SideOnly(Side.CLIENT) - private static TextureAtlasSprite[] brushSprites; - - public int getDarkHex() { - return DARK_HEX[ordinal()]; - } - - public int getLightHex() { - return LIGHT_HEX[ordinal()]; - } - - public static EnumColor fromId(int id) { - if (id < 0 || id >= VALUES.length) { - return WHITE; - } - return VALUES[id]; - } - - public static EnumColor fromDye(String dyeTag) { - for (int id = 0; id < DYES.length; id++) { - if (DYES[id].equals(dyeTag)) { - return VALUES[id]; - } - } - return null; - } - - public static EnumColor fromName(String name) { - for (int id = 0; id < NAMES.length; id++) { - if (NAMES[id].equals(name)) { - return VALUES[id]; - } - } - return null; - } - - public static EnumColor getRand() { - return VALUES[new Random().nextInt(VALUES.length)]; - } - - public EnumColor getNext() { - EnumColor next = VALUES[(ordinal() + 1) % VALUES.length]; - return next; - } - - public EnumColor getPrevious() { - EnumColor previous = VALUES[(ordinal() + VALUES.length - 1) % VALUES.length]; - return previous; - } - - public EnumColor inverse() { - return EnumColor.VALUES[15 - ordinal()]; - } - - public String getTag() { - return "color." + name().replace("_", ".").toLowerCase(Locale.ENGLISH); - } - - public String getBasicTag() { - return name().replace("_", ".").toLowerCase(Locale.ENGLISH); - } - - @Override - public String getName() { - return NAMES[ordinal()]; - } - - public String getLocalizedName() { - return StatCollector.translateToLocal(getTag()); - } - - public String getDye() { - return DYES[ordinal()]; - } - - @Override - public String toString() { - String s = name().replace("_", " "); - String[] words = s.split(" "); - StringBuilder b = new StringBuilder(); - for (String word : words) { - b.append(word.charAt(0)).append(word.substring(1).toLowerCase(Locale.ENGLISH)).append(" "); - } - return b.toString().trim(); - } - - @SideOnly(Side.CLIENT) - public static void registerSprites(TextureAtlasSprite[] sprites) { - brushSprites = sprites; - } - - @SideOnly(Side.CLIENT) - public TextureAtlasSprite getSprite() { - return brushSprites[ordinal()]; - } -} diff --git a/dependencies/main/java/buildcraft/api/core/EnumPipePart.java b/dependencies/main/java/buildcraft/api/core/EnumPipePart.java deleted file mode 100644 index 2f97777cbe..0000000000 --- a/dependencies/main/java/buildcraft/api/core/EnumPipePart.java +++ /dev/null @@ -1,120 +0,0 @@ -package buildcraft.api.core; - -import com.google.common.collect.Maps; -import io.netty.buffer.ByteBuf; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTBase.NBTPrimitive; -import net.minecraft.nbt.NBTTagString; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.IStringSerializable; - -import java.util.Locale; -import java.util.Map; - -public enum EnumPipePart implements IStringSerializable,INetworkLoadable_BC8 { - DOWN(EnumFacing.DOWN), - UP(EnumFacing.UP), - NORTH(EnumFacing.NORTH), - SOUTH(EnumFacing.SOUTH), - WEST(EnumFacing.WEST), - EAST(EnumFacing.EAST), - /** CENTER, UNKNOWN and ALL are all valid uses of this constant. */ - CENTER(null); - - private static final Map facingMap = Maps.newEnumMap(EnumFacing.class); - private static final Map nameMap = Maps.newHashMap(); - private static final int MAX_VALUES = values().length; - - public final EnumFacing face; - - static { - for (EnumPipePart part : values()) { - nameMap.put(part.name(), part); - if (part.face != null) facingMap.put(part.face, part); - } - } - - public static int ordinal(EnumFacing face) { - return face == null ? 6 : face.ordinal(); - } - - public static EnumPipePart fromFacing(EnumFacing face) { - if (face == null) return EnumPipePart.CENTER; - return facingMap.get(face); - } - - public static EnumPipePart[] validFaces() { - return new EnumPipePart[] { DOWN, UP, NORTH, SOUTH, WEST, EAST }; - } - - public static EnumPipePart fromMeta(int meta) { - if (meta < 0 || meta >= MAX_VALUES) return EnumPipePart.CENTER; - return values()[meta]; - } - - private EnumPipePart(EnumFacing face) { - this.face = face; - } - - public int getIndex() { - if (face == null) return 6; - return face.getIndex(); - } - - @Override - public String getName() { - return name().toLowerCase(Locale.ROOT); - } - - public EnumPipePart next() { - switch (this) { - case DOWN: - return EAST; - case EAST: - return NORTH; - case NORTH: - return SOUTH; - case SOUTH: - return UP; - case UP: - return WEST; - case WEST: - return DOWN; - default: - return DOWN; - } - } - - public EnumPipePart opposite() { - if (this == CENTER) return CENTER; - return fromFacing(face.getOpposite()); - } - - public static EnumPipePart readFromNBT(NBTBase base) { - if (base == null) return CENTER; - if (base instanceof NBTTagString) { - NBTTagString nbtString = (NBTTagString) base; - String string = nbtString.getString(); - return nameMap.containsKey(string) ? nameMap.get(string) : CENTER; - } else { - byte ord = ((NBTPrimitive) base).getByte(); - if (ord < 0 || ord > 6) return CENTER; - return values()[ord]; - } - } - - public NBTBase writeToNBT() { - return new NBTTagString(name()); - } - - @Override - public EnumPipePart readFromByteBuf(ByteBuf buf) { - byte ord = buf.readByte(); - return fromMeta(ord); - } - - @Override - public void writeToByteBuf(ByteBuf buf) { - buf.writeByte(ordinal()); - } -} diff --git a/dependencies/main/java/buildcraft/api/core/IAreaProvider.java b/dependencies/main/java/buildcraft/api/core/IAreaProvider.java deleted file mode 100644 index e504694baf..0000000000 --- a/dependencies/main/java/buildcraft/api/core/IAreaProvider.java +++ /dev/null @@ -1,17 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import net.minecraft.util.BlockPos; - -/** To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers. */ -public interface IAreaProvider { - BlockPos min(); - - BlockPos max(); - - /** Remove from the world all objects used to define the area. */ - void removeFromWorld(); -} diff --git a/dependencies/main/java/buildcraft/api/core/IBox.java b/dependencies/main/java/buildcraft/api/core/IBox.java deleted file mode 100644 index d7c11f4f43..0000000000 --- a/dependencies/main/java/buildcraft/api/core/IBox.java +++ /dev/null @@ -1,19 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import net.minecraft.util.BlockPos; - -public interface IBox extends IZone { - IBox expand(int amount); - - IBox contract(int amount); - - BlockPos min(); - - BlockPos max(); - - void createLaserData(); -} diff --git a/dependencies/main/java/buildcraft/api/core/IBuildCraftMod.java b/dependencies/main/java/buildcraft/api/core/IBuildCraftMod.java deleted file mode 100644 index c287088b11..0000000000 --- a/dependencies/main/java/buildcraft/api/core/IBuildCraftMod.java +++ /dev/null @@ -1,7 +0,0 @@ -package buildcraft.api.core; - -import net.minecraftforge.common.config.Property; - -public interface IBuildCraftMod { - Property getOption(String name); -} diff --git a/dependencies/main/java/buildcraft/api/core/ICoreProxy.java b/dependencies/main/java/buildcraft/api/core/ICoreProxy.java deleted file mode 100644 index 7648e35636..0000000000 --- a/dependencies/main/java/buildcraft/api/core/ICoreProxy.java +++ /dev/null @@ -1,15 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import java.lang.ref.WeakReference; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; -import net.minecraft.world.WorldServer; - -public interface ICoreProxy { - WeakReference getBuildCraftPlayer(WorldServer world, BlockPos pos); -} diff --git a/dependencies/main/java/buildcraft/api/core/IFluidFilter.java b/dependencies/main/java/buildcraft/api/core/IFluidFilter.java deleted file mode 100644 index 0b61d440d8..0000000000 --- a/dependencies/main/java/buildcraft/api/core/IFluidFilter.java +++ /dev/null @@ -1,12 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - *

- * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.core; - -import net.minecraftforge.fluids.Fluid; - -public interface IFluidFilter { - - boolean matches(Fluid fluid); -} diff --git a/dependencies/main/java/buildcraft/api/core/IIconProvider.java b/dependencies/main/java/buildcraft/api/core/IIconProvider.java deleted file mode 100644 index 418c08a00d..0000000000 --- a/dependencies/main/java/buildcraft/api/core/IIconProvider.java +++ /dev/null @@ -1,13 +0,0 @@ -package buildcraft.api.core; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public interface IIconProvider { - public TextureAtlasSprite getIcon(int iconIndex); - - @SideOnly(Side.CLIENT) - public void registerIcons(TextureMap iconRegister); -} diff --git a/dependencies/main/java/buildcraft/api/core/IInvSlot.java b/dependencies/main/java/buildcraft/api/core/IInvSlot.java deleted file mode 100644 index a047a2f879..0000000000 --- a/dependencies/main/java/buildcraft/api/core/IInvSlot.java +++ /dev/null @@ -1,26 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import net.minecraft.item.ItemStack; - -public interface IInvSlot { - /** Returns the slot number of the underlying Inventory. - * - * @return the slot number */ - int getIndex(); - - boolean canPutStackInSlot(ItemStack stack); - - boolean canTakeStackFromSlot(ItemStack stack); - - boolean isItemValidForSlot(ItemStack stack); - - ItemStack decreaseStackInSlot(int amount); - - ItemStack getStackInSlot(); - - void setStackInSlot(ItemStack stack); -} diff --git a/dependencies/main/java/buildcraft/api/core/INBTLoadable_BC8.java b/dependencies/main/java/buildcraft/api/core/INBTLoadable_BC8.java deleted file mode 100644 index 8005bcf53f..0000000000 --- a/dependencies/main/java/buildcraft/api/core/INBTLoadable_BC8.java +++ /dev/null @@ -1,14 +0,0 @@ -package buildcraft.api.core; - -import net.minecraft.nbt.NBTBase; - -/** @param The type that will be loaded from and saved too. This essentially allows Immutable objects to be safely - * loaded without helper methods everywhere. However you are allowed to return this if you are a mutable - * object */ -public interface INBTLoadable_BC8 { - /** @return An object that has the properties loaded. WARNIG! This might be the same object as the one this method - * was called on! (You should always replace the object you have stored with whatever this returns) */ - T readFromNBT(NBTBase nbt); - - NBTBase writeToNBT(); -} diff --git a/dependencies/main/java/buildcraft/api/core/INBTStoreable.java b/dependencies/main/java/buildcraft/api/core/INBTStoreable.java deleted file mode 100644 index c34c134ac7..0000000000 --- a/dependencies/main/java/buildcraft/api/core/INBTStoreable.java +++ /dev/null @@ -1,12 +0,0 @@ -package buildcraft.api.core; - -import net.minecraft.nbt.NBTTagCompound; - -/** Use {@link INBTLoadable_BC8} instead of this, as this gives you more control over what NBT goes where, and what - * objects are allowed to do. */ -@Deprecated -public interface INBTStoreable { - void readFromNBT(NBTTagCompound tag); - - void writeToNBT(NBTTagCompound tag); -} diff --git a/dependencies/main/java/buildcraft/api/core/INetworkLoadable_BC8.java b/dependencies/main/java/buildcraft/api/core/INetworkLoadable_BC8.java deleted file mode 100644 index de0f99e95f..0000000000 --- a/dependencies/main/java/buildcraft/api/core/INetworkLoadable_BC8.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.core; - -import io.netty.buffer.ByteBuf; - -public interface INetworkLoadable_BC8 { - T readFromByteBuf(ByteBuf buf); - - void writeToByteBuf(ByteBuf buf); -} diff --git a/dependencies/main/java/buildcraft/api/core/IPathProvider.java b/dependencies/main/java/buildcraft/api/core/IPathProvider.java deleted file mode 100644 index d953bca12e..0000000000 --- a/dependencies/main/java/buildcraft/api/core/IPathProvider.java +++ /dev/null @@ -1,13 +0,0 @@ -package buildcraft.api.core; - -import java.util.List; - -import net.minecraft.util.BlockPos; - -/** To be implemented by TileEntities able to provide a path on the world, typically BuildCraft path markers. */ -public interface IPathProvider { - List getPath(); - - /** Remove from the world all objects used to define the path. */ - void removeFromWorld(); -} diff --git a/dependencies/main/java/buildcraft/api/core/ISerializable.java b/dependencies/main/java/buildcraft/api/core/ISerializable.java deleted file mode 100644 index 77d56d5414..0000000000 --- a/dependencies/main/java/buildcraft/api/core/ISerializable.java +++ /dev/null @@ -1,21 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.core; - -import io.netty.buffer.ByteBuf; - -/** Use {@link INetworkLoadable_BC8} instead, as that gives you more control over how you use objects */ -@Deprecated -public interface ISerializable { - /** Serializes the state to the stream - * - * @param data */ - void writeData(ByteBuf data); - - /** Deserializes the state from the stream - * - * @param data */ - void readData(ByteBuf data); -} diff --git a/dependencies/main/java/buildcraft/api/core/IStackFilter.java b/dependencies/main/java/buildcraft/api/core/IStackFilter.java deleted file mode 100644 index ef4f558833..0000000000 --- a/dependencies/main/java/buildcraft/api/core/IStackFilter.java +++ /dev/null @@ -1,14 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - *

- * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.core; - -import net.minecraft.item.ItemStack; - -/** This interface provides a convenient means of dealing with entire classes of items without having to specify each - * item individually. */ -public interface IStackFilter { - - boolean matches(ItemStack stack); -} diff --git a/dependencies/main/java/buildcraft/api/core/IWorldProperty.java b/dependencies/main/java/buildcraft/api/core/IWorldProperty.java deleted file mode 100644 index ba440d7d36..0000000000 --- a/dependencies/main/java/buildcraft/api/core/IWorldProperty.java +++ /dev/null @@ -1,14 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import net.minecraft.util.BlockPos; -import net.minecraft.world.World; - -public interface IWorldProperty { - boolean get(World world, BlockPos pos); - - void clear(); -} diff --git a/dependencies/main/java/buildcraft/api/core/IZone.java b/dependencies/main/java/buildcraft/api/core/IZone.java deleted file mode 100644 index 5d722ffe6b..0000000000 --- a/dependencies/main/java/buildcraft/api/core/IZone.java +++ /dev/null @@ -1,26 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import java.util.Random; - -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; - -public interface IZone { - /** Returns the smallest possible distance that the index would have to be changed by in order for - * {@link #contains(Vec3)} to return true. If the position is already inside then this will return 0 */ - double distanceTo(BlockPos index); - - /** Returns {@link #distanceTo(BlockPos)} but squared. Usually this will be quicker to calculate. */ - double distanceToSquared(BlockPos index); - - /** Returns true if the point is enclosed by this zone, such that none of the coordinates lie outside the range - * specified by this zone. */ - boolean contains(Vec3 point); - - /** Gets a random position that {@link #contains(Vec3)} will return true. */ - BlockPos getRandomBlockPos(Random rand); -} diff --git a/dependencies/main/java/buildcraft/api/core/Identifier.java b/dependencies/main/java/buildcraft/api/core/Identifier.java deleted file mode 100644 index 331600fbf9..0000000000 --- a/dependencies/main/java/buildcraft/api/core/Identifier.java +++ /dev/null @@ -1,234 +0,0 @@ -package buildcraft.api.core; - -import java.util.Map; -import java.util.UUID; - -import com.google.common.base.Supplier; - -import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.world.World; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** Identifies an in world tile entity or movable entity. Feel free to extend this class if your tile entity contains - * multiple identifiable {@link IPowerConnection}. Just make sure to register it with - * {@link #registerType(String, Supplier)} to make loading work. - *

- * Created on 1 Jan 2016 by AlexIIL */ -public abstract class Identifier { - private static Map> registeredIdentifiers; - - static { - registeredIdentifiers.put("mincraft:tile", new Supplier() { - @Override - public Identifier get() { - return new Tile(0, null); - } - }); - registeredIdentifiers.put("mincraft:entity", new Supplier() { - @Override - public Identifier get() { - return new MovableEntity(0, null); - } - }); - } - - protected final int dimId; - - public static void registerType(String type, Supplier constructor) { - if (constructor == null) throw new NullPointerException("constructor"); - if (constructor.get() == null) throw new NullPointerException("constructor.get()"); - registeredIdentifiers.put(type, constructor); - } - - public static Identifier getFor(Object obj) { - if (obj == null) throw new NullPointerException("obj"); - if (obj instanceof TileEntity) { - return Tile.create((TileEntity) obj); - } - if (obj instanceof Entity) { - return MovableEntity.create((Entity) obj); - } - if (obj instanceof NBTTagCompound) { - NBTTagCompound nbt = (NBTTagCompound) obj; - String type = nbt.getString("type"); - if (!registeredIdentifiers.containsKey(type)) return null; - return registeredIdentifiers.get(type).get().load(nbt.getCompoundTag("data")); - } - throw new IllegalArgumentException("Unknown type " + obj.getClass()); - } - - public static NBTTagCompound save(Identifier ident) { - NBTTagCompound tag = new NBTTagCompound(); - tag.setString("type", ident.typeId()); - tag.setTag("data", ident.save()); - return tag; - } - - private Identifier(int dimId) { - this.dimId = dimId; - } - - public abstract Object getByIdentifier(MinecraftServer server); - - public abstract boolean isLoaded(MinecraftServer server); - - protected abstract Identifier load(NBTTagCompound tag); - - protected abstract NBTTagCompound save(); - - public abstract String typeId(); - - @SideOnly(Side.CLIENT) - public abstract Object getByIdentifierClient(); - - @SideOnly(Side.CLIENT) - public abstract boolean isLoadedClient(); - - public static class Tile extends Identifier { - private final BlockPos pos; - - public static Tile create(TileEntity tile) { - if (tile.getWorld() == null) throw new NullPointerException("tile.getWorld() for the tile " + tile.getClass()); - if (tile.getPos() == null) throw new NullPointerException("tile.getPos() for the tile " + tile.getClass()); - return new Tile(tile.getWorld().provider.getDimension(), tile.getPos()); - } - - private Tile(int dimId, BlockPos pos) { - super(dimId); - this.pos = pos; - } - - @Override - public Tile load(NBTTagCompound tag) { - int dimId = tag.getInteger("dimId"); - int[] arr = tag.getIntArray("pos"); - if (arr.length == 0) return null; - return new Tile(dimId, new BlockPos(arr[0], arr[1], arr[2])); - } - - @Override - protected NBTTagCompound save() { - NBTTagCompound tag = new NBTTagCompound(); - tag.setInteger("dimId", dimId); - tag.setIntArray("pos", new int[] { pos.getX(), pos.getY(), pos.getZ() }); - return tag; - } - - @Override - public String typeId() { - return "minecraft:tile"; - } - - @Override - public TileEntity getByIdentifier(MinecraftServer server) { - World world = server.worldServerForDimension(dimId); - if (world == null) return null; - return world.getTileEntity(pos); - } - - @Override - public boolean isLoaded(MinecraftServer server) { - World world = server.worldServerForDimension(dimId); - if (world == null) return false; - return world.getTileEntity(pos) != null; - } - - @Override - @SideOnly(Side.CLIENT) - public TileEntity getByIdentifierClient() { - World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimension() != dimId) return null; - return world.getTileEntity(pos); - } - - @Override - @SideOnly(Side.CLIENT) - public boolean isLoadedClient() { - World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimension() != dimId) return false; - return world.getTileEntity(pos) != null; - } - - } - - public static class MovableEntity extends Identifier { - private final UUID uniqueId; - - public static MovableEntity create(Entity ent) { - if (ent.getEntityWorld() == null) throw new NullPointerException("ent.getEntityWorld() for the entity " + ent.getClass()); - if (ent.getPersistentID() == null) throw new NullPointerException("ent.getPersistentID() for the entity " + ent.getClass()); - return new MovableEntity(ent.getEntityWorld().provider.getDimension(), ent.getPersistentID()); - } - - private MovableEntity(int dimId, UUID uniqueId) { - super(dimId); - this.uniqueId = uniqueId; - } - - private Entity get(World world) { - for (Entity entity : world.loadedEntityList) { - if (entity.getPersistentID().equals(uniqueId)) { - return entity; - } - } - return null; - } - - @Override - public Entity getByIdentifier(MinecraftServer server) { - World world = server.worldServerForDimension(dimId); - if (world == null || world.provider.getDimension() != dimId) return null; - return get(world); - } - - @Override - public boolean isLoaded(MinecraftServer server) { - World world = server.worldServerForDimension(dimId); - if (world == null || world.provider.getDimension() != dimId) return false; - return get(world) != null; - } - - @Override - @SideOnly(Side.CLIENT) - public Entity getByIdentifierClient() { - World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimension() != dimId) return null; - return get(world); - } - - @Override - @SideOnly(Side.CLIENT) - public boolean isLoadedClient() { - World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimension() != dimId) return false; - return get(world) != null; - } - - @Override - protected MovableEntity load(NBTTagCompound tag) { - int dimId = tag.getInteger("dimId"); - UUID uuid = UUID.fromString(tag.getString("uuid")); - return new MovableEntity(dimId, uuid); - } - - @Override - protected NBTTagCompound save() { - NBTTagCompound tag = new NBTTagCompound(); - tag.setInteger("dimId", dimId); - tag.setString("uuid", uniqueId.toString()); - return tag; - } - - @Override - public String typeId() { - return "minecraft:entity"; - } - } -} diff --git a/dependencies/main/java/buildcraft/api/core/JavaTools.java b/dependencies/main/java/buildcraft/api/core/JavaTools.java deleted file mode 100644 index 7b7eb513c2..0000000000 --- a/dependencies/main/java/buildcraft/api/core/JavaTools.java +++ /dev/null @@ -1,39 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import java.util.Arrays; - -public final class JavaTools { - private JavaTools() { - - } - - public static T[] concat(T[] first, T[] second) { - T[] result = Arrays.copyOf(first, first.length + second.length); - System.arraycopy(second, 0, result, first.length, second.length); - return result; - } - - public static int[] concat(int[] first, int[] second) { - int[] result = Arrays.copyOf(first, first.length + second.length); - System.arraycopy(second, 0, result, first.length, second.length); - return result; - } - - public static float[] concat(float[] first, float[] second) { - float[] result = Arrays.copyOf(first, first.length + second.length); - System.arraycopy(second, 0, result, first.length, second.length); - return result; - } - - public static String surroundWithQuotes(String stringToSurroundWithQuotes) { - return String.format("\"%s\"", stringToSurroundWithQuotes); - } - - public static String stripSurroundingQuotes(String stringToStripQuotes) { - return stringToStripQuotes.replaceAll("^\"|\"$", ""); - } -} diff --git a/dependencies/main/java/buildcraft/api/core/SafeTimeTracker.java b/dependencies/main/java/buildcraft/api/core/SafeTimeTracker.java deleted file mode 100644 index 9390d87e7b..0000000000 --- a/dependencies/main/java/buildcraft/api/core/SafeTimeTracker.java +++ /dev/null @@ -1,68 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import net.minecraft.world.World; - -public class SafeTimeTracker { - - private long lastMark = Long.MIN_VALUE; - private long duration = -1; - private long randomRange = 0; - private long lastRandomDelay = 0; - private long internalDelay = 1; - - /** Only use this if the delay time changes (say, if you use this to determine when a refining should be complete */ - public SafeTimeTracker() { - - } - - public SafeTimeTracker(long delay) { - internalDelay = delay; - } - - /** In many situations, it is a bad idea to have all objects of the same kind to be waiting for the exact same - * amount of time, as that can lead to some situation where they're all synchronized and got to work all at the same - * time. When created with a random range, the mark that is set when reaching the expect delay will be added with a - * random number between [0, range[, meaning that the event will take between 0 and range more tick to run. */ - public SafeTimeTracker(long delay, long random) { - internalDelay = delay; - randomRange = random; - } - - public boolean markTimeIfDelay(World world) { - return markTimeIfDelay(world, internalDelay); - } - - /** Return true if a given delay has passed since last time marked was called successfully. */ - public boolean markTimeIfDelay(World world, long delay) { - if (world == null) { - return false; - } - - long currentTime = world.getTotalWorldTime(); - - if (currentTime < lastMark) { - lastMark = currentTime; - return false; - } else if (lastMark + delay + lastRandomDelay <= currentTime) { - duration = currentTime - lastMark; - lastMark = currentTime; - lastRandomDelay = (int) (Math.random() * randomRange); - - return true; - } else { - return false; - } - } - - public long durationOfLastDelay() { - return duration > 0 ? duration : 0; - } - - public void markTime(World world) { - lastMark = world.getTotalWorldTime(); - } -} diff --git a/dependencies/main/java/buildcraft/api/core/StackKey.java b/dependencies/main/java/buildcraft/api/core/StackKey.java deleted file mode 100644 index 13a8e89891..0000000000 --- a/dependencies/main/java/buildcraft/api/core/StackKey.java +++ /dev/null @@ -1,125 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.core; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidStack; - -/** This class is used whenever stacks needs to be stored as keys. */ -public final class StackKey { - public final ItemStack stack; - public final FluidStack fluidStack; - - public StackKey(FluidStack fluidStack) { - this(null, fluidStack); - } - - public StackKey(ItemStack stack) { - this(stack, null); - } - - public StackKey(ItemStack stack, FluidStack fluidStack) { - this.stack = stack; - this.fluidStack = fluidStack; - } - - public static StackKey stack(Item item, int amount, int damage) { - return new StackKey(new ItemStack(item, amount, damage)); - } - - public static StackKey stack(Block block, int amount, int damage) { - return new StackKey(new ItemStack(block, amount, damage)); - } - - public static StackKey stack(Item item) { - return new StackKey(new ItemStack(item, 1, 0)); - } - - public static StackKey stack(Block block) { - return new StackKey(new ItemStack(block, 1, 0)); - } - - public static StackKey stack(ItemStack itemStack) { - return new StackKey(itemStack); - } - - public static StackKey fluid(Fluid fluid, int amount) { - return new StackKey(new FluidStack(fluid, amount)); - } - - public static StackKey fluid(Fluid fluid) { - return new StackKey(new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME)); - } - - public static StackKey fluid(FluidStack fluidStack) { - return new StackKey(fluidStack); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || o.getClass() != StackKey.class) { - return false; - } - StackKey k = (StackKey) o; - if ((stack == null ^ k.stack == null) || (fluidStack == null ^ k.fluidStack == null)) { - return false; - } - if (stack != null) { - if (stack.getItem() != k.stack.getItem() || stack.getHasSubtypes() && stack.getItemDamage() != k.stack.getItemDamage() || !objectsEqual( - stack.getTagCompound(), k.stack.getTagCompound())) { - return false; - } - } - if (fluidStack != null) { - if (fluidStack.getFluid().getID() != k.fluidStack.getFluid().getID() || fluidStack.amount != k.fluidStack.amount || !objectsEqual( - fluidStack.tag, k.fluidStack.tag)) { - return false; - } - } - return true; - } - - @Override - public int hashCode() { - int result = 7; - if (stack != null) { - result = 31 * result + stack.getItem().hashCode(); - result = 31 * result + stack.getItemDamage(); - result = 31 * result + objectHashCode(stack.getTagCompound()); - } - result = 31 * result + 7; - if (fluidStack != null) { - result = 31 * result + fluidStack.getFluid().getID(); - result = 31 * result + fluidStack.amount; - result = 31 * result + objectHashCode(fluidStack.tag); - } - return result; - } - - private boolean objectsEqual(Object o1, Object o2) { - if (o1 == null && o2 == null) { - return true; - } else if (o1 == null || o2 == null) { - return false; - } else { - return o1.equals(o2); - } - } - - private int objectHashCode(Object o) { - return o != null ? o.hashCode() : 0; - } - - public StackKey copy() { - return new StackKey(stack != null ? stack.copy() : null, fluidStack != null ? fluidStack.copy() : null); - } -} diff --git a/dependencies/main/java/buildcraft/api/enums/EnumBlueprintType.java b/dependencies/main/java/buildcraft/api/enums/EnumBlueprintType.java deleted file mode 100644 index 8d62177977..0000000000 --- a/dependencies/main/java/buildcraft/api/enums/EnumBlueprintType.java +++ /dev/null @@ -1,29 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.item.ItemStack; - -import buildcraft.api.items.IBlueprintItem; - -public enum EnumBlueprintType { - NONE, - BLUEPRINT, - TEMPLATE; - - public static EnumBlueprintType valueOf(int index) { - if (index <= 0 || index >= values().length) { - return NONE; - } else { - return values()[index]; - } - } - - public static EnumBlueprintType getType(ItemStack item) { - if (item == null) { - return NONE; - } else if (item.getItem() instanceof IBlueprintItem) { - return ((IBlueprintItem) item.getItem()).getType(item); - } else { - return NONE; - } - } -} diff --git a/dependencies/main/java/buildcraft/api/enums/EnumDecoratedBlock.java b/dependencies/main/java/buildcraft/api/enums/EnumDecoratedBlock.java deleted file mode 100644 index 0956fa11ee..0000000000 --- a/dependencies/main/java/buildcraft/api/enums/EnumDecoratedBlock.java +++ /dev/null @@ -1,24 +0,0 @@ -package buildcraft.api.enums; - -import java.util.Locale; - -import net.minecraft.util.IStringSerializable; - -public enum EnumDecoratedBlock implements IStringSerializable { - DESTROY(0), - BLUEPRINT(10), - TEMPLATE(10), - PAPER(10), - LEATHER(10); - - public final int lightValue; - - private EnumDecoratedBlock(int lightValue) { - this.lightValue = lightValue; - } - - @Override - public String getName() { - return name().toLowerCase(Locale.ROOT); - } -} diff --git a/dependencies/main/java/buildcraft/api/enums/EnumEnergyStage.java b/dependencies/main/java/buildcraft/api/enums/EnumEnergyStage.java deleted file mode 100644 index dd809fea84..0000000000 --- a/dependencies/main/java/buildcraft/api/enums/EnumEnergyStage.java +++ /dev/null @@ -1,24 +0,0 @@ -package buildcraft.api.enums; - -import org.apache.commons.lang3.StringUtils; - -import net.minecraft.util.IStringSerializable; - -public enum EnumEnergyStage implements IStringSerializable { - BLUE, - GREEN, - YELLOW, - RED, - OVERHEAT, - BLACK; - public static final EnumEnergyStage[] VALUES = values(); - - public String getModelName() { - return StringUtils.lowerCase(name()); - } - - @Override - public String getName() { - return getModelName(); - } -} diff --git a/dependencies/main/java/buildcraft/api/enums/EnumEngineType.java b/dependencies/main/java/buildcraft/api/enums/EnumEngineType.java deleted file mode 100644 index f2be6833ec..0000000000 --- a/dependencies/main/java/buildcraft/api/enums/EnumEngineType.java +++ /dev/null @@ -1,27 +0,0 @@ -package buildcraft.api.enums; - -import java.util.Locale; - -import net.minecraft.util.IStringSerializable; - -public enum EnumEngineType implements IStringSerializable { - WOOD("core", "wood"), - STONE("energy", "stone"), - IRON("energy", "iron"), - CREATIVE("energy", "creative"); - - public final String resourceLocation; - - EnumEngineType(String mod, String loc) { - resourceLocation = "buildcraft" + mod + ":blocks/engine/inv/" + loc + "/"; - } - - @Override - public String getName() { - return name(); - } - - public String getModelName() { - return getName().toLowerCase(Locale.ROOT); - } -} diff --git a/dependencies/main/java/buildcraft/api/enums/EnumFillerPattern.java b/dependencies/main/java/buildcraft/api/enums/EnumFillerPattern.java deleted file mode 100644 index 4570f0c79c..0000000000 --- a/dependencies/main/java/buildcraft/api/enums/EnumFillerPattern.java +++ /dev/null @@ -1,28 +0,0 @@ -package buildcraft.api.enums; - -import java.util.Locale; - -import net.minecraft.util.IStringSerializable; - -public enum EnumFillerPattern implements IStringSerializable { - NONE, - BOX, - CLEAR, - CYLINDER, - FILL, - FLATTEN, - FRAME, - HORIZON, - PYRAMID, - STAIRS; - - @Override - public String toString() { - return getName(); - } - - @Override - public String getName() { - return name().toLowerCase(Locale.ROOT); - } -} diff --git a/dependencies/main/java/buildcraft/api/enums/EnumLaserTableType.java b/dependencies/main/java/buildcraft/api/enums/EnumLaserTableType.java deleted file mode 100644 index cc8b41e7de..0000000000 --- a/dependencies/main/java/buildcraft/api/enums/EnumLaserTableType.java +++ /dev/null @@ -1,24 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.IStringSerializable; - -import buildcraft.api.properties.BuildCraftProperties; - -public enum EnumLaserTableType implements IStringSerializable { - ASSEMBLY_TABLE, - ADVANCED_CRAFTING_TABLE, - INTEGRATION_TABLE, - CHARGING_TABLE, - PROGRAMMING_TABLE, - STAMPING_TABLE; - - public static EnumLaserTableType getType(IBlockState state) { - return (EnumLaserTableType) state.getValue(BuildCraftProperties.LASER_TABLE_TYPE); - } - - @Override - public String getName() { - return name(); - } -} diff --git a/dependencies/main/java/buildcraft/api/enums/EnumMachineState.java b/dependencies/main/java/buildcraft/api/enums/EnumMachineState.java deleted file mode 100644 index 6a215c235b..0000000000 --- a/dependencies/main/java/buildcraft/api/enums/EnumMachineState.java +++ /dev/null @@ -1,21 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.IStringSerializable; - -import buildcraft.api.properties.BuildCraftProperties; - -public enum EnumMachineState implements IStringSerializable { - OFF, - ON, - DONE; - - public static EnumMachineState getType(IBlockState state) { - return (EnumMachineState) state.getValue(BuildCraftProperties.MACHINE_STATE); - } - - @Override - public String getName() { - return name(); - } -} diff --git a/dependencies/main/java/buildcraft/api/enums/EnumRedstoneChipset.java b/dependencies/main/java/buildcraft/api/enums/EnumRedstoneChipset.java deleted file mode 100644 index 68ecb25157..0000000000 --- a/dependencies/main/java/buildcraft/api/enums/EnumRedstoneChipset.java +++ /dev/null @@ -1,42 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public enum EnumRedstoneChipset { - RED, - IRON, - GOLD, - DIAMOND, - PULSATING, - QUARTZ, - COMP, - EMERALD; - - public ItemStack getStack(int stackSize) { - Item chipset = Item.getByNameOrId("buildcraft|silicon:redstoneChipset"); - if (chipset == null) { - return null; - } - - return new ItemStack(chipset, stackSize, ordinal()); - } - - public ItemStack getStack() { - return getStack(1); - } - - public static EnumRedstoneChipset fromStack(ItemStack stack) { - if (stack == null) { - return RED; - } - return fromOrdinal(stack.getMetadata()); - } - - public static EnumRedstoneChipset fromOrdinal(int ordinal) { - if (ordinal < 0 || ordinal >= values().length) { - return RED; - } - return values()[ordinal]; - } -} diff --git a/dependencies/main/java/buildcraft/api/enums/EnumSpring.java b/dependencies/main/java/buildcraft/api/enums/EnumSpring.java deleted file mode 100644 index a4ed92e657..0000000000 --- a/dependencies/main/java/buildcraft/api/enums/EnumSpring.java +++ /dev/null @@ -1,32 +0,0 @@ -package buildcraft.api.enums; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; -import net.minecraft.util.IStringSerializable; - -import buildcraft.api.properties.BuildCraftProperties; - -public enum EnumSpring implements IStringSerializable { - - WATER(5, -1, Blocks.water.getDefaultState()), - OIL(6000, 8, null); // Set in BuildCraftEnergy - public static final EnumSpring[] VALUES = values(); - public final int tickRate, chance; - public IBlockState liquidBlock; - public boolean canGen = true; - - private EnumSpring(int tickRate, int chance, IBlockState liquidBlock) { - this.tickRate = tickRate; - this.chance = chance; - this.liquidBlock = liquidBlock; - } - - public static EnumSpring fromState(IBlockState state) { - return state.getValue(BuildCraftProperties.SPRING_TYPE); - } - - @Override - public String getName() { - return this.name(); - } -} diff --git a/dependencies/main/java/buildcraft/api/filler/FillerManager.java b/dependencies/main/java/buildcraft/api/filler/FillerManager.java deleted file mode 100644 index 03567c45ac..0000000000 --- a/dependencies/main/java/buildcraft/api/filler/FillerManager.java +++ /dev/null @@ -1,13 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.filler; - -public final class FillerManager { - - public static IFillerRegistry registry; - - /** Deactivate constructor */ - private FillerManager() {} -} diff --git a/dependencies/main/java/buildcraft/api/filler/IFillerPattern.java b/dependencies/main/java/buildcraft/api/filler/IFillerPattern.java deleted file mode 100644 index 7d89469f10..0000000000 --- a/dependencies/main/java/buildcraft/api/filler/IFillerPattern.java +++ /dev/null @@ -1,11 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.filler; - -import buildcraft.api.statements.IStatement; - -public interface IFillerPattern extends IStatement { - // Object getBlockOverlay(); -} diff --git a/dependencies/main/java/buildcraft/api/filler/IFillerRegistry.java b/dependencies/main/java/buildcraft/api/filler/IFillerRegistry.java deleted file mode 100644 index f9e588f62d..0000000000 --- a/dependencies/main/java/buildcraft/api/filler/IFillerRegistry.java +++ /dev/null @@ -1,19 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.filler; - -import java.util.Collection; - -public interface IFillerRegistry { - void addPattern(IFillerPattern pattern); - - IFillerPattern getPattern(String patternName); - - IFillerPattern getNextPattern(IFillerPattern currentPattern); - - IFillerPattern getPreviousPattern(IFillerPattern currentPattern); - - Collection getPatterns(); -} diff --git a/dependencies/main/java/buildcraft/api/fuels/BuildcraftFuelRegistry.java b/dependencies/main/java/buildcraft/api/fuels/BuildcraftFuelRegistry.java deleted file mode 100644 index 545ac3d3bf..0000000000 --- a/dependencies/main/java/buildcraft/api/fuels/BuildcraftFuelRegistry.java +++ /dev/null @@ -1,12 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.fuels; - -public final class BuildcraftFuelRegistry { - public static IFuelManager fuel; - public static ICoolantManager coolant; - - private BuildcraftFuelRegistry() {} -} diff --git a/dependencies/main/java/buildcraft/api/fuels/ICoolant.java b/dependencies/main/java/buildcraft/api/fuels/ICoolant.java deleted file mode 100644 index 5d038c8d5b..0000000000 --- a/dependencies/main/java/buildcraft/api/fuels/ICoolant.java +++ /dev/null @@ -1,13 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.fuels; - -import net.minecraftforge.fluids.Fluid; - -public interface ICoolant { - Fluid getFluid(); - - float getDegreesCoolingPerMB(float heat); -} diff --git a/dependencies/main/java/buildcraft/api/fuels/ICoolantManager.java b/dependencies/main/java/buildcraft/api/fuels/ICoolantManager.java deleted file mode 100644 index 849bf1acf2..0000000000 --- a/dependencies/main/java/buildcraft/api/fuels/ICoolantManager.java +++ /dev/null @@ -1,29 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.fuels; - -import java.util.Collection; - -import net.minecraftforge.fluids.Fluid; - -import buildcraft.api.core.StackKey; - -public interface ICoolantManager { - ICoolant addCoolant(ICoolant coolant); - - ICoolant addCoolant(Fluid fluid, float degreesCoolingPerMB); - - ISolidCoolant addSolidCoolant(ISolidCoolant solidCoolant); - - ISolidCoolant addSolidCoolant(StackKey solid, StackKey liquid, float multiplier); - - Collection getCoolants(); - - Collection getSolidCoolants(); - - ICoolant getCoolant(Fluid fluid); - - ISolidCoolant getSolidCoolant(StackKey solid); -} diff --git a/dependencies/main/java/buildcraft/api/fuels/IFuel.java b/dependencies/main/java/buildcraft/api/fuels/IFuel.java deleted file mode 100644 index a2590c6082..0000000000 --- a/dependencies/main/java/buildcraft/api/fuels/IFuel.java +++ /dev/null @@ -1,15 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.fuels; - -import net.minecraftforge.fluids.Fluid; - -public interface IFuel { - Fluid getFluid(); - - int getTotalBurningTime(); - - int getPowerPerCycle(); -} diff --git a/dependencies/main/java/buildcraft/api/fuels/IFuelManager.java b/dependencies/main/java/buildcraft/api/fuels/IFuelManager.java deleted file mode 100644 index 3678182703..0000000000 --- a/dependencies/main/java/buildcraft/api/fuels/IFuelManager.java +++ /dev/null @@ -1,27 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.fuels; - -import java.util.Collection; - -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -public interface IFuelManager { - IFuel addFuel(IFuel fuel); - - IFuel addFuel(Fluid fluid, int powerPerCycle, int totalBurningTime); - - IDirtyFuel addDirtyFuel(Fluid fuel, int powerPerCycle, int totalBurningTime, FluidStack residue); - - Collection getFuels(); - - IFuel getFuel(Fluid fluid); - - public interface IDirtyFuel extends IFuel { - /** @return The residue fluidstack, per bucket of original fuel. */ - FluidStack getResidue(); - } -} diff --git a/dependencies/main/java/buildcraft/api/fuels/ISolidCoolant.java b/dependencies/main/java/buildcraft/api/fuels/ISolidCoolant.java deleted file mode 100644 index ab41cc46d5..0000000000 --- a/dependencies/main/java/buildcraft/api/fuels/ISolidCoolant.java +++ /dev/null @@ -1,12 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.fuels; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -public interface ISolidCoolant { - FluidStack getFluidFromSolidCoolant(ItemStack stack); -} diff --git a/dependencies/main/java/buildcraft/api/gates/GateExpansionController.java b/dependencies/main/java/buildcraft/api/gates/GateExpansionController.java deleted file mode 100644 index 749de86f79..0000000000 --- a/dependencies/main/java/buildcraft/api/gates/GateExpansionController.java +++ /dev/null @@ -1,54 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.gates; - -import java.util.List; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; - -import buildcraft.api.statements.IActionInternal; -import buildcraft.api.statements.IStatement; -import buildcraft.api.statements.IStatementParameter; -import buildcraft.api.statements.ITriggerInternal; - -public abstract class GateExpansionController { - - public final IGateExpansion type; - public final TileEntity pipeTile; - - public GateExpansionController(IGateExpansion type, TileEntity pipeTile) { - this.pipeTile = pipeTile; - this.type = type; - } - - public IGateExpansion getType() { - return type; - } - - public boolean isActive() { - return false; - } - - public void tick(IGate gate) {} - - public void startResolution() {} - - public boolean resolveAction(IStatement action, int count) { - return false; - } - - public boolean isTriggerActive(IStatement trigger, IStatementParameter[] parameters) { - return false; - } - - public void addTriggers(List list) {} - - public void addActions(List list) {} - - public void writeToNBT(NBTTagCompound nbt) {} - - public void readFromNBT(NBTTagCompound nbt) {} -} diff --git a/dependencies/main/java/buildcraft/api/gates/GateExpansionModelKey.java b/dependencies/main/java/buildcraft/api/gates/GateExpansionModelKey.java deleted file mode 100644 index 85763f19d0..0000000000 --- a/dependencies/main/java/buildcraft/api/gates/GateExpansionModelKey.java +++ /dev/null @@ -1,36 +0,0 @@ -package buildcraft.api.gates; - -import java.util.Arrays; - -import net.minecraft.util.EnumWorldBlockLayer; - -public class GateExpansionModelKey> { - public final EnumWorldBlockLayer layer; - public final IExpansionBaker baker; - private final int hash; - - public GateExpansionModelKey(EnumWorldBlockLayer layer, IExpansionBaker baker) { - if (layer != EnumWorldBlockLayer.CUTOUT && layer != EnumWorldBlockLayer.TRANSLUCENT) { - throw new IllegalArgumentException("Unsuported layer! Was " + layer + ", wanted CUTOUT or TRANSLUCENT"); - } - if (baker == null) throw new NullPointerException("baker"); - this.layer = layer; - this.baker = baker; - hash = Arrays.hashCode(new int[] { layer.hashCode(), System.identityHashCode(baker) }); - } - - @Override - public int hashCode() { - return hash; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - GateExpansionModelKey other = (GateExpansionModelKey) obj; - if (baker != other.baker) return false; - return true; - } -} diff --git a/dependencies/main/java/buildcraft/api/gates/GateExpansions.java b/dependencies/main/java/buildcraft/api/gates/GateExpansions.java deleted file mode 100644 index b1e6003712..0000000000 --- a/dependencies/main/java/buildcraft/api/gates/GateExpansions.java +++ /dev/null @@ -1,61 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.gates; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import com.google.common.collect.HashBiMap; - -import net.minecraft.item.ItemStack; - -public final class GateExpansions { - private static final Map expansions = new HashMap(); - private static final ArrayList expansionIDs = new ArrayList(); - private static final Map recipes = HashBiMap.create(); - - private GateExpansions() {} - - public static void registerExpansion(IGateExpansion expansion) { - registerExpansion(expansion.getUniqueIdentifier(), expansion); - } - - public static void registerExpansion(String identifier, IGateExpansion expansion) { - expansions.put(identifier, expansion); - expansionIDs.add(expansion); - } - - public static void registerExpansion(IGateExpansion expansion, ItemStack addedRecipe) { - registerExpansion(expansion.getUniqueIdentifier(), expansion); - recipes.put(expansion, addedRecipe); - } - - public static IGateExpansion getExpansion(String identifier) { - return expansions.get(identifier); - } - - public static Set getExpansions() { - Set set = new HashSet(); - set.addAll(expansionIDs); - return set; - } - - public static Map getRecipesForPostInit() { - return recipes; - } - - // The code below is used by networking. - - public static IGateExpansion getExpansionByID(int id) { - return expansionIDs.get(id); - } - - public static int getExpansionID(IGateExpansion expansion) { - return expansionIDs.indexOf(expansion); - } -} diff --git a/dependencies/main/java/buildcraft/api/gates/IExpansionBaker.java b/dependencies/main/java/buildcraft/api/gates/IExpansionBaker.java deleted file mode 100644 index 846cfe598e..0000000000 --- a/dependencies/main/java/buildcraft/api/gates/IExpansionBaker.java +++ /dev/null @@ -1,13 +0,0 @@ -package buildcraft.api.gates; - -import com.google.common.collect.ImmutableList; - -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.vertex.VertexFormat; - -public interface IExpansionBaker> { - /** @return The vertex format used to generate the quads. */ - VertexFormat getVertexFormat(); - - ImmutableList bake(K key); -} diff --git a/dependencies/main/java/buildcraft/api/gates/IGate.java b/dependencies/main/java/buildcraft/api/gates/IGate.java deleted file mode 100644 index df23649372..0000000000 --- a/dependencies/main/java/buildcraft/api/gates/IGate.java +++ /dev/null @@ -1,30 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.gates; - -import java.util.List; - -import buildcraft.api.statements.IStatement; -import buildcraft.api.statements.IStatementParameter; -import buildcraft.api.statements.StatementSlot; -import buildcraft.api.statements.containers.ISidedStatementContainer; -import buildcraft.api.transport.IPipe; - -public interface IGate extends ISidedStatementContainer { - @Deprecated - void setPulsing(boolean pulse); - - IPipe getPipe(); - - List getTriggers(); - - List getActions(); - - List getActiveActions(); - - List getTriggerParameters(int index); - - List getActionParameters(int index); -} diff --git a/dependencies/main/java/buildcraft/api/gates/IGateExpansion.java b/dependencies/main/java/buildcraft/api/gates/IGateExpansion.java deleted file mode 100644 index 2dad213240..0000000000 --- a/dependencies/main/java/buildcraft/api/gates/IGateExpansion.java +++ /dev/null @@ -1,27 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.gates; - -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumWorldBlockLayer; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public interface IGateExpansion { - - String getUniqueIdentifier(); - - String getDisplayName(); - - GateExpansionController makeController(TileEntity pipeTile); - - @SideOnly(Side.CLIENT) - void textureStitch(TextureMap map); - - @SideOnly(Side.CLIENT) - GateExpansionModelKey getRenderModelKey(EnumWorldBlockLayer layer); -} diff --git a/dependencies/main/java/buildcraft/api/items/IBlueprintItem.java b/dependencies/main/java/buildcraft/api/items/IBlueprintItem.java deleted file mode 100644 index d67bc39fd0..0000000000 --- a/dependencies/main/java/buildcraft/api/items/IBlueprintItem.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.items; - -import net.minecraft.item.ItemStack; - -import buildcraft.api.enums.EnumBlueprintType; - -public interface IBlueprintItem extends INamedItem { - EnumBlueprintType getType(ItemStack stack); -} diff --git a/dependencies/main/java/buildcraft/api/items/INamedItem.java b/dependencies/main/java/buildcraft/api/items/INamedItem.java deleted file mode 100644 index 4080dae2ff..0000000000 --- a/dependencies/main/java/buildcraft/api/items/INamedItem.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.items; - -import net.minecraft.item.ItemStack; - -public interface INamedItem { - String getName(ItemStack stack); - - boolean setName(ItemStack stack, String name); -} diff --git a/dependencies/main/java/buildcraft/api/power/IEngine.java b/dependencies/main/java/buildcraft/api/power/IEngine.java deleted file mode 100644 index 18901747ea..0000000000 --- a/dependencies/main/java/buildcraft/api/power/IEngine.java +++ /dev/null @@ -1,26 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.power; - -import net.minecraft.util.EnumFacing; - -/** Engines should implement this interface if they want to support BuildCraft's behaviour of passing energy between - * engines without using receiveEnergy() (which has other issues). */ -public interface IEngine { - /** Returns true if the engine wants to receive power from another engine on this side. - * - * @param side - * @return */ - boolean canReceiveFromEngine(EnumFacing side); - - /** Receives energy from an engine. See - * {@link cofh.api.energy.IEnergyHandler#receiveEnergy(EnumFacing, int, boolean)} - * - * @param side The side the engine is receiving energy from. - * @param energy The amount of energy given to the engine. - * @param simulate True if the energy should not actually be added. - * @return The amount of energy used by the engine. */ - int receiveEnergyFromEngine(EnumFacing side, int energy, boolean simulate); -} diff --git a/dependencies/main/java/buildcraft/api/power/ILaserTarget.java b/dependencies/main/java/buildcraft/api/power/ILaserTarget.java deleted file mode 100644 index 0b39099354..0000000000 --- a/dependencies/main/java/buildcraft/api/power/ILaserTarget.java +++ /dev/null @@ -1,28 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.power; - -import net.minecraft.util.BlockPos; - -/** This interface should be defined by any Tile which wants to receive energy from BuildCraft lasers. - * - * The respective Block MUST implement ILaserTargetBlock! */ -public interface ILaserTarget { - - /** Returns true if the target currently needs power. For example, if the Advanced Crafting Table has work to do. - * - * @return true if needs power */ - boolean requiresLaserEnergy(); - - /** Transfers energy from the laser to the target. - * - * @param energy */ - void receiveLaserEnergy(int energy); - - /** Return true if the Tile Entity object is no longer a valid target. For example, if its been invalidated. - * - * @return true if no longer a valid target object */ - boolean isInvalidTarget(); -} diff --git a/dependencies/main/java/buildcraft/api/power/ILaserTargetBlock.java b/dependencies/main/java/buildcraft/api/power/ILaserTargetBlock.java deleted file mode 100644 index 27469605ca..0000000000 --- a/dependencies/main/java/buildcraft/api/power/ILaserTargetBlock.java +++ /dev/null @@ -1,12 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.power; - -/** This is a marker interface for laser targets. Implement it on your Block. - * - * It is used by BuildCraft Lasers for optimization purposes. */ -public interface ILaserTargetBlock { - -} diff --git a/dependencies/main/java/buildcraft/api/power/IRedstoneEngine.java b/dependencies/main/java/buildcraft/api/power/IRedstoneEngine.java deleted file mode 100644 index 3fc534d457..0000000000 --- a/dependencies/main/java/buildcraft/api/power/IRedstoneEngine.java +++ /dev/null @@ -1,7 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.power; - -public interface IRedstoneEngine {} diff --git a/dependencies/main/java/buildcraft/api/power/IRedstoneEngineReceiver.java b/dependencies/main/java/buildcraft/api/power/IRedstoneEngineReceiver.java deleted file mode 100644 index 213d06fe2e..0000000000 --- a/dependencies/main/java/buildcraft/api/power/IRedstoneEngineReceiver.java +++ /dev/null @@ -1,21 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.power; - -import net.minecraft.util.EnumFacing; - -import cofh.api.energy.IEnergyReceiver; - -/** Implement this on tiles that you wish to be able to receive Redstone Engine (low-power) energy. - * - * Please do not implement it on batteries, pipes or machines which can have their energy extracted from. That could - * lead to exploits and abuse. */ -public interface IRedstoneEngineReceiver extends IEnergyReceiver { - /** This function is queried on every attempt to receive energy from a redstone engine as well. - * - * @param side - * @return */ - boolean canConnectRedstoneEngine(EnumFacing side); -} diff --git a/dependencies/main/java/buildcraft/api/properties/BuildCraftExtendedProperty.java b/dependencies/main/java/buildcraft/api/properties/BuildCraftExtendedProperty.java deleted file mode 100644 index e0ba3a62d1..0000000000 --- a/dependencies/main/java/buildcraft/api/properties/BuildCraftExtendedProperty.java +++ /dev/null @@ -1,65 +0,0 @@ -package buildcraft.api.properties; - -import java.util.List; - -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; - -import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.common.property.IUnlistedProperty; - -public class BuildCraftExtendedProperty> extends BuildCraftProperty implements IUnlistedProperty { - private final Predicate function; - - public BuildCraftExtendedProperty(String name, Class clazz, Predicate allowingFunction) { - super(name, clazz); - function = allowingFunction; - } - - public BuildCraftExtendedProperty(String name, Class clazz, List allowedValues) { - super(name, clazz, allowedValues); - function = null; - } - - public static BuildCraftExtendedProperty create(String name, final double min, final double max) { - return new BuildCraftExtendedProperty(name, Double.class, new Predicate() { - @Override - public boolean apply(Double input) { - return input >= min && input <= max; - } - }); - } - - /** This is useful if you want to use a particular class for this property, but don't care what the class contains - * (it will never contain an incorrect value) */ - public static > BuildCraftExtendedProperty createExtended(String name, Class clazz) { - return new BuildCraftExtendedProperty(name, clazz, Predicates. alwaysTrue()); - } - - @Override - public boolean isValid(T value) { - if (function == null) { - return values.contains(value); - } - return function.apply(value); - } - - @Override - public Class getType() { - return getValueClass(); - } - - @Override - public String valueToString(T value) { - return valueName(value); - } - - public T getUnlistedValue(IExtendedBlockState state) { - return state.getValue(asUnlistedProperty()); - } - - // Helper methods for arguments - public IUnlistedProperty asUnlistedProperty() { - return this; - } -} diff --git a/dependencies/main/java/buildcraft/api/properties/BuildCraftProperties.java b/dependencies/main/java/buildcraft/api/properties/BuildCraftProperties.java deleted file mode 100644 index 747dd470a8..0000000000 --- a/dependencies/main/java/buildcraft/api/properties/BuildCraftProperties.java +++ /dev/null @@ -1,83 +0,0 @@ -package buildcraft.api.properties; - -import java.util.Map; - -import com.google.common.collect.Maps; - -import net.minecraft.util.EnumFacing; - -import buildcraft.api.core.EnumColor; -import buildcraft.api.enums.*; - -public final class BuildCraftProperties { - public static final BuildCraftProperty BLOCK_FACING = BuildCraftProperty.create("facing", EnumFacing.Plane.HORIZONTAL.facings()); - public static final BuildCraftProperty BLOCK_FACING_6 = BuildCraftProperty.create("facing", EnumFacing.class); - - public static final BuildCraftProperty BLOCK_COLOR = BuildCraftProperty.create("color", EnumColor.class); - public static final BuildCraftProperty SPRING_TYPE = BuildCraftProperty.create("type", EnumSpring.class); - public static final BuildCraftProperty ENGINE_TYPE = BuildCraftProperty.create("type", EnumEngineType.class); - public static final BuildCraftProperty LASER_TABLE_TYPE = BuildCraftProperty.create("type", EnumLaserTableType.class); - public static final BuildCraftProperty MACHINE_STATE = BuildCraftProperty.create("state", EnumMachineState.class); - public static final BuildCraftProperty ENERGY_STAGE = BuildCraftProperty.create("stage", EnumEnergyStage.class); - public static final BuildCraftProperty BLUEPRINT_TYPE = BuildCraftProperty.create("blueprint_type", EnumBlueprintType.class); - public static final BuildCraftProperty DECORATED_BLOCK = BuildCraftProperty.create("decoration_type", - EnumDecoratedBlock.class); - - public static final BuildCraftProperty GENERIC_PIPE_DATA = BuildCraftProperty.create("pipe_data", 0, 15); - public static final BuildCraftProperty LED_POWER = BuildCraftProperty.create("led_power", 0, 3); - - public static final BuildCraftProperty JOINED_BELOW = BuildCraftProperty.create("joined_below", false); - public static final BuildCraftProperty MOVING = BuildCraftProperty.create("moving", false); - public static final BuildCraftProperty LED_DONE = BuildCraftProperty.create("led_done", false); - - public static final BuildCraftProperty CONNECTED_UP = BuildCraftProperty.create("connected_up", false); - public static final BuildCraftProperty CONNECTED_DOWN = BuildCraftProperty.create("connected_down", false); - public static final BuildCraftProperty CONNECTED_EAST = BuildCraftProperty.create("connected_east", false); - public static final BuildCraftProperty CONNECTED_WEST = BuildCraftProperty.create("connected_west", false); - public static final BuildCraftProperty CONNECTED_NORTH = BuildCraftProperty.create("connected_north", false); - public static final BuildCraftProperty CONNECTED_SOUTH = BuildCraftProperty.create("connected_south", false); - - public static final Map> CONNECTED_MAP; - - // Unlisted properties - // public static final PropertyDouble FLUID_HEIGHT_NE = new PropertyDouble("height_ne", 0, 1); - // public static final PropertyDouble FLUID_HEIGHT_NW = new PropertyDouble("height_nw", 0, 1); - // public static final PropertyDouble FLUID_HEIGHT_SE = new PropertyDouble("height_se", 0, 1); - // public static final PropertyDouble FLUID_HEIGHT_SW = new PropertyDouble("height_sw", 0, 1); - // public static final PropertyDouble FLUID_FLOW_DIRECTION = new PropertyDouble("direction", - // Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY); - public static final BuildCraftProperty FILLER_PATTERN = BuildCraftProperty.create("pattern", EnumFillerPattern.class); - - // Block state setting flags -these are used by World.markAndNotifyBlock and World.setBlockState. These flags can be - // added together to pass the additions - public static final int UPDATE_NONE = 0; - /** This updates the neighbouring blocks that the new block is set. It also updates the comparator output of this - * block. */ - public static final int UPDATE_NEIGHBOURS = 1; - /** This will mark the block for an update next tick, as well as send an update to the client (if this is a server - * world). */ - public static final int MARK_BLOCK_FOR_UPDATE = 2; - /** This will mark the block for an update, even if this is a client world. It is useless to use this if - * world.isRemote returns false. */ - public static final int UPDATE_EVEN_CLIENT = 4 + MARK_BLOCK_FOR_UPDATE; // 6 - - // Pre-added flags- pass these as-is to the World.markAndNotifyBlock and World.setBlockState methods. - /** This will do what both {@link #UPDATE_NEIGHBOURS} and {@link #MARK_BLOCK_FOR_UPDATE} do. */ - public static final int MARK_THIS_AND_NEIGHBOURS = UPDATE_NEIGHBOURS + MARK_BLOCK_FOR_UPDATE; - /** This will update everything about this block. */ - public static final int UPDATE_ALL = UPDATE_NEIGHBOURS + MARK_BLOCK_FOR_UPDATE + UPDATE_EVEN_CLIENT; - - static { - Map> map = Maps.newEnumMap(EnumFacing.class); - map.put(EnumFacing.DOWN, CONNECTED_DOWN); - map.put(EnumFacing.UP, CONNECTED_UP); - map.put(EnumFacing.EAST, CONNECTED_EAST); - map.put(EnumFacing.WEST, CONNECTED_WEST); - map.put(EnumFacing.NORTH, CONNECTED_NORTH); - map.put(EnumFacing.SOUTH, CONNECTED_SOUTH); - CONNECTED_MAP = Maps.immutableEnumMap(map); - } - - /** Deactivate constructor */ - private BuildCraftProperties() {} -} diff --git a/dependencies/main/java/buildcraft/api/properties/BuildCraftProperty.java b/dependencies/main/java/buildcraft/api/properties/BuildCraftProperty.java deleted file mode 100644 index bc4608a1cd..0000000000 --- a/dependencies/main/java/buildcraft/api/properties/BuildCraftProperty.java +++ /dev/null @@ -1,129 +0,0 @@ -package buildcraft.api.properties; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import net.minecraft.block.properties.PropertyHelper; -import net.minecraft.util.IStringSerializable; -import net.minecraft.util.math.MathHelper; - -/** This class exists primarily to allow for a property to be used as either a normal IProperty, or an - * IUnlistedProperty. It also exists to give IProperty's generic types. */ -public class BuildCraftProperty> extends PropertyHelper { - private final String name; - private final Class clazz; - protected final List values; - - public BuildCraftProperty(String name, Class clazz, T[] values) { - this(name, clazz, Arrays.asList(values)); - } - - public BuildCraftProperty(String name, Class clazz, List values) { - super(name, clazz); - this.name = name; - this.clazz = clazz; - this.values = values; - } - - /** Used for BuildCraftInifiniteProperty */ - protected BuildCraftProperty(String name, Class clazz) { - super(name, clazz); - this.name = name; - this.clazz = clazz; - this.values = Collections.emptyList(); - } - - public static > BuildCraftProperty create(String name, Class enumeration) { - List values = Arrays.asList(enumeration.getEnumConstants()); - return new BuildCraftProperty(name, enumeration, values); - } - - public static > BuildCraftProperty create(String name, E... values) { - Class clazz = values[0].getDeclaringClass(); - List list = Arrays.asList(values); - return new BuildCraftProperty(name, clazz, list); - } - - public static BuildCraftProperty create(String name, boolean first) { - return new BuildCraftProperty(name, Boolean.class, new Boolean[] { first, !first }); - } - - /** first and last are both inclusive values (use 0, 4 to create an array of [0, 1, 2, 3, 4]) */ - public static BuildCraftProperty create(String name, int first, int last) { - return create(name, first, last, 1); - } - - /** first and last are both inclusive values (use 0, 12, 3 to create an array of [0, 3, 6, 9, 12]) */ - public static BuildCraftProperty create(String name, int first, int last, int difference) { - int actualDiff = Math.abs(difference); - int number = MathHelper.floor_float(Math.abs(first - last) / (float) actualDiff + 1); - Integer[] array = new Integer[number]; - int addedDiff = actualDiff * (first > last ? -1 : 1); - int current = first; - for (int i = 0; i < array.length; i++) { - array[i] = current; - current += addedDiff; - } - return new BuildCraftProperty(name, Integer.class, array); - } - - public static BuildCraftProperty create(String name, double first, double last) { - return create(name, first, last, 1); - } - - public static BuildCraftProperty create(String name, double first, double last, double difference) { - double actualDiff = Math.abs(difference); - Double[] array = new Double[(int) (Math.abs(first - last) / actualDiff)]; - double addedDiff = actualDiff * (first > last ? -1 : 1); - for (int i = 0; i <= array.length; i++) { - array[i] = first + (first - last) / addedDiff * i; - } - return new BuildCraftProperty(name, Double.class, array); - } - - @Override - public String getName() { - return name; - } - - @Override - public List getAllowedValues() { - return values; - } - - @Override - public Class getValueClass() { - return clazz; - } - - @Override - public String getName(@SuppressWarnings("rawtypes") Comparable value) { - return valueName(value); - } - - protected String valueName(Object value) { - if (value == null) { - return "null"; - } else if (value instanceof IStringSerializable) { - return ((IStringSerializable) value).getName(); - } else if (value instanceof Enum) { - return ((Enum) value).name(); - } else { - return value.toString(); - } - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("BuildCraftProperty [name="); - builder.append(name); - builder.append(", clazz="); - builder.append(clazz); - builder.append(", values="); - builder.append(values); - builder.append("]"); - return builder.toString(); - } -} diff --git a/dependencies/main/java/buildcraft/api/recipes/BuildcraftRecipeRegistry.java b/dependencies/main/java/buildcraft/api/recipes/BuildcraftRecipeRegistry.java deleted file mode 100644 index 72904b5cb7..0000000000 --- a/dependencies/main/java/buildcraft/api/recipes/BuildcraftRecipeRegistry.java +++ /dev/null @@ -1,16 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -public final class BuildcraftRecipeRegistry { - - public static IAssemblyRecipeManager assemblyTable; - public static IIntegrationRecipeManager integrationTable; - public static IRefineryRecipeManager refinery; - public static IProgrammingRecipeManager programmingTable; - public static IComplexRefineryRecipeManager complexRefinery; - - private BuildcraftRecipeRegistry() {} -} diff --git a/dependencies/main/java/buildcraft/api/recipes/CraftingResult.java b/dependencies/main/java/buildcraft/api/recipes/CraftingResult.java deleted file mode 100644 index 5142844230..0000000000 --- a/dependencies/main/java/buildcraft/api/recipes/CraftingResult.java +++ /dev/null @@ -1,20 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.ArrayList; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -public class CraftingResult { - - public T crafted = null; - public ArrayList usedItems = new ArrayList(); - public ArrayList usedFluids = new ArrayList(); - public int energyCost = 0; - public long craftingTime = 0; - public IFlexibleRecipe recipe; -} diff --git a/dependencies/main/java/buildcraft/api/recipes/IAssemblyRecipeManager.java b/dependencies/main/java/buildcraft/api/recipes/IAssemblyRecipeManager.java deleted file mode 100644 index b9f29ca185..0000000000 --- a/dependencies/main/java/buildcraft/api/recipes/IAssemblyRecipeManager.java +++ /dev/null @@ -1,27 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.Collection; - -import net.minecraft.item.ItemStack; - -public interface IAssemblyRecipeManager { - - /** Add an Assembly Table recipe. - * - * @param input Object... containing either an ItemStack, or a paired string and integer(ex: "dyeBlue", 1) - * @param energyCost RF cost to produce - * @param output resulting ItemStack */ - void addRecipe(String id, int energyCost, ItemStack output, Object... input); - - void addRecipe(IFlexibleRecipe recipe); - - void removeRecipe(String id); - - void removeRecipe(IFlexibleRecipe recipe); - - Collection> getRecipes(); -} diff --git a/dependencies/main/java/buildcraft/api/recipes/IComplexRefineryRecipeManager.java b/dependencies/main/java/buildcraft/api/recipes/IComplexRefineryRecipeManager.java deleted file mode 100644 index 5623b5eaaa..0000000000 --- a/dependencies/main/java/buildcraft/api/recipes/IComplexRefineryRecipeManager.java +++ /dev/null @@ -1,66 +0,0 @@ -package buildcraft.api.recipes; - -import java.util.Set; - -import com.google.common.base.Predicate; - -import net.minecraftforge.fluids.FluidStack; - -public interface IComplexRefineryRecipeManager { - IHeatableRecipe createHeatingRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks); - - IHeatableRecipe addHeatableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks, boolean replaceExisting); - - ICoolableRecipe createCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks); - - ICoolableRecipe addCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks, boolean replaceExisting); - - IDistilationRecipe createDistilationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, int ticks); - - IDistilationRecipe addDistilationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, int ticks, boolean replaceExisting); - - IComplexRefineryRegistry getHeatableRegistry(); - - IComplexRefineryRegistry getCoolableRegistry(); - - IComplexRefineryRegistry getDistilationRegistry(); - - public interface IComplexRefineryRegistry { - /** @return an unmodifiable set containing all of the distilation recipies that satisfy the given predicate. All - * of the recipe objects are guarenteed to never be null. */ - Set getRecipes(Predicate toReturn); - - /** @return an unmodifiable set containing all of the distilation recipies. */ - Set getAllRecipes(); - - R getRecipeForInput(FluidStack fluid); - - Set removeRecipes(Predicate toRemove); - - R addRecipe(R recipe, boolean replaceExisting); - } - - public interface IComplexRefineryRecipe { - int ticks(); - - FluidStack in(); - } - - public interface IHeatExchangerRecipe extends IComplexRefineryRecipe { - FluidStack out(); - - int heatFrom(); - - int heatTo(); - } - - public interface IHeatableRecipe extends IHeatExchangerRecipe {} - - public interface ICoolableRecipe extends IHeatExchangerRecipe {} - - public interface IDistilationRecipe extends IComplexRefineryRecipe { - FluidStack outGas(); - - FluidStack outLiquid(); - } -} diff --git a/dependencies/main/java/buildcraft/api/recipes/IFlexibleCrafter.java b/dependencies/main/java/buildcraft/api/recipes/IFlexibleCrafter.java deleted file mode 100644 index a69b0424f6..0000000000 --- a/dependencies/main/java/buildcraft/api/recipes/IFlexibleCrafter.java +++ /dev/null @@ -1,24 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -public interface IFlexibleCrafter { - - int getCraftingItemStackSize(); - - ItemStack getCraftingItemStack(int slotid); - - ItemStack decrCraftingItemStack(int slotid, int val); - - FluidStack getCraftingFluidStack(int tankid); - - FluidStack decrCraftingFluidStack(int tankid, int val); - - int getCraftingFluidStackSize(); - -} diff --git a/dependencies/main/java/buildcraft/api/recipes/IFlexibleRecipe.java b/dependencies/main/java/buildcraft/api/recipes/IFlexibleRecipe.java deleted file mode 100644 index 53565499d6..0000000000 --- a/dependencies/main/java/buildcraft/api/recipes/IFlexibleRecipe.java +++ /dev/null @@ -1,18 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import net.minecraft.item.ItemStack; - -public interface IFlexibleRecipe { - - boolean canBeCrafted(IFlexibleCrafter crafter); - - CraftingResult craft(IFlexibleCrafter crafter, boolean preview); - - CraftingResult canCraft(ItemStack expectedOutput); - - String getId(); -} diff --git a/dependencies/main/java/buildcraft/api/recipes/IFlexibleRecipeViewable.java b/dependencies/main/java/buildcraft/api/recipes/IFlexibleRecipeViewable.java deleted file mode 100644 index d19170fa08..0000000000 --- a/dependencies/main/java/buildcraft/api/recipes/IFlexibleRecipeViewable.java +++ /dev/null @@ -1,25 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.Collection; - -/** This class is intended for mods such as Not Enough Items in order for them to be able to look inside a recipe. - * - * It is intentionally left as a separate interface, so that it remains possible to register a "dynamic" flexible recipe - * which does not have static inputs and outputs. - * - * @author asie */ -public interface IFlexibleRecipeViewable { - Object getOutput(); - - /** With BuildCraft's implementation (as of 6.1.3), this might contain either an ItemStack, a List<ItemStack> - * or a FluidStack. */ - Collection getInputs(); - - long getCraftingTime(); - - int getEnergyCost(); -} diff --git a/dependencies/main/java/buildcraft/api/recipes/IIntegrationRecipe.java b/dependencies/main/java/buildcraft/api/recipes/IIntegrationRecipe.java deleted file mode 100644 index 8aeb25ade2..0000000000 --- a/dependencies/main/java/buildcraft/api/recipes/IIntegrationRecipe.java +++ /dev/null @@ -1,59 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.List; - -import net.minecraft.item.ItemStack; - -public interface IIntegrationRecipe { - /** Get the energy cost (in RF) of the recipe. - * - * @return The energy cost of the recipe. */ - int getEnergyCost(); - - /** Get a list of example inputs. This is used for recipe preview. - * - * @return A list of example inputs. */ - List getExampleInput(); - - /** Get a list of example expansions. This is used for recipe preview. If the amount of lists of expansions is - * smaller than the maximum expansion count, the lists will be repeated. - * - * @return A list of every slot's list of example expansions. */ - List> getExampleExpansions(); - - /** Get a list of example outputs. This is used for recipe preview. - * - * @return A list of example outputs. */ - List getExampleOutput(); - - /** Check if an input is valid. - * - * @param input The input. - * @return Whether the input is valid. */ - boolean isValidInput(ItemStack input); - - /** Check if an expansion is valid. - * - * @param input The input currently in. - * @param expansion The expansion. - * @return Whether the expansion can be fitted to a given input. */ - boolean isValidExpansion(ItemStack input, ItemStack expansion); - - /** Craft the recipe. Keep in mind that you need to decrease the amount of expansions yourself - the amount of - * inputs is decreased for you. - * - * @param input The input. - * @param expansions All inserted expansions. - * @param preview If true, do not decrease the amount of expansions. - * @return The output stack. */ - ItemStack craft(ItemStack input, List expansions, boolean preview); - - /** Returns the maximum count of expansions this recipe can have. - * - * @return -1 for no limit, a different number otherwise */ - int getMaximumExpansionCount(ItemStack input); -} diff --git a/dependencies/main/java/buildcraft/api/recipes/IIntegrationRecipeManager.java b/dependencies/main/java/buildcraft/api/recipes/IIntegrationRecipeManager.java deleted file mode 100644 index 7bf51e4565..0000000000 --- a/dependencies/main/java/buildcraft/api/recipes/IIntegrationRecipeManager.java +++ /dev/null @@ -1,13 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.List; - -public interface IIntegrationRecipeManager { - void addRecipe(IIntegrationRecipe recipe); - - List getRecipes(); -} diff --git a/dependencies/main/java/buildcraft/api/recipes/IProgrammingRecipe.java b/dependencies/main/java/buildcraft/api/recipes/IProgrammingRecipe.java deleted file mode 100644 index 3141196fbd..0000000000 --- a/dependencies/main/java/buildcraft/api/recipes/IProgrammingRecipe.java +++ /dev/null @@ -1,33 +0,0 @@ -package buildcraft.api.recipes; - -import java.util.List; - -import net.minecraft.item.ItemStack; - -public interface IProgrammingRecipe { - String getId(); - - /** Get a list (size at least width*height) of ItemStacks representing options. - * - * @param width The width of the Programming Table panel. - * @param height The height of the Programming Table panel. - * @return */ - List getOptions(int width, int height); - - /** Get the energy cost of a given option ItemStack. - * - * @param option - * @return */ - int getEnergyCost(ItemStack option); - - /** @param input The input stack. - * @return Whether this recipe applies to the given input stack. */ - boolean canCraft(ItemStack input); - - /** Craft the input ItemStack with the given option into an output ItemStack. - * - * @param input - * @param option - * @return The output ItemStack. */ - ItemStack craft(ItemStack input, ItemStack option); -} diff --git a/dependencies/main/java/buildcraft/api/recipes/IProgrammingRecipeManager.java b/dependencies/main/java/buildcraft/api/recipes/IProgrammingRecipeManager.java deleted file mode 100644 index 1ea444631a..0000000000 --- a/dependencies/main/java/buildcraft/api/recipes/IProgrammingRecipeManager.java +++ /dev/null @@ -1,19 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.Collection; - -public interface IProgrammingRecipeManager { - void addRecipe(IProgrammingRecipe recipe); - - void removeRecipe(String id); - - void removeRecipe(IProgrammingRecipe recipe); - - IProgrammingRecipe getRecipe(String id); - - Collection getRecipes(); -} diff --git a/dependencies/main/java/buildcraft/api/recipes/IRecipeManager.java b/dependencies/main/java/buildcraft/api/recipes/IRecipeManager.java deleted file mode 100644 index fa767734a9..0000000000 --- a/dependencies/main/java/buildcraft/api/recipes/IRecipeManager.java +++ /dev/null @@ -1,29 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.Collection; - -public interface IRecipeManager { - - /** Add a recipe. - * - * @param input Object... containing either an ItemStack, or a paired string and integer(ex: "dyeBlue", 1) - * @param energyCost RF cost to produce - * @param output resulting ItemStack */ - void addRecipe(String id, int energyCost, T output, Object... input); - - void addRecipe(String id, int energyCost, int craftingDelay, T output, Object... input); - - void addRecipe(IFlexibleRecipe recipe); - - void removeRecipe(String id); - - void removeRecipe(IFlexibleRecipe recipe); - - Collection> getRecipes(); - - IFlexibleRecipe getRecipe(String id); -} diff --git a/dependencies/main/java/buildcraft/api/recipes/IRefineryRecipeManager.java b/dependencies/main/java/buildcraft/api/recipes/IRefineryRecipeManager.java deleted file mode 100644 index b310fe2360..0000000000 --- a/dependencies/main/java/buildcraft/api/recipes/IRefineryRecipeManager.java +++ /dev/null @@ -1,25 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.recipes; - -import java.util.Collection; - -import net.minecraftforge.fluids.FluidStack; - -public interface IRefineryRecipeManager { - - void addRecipe(String id, FluidStack ingredient, FluidStack result, int energy, int delay); - - void addRecipe(String id, FluidStack ingredient1, FluidStack ingredient2, FluidStack result, int energy, int delay); - - void removeRecipe(String id); - - void removeRecipe(IFlexibleRecipe recipe); - - Collection> getRecipes(); - - IFlexibleRecipe getRecipe(String currentRecipeId); - -} diff --git a/dependencies/main/java/buildcraft/api/statements/ActionState.java b/dependencies/main/java/buildcraft/api/statements/ActionState.java deleted file mode 100644 index 15f547c072..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/ActionState.java +++ /dev/null @@ -1,9 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -public class ActionState { - -} diff --git a/dependencies/main/java/buildcraft/api/statements/IActionExternal.java b/dependencies/main/java/buildcraft/api/statements/IActionExternal.java deleted file mode 100644 index 21ffc92c4d..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/IActionExternal.java +++ /dev/null @@ -1,12 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -public interface IActionExternal extends IStatement { - void actionActivate(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); -} diff --git a/dependencies/main/java/buildcraft/api/statements/IActionInternal.java b/dependencies/main/java/buildcraft/api/statements/IActionInternal.java deleted file mode 100644 index 621c317e81..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/IActionInternal.java +++ /dev/null @@ -1,15 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -public interface IActionInternal extends IStatement { - - void actionActivate(IStatementContainer source, IStatementParameter[] parameters); - - public interface IActionInternalSingle extends IActionInternal { - /** @return True if this action should only be fired for the first tick of it being active. */ - boolean singleActionTick(); - } -} diff --git a/dependencies/main/java/buildcraft/api/statements/IActionProvider.java b/dependencies/main/java/buildcraft/api/statements/IActionProvider.java deleted file mode 100644 index 63625b05a0..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/IActionProvider.java +++ /dev/null @@ -1,19 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import java.util.Collection; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -public interface IActionProvider { - - /** Returns the list of actions that are available from the statement container holding the gate. */ - Collection getInternalActions(IStatementContainer container); - - /** Returns the list of actions available to a gate next to the given block. */ - Collection getExternalActions(EnumFacing side, TileEntity tile); -} diff --git a/dependencies/main/java/buildcraft/api/statements/IActionReceptor.java b/dependencies/main/java/buildcraft/api/statements/IActionReceptor.java deleted file mode 100644 index 34155b86ab..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/IActionReceptor.java +++ /dev/null @@ -1,9 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -public interface IActionReceptor { - void actionActivated(IStatement statement, IStatementParameter[] parameters); -} diff --git a/dependencies/main/java/buildcraft/api/statements/IOverrideDefaultStatements.java b/dependencies/main/java/buildcraft/api/statements/IOverrideDefaultStatements.java deleted file mode 100644 index cb2dc78e19..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/IOverrideDefaultStatements.java +++ /dev/null @@ -1,13 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import java.util.List; - -public interface IOverrideDefaultStatements { - List overrideTriggers(); - - List overrideActions(); -} diff --git a/dependencies/main/java/buildcraft/api/statements/IStatement.java b/dependencies/main/java/buildcraft/api/statements/IStatement.java deleted file mode 100644 index dc02543322..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/IStatement.java +++ /dev/null @@ -1,36 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public interface IStatement { - /** Every statement needs a unique tag, it should be in the format of "<modid>:<name>. - * - * @return the unique id */ - String getUniqueTag(); - - /** Return the maximum number of parameter this statement can have, 0 if none. */ - int maxParameters(); - - /** Return the minimum number of parameter this statement can have, 0 if none. */ - int minParameters(); - - /** Return the statement description in the UI */ - String getDescription(); - - /** Create parameters for the statement. */ - IStatementParameter createParameter(int index); - - /** This returns the statement after a left rotation. Used in particular in blueprints orientation. */ - IStatement rotateLeft(); - - /** This should return the icon for this statement, suitable for rending directly into a GUI. This should refer to a - * texture on the map block texture map. */ - @SideOnly(Side.CLIENT) - TextureAtlasSprite getGuiSprite(); -} diff --git a/dependencies/main/java/buildcraft/api/statements/IStatementContainer.java b/dependencies/main/java/buildcraft/api/statements/IStatementContainer.java deleted file mode 100644 index f4a73465fa..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/IStatementContainer.java +++ /dev/null @@ -1,12 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import net.minecraft.tileentity.TileEntity; - -/** This is implemented by objects containing Statements, such as Gates and TileEntities. */ -public interface IStatementContainer { - TileEntity getTile(); -} diff --git a/dependencies/main/java/buildcraft/api/statements/IStatementParameter.java b/dependencies/main/java/buildcraft/api/statements/IStatementParameter.java deleted file mode 100644 index 7ef29c793d..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/IStatementParameter.java +++ /dev/null @@ -1,36 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public interface IStatementParameter { - - /** Every parameter needs a unique tag, it should be in the format of "<modid>:<name>". - * - * @return the unique id */ - String getUniqueTag(); - - @SideOnly(Side.CLIENT) - TextureAtlasSprite getIcon(); - - ItemStack getItemStack(); - - /** Return the parameter description in the UI */ - String getDescription(); - - void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse); - - void readFromNBT(NBTTagCompound compound); - - void writeToNBT(NBTTagCompound compound); - - /** This returns the parameter after a left rotation. Used in particular in blueprints orientation. */ - IStatementParameter rotateLeft(); -} diff --git a/dependencies/main/java/buildcraft/api/statements/ITriggerExternal.java b/dependencies/main/java/buildcraft/api/statements/ITriggerExternal.java deleted file mode 100644 index 3db589cbcf..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/ITriggerExternal.java +++ /dev/null @@ -1,14 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -public interface ITriggerExternal extends IStatement { - - boolean isTriggerActive(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); - -} diff --git a/dependencies/main/java/buildcraft/api/statements/ITriggerExternalOverride.java b/dependencies/main/java/buildcraft/api/statements/ITriggerExternalOverride.java deleted file mode 100644 index b8628deec5..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/ITriggerExternalOverride.java +++ /dev/null @@ -1,16 +0,0 @@ -package buildcraft.api.statements; - -import net.minecraft.util.EnumFacing; - -/** This interface can be used by tiles to override external trigger behaviour. - * - * Please use wisely. */ -public interface ITriggerExternalOverride { - public enum Result { - TRUE, - FALSE, - IGNORE - } - - Result override(EnumFacing side, IStatementContainer source, IStatementParameter[] parameters); -} diff --git a/dependencies/main/java/buildcraft/api/statements/ITriggerInternal.java b/dependencies/main/java/buildcraft/api/statements/ITriggerInternal.java deleted file mode 100644 index 610a5728b6..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/ITriggerInternal.java +++ /dev/null @@ -1,11 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -public interface ITriggerInternal extends IStatement { - - boolean isTriggerActive(IStatementContainer source, IStatementParameter[] parameters); - -} diff --git a/dependencies/main/java/buildcraft/api/statements/ITriggerProvider.java b/dependencies/main/java/buildcraft/api/statements/ITriggerProvider.java deleted file mode 100644 index d6ffbd42f2..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/ITriggerProvider.java +++ /dev/null @@ -1,20 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import java.util.Collection; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -public interface ITriggerProvider { - - /** Returns the list of triggers that are available from the object holding the gate. */ - Collection getInternalTriggers(IStatementContainer container); - - /** Returns the list of triggers available to a gate next to the given block. */ - Collection getExternalTriggers(EnumFacing side, TileEntity tile); - -} diff --git a/dependencies/main/java/buildcraft/api/statements/StatementManager.java b/dependencies/main/java/buildcraft/api/statements/StatementManager.java deleted file mode 100644 index 166541ac10..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/StatementManager.java +++ /dev/null @@ -1,181 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -import buildcraft.api.core.BCLog; - -public final class StatementManager { - - public static Map statements = new HashMap(); - public static Map> parameters = new HashMap>(); - private static List triggerProviders = new LinkedList(); - private static List actionProviders = new LinkedList(); - - /** Deactivate constructor */ - private StatementManager() {} - - public static void registerTriggerProvider(ITriggerProvider provider) { - if (provider != null && !triggerProviders.contains(provider)) { - triggerProviders.add(provider); - } - } - - public static void registerActionProvider(IActionProvider provider) { - if (provider != null && !actionProviders.contains(provider)) { - actionProviders.add(provider); - } - } - - public static void registerStatement(IStatement statement) { - statements.put(statement.getUniqueTag(), statement); - } - - public static void registerParameterClass(Class param) { - parameters.put(createParameter(param).getUniqueTag(), param); - } - - @Deprecated - public static void registerParameterClass(String name, Class param) { - parameters.put(name, param); - } - - public static List getExternalTriggers(EnumFacing side, TileEntity entity) { - List result; - - if (entity instanceof IOverrideDefaultStatements) { - result = ((IOverrideDefaultStatements) entity).overrideTriggers(); - if (result != null) { - return result; - } - } - - result = new LinkedList(); - - for (ITriggerProvider provider : triggerProviders) { - Collection toAdd = provider.getExternalTriggers(side, entity); - - if (toAdd != null) { - for (ITriggerExternal t : toAdd) { - if (!result.contains(t)) { - result.add(t); - } - } - } - } - - return result; - } - - public static List getExternalActions(EnumFacing side, TileEntity entity) { - List result = new LinkedList(); - - if (entity instanceof IOverrideDefaultStatements) { - result = ((IOverrideDefaultStatements) entity).overrideActions(); - if (result != null) { - return result; - } - } - - result = new LinkedList(); - - for (IActionProvider provider : actionProviders) { - Collection toAdd = provider.getExternalActions(side, entity); - - if (toAdd != null) { - for (IActionExternal t : toAdd) { - if (!result.contains(t)) { - result.add(t); - } - } - } - } - - return result; - } - - public static List getInternalTriggers(IStatementContainer container) { - List result = new LinkedList(); - - for (ITriggerProvider provider : triggerProviders) { - Collection toAdd = provider.getInternalTriggers(container); - - if (toAdd != null) { - for (ITriggerInternal t : toAdd) { - if (!result.contains(t)) { - result.add(t); - } - } - } - } - - return result; - } - - public static List getInternalActions(IStatementContainer container) { - List result = new LinkedList(); - - for (IActionProvider provider : actionProviders) { - Collection toAdd = provider.getInternalActions(container); - - if (toAdd != null) { - for (IActionInternal t : toAdd) { - if (!result.contains(t)) { - result.add(t); - } - } - } - } - - return result; - } - - public static IStatementParameter createParameter(String kind) { - return createParameter(parameters.get(kind)); - } - - private static IStatementParameter createParameter(Class param) { - if (param == null) { - return null; - } - - try { - return param.newInstance(); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (Error error) { - BCLog.logErrorAPI(error, IStatementParameter.class); - throw error; - } - - return null; - } - - // /** - // * Generally, this function should be called by every mod implementing - // * the Statements API ***as a container*** (that is, adding its own gates) - // * on the client side from a given Item of choice. - // */ - // @SideOnly(Side.CLIENT) - // public static void registerIcons(TextureAtlasSpriteRegister register) { - // for (IStatement statement : statements.values()) { - // statement.registerIcons(register); - // } - // - // for (Class parameter : parameters.values()) { - // createParameter(parameter).registerIcons(register); - // } - // } -} diff --git a/dependencies/main/java/buildcraft/api/statements/StatementMouseClick.java b/dependencies/main/java/buildcraft/api/statements/StatementMouseClick.java deleted file mode 100644 index c39ed336f4..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/StatementMouseClick.java +++ /dev/null @@ -1,23 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -public final class StatementMouseClick { - private int button; - private boolean shift; - - public StatementMouseClick(int button, boolean shift) { - this.button = button; - this.shift = shift; - } - - public boolean isShift() { - return shift; - } - - public int getButton() { - return button; - } -} diff --git a/dependencies/main/java/buildcraft/api/statements/StatementParameterItemStack.java b/dependencies/main/java/buildcraft/api/statements/StatementParameterItemStack.java deleted file mode 100644 index 3ed0ec5dbd..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/StatementParameterItemStack.java +++ /dev/null @@ -1,90 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.statements; - -import java.util.Objects; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public class StatementParameterItemStack implements IStatementParameter { - - protected ItemStack stack; - - @Override - public TextureAtlasSprite getIcon() { - return null; - } - - @Override - public ItemStack getItemStack() { - return stack; - } - - @Override - public void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse) { - if (stack != null) { - this.stack = stack.copy(); - this.stack.stackSize = 1; - } else { - this.stack = null; - } - } - - @Override - public void writeToNBT(NBTTagCompound compound) { - if (stack != null) { - NBTTagCompound tagCompound = new NBTTagCompound(); - stack.writeToNBT(tagCompound); - compound.setTag("stack", tagCompound); - } - } - - @Override - public void readFromNBT(NBTTagCompound compound) { - stack = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("stack")); - } - - @Override - public boolean equals(Object object) { - if (object instanceof StatementParameterItemStack) { - StatementParameterItemStack param = (StatementParameterItemStack) object; - - return ItemStack.areItemStacksEqual(stack, param.stack) && ItemStack.areItemStackTagsEqual(stack, param.stack); - } else { - return false; - } - } - - @Override - public int hashCode() { - return Objects.hashCode(stack); - } - - @Override - public String getDescription() { - if (stack != null) { - return stack.getDisplayName(); - } else { - return ""; - } - } - - @Override - public String getUniqueTag() { - return "buildcraft:stack"; - } - - // @Override - // public void registerIcons(TextureAtlasSpriteRegister iconRegister) { - // - // } - - @Override - public IStatementParameter rotateLeft() { - return this; - } -} diff --git a/dependencies/main/java/buildcraft/api/statements/StatementSlot.java b/dependencies/main/java/buildcraft/api/statements/StatementSlot.java deleted file mode 100644 index 27c0071bbf..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/StatementSlot.java +++ /dev/null @@ -1,42 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.statements; - -import java.util.Arrays; -import java.util.Objects; - -public class StatementSlot { - public IStatement statement; - public IStatementParameter[] parameters; - - @Override - public boolean equals(Object o) { - if (!(o instanceof StatementSlot)) { - return false; - } - StatementSlot s = (StatementSlot) o; - if (s.statement != statement || parameters.length != s.parameters.length) { - return false; - } - for (int i = 0; i < parameters.length; i++) { - IStatementParameter p1 = parameters[i]; - IStatementParameter p2 = s.parameters[i]; - if (p1 == null) { - if (p2 != null) return false; - continue; - } - if (p2 == null) return false; - if (!(p1.equals(p2))) { - return false; - } - } - return true; - } - - @Override - public int hashCode() { - return Objects.hash(statement, Arrays.deepHashCode(parameters)); - } -} diff --git a/dependencies/main/java/buildcraft/api/statements/containers/IRedstoneStatementContainer.java b/dependencies/main/java/buildcraft/api/statements/containers/IRedstoneStatementContainer.java deleted file mode 100644 index 5b34bfd948..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/containers/IRedstoneStatementContainer.java +++ /dev/null @@ -1,17 +0,0 @@ -package buildcraft.api.statements.containers; - -import net.minecraft.util.EnumFacing; - -public interface IRedstoneStatementContainer { - /** Get the redstone input from a given side. - * - * @param side The side - use "UNKNOWN" for maximum input. - * @return The redstone input, from 0 to 15. */ - int getRedstoneInput(EnumFacing side); - - /** Set the redstone input for a given side. - * - * @param side The side - use "UNKNOWN" for all sides. - * @return Whether the set was successful. */ - boolean setRedstoneOutput(EnumFacing side, int value); -} diff --git a/dependencies/main/java/buildcraft/api/statements/containers/ISidedStatementContainer.java b/dependencies/main/java/buildcraft/api/statements/containers/ISidedStatementContainer.java deleted file mode 100644 index b65ace45ae..0000000000 --- a/dependencies/main/java/buildcraft/api/statements/containers/ISidedStatementContainer.java +++ /dev/null @@ -1,10 +0,0 @@ -package buildcraft.api.statements.containers; - -import net.minecraft.util.EnumFacing; - -import buildcraft.api.statements.IStatementContainer; - -/** Created by asie on 3/14/15. */ -public interface ISidedStatementContainer extends IStatementContainer { - EnumFacing getSide(); -} diff --git a/dependencies/main/java/buildcraft/api/tools/IToolWrench.java b/dependencies/main/java/buildcraft/api/tools/IToolWrench.java deleted file mode 100644 index 0138fdf91d..0000000000 --- a/dependencies/main/java/buildcraft/api/tools/IToolWrench.java +++ /dev/null @@ -1,33 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.tools; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; - -/*** Implement this interface on subclasses of Item to have that item work as a wrench for buildcraft */ -public interface IToolWrench { - - /*** Called to ensure that the wrench can be used. To get the ItemStack that is used, check - * player.inventory.getCurrentItem() - * - * @param player - The player doing the wrenching - * @param pos - The coordinates for the block being wrenched - * - * @return true if wrenching is allowed, false if not */ - boolean canWrench(EntityPlayer player, BlockPos pos); - - /*** Callback after the wrench has been used. This can be used to decrease durability or for other purposes. To get - * the ItemStack that was used, check player.inventory.getCurrentItem() - * - * @param player - The player doing the wrenching - * @param pos - The position of the block being wrenched */ - void wrenchUsed(EntityPlayer player, BlockPos pos); - - boolean canWrench(EntityPlayer player, Entity entity); - - void wrenchUsed(EntityPlayer player, Entity entity); -} diff --git a/dependencies/main/java/buildcraft/api/transport/ICustomPipeConnection.java b/dependencies/main/java/buildcraft/api/transport/ICustomPipeConnection.java deleted file mode 100644 index c4cc1efdf8..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/ICustomPipeConnection.java +++ /dev/null @@ -1,12 +0,0 @@ -package buildcraft.api.transport; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -public interface ICustomPipeConnection { - /** @return How long the connecting pipe should extend for. Values less than -4/16 indicate that the pipe will not - * connect at all, and will render as it it was not connected. */ - public float getExtension(World world, BlockPos pos, EnumFacing face, IBlockState state); -} diff --git a/dependencies/main/java/buildcraft/api/transport/IInjectable.java b/dependencies/main/java/buildcraft/api/transport/IInjectable.java deleted file mode 100644 index 0de9e20054..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/IInjectable.java +++ /dev/null @@ -1,18 +0,0 @@ -package buildcraft.api.transport; - -import net.minecraft.item.EnumDyeColor; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; - -public interface IInjectable { - boolean canInjectItems(EnumFacing from); - - /** Offers an ItemStack for 3addition to the pipe. Will be rejected if the pipe doesn't accept items from that side. - * - * @param stack ItemStack offered for addition. Do not manipulate this! - * @param doAdd If false no actual addition should take place. Implementors should simulate. - * @param from Orientation the ItemStack is offered from. - * @param color The color of the item to be added to the pipe, or null for no color. - * @return Amount of items used from the passed stack. */ - int injectItem(ItemStack stack, boolean doAdd, EnumFacing from, EnumDyeColor color); -} diff --git a/dependencies/main/java/buildcraft/api/transport/IItemPipe.java b/dependencies/main/java/buildcraft/api/transport/IItemPipe.java deleted file mode 100644 index c943a81a66..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/IItemPipe.java +++ /dev/null @@ -1,11 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents - * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ -package buildcraft.api.transport; - -/** To be implemented by the real item pipe in Transport mod, but leaves knowledge for classes that do not have direct - * dependency on transport. */ -public interface IItemPipe { - -} diff --git a/dependencies/main/java/buildcraft/api/transport/IPipe.java b/dependencies/main/java/buildcraft/api/transport/IPipe.java deleted file mode 100644 index 96a7a764cf..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/IPipe.java +++ /dev/null @@ -1,21 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import net.minecraft.util.EnumFacing; - -import buildcraft.api.gates.IGate; - -public interface IPipe { - IPipeTile getTile(); - - IGate getGate(EnumFacing side); - - boolean hasGate(EnumFacing side); - - boolean isWired(PipeWire wire); - - boolean isWireActive(PipeWire wire); -} diff --git a/dependencies/main/java/buildcraft/api/transport/IPipeConnection.java b/dependencies/main/java/buildcraft/api/transport/IPipeConnection.java deleted file mode 100644 index 0b25ec8185..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/IPipeConnection.java +++ /dev/null @@ -1,24 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import net.minecraft.util.EnumFacing; - -public interface IPipeConnection { - - enum ConnectOverride { - - CONNECT, - DISCONNECT, - DEFAULT - } - - /** Allows you to override pipe connection logic. - * - * @param type - * @param with - * @return CONNECT to force a connection, DISCONNECT to force no connection, and DEFAULT to let the pipe decide. */ - ConnectOverride overridePipeConnection(IPipeTile.PipeType type, EnumFacing with); -} diff --git a/dependencies/main/java/buildcraft/api/transport/IPipeTile.java b/dependencies/main/java/buildcraft/api/transport/IPipeTile.java deleted file mode 100644 index d8d38c234b..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/IPipeTile.java +++ /dev/null @@ -1,54 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import net.minecraft.block.Block; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -import buildcraft.api.transport.pluggable.PipePluggable; - -public interface IPipeTile extends IInjectable { - enum PipeType { - ITEM, - FLUID, - POWER, - STRUCTURE - } - - PipeType getPipeType(); - - World getWorldBC(); - - BlockPos getPosBC(); - - /** True if the pipe is connected to the block/pipe in the specific direction - * - * @param with - * @return true if connect */ - boolean isPipeConnected(EnumFacing with); - - Block getNeighborBlock(EnumFacing dir); - - TileEntity getNeighborTile(EnumFacing dir); - - IPipe getNeighborPipe(EnumFacing dir); - - IPipe getPipe(); - - int getPipeColor(); - - PipePluggable getPipePluggable(EnumFacing direction); // Now in IPluggableProvider - - boolean hasPipePluggable(EnumFacing direction); // Now in IPluggableProvider - - boolean hasBlockingPluggable(EnumFacing direction); - - void scheduleNeighborChange(); - - void scheduleRenderUpdate(); -} diff --git a/dependencies/main/java/buildcraft/api/transport/IStripesActivator.java b/dependencies/main/java/buildcraft/api/transport/IStripesActivator.java deleted file mode 100644 index 540346d7bc..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/IStripesActivator.java +++ /dev/null @@ -1,14 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; - -public interface IStripesActivator { - void sendItem(ItemStack itemStack, EnumFacing direction); - - void dropItem(ItemStack itemStack, EnumFacing direction); -} diff --git a/dependencies/main/java/buildcraft/api/transport/IStripesHandler.java b/dependencies/main/java/buildcraft/api/transport/IStripesHandler.java deleted file mode 100644 index 71f4205521..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/IStripesHandler.java +++ /dev/null @@ -1,24 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -public interface IStripesHandler { - enum StripesHandlerType { - ITEM_USE, - BLOCK_BREAK - } - - StripesHandlerType getType(); - - boolean shouldHandle(ItemStack stack); - - boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack stack, EntityPlayer player, IStripesActivator activator); -} diff --git a/dependencies/main/java/buildcraft/api/transport/IStripesPipe.java b/dependencies/main/java/buildcraft/api/transport/IStripesPipe.java deleted file mode 100644 index 569c53954f..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/IStripesPipe.java +++ /dev/null @@ -1,9 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import cofh.api.energy.IEnergyHandler; - -public interface IStripesPipe extends IPipe, IStripesActivator, IEnergyHandler {} diff --git a/dependencies/main/java/buildcraft/api/transport/PipeConnectionAPI.java b/dependencies/main/java/buildcraft/api/transport/PipeConnectionAPI.java deleted file mode 100644 index e79da26462..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/PipeConnectionAPI.java +++ /dev/null @@ -1,48 +0,0 @@ -package buildcraft.api.transport; - -import java.util.Map; - -import com.google.common.collect.Maps; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -/** Use this class to register blocks with custom block sizes so that pipes can connect to them properly. Note that you - * do not need to register a custom pipe connection if your block implements ICustomPipeConnection. The registered - * version does not override your own implementation. */ -public final class PipeConnectionAPI { - private static final Map connections = Maps.newHashMap(); - private static final ICustomPipeConnection NOTHING = new ICustomPipeConnection() { - @Override - public float getExtension(World world, BlockPos pos, EnumFacing face, IBlockState state) { - return 0; - } - }; - - /** Register a block with a custom connection. Useful if you don't own the block class or are adding it for some-one - * - * @param block The block instance - * @param connection The connection instance */ - public static void registerConnection(Block block, ICustomPipeConnection connection) { - connections.put(block, connection); - } - - public static void registerConnectionAsNothing(Block block) { - connections.put(block, NOTHING); - } - - /** Gets the current custom connection that the block uses. Will be null if nothing has been set. */ - public static ICustomPipeConnection getCustomConnection(Block block) { - if (block instanceof ICustomPipeConnection) { - return (ICustomPipeConnection) block; - } - ICustomPipeConnection connection = connections.get(block); - if (connection != null) { - return connection; - } - return null; - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/PipeManager.java b/dependencies/main/java/buildcraft/api/transport/PipeManager.java deleted file mode 100644 index 0fd0f8aad8..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/PipeManager.java +++ /dev/null @@ -1,71 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.util.BlockPos; -import net.minecraft.world.World; - -import buildcraft.api.transport.pluggable.PipePluggable; - -public abstract class PipeManager { - - public static List stripesHandlers = new ArrayList(); - public static ArrayList> pipePluggables = new ArrayList>(); - private static Map> pipePluggableNames = new HashMap>(); - private static Map, String> pipePluggableByNames = new HashMap, String>(); - private static Map stripesHandlerPriorities = new HashMap(); - - @Deprecated - public static boolean canExtractItems(Object extractor, World world, BlockPos pos) { - return true; - } - - @Deprecated - public static boolean canExtractFluids(Object extractor, World world, BlockPos pos) { - return true; - } - - @Deprecated - public static void registerStripesHandler(IStripesHandler handler) { - registerStripesHandler(handler, 0); - } - - /** Register a Stripes Pipe handler. - * - * @param handler The handler. - * @param priority The priority - 0 is normal, higher numbers have higher priority. */ - public static void registerStripesHandler(IStripesHandler handler, int priority) { - stripesHandlers.add(handler); - stripesHandlerPriorities.put(handler, priority); - - Collections.sort(stripesHandlers, new Comparator() { - @Override - public int compare(IStripesHandler o1, IStripesHandler o2) { - return stripesHandlerPriorities.get(o2) - stripesHandlerPriorities.get(o1); - } - }); - } - - public static void registerPipePluggable(Class pluggable, String name) { - pipePluggables.add(pluggable); - pipePluggableNames.put(name, pluggable); - pipePluggableByNames.put(pluggable, name); - } - - public static Class getPluggableByName(String pluggableName) { - return pipePluggableNames.get(pluggableName); - } - - public static String getPluggableName(Class aClass) { - return pipePluggableByNames.get(aClass); - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/PipeWire.java b/dependencies/main/java/buildcraft/api/transport/PipeWire.java deleted file mode 100644 index 5864db9c3f..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/PipeWire.java +++ /dev/null @@ -1,73 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport; - -import java.util.Locale; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public enum PipeWire { - - RED, - BLUE, - GREEN, - YELLOW; - public static Item item; - public static final PipeWire[] VALUES = values(); - - public PipeWire reverse() { - switch (this) { - case RED: - return YELLOW; - case BLUE: - return GREEN; - case GREEN: - return BLUE; - default: - return RED; - } - } - - public String getTag() { - return name().toLowerCase(Locale.ENGLISH) + "PipeWire"; - } - - public String getColor() { - String name = this.toString().toLowerCase(Locale.ENGLISH); - char first = Character.toUpperCase(name.charAt(0)); - return first + name.substring(1); - } - - public ItemStack getStack() { - return getStack(1); - } - - public ItemStack getStack(int qty) { - if (item == null) { - return null; - } else { - return new ItemStack(item, qty, ordinal()); - } - } - - public boolean isPipeWire(ItemStack stack) { - if (stack == null) { - return false; - } else if (stack.getItem() != item) { - return false; - } else { - return stack.getItemDamage() == ordinal(); - } - } - - public static PipeWire fromOrdinal(int ordinal) { - if (ordinal < 0 || ordinal >= VALUES.length) { - return RED; - } else { - return VALUES[ordinal]; - } - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/BCPipeEventHandler.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/BCPipeEventHandler.java deleted file mode 100644 index bb163b9f0c..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/BCPipeEventHandler.java +++ /dev/null @@ -1,12 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(value = ElementType.METHOD) -@Retention(value = RetentionPolicy.RUNTIME) -public @interface BCPipeEventHandler { - // TODO -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/EnumContentsJourneyPart.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/EnumContentsJourneyPart.java deleted file mode 100644 index 3bf724a427..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/EnumContentsJourneyPart.java +++ /dev/null @@ -1,7 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -public enum EnumContentsJourneyPart { - JUST_ENTERED, - TO_CENTER, - FROM_CENTER; -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IConnection_BC8.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IConnection_BC8.java deleted file mode 100644 index a18140f6b7..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IConnection_BC8.java +++ /dev/null @@ -1,35 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.TileEntity; - -import buildcraft.api.transport.pipe_bc8.IExtractionManager.IExtractable_BC8; -import buildcraft.api.transport.pipe_bc8.IInsertionManager.IInsertable_BC8; - -public interface IConnection_BC8 { - Object getOther(); - - /** @return The length of the connection. For connections to another buildcraft pipe or a full block this value will - * be 0.25. Values less than 0 are NOT permitted and returning values less than 0 will introduce crashes or - * errors further down! */ - double getLength(); - - IExtractable_BC8 getExtractor(); - - IInsertable_BC8 getInserter(); - - interface Pipe extends IConnection_BC8 { - @Override - IPipe_BC8 getOther(); - } - - interface MovableEntity extends IConnection_BC8 { - @Override - Entity getOther(); - } - - interface Tile extends IConnection_BC8 { - @Override - TileEntity getOther(); - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IExtractionManager.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IExtractionManager.java deleted file mode 100644 index 0983d7d166..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IExtractionManager.java +++ /dev/null @@ -1,46 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.util.EnumFacing; - -import buildcraft.api.core.IFluidFilter; -import buildcraft.api.core.IStackFilter; -import buildcraft.api.transport.pipe_bc8.IInsertionManager.IInsertableFactory; -import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableFluid; -import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableItem; - -public interface IExtractionManager { - /** Gets an {@link IExtractable_BC8} interface for a given tile or movable entity. */ - IExtractable_BC8 getExtractableFor(Object obj); - - /** Registers an {@link IInsertableFactory}. Note that if two insertables are registered and have an overlapping - * class child, the most specific one is used. */ - void registerInsertable(Class clazz, IExtractableFactory factory); - - public interface IExtractableFactory { - IExtractable_BC8 createNew(T obj); - } - - public interface IExtractable_BC8 { - /** @param filter The filter to use when determining what can be extracted - * @param extractor The object the the contents are being extracted by - * @param direction The direction the contents will be going in - * @param simulate If true no changes will be made to the target inventory - * @return A pipe contents object if it was successfully extracted, or null if nothing was extracted. */ - IPipeContentsEditableItem tryExtractItems(IStackFilter filter, Object extractor, EnumFacing direction, boolean simulate); - - /** @param filter The filter to use when determining what can be extracted - * @param extractor The object the the contents are being extracted by - * @param direction The direction the contents will be going in - * @param simulate If true no changes will be made to the target tank - * @return A pipe contents object if it was successfully extracted, or null if nothing was extracted. */ - IPipeContentsEditableFluid tryExtractFluid(IFluidFilter filter, Object extractor, EnumFacing direction, boolean simulate); - - /** @return True if {@link #tryExtractItems(IStackFilter, Object, EnumFacing, boolean)} can return a non-null - * value at any future point in time. */ - boolean givesItems(); - - /** @return True if {@link #tryExtractFluid(IFluidFilter, Object, EnumFacing, boolean)} can return a non-null - * value at any future point in time. */ - boolean givesFluids(); - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IInsertionManager.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IInsertionManager.java deleted file mode 100644 index 0ae64a68a7..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IInsertionManager.java +++ /dev/null @@ -1,35 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.util.EnumFacing; - -import buildcraft.api.core.IFluidFilter; -import buildcraft.api.core.IStackFilter; -import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableFluid; -import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableItem; - -public interface IInsertionManager { - /** Gets an {@link IInsertable_BC8} interface for a given tile or movable entity. */ - IInsertable_BC8 getInsertableFor(Object obj); - - /** Registers an {@link IInsertableFactory}. Note that if two insertables are registered and have an overlapping - * class child, the most specific one is used. */ - void registerInsertable(Class clazz, IInsertableFactory factory); - - public interface IInsertableFactory { - IInsertable_BC8 createNew(T obj); - } - - public interface IInsertable_BC8 { - boolean tryInsertItems(IPipeContentsEditableItem contents, Object extractor, EnumFacing direction, boolean simulate); - - boolean tryInsertFluid(IPipeContentsEditableFluid fluid, Object extractor, EnumFacing direction, boolean simulate); - - /** @return True if {@link #tryExtractItems(IStackFilter, Object, EnumFacing, boolean)} can return a non-null - * value at any future point in time. */ - boolean acceptsItems(); - - /** @return True if {@link #tryExtractFluid(IFluidFilter, Object, EnumFacing, boolean)} can return a non-null - * value at any future point in time. */ - boolean acceptsFluids(); - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeAddonItem.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeAddonItem.java deleted file mode 100644 index fa98b71df0..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeAddonItem.java +++ /dev/null @@ -1,8 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -/** - * - */ -public interface IPipeAddonItem { - -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeBehaviourFactory.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeBehaviourFactory.java deleted file mode 100644 index 8fa7afb230..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeBehaviourFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -public interface IPipeBehaviourFactory { - PipeBehaviour_BC8 createNew(IPipe_BC8 pipe); -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeContents.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeContents.java deleted file mode 100644 index 23e16eeb2a..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeContents.java +++ /dev/null @@ -1,37 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; - -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -/** Provides a simple abstraction for items and fluids. This is intended to be useful for pipes which cover both kinds, - * without having lots of if (item) ... else ... */ -public interface IPipeContents { - EnumContentsJourneyPart getJourneyPart(); - - EnumFacing getDirection(); - - /** This should NEVER return numbers less than or equal to 0! - * - * @return The number of minecraft blocks this contents moves per minecraft ticks */ - double getSpeed(); - - public interface IPipeContentsItem extends IPipeContents { - ItemStack cloneItemStack(); - - IPipePropertyProvider getProperties(); - } - - public interface IPipeContentsFluid extends IPipeContents { - int getAmount(); - - Fluid getFluid(); - - NBTTagCompound getNBT(); - - FluidStack cloneFluidStack(); - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeContentsEditable.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeContentsEditable.java deleted file mode 100644 index 789772f128..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeContentsEditable.java +++ /dev/null @@ -1,60 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; - -import net.minecraftforge.fluids.Fluid; - -import buildcraft.api.core.INBTLoadable_BC8; -import buildcraft.api.core.INetworkLoadable_BC8; -import buildcraft.api.transport.pipe_bc8.IPipePropertyProvider.IPipePropertyProviderEditable; - -import io.netty.buffer.ByteBuf; - -/** Provides a way to change the contents of a pipe. */ -public interface IPipeContentsEditable extends IPipeContents, INetworkLoadable_BC8, INBTLoadable_BC8 { - IPipeContents asReadOnly(); - - void setJourneyPart(EnumContentsJourneyPart journeyPart); - - void setDirection(EnumFacing direction); - - void setSpeed(double speed); - - public interface IPipeContentsEditableFluid extends IPipeContentsEditable, IPipeContentsFluid { - int setAmount(int newAmount); - - void setFluid(Fluid fluid); - - void setNBT(NBTTagCompound compound); - - void setFluidStack(); - - @Override - IPipeContentsFluid asReadOnly(); - - @Override - IPipeContentsEditableFluid readFromNBT(NBTBase nbt); - - @Override - IPipeContentsEditableFluid readFromByteBuf(ByteBuf buf); - } - - public interface IPipeContentsEditableItem extends IPipeContentsEditable, IPipeContentsItem { - void setStack(ItemStack newStack); - - @Override - IPipePropertyProviderEditable getProperties(); - - @Override - IPipeContentsItem asReadOnly(); - - @Override - IPipeContentsEditableItem readFromNBT(NBTBase nbt); - - @Override - IPipeContentsEditableItem readFromByteBuf(ByteBuf buf); - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeHelper.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeHelper.java deleted file mode 100644 index 1d39da2b1c..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeHelper.java +++ /dev/null @@ -1,14 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fluids.FluidStack; - -import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableFluid; -import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableItem; - -public interface IPipeHelper { - IPipeContentsEditableItem getContentsForItem(ItemStack stack); - - IPipeContentsEditableFluid getContentsForFluid(FluidStack fluid); -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeHolder_BC8.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeHolder_BC8.java deleted file mode 100644 index 1d2abc738f..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeHolder_BC8.java +++ /dev/null @@ -1,5 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -public interface IPipeHolder_BC8 { - IPipe_BC8 getPipe(); -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeListener.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeListener.java deleted file mode 100644 index 1533faf593..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeListener.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import buildcraft.api.core.INBTLoadable_BC8; -import buildcraft.api.core.INetworkLoadable_BC8; - -/** Something that will be saved and loaded from disk and sent across the network to the client world to be added as a - * listener. This class should be registered with {@link PipeAPI_BC8#PIPE_LISTENER_REGISTRY} in order to be successfully - * saved and loaded. */ -public interface IPipeListener extends INBTLoadable_BC8, INetworkLoadable_BC8 {} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeListenerFactory.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeListenerFactory.java deleted file mode 100644 index d2e96cf3d7..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeListenerFactory.java +++ /dev/null @@ -1,5 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -public interface IPipeListenerFactory { - IPipeListener createNewListener(IPipe_BC8 pipe); -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeListenerRegistry.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeListenerRegistry.java deleted file mode 100644 index abe78251da..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeListenerRegistry.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -public interface IPipeListenerRegistry { - IPipeListenerFactory getFactory(String globalUniqueTag); - - String getGlobalUniqueTag(IPipeListener listener); - - void registerListenerFactory(String modUniqueTag, IPipeListenerFactory factory); -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipePropertyProvider.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipePropertyProvider.java deleted file mode 100644 index 5581d82ff5..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipePropertyProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import java.util.Set; - -import net.minecraft.nbt.NBTBase; - -import buildcraft.api.core.INBTLoadable_BC8; -import buildcraft.api.core.INetworkLoadable_BC8; - -public interface IPipePropertyProvider { - /** This will return either the value of the property (if {@link #hasProperty(IPipeProperty)} returns true) or the - * default value of the property. */ - T getValue(IPipeProperty property); - - boolean hasProperty(IPipeProperty property); - - Set> getPropertySet(); - - /** Defines a property key- this should be stored in a publicly accessible static variable somewhere. */ - public interface IPipeProperty { - String getName(); - - T getDefault(); - } - - /** Defines a pipe property that has its value queried every time it is asked for its value. */ - public interface IPipePropertyImplicit extends IPipeProperty { - T getValue(IPipe_BC8 pipe); - } - - /** Defines a pipe property that has a value explicitly set */ - public interface IPipePropertyValue extends IPipeProperty, INBTLoadable_BC8, INetworkLoadable_BC8 { - T getValue(); - - @Override - T readFromNBT(NBTBase tag); - } - - /** Defines a provider that can have value properties changed and added. */ - public interface IPipePropertyProviderEditable extends IPipePropertyProvider, INBTLoadable_BC8, - INetworkLoadable_BC8 { - void addProperty(IPipePropertyValue property); - - void removeProperty(IPipePropertyValue property); - - IPipePropertyProvider asReadOnly(); - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeRegistry.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeRegistry.java deleted file mode 100644 index ca0ec628b6..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeRegistry.java +++ /dev/null @@ -1,11 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.item.Item; - -import buildcraft.api.ITripleRegistry; - -public interface IPipeRegistry extends ITripleRegistry { - /** Registers a definition, returning the item associated with it. Note that the item has not been registered, so - * you still need to register it with forge. */ - Item registerDefinition(PipeDefinition_BC8 definition); -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeType.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeType.java deleted file mode 100644 index 28deb4eeeb..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipeType.java +++ /dev/null @@ -1,22 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import java.util.Collections; -import java.util.List; - -public interface IPipeType { - /** Creates all of the default listeners for this pipe. Normally this will be a list with a single object, that will - * normally be a pipe transport. However, you can use this to register any listeners you wish. */ - List createDefaultListeners(IPipe_BC8 pipe); - - enum Void implements IPipeType { - STRUCTURE, - POWER, - FLUID, - ITEM; - - @Override - public List createDefaultListeners(IPipe_BC8 pipe) { - return Collections.emptyList(); - } - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipe_BC8.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipe_BC8.java deleted file mode 100644 index 66dc2037c0..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPipe_BC8.java +++ /dev/null @@ -1,50 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import java.util.Map; - -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -import buildcraft.api.core.INBTLoadable_BC8; -import buildcraft.api.transport.pipe_bc8.event_bc8.IPipeEvent_BC8; - -/** Represents a pipe in a world. Most older (BC version less than 8.x) events, functions and querys can be called by - * firing the appropriate event, and inspecting the event afterwards. Most functionality has been delegated to */ -/* Note that this does not have a "get pipe tile" method, as pipes are not bound to just tile entities */ -public interface IPipe_BC8 extends INBTLoadable_BC8 { - World getWorld(); - - IPipeHolder_BC8 getHolder(); - - IPipePropertyProvider getProperties(); - - PipeBehaviour_BC8 getBehaviour(); - - Map getConnections(); - - void fireEvent(IPipeEvent_BC8 event); - - /** Adds an event listener that will be saved and sent over the network. - * - * @return True if the listener was added to the listener bus. If this returns false it will usually be todo with - * the listener not being allowed onto the pipe (for example it was a gate and there was already a gate on - * that side, or a facade or something similar to that) */ - boolean addEventListener(IPipeListener list); - - void removeEventListener(IPipeListener list); - - /** Sends all of the network data about this listener to the client. Note that this is called automatically by - * {@link #addEventListener(IPipeListener)}. */ - void sendClientUpdate(IPipeListener listener); - - /** Makes this pipe send a client update at some point in the future. This might send it now, or it might send it - * next tick. */ - void scheduleClientUpdate(IPipeListener listener); - - /** Makes this pipe re-render its static parts. */ - void sendRenderUpdate(); - - /** Makes this pipe send a render update at some point in the future. This might send it now, or it might send it in - * a few ticks time. */ - void scheduleRenderUpdate(); -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPluggable_BC8.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPluggable_BC8.java deleted file mode 100644 index 414f10458b..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPluggable_BC8.java +++ /dev/null @@ -1,8 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import buildcraft.api.core.INBTLoadable_BC8; -import buildcraft.api.core.INetworkLoadable_BC8; - -public interface IPluggable_BC8 extends INetworkLoadable_BC8, INBTLoadable_BC8 { - -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPropertyRegistry.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPropertyRegistry.java deleted file mode 100644 index 5d54e5f94f..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/IPropertyRegistry.java +++ /dev/null @@ -1,48 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import buildcraft.api.transport.pipe_bc8.IPipePropertyProvider.IPipePropertyImplicit; -import buildcraft.api.transport.pipe_bc8.IPipePropertyProvider.IPipePropertyValue; - -public interface IPropertyRegistry { - IPipePropertyValue getValueProperty(String modId, String name); - - IPipePropertyValue registerValueProperty(String name, Class typeClass); - - IPipePropertyImplicit getImplicitProperty(String modId, String uniqueName); - - IPipePropertyImplicit registerSimpleImplicitProperty(String name, Class typeClass); - - IPipePropertyImplicit registerCutomImplicitProperty(String name, IPipePropertyImplicit property); - - // Used in case BuildCraft is not installed - enum Void implements IPropertyRegistry { - INSTANCE; - - // @formatter:off - @Override - public IPipePropertyValue getValueProperty(String a, String b) { - return null; - } - - @Override - public IPipePropertyValue registerValueProperty(String a, Class b) { - return null; - } - - @Override - public IPipePropertyImplicit getImplicitProperty(String a, String b) { - return null; - } - - @Override - public IPipePropertyImplicit registerSimpleImplicitProperty(String a, Class b) { - return null; - } - - @Override - public IPipePropertyImplicit registerCutomImplicitProperty(String a, IPipePropertyImplicit p) { - return p; - } - // @formatter:on - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeAPI_BC8.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeAPI_BC8.java deleted file mode 100644 index 80030d4595..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeAPI_BC8.java +++ /dev/null @@ -1,58 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.item.EnumDyeColor; - -import buildcraft.api.APIHelper; -import buildcraft.api.transport.pipe_bc8.IExtractionManager.IExtractable_BC8; -import buildcraft.api.transport.pipe_bc8.IInsertionManager.IInsertable_BC8; -import buildcraft.api.transport.pipe_bc8.IPipePropertyProvider.IPipePropertyImplicit; -import buildcraft.api.transport.pipe_bc8.IPipePropertyProvider.IPipePropertyValue; - -public enum PipeAPI_BC8 { - INSTANCE; - - public static final IPropertyRegistry PROPERTY_REGISTRY; - /** An insertion manager- used to get an instance of {@link IInsertable_BC8} for a given tile entity or movable - * entity. Can also be used to register custom {@link IInsertable_BC8} for custom tiles. */ - public static final IInsertionManager INSERTION_MANAGER; - /** An extraction manager- used to get an instance of {@link IExtractable_BC8} for a given tile entity or movable - * entity. Can also be used to register custom {@link IExtractable_BC8} for custom entities. */ - public static final IExtractionManager EXTRACTION_MANAGER; - - public static final IPipeRegistry PIPE_REGISTRY; - public static final IPipeListenerRegistry PIPE_LISTENER_REGISTRY; - - public static final IPipeHelper PIPE_HELPER; - - public static final IPipeType PIPE_TYPE_STRUCTURE; - public static final IPipeType PIPE_TYPE_POWER; - public static final IPipeType PIPE_TYPE_FLUID; - public static final IPipeType PIPE_TYPE_ITEM; - - public static final IPipePropertyValue ITEM_COLOUR; - public static final IPipePropertyValue ITEM_PAUSED; - - public static final IPipePropertyImplicit ITEM_COUNT; - public static final IPipePropertyImplicit STACK_COUNT; - - static { - PROPERTY_REGISTRY = APIHelper.getInstance("buildcraft.transport.api.impl.PropertyRegistry", IPropertyRegistry.class); - INSERTION_MANAGER = APIHelper.getInstance("buildcraft.transport.api.impl.InsertionManager", IInsertionManager.class); - EXTRACTION_MANAGER = APIHelper.getInstance("buildcraft.transport.api.impl.ExtractionManager", IExtractionManager.class); - - PIPE_REGISTRY = APIHelper.getInstance("buildcraft.transport.api.impl.PipeRegistry", IPipeRegistry.class); - PIPE_LISTENER_REGISTRY = APIHelper.getInstance("buildcraft.transport.api.impl.PipeListenerRegistry", IPipeListenerRegistry.class); - PIPE_HELPER = APIHelper.getInstance("buildcraft.transport.api.impl.PipeHelper", IPipeHelper.class); - - PIPE_TYPE_STRUCTURE = APIHelper.getNamedInstance("buildcraft.transport.api.impl.EnumPipeType", "STRUCTURE", IPipeType.class); - PIPE_TYPE_POWER = APIHelper.getNamedInstance("buildcraft.transport.api.impl.EnumPipeType", "POWER", IPipeType.class); - PIPE_TYPE_FLUID = APIHelper.getNamedInstance("buildcraft.transport.api.impl.EnumPipeType", "FLUID", IPipeType.class); - PIPE_TYPE_ITEM = APIHelper.getNamedInstance("buildcraft.transport.api.impl.EnumPipeType", "ITEM", IPipeType.class); - - ITEM_COLOUR = PROPERTY_REGISTRY.getValueProperty("BuildCraft|Transport", "item_colour"); - ITEM_PAUSED = PROPERTY_REGISTRY.getValueProperty("BuildCraft|Transport", "item_paused"); - - ITEM_COUNT = PROPERTY_REGISTRY.getImplicitProperty("BuildCraft|Transport", "item_count"); - STACK_COUNT = PROPERTY_REGISTRY.getImplicitProperty("BuildCraft|Transport", "stack_count"); - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeBehaviour_BC8.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeBehaviour_BC8.java deleted file mode 100644 index 41daf25fb1..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeBehaviour_BC8.java +++ /dev/null @@ -1,35 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import net.minecraft.nbt.NBTBase; -import net.minecraft.util.EnumFacing; - -import io.netty.buffer.ByteBuf; - -/** An instance is created by instance of IBehaviourFactory per pipe block in world, and is registered with the pipe - * event bus to listen and respond to events. */ -public abstract class PipeBehaviour_BC8 implements IPipeListener { - public final PipeDefinition_BC8 definition; - public final IPipe_BC8 pipe; - - public PipeBehaviour_BC8(PipeDefinition_BC8 definition, IPipe_BC8 pipe) { - if (definition == null) throw new NullPointerException("definition"); - if (pipe == null) throw new NullPointerException("pipe"); - this.definition = definition; - this.pipe = pipe; - } - - /** @param side The side of which the pipe should be registered - * @return An integer between 0 (inclusive) and definition.maxSprites (exclusive). */ - public abstract int getIconIndex(EnumFacing side); - - /** Return the index for the icon for items. Override this if getIconIndex(null) does NOT return the item icon */ - public int getIconIndexForItem() { - return getIconIndex(null); - } - - @Override - public abstract PipeBehaviour_BC8 readFromByteBuf(ByteBuf buf); - - @Override - public abstract PipeBehaviour_BC8 readFromNBT(NBTBase nbt); -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeConnectionAPI.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeConnectionAPI.java deleted file mode 100644 index 370f9cf1f1..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeConnectionAPI.java +++ /dev/null @@ -1,46 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import java.util.Map; - -import com.google.common.collect.Maps; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -import buildcraft.api.transport.ICustomPipeConnection; - -/** Use this class to register blocks with custom block sizes so that pipes can connect to them properly. Note that you - * do not need to register a custom pipe connection if your block implements ICustomPipeConnection. The registered - * version also overrides your own implementation. */ -public final class PipeConnectionAPI { - private static final Map connections = Maps.newHashMap(); - private static final ICustomPipeConnection NOTHING = new ICustomPipeConnection() { - @Override - public float getExtension(World world, BlockPos pos, EnumFacing face, IBlockState state) { - return 0; - } - }; - - /** Register a block with a custom connection. Useful if you don't own the block class - * - * @param block The block instance - * @param connection The connection instance */ - public static void registerConnection(Block block, ICustomPipeConnection connection) { - connections.put(block, connection); - } - - /** Gets the current custom connection that the */ - public static ICustomPipeConnection getCustomConnection(Block block) { - ICustomPipeConnection connection = connections.get(block); - if (connection != null) { - return connection; - } - if (block instanceof ICustomPipeConnection) { - return (ICustomPipeConnection) block; - } - return NOTHING; - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeDefinition_BC8.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeDefinition_BC8.java deleted file mode 100644 index 909cf8c5ad..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/PipeDefinition_BC8.java +++ /dev/null @@ -1,86 +0,0 @@ -package buildcraft.api.transport.pipe_bc8; - -import java.util.Arrays; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.ResourceLocation; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import buildcraft.api.ObjectDefinition; -import buildcraft.api.core.BCLog; - -/** Contains all of the definitions of a pipe. */ -public final class PipeDefinition_BC8 extends ObjectDefinition { - /** The number of sprites to register related to this definition. */ - public final int maxSprites; - /** A string containing the location of the texture of a pipe. The final texture location will be - * {@link #textureLocationStart} + {@link #spriteLocations} */ - public final String textureLocationStart; - /** An array containing the end locations of each pipe texture. This array have a length equal to maxSprites. It is - * up to each indervidual pipe to determine which sprite to use for locations though. By default all of them will be - * initialised to {@link #textureLocationStart}+{@link #modUniqueTag}+{The texture suffixes given to the - * constructor} */ - private final String[] spriteLocations; - /** A factory the creates the behaviour of this definition. */ - public final IPipeBehaviourFactory behaviourFactory; - /** The type of this pipe. This determines how the pipe should be rendered and how the pipe should act. */ - public final IPipeType type; - - /** An array containing the actual sprites, where the positions are determined by {@link #spriteLocations} */ - @SideOnly(Side.CLIENT) - private TextureAtlasSprite[] sprites; - public final int itemSpriteIndex; - - public PipeDefinition_BC8(String tag, IPipeType type, String textureStart, String[] textureSuffixes, IPipeBehaviourFactory behaviour) { - this(tag, type, 0, textureStart, textureSuffixes, behaviour); - } - - /** @param tag A MOD-unique tag for the pipe - * @param type The type of pipe this is - * @param maxSprites The maximum number of sprites - * @param itemSpriteIndex - * @param textureStart - * @param factory */ - public PipeDefinition_BC8(String tag, IPipeType type, int itemSpriteIndex, String textureStart, String[] textureSuffixes, - IPipeBehaviourFactory factory) { - super(tag); - this.type = type; - this.maxSprites = textureSuffixes == null ? 1 : textureSuffixes.length; - this.itemSpriteIndex = itemSpriteIndex; - this.textureLocationStart = textureStart.endsWith("/") ? textureStart : (textureStart + "/"); - this.spriteLocations = new String[maxSprites]; - for (int i = 0; i < maxSprites; i++) { - spriteLocations[i] = textureLocationStart + modUniqueTag + (textureSuffixes == null ? "" : textureSuffixes[i]); - } - this.behaviourFactory = factory; - } - - @SideOnly(Side.CLIENT) - public TextureAtlasSprite getSprite(int index) { - if (sprites == null || index < 0 || index >= sprites.length) { - BCLog.logger.warn("Tried to get the sprite index " + index + " for " + globalUniqueTag); - return Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite(); - } - return sprites[index]; - } - - @SideOnly(Side.CLIENT) - public void registerSprites(TextureMap map) { - sprites = new TextureAtlasSprite[maxSprites]; - for (int i = 0; i < spriteLocations.length; i++) { - String string = spriteLocations[i]; - ResourceLocation location = new ResourceLocation(string); - sprites[i] = map.registerSprite(location); - } - } - - @Override - public String toString() { - return "PipeDefinition [globalUniqueTag=" + globalUniqueTag + ", modUniqueTag=" + modUniqueTag + ", behaviourFactory=" + behaviourFactory - + ", type=" + type + ", spriteLocations=" + Arrays.toString(spriteLocations) + "]"; - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventConnection_BC8.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventConnection_BC8.java deleted file mode 100644 index f03e246a88..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventConnection_BC8.java +++ /dev/null @@ -1,88 +0,0 @@ -package buildcraft.api.transport.pipe_bc8.event_bc8; - -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -import buildcraft.api.transport.IPipeConnection; -import buildcraft.api.transport.pipe_bc8.IConnection_BC8; -import buildcraft.api.transport.pipe_bc8.IPipe_BC8; - -public interface IPipeEventConnection_BC8 extends IPipeEvent_BC8 { - /** @return The connection object that is used. */ - IConnection_BC8 getConnection(); - - /** @return The face that this connection is over */ - EnumFacing getFace(); - - public interface AttemptCreate extends IPipeEventConnection_BC8 { - /** Calling this will disallow ANY connection to the pipe, regardless of any previous arguments passed. */ - void disallow(); - - /** Calling this any number of times will allow the connection to the pipe, but only if {@link #disallow()} has - * not been called. If this is never called, and the connection override type is DEFAULT (As specified by - * {@link IPipeConnection}) then there will be no connection. */ - void couldAccept(); - - /** @return The connection object that will be used if this event is not blocked. */ - @Override - IConnection_BC8 getConnection(); - - Object with(); - - public interface Pipe extends AttemptCreate { - @Override - IPipe_BC8 with(); - } - - public interface Tile extends AttemptCreate { - @Override - TileEntity with(); - } - - public interface MovableEntity extends AttemptCreate { - @Override - Entity with(); - } - } - - /** Fired after the connection object has been created and bound in the pipe, such that - * {@link IPipe_BC8#getConnections()} will include {@link #getFace()} mapped to {@link #getConnection()} */ - public interface Create extends IPipeEventConnection_BC8 { - Object with(); - - public interface Pipe extends Create { - @Override - IPipe_BC8 with(); - } - - public interface Tile extends Create { - @Override - TileEntity with(); - } - - public interface MovableEntity extends Create { - @Override - Entity with(); - } - } - - public interface Destroy extends IPipeEventConnection_BC8 { - Object with(); - - public interface Pipe extends Destroy { - @Override - IPipe_BC8 with(); - } - - public interface Tile extends Destroy { - @Override - TileEntity with(); - } - - public interface MovableEntity extends Destroy { - @Override - Entity with(); - } - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventContents_BC8.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventContents_BC8.java deleted file mode 100644 index 5b0c1f8940..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventContents_BC8.java +++ /dev/null @@ -1,88 +0,0 @@ -package buildcraft.api.transport.pipe_bc8.event_bc8; - -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -import buildcraft.api.transport.pipe_bc8.IPipeContents; -import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable; -import buildcraft.api.transport.pipe_bc8.IPipe_BC8; - -/** In all events, the contents have had the appropriate variables set up as if they were in the pipe at the time the - * event is fired. */ -public interface IPipeEventContents_BC8 extends IPipeEvent_BC8 { - IPipeContents getContents(); - - // Attempts to put in some contents - - /** Checks to make sure all parts of the pipe agree to the insertion. The pipe object will automatically fire this - * if you fire an {@link Enter} event, so most of the time you dod not actually need to check this yourself. */ - public interface AttemptEnter extends IPipeEventContents_BC8 { - void disallow(); - - /** Gets the direction that the contents came from. So if this was a pipe below, and the item was moving - * upwards, this would be {@link EnumFacing#DOWN} */ - EnumFacing getFrom(); - - /** Gets the *thing* that tried to insert to this pipe. Most of the time this will be a tile entity, however it - * might be a robot or anything else an addon can think of. */ - Object getInserter(); - - public interface Pipe extends AttemptEnter { - @Override - IPipe_BC8 getInserter(); - } - - /** Fired whenever a tile entity attempts to insert an item. NOTE: this will NEVER call with a pipe as the - * argument. */ - public interface Tile extends AttemptEnter { - @Override - TileEntity getInserter(); - } - - public interface MovableEntity extends AttemptEnter { - @Override - Entity getInserter(); - } - } - - // Actually puts in the contents - - /** Fired after {@link AttemptEnter}. The contents will be added to the pipe at some time during this event, but the - * contents will NEVER change during the event interval. Also the contents will be the same object as when they have - * been added to the pipe. NOTE: The pipe object will automatically fire {@link AttemptEnter} before firing this - * event, just to check if the contents can be inserted. You do not have to manually fire {@link AttemptEnter} - * yourself. */ - public interface Enter extends IPipeEventContents_BC8 { - @Override - IPipeContentsEditable getContents(); - - /** Gets the direction that the contents came from. So if this was a pipe below, and the item was moving - * upwards, this would be {@link EnumFacing#DOWN} */ - EnumFacing getFrom(); - - /** Call this (while the event is firing) to make {@link #hasBeenHandled()} return true */ - void handle(); - - /** @return If a listener has handled the enter event. (Usually if this returns false after an event was fired - * it means that something went very wrong somewhere, and the contents has NOT been used up.) If this - * does return false you should keep the contents to yourself. */ - boolean hasBeenHandled(); - } - - /** Fired after the contents have been removed from the pipe, but before they have been dropped onto the ground or - * added to a different pipe or inventory. */ - public interface Exit extends IPipeEventContents_BC8 { - @Override - IPipeContentsEditable getContents(); - } - - public interface ChangeSpeed extends IPipeEventContents_BC8 { - /** @return the normalized speed for this contents. For items the actual speed has been multiplied by a constant - * that ensures that this returns 1 if the item is going at normal speed through a cobblestone pipe, and - * 4 if it is going at maximum speed through a gold pipe. */ - double getNormalizedSpeed(); - - void setNormalizedSpeed(double speed); - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventInteract_BC8.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventInteract_BC8.java deleted file mode 100644 index 5f73794dd9..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventInteract_BC8.java +++ /dev/null @@ -1,29 +0,0 @@ -package buildcraft.api.transport.pipe_bc8.event_bc8; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; - -import buildcraft.api.tools.IToolWrench; -import buildcraft.api.transport.pipe_bc8.IPipeListener; - -public interface IPipeEventInteract_BC8 extends IPipeEvent_BC8 { - EntityPlayer getPlayer(); - - /** Fired whenever a player selects a pipe. */ - public interface Select extends IPipeEventInteract_BC8 { - /** This should be called for every {@link AxisAlignedBB} that makes up your listener, and with your listener. - * The listener will receive the actual event directly. */ - void testBB(AxisAlignedBB aabb, IPipeListener callback); - } - - public interface Activate extends IPipeEventInteract_BC8 {} - - public interface UseItem extends IPipeEventInteract_BC8 { - ItemStack getItemStack(); - } - - public interface UseWrench extends IPipeEventInteract_BC8 { - IToolWrench getWrench(); - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEvent_BC8.java b/dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEvent_BC8.java deleted file mode 100644 index 927aa34ed5..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEvent_BC8.java +++ /dev/null @@ -1,26 +0,0 @@ -package buildcraft.api.transport.pipe_bc8.event_bc8; - -import buildcraft.api.transport.pipe_bc8.IPipePropertyProvider.IPipePropertyImplicit; -import buildcraft.api.transport.pipe_bc8.IPipe_BC8; - -public interface IPipeEvent_BC8 { - IPipe_BC8 getPipe(); - - public interface Tick extends IPipeEvent_BC8 { - long getCurrentTick(); - - public interface Client extends Tick {} - - public interface Server extends Tick {} - } - - public interface PropertyQuery extends IPipeEvent_BC8 { - Class getTypeClass(); - - IPipePropertyImplicit getProperty(); - - T getValue(); - - void setValue(T newValue); - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pluggable/IConnectionMatrix.java b/dependencies/main/java/buildcraft/api/transport/pluggable/IConnectionMatrix.java deleted file mode 100644 index 4bede4d03e..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pluggable/IConnectionMatrix.java +++ /dev/null @@ -1,7 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import net.minecraft.util.EnumFacing; - -public interface IConnectionMatrix { - boolean isConnected(EnumFacing face); -} diff --git a/dependencies/main/java/buildcraft/api/transport/pluggable/IFacadePluggable.java b/dependencies/main/java/buildcraft/api/transport/pluggable/IFacadePluggable.java deleted file mode 100644 index a3ad9f329b..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pluggable/IFacadePluggable.java +++ /dev/null @@ -1,11 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import net.minecraft.block.state.IBlockState; - -public interface IFacadePluggable { - IBlockState getCurrentState(); - - boolean isTransparent(); - - boolean isHollow(); -} diff --git a/dependencies/main/java/buildcraft/api/transport/pluggable/IPipePluggableDynamicRenderer.java b/dependencies/main/java/buildcraft/api/transport/pluggable/IPipePluggableDynamicRenderer.java deleted file mode 100644 index 61c69bed4d..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pluggable/IPipePluggableDynamicRenderer.java +++ /dev/null @@ -1,13 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import net.minecraft.util.EnumFacing; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import buildcraft.api.transport.IPipe; - -@SideOnly(Side.CLIENT) -public interface IPipePluggableDynamicRenderer { - void renderDynamicPluggable(IPipe pipe, EnumFacing side, PipePluggable pipePluggable, double x, double y, double z); -} diff --git a/dependencies/main/java/buildcraft/api/transport/pluggable/IPipePluggableItem.java b/dependencies/main/java/buildcraft/api/transport/pluggable/IPipePluggableItem.java deleted file mode 100644 index b9295e5f0a..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pluggable/IPipePluggableItem.java +++ /dev/null @@ -1,10 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; - -import buildcraft.api.transport.IPipe; - -public interface IPipePluggableItem { - PipePluggable createPipePluggable(IPipe pipe, EnumFacing side, ItemStack stack); -} diff --git a/dependencies/main/java/buildcraft/api/transport/pluggable/IPipePluggableState.java b/dependencies/main/java/buildcraft/api/transport/pluggable/IPipePluggableState.java deleted file mode 100644 index 7b657dfd06..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pluggable/IPipePluggableState.java +++ /dev/null @@ -1,9 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import net.minecraft.util.EnumFacing; - -public interface IPipePluggableState { - IConnectionMatrix getPluggableConnections(); - - PipePluggable getPluggable(EnumFacing face); -} diff --git a/dependencies/main/java/buildcraft/api/transport/pluggable/IPipeRenderState.java b/dependencies/main/java/buildcraft/api/transport/pluggable/IPipeRenderState.java deleted file mode 100644 index d923061fdd..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pluggable/IPipeRenderState.java +++ /dev/null @@ -1,5 +0,0 @@ -package buildcraft.api.transport.pluggable; - -public interface IPipeRenderState { - IConnectionMatrix getPipeConnectionMatrix(); -} diff --git a/dependencies/main/java/buildcraft/api/transport/pluggable/IPluggableModelBaker.java b/dependencies/main/java/buildcraft/api/transport/pluggable/IPluggableModelBaker.java deleted file mode 100644 index 829eedaa80..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pluggable/IPluggableModelBaker.java +++ /dev/null @@ -1,17 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import com.google.common.collect.ImmutableList; - -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.vertex.VertexFormat; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public interface IPluggableModelBaker> { - /** @return The vertex format used to generate the quads. */ - VertexFormat getVertexFormat(); - - ImmutableList bake(K key); -} diff --git a/dependencies/main/java/buildcraft/api/transport/pluggable/PipePluggable.java b/dependencies/main/java/buildcraft/api/transport/pluggable/PipePluggable.java deleted file mode 100644 index 5d505904c2..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pluggable/PipePluggable.java +++ /dev/null @@ -1,62 +0,0 @@ -/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com - * - * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which - * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -package buildcraft.api.transport.pluggable; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import buildcraft.api.core.INBTStoreable; -import buildcraft.api.core.ISerializable; -import buildcraft.api.transport.IPipeTile; - -/** An IPipePluggable MUST have an empty constructor for client-side rendering! */ -public abstract class PipePluggable implements INBTStoreable, ISerializable { - public abstract ItemStack[] getDropItems(IPipeTile pipe); - - public void update(IPipeTile pipe, EnumFacing direction) { - - } - - public void onAttachedPipe(IPipeTile pipe, EnumFacing direction) { - validate(pipe, direction); - } - - public void onDetachedPipe(IPipeTile pipe, EnumFacing direction) { - invalidate(); - } - - public abstract boolean isBlocking(IPipeTile pipe, EnumFacing direction); - - public void invalidate() { - - } - - public void validate(IPipeTile pipe, EnumFacing direction) { - - } - - public boolean isSolidOnSide(IPipeTile pipe, EnumFacing direction) { - return false; - } - - public abstract AxisAlignedBB getBoundingBox(EnumFacing side); - - @SideOnly(Side.CLIENT) - public IPipePluggableDynamicRenderer getDynamicRenderer() { - return null; - } - - @SideOnly(Side.CLIENT) - public abstract PluggableModelKey getModelRenderKey(EnumWorldBlockLayer layer, EnumFacing side); - - public boolean requiresRenderUpdate(PipePluggable old) { - return true; - } -} diff --git a/dependencies/main/java/buildcraft/api/transport/pluggable/PluggableModelKey.java b/dependencies/main/java/buildcraft/api/transport/pluggable/PluggableModelKey.java deleted file mode 100644 index 3094cbb221..0000000000 --- a/dependencies/main/java/buildcraft/api/transport/pluggable/PluggableModelKey.java +++ /dev/null @@ -1,45 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import java.util.Arrays; -import java.util.Objects; - -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public abstract class PluggableModelKey> { - public final EnumWorldBlockLayer layer; - public final IPluggableModelBaker baker; - public final EnumFacing side; - private final int hash; - - public PluggableModelKey(EnumWorldBlockLayer layer, IPluggableModelBaker baker, EnumFacing side) { - this.layer = layer; - if (layer != EnumWorldBlockLayer.CUTOUT && layer != EnumWorldBlockLayer.TRANSLUCENT) { - throw new IllegalArgumentException("Can only use CUTOUT or TRANSLUCENT at the moment (was " + layer + ")"); - } - if (baker == null) throw new NullPointerException("baker"); - this.baker = baker; - this.side = side; - /* Don't inclue the block layer in the hash code as there are different caches for cutout and translucent */ - this.hash = Arrays.hashCode(new int[] { System.identityHashCode(baker), Objects.hashCode(side) }); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - PluggableModelKey other = (PluggableModelKey) obj; - if (baker != other.baker) return false; - if (side != other.side) return false; - return true; - } - - @Override - public int hashCode() { - return hash; - } -} diff --git a/dependencies/main/java/codechicken/core/CCUpdateChecker.java b/dependencies/main/java/codechicken/core/CCUpdateChecker.java index 9fbb4800f9..c26fce5222 100644 --- a/dependencies/main/java/codechicken/core/CCUpdateChecker.java +++ b/dependencies/main/java/codechicken/core/CCUpdateChecker.java @@ -3,7 +3,8 @@ import codechicken.core.launch.CodeChickenCorePlugin; import com.google.common.base.Function; import net.minecraft.client.Minecraft; -import net.minecraft.util.ChatComponentText; +import net.minecraft.util.text.TextComponentString; +import net.minecraftforge.common.ForgeVersion; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.versioning.ComparableVersion; import net.minecraftforge.fml.relauncher.FMLInjectionData; @@ -57,8 +58,8 @@ public static void tick() { } synchronized (updates) { - for (String s : updates) { - mc.thePlayer.addChatMessage(new ChatComponentText(s)); + for (String updateMessage : updates) { + mc.thePlayer.addChatMessage(new TextComponentString(updateMessage)); } updates.clear(); } @@ -84,9 +85,10 @@ public Void apply(String ret) { CodeChickenCorePlugin.logger.error("Failed to check update for " + mod + " returned: " + ret); return null; } - ComparableVersion newversion = new ComparableVersion(ret.substring(5)); - if (newversion.compareTo(new ComparableVersion(version)) > 0) { - addUpdateMessage("Version " + newversion + " of " + mod + " is available"); + ComparableVersion newVersion = new ComparableVersion(ret.substring(5)); + if (newVersion.compareTo(new ComparableVersion(version)) > 0) { + ModDescriptionEnhancer.setUpdateStatus(mod, ForgeVersion.Status.OUTDATED, newVersion); + addUpdateMessage("Version " + newVersion + " of " + mod + " is available"); } return null; } diff --git a/dependencies/main/java/codechicken/core/GuiModListScroll.java b/dependencies/main/java/codechicken/core/GuiModListScroll.java deleted file mode 100644 index 1865588c16..0000000000 --- a/dependencies/main/java/codechicken/core/GuiModListScroll.java +++ /dev/null @@ -1,169 +0,0 @@ -package codechicken.core; - -import codechicken.core.launch.CodeChickenCorePlugin; -import codechicken.lib.gui.GuiDraw; -import codechicken.lib.render.RenderUtils; -import codechicken.lib.vec.Rectangle4i; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.client.GuiModList; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.common.ModMetadata; -import org.lwjgl.BufferUtils; -import org.lwjgl.input.Keyboard; - -import javax.imageio.ImageIO; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.LinkedList; -import java.util.List; - -import static org.lwjgl.opengl.GL11.*; - -public class GuiModListScroll { - private static List scrollMods = new LinkedList(); - - public static void register(Object mod) { - register(FMLCommonHandler.instance().findContainerFor(mod)); - } - - private static void register(ModContainer mod) { - if (!RenderUtils.checkEnableStencil()) { - CodeChickenCorePlugin.logger.error("Unable to do mod description scrolling due to lack of stencil buffer"); - } else { - scrollMods.add(mod); - } - } - - private static void screenshotStencil(int x) { - Dimension d = GuiDraw.displayRes(); - ByteBuffer buf = BufferUtils.createByteBuffer(d.width * d.height); - BufferedImage img = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_RGB); - - glPixelStorei(GL_PACK_ALIGNMENT, 1); - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glReadPixels(0, 0, d.width, d.height, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, buf); - for (int i = 0; i < d.width; i++) { - for (int j = 0; j < d.height; j++) { - img.setRGB(i, d.height - j - 1, buf.get(j * d.width + i) == 0 ? 0 : 0xFFFFFF); - } - } - try { - ImageIO.write(img, "png", new File("stencil" + x + ".png")); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private static ModContainer lastMod; - private static double scroll; - private static double lastFrameTime; - private static double timeStart; - - public static void draw(GuiModList gui, int mouseX, int mouseY) { - ModContainer selectedMod = ReflectionManager.getField(GuiModList.class, ModContainer.class, gui, "selectedMod"); - if (selectedMod != lastMod) { - lastMod = selectedMod; - scroll = 0; - timeStart = ClientUtils.getRenderTime(); - } - if (!scrollMods.contains(selectedMod) || selectedMod.getMetadata().autogenerated) { - return; - } - - int y1 = calcDescY(gui, selectedMod); - int y1draw = y1 + 10; - int y2 = gui.height - 38; - int x1 = ReflectionManager.getField(GuiModList.class, Integer.class, gui, "listWidth") + 20; - int x2 = gui.width - 20; - if (x2 - x1 <= 20) { - return; - } - - glEnable(GL_STENCIL_TEST); - glStencilFunc(GL_ALWAYS, 1, 1); - GlStateManager.colorMask(false, false, false, false); - glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO); - GuiDraw.drawRect(0, 0, gui.width, gui.height, -1);//clear stencil buffer - - screenshotStencil(1); - - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - GuiDraw.drawRect(x1, y1, gui.width - x1, gui.height - y1, -1);//add description area (even below button) - glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO); - GuiDraw.drawRect(gui.width / 2 - 75, y2, 200, 20, -1);//subtract done button - - screenshotStencil(2); - - GlStateManager.colorMask(true, true, true, true); - glStencilFunc(GL_EQUAL, 1, 1); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - - gui.drawDefaultBackground();//fill stencil with background - - GlStateManager.colorMask(false, false, false, false); - glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO); - GuiDraw.drawRect(0, 0, gui.width, gui.height, -1); - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - GuiDraw.drawRect(x1, y1draw, x2 - x1, y2 - y1draw, -1); - - screenshotStencil(3); - - GlStateManager.colorMask(true, true, true, true); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - - String description = selectedMod.getMetadata().description; - int height = GuiDraw.fontRenderer.listFormattedStringToWidth(description, x2 - x1).size() * GuiDraw.fontRenderer.FONT_HEIGHT; - - boolean needsScroll = height > y2 - y1draw; - if ((ClientUtils.getRenderTime() - timeStart) > 40 && needsScroll) { - double dt = ClientUtils.getRenderTime() - lastFrameTime; - if (new Rectangle4i(x1, y1draw, x2 - x1, y2 - y1draw).contains(mouseX, mouseY)) { - double d = Keyboard.isKeyDown(Keyboard.KEY_UP) ? -1 : Keyboard.isKeyDown(Keyboard.KEY_DOWN) ? 1 : 0; - scroll += d * dt * 1.5; - } else { - scroll += dt * 0.2; - } - } - lastFrameTime = ClientUtils.getRenderTime(); - - //draw description - - double dy = scroll % (height + 20); - GlStateManager.pushMatrix(); - GlStateManager.translate(0, -dy, 0); - GuiDraw.fontRenderer.drawSplitString(description, x1, y1draw, x2 - x1, 0xDDDDDD); - if (needsScroll) { - GlStateManager.translate(0, height + 20, 0); - GuiDraw.fontRenderer.drawSplitString(description, x1, y1draw, x2 - x1, 0xDDDDDD); - } - GlStateManager.popMatrix(); - - glDisable(GL_STENCIL_TEST); - } - - /** - * Does not add the last 10 px space before the description normally starts - * Ignores empty child mods expecting a background draw overwrite - */ - private static int calcDescY(GuiModList gui, ModContainer mod) { - ModMetadata meta = mod.getMetadata(); - int y = 35; - if (!!meta.logoFile.isEmpty() && ReflectionManager.getField(GuiModList.class, ResourceLocation.class, gui, "cachedLogo") != null) { - y += 65; - } - y += 12; // title - y += 40; // necessary lines - if (!meta.credits.isEmpty()) { - y += 10; - } - if (!meta.childMods.isEmpty()) { - y += 10; - } - return y; - } -} diff --git a/dependencies/main/java/codechicken/core/IStringMatcher.java b/dependencies/main/java/codechicken/core/IStringMatcher.java deleted file mode 100644 index 781b17ab46..0000000000 --- a/dependencies/main/java/codechicken/core/IStringMatcher.java +++ /dev/null @@ -1,5 +0,0 @@ -package codechicken.core; - -public interface IStringMatcher { - public boolean matches(String test); -} diff --git a/dependencies/main/java/codechicken/core/ModDescriptionEnhancer.java b/dependencies/main/java/codechicken/core/ModDescriptionEnhancer.java new file mode 100644 index 0000000000..884b1ce171 --- /dev/null +++ b/dependencies/main/java/codechicken/core/ModDescriptionEnhancer.java @@ -0,0 +1,55 @@ +package codechicken.core; + +import codechicken.lib.util.ReflectionManager; +import net.minecraft.util.text.TextFormatting; +import net.minecraftforge.common.ForgeVersion; +import net.minecraftforge.common.ForgeVersion.CheckResult; +import net.minecraftforge.common.ForgeVersion.Status; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.ModContainer; +import net.minecraftforge.fml.common.versioning.ComparableVersion; + +import java.util.HashMap; +import java.util.Map; + +@SuppressWarnings("unchecked") +public class ModDescriptionEnhancer { + public static void enhanceMod(Object mod) { + ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod); + mc.getMetadata().description = enhanceDesc(mc.getMetadata().description); + } + + public static String enhanceDesc(String desc) { + int supportersIdx = desc.indexOf("Supporters:"); + if (supportersIdx < 0) { + return desc; + } + + String supportersList = desc.substring(supportersIdx); + supportersList = supportersList.replaceAll("\\b(\\w+)\\b", TextFormatting.AQUA + "$1"); + return desc.substring(0, supportersIdx) + supportersList; + } + + public static void setUpdateStatus(String modId, Status status, ComparableVersion version) { + try { + ModContainer modContainer = FMLCommonHandler.instance().findContainerFor(modId); + Map changes = new HashMap(); + CheckResult result = ReflectionManager.newInstance(CheckResult.class, status, version, changes, ""); + setUpdateStatus(modContainer, result); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void setUpdateStatus(ModContainer container, CheckResult result) { + try { + Map resultMap = ReflectionManager.getField(ForgeVersion.class, Map.class, null, "results"); + synchronized (resultMap) { + resultMap.put(container, result); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/dependencies/main/java/codechicken/core/asm/CodeChickenAccessTransformer.java b/dependencies/main/java/codechicken/core/asm/CodeChickenAccessTransformer.java deleted file mode 100644 index f5acdf93bf..0000000000 --- a/dependencies/main/java/codechicken/core/asm/CodeChickenAccessTransformer.java +++ /dev/null @@ -1,70 +0,0 @@ -package codechicken.core.asm; - -import codechicken.lib.asm.ObfMapping; -import com.google.common.collect.ImmutableBiMap; -import net.minecraftforge.fml.common.asm.transformers.AccessTransformer; -import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; - -import java.io.IOException; -import java.lang.reflect.Field; - -public class CodeChickenAccessTransformer extends AccessTransformer { - private static boolean makeAllPublic; - private static Field f_classNameBiMap; - private static Object emptyMap = ImmutableBiMap.of(); - - public CodeChickenAccessTransformer() throws IOException { - super(); - loadPublicConfig(); - } - - private void loadPublicConfig() { - if (ObfMapping.obfuscated) { - return; - } - - makeAllPublic = CodeChickenCoreModContainer.config.getTag("dev.runtimePublic").setComment("Enabling this setting will make all minecraft classes public at runtime in MCP just as they are in modloader." + - "\nYou should ONLY use this when you are testing with a mod that relies on runtime publicity and doesn't include access transformers." + - "\nSuch mods are doing the wrong thing and should be fixed.").getBooleanValue(false); - - if (!makeAllPublic) { - return; - } - - try { - f_classNameBiMap = FMLDeobfuscatingRemapper.class.getDeclaredField("classNameBiMap"); - f_classNameBiMap.setAccessible(true); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - @Override - public byte[] transform(String name, String transformedName, byte[] bytes) { - boolean setPublic = makeAllPublic && name.startsWith("net.minecraft."); - if (setPublic) { - setClassMap(name); - } - bytes = super.transform(name, transformedName, bytes); - if (setPublic) { - restoreClassMap(); - } - return bytes; - } - - private void restoreClassMap() { - try { - f_classNameBiMap.set(FMLDeobfuscatingRemapper.INSTANCE, emptyMap); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private void setClassMap(String name) { - try { - f_classNameBiMap.set(FMLDeobfuscatingRemapper.INSTANCE, ImmutableBiMap.of(name.replace('.', '/'), "")); - } catch (Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/dependencies/main/java/codechicken/core/asm/CodeChickenCoreModContainer.java b/dependencies/main/java/codechicken/core/asm/CodeChickenCoreModContainer.java deleted file mode 100644 index 8b17d1df42..0000000000 --- a/dependencies/main/java/codechicken/core/asm/CodeChickenCoreModContainer.java +++ /dev/null @@ -1,83 +0,0 @@ -package codechicken.core.asm; - -import codechicken.core.CCUpdateChecker; -import codechicken.core.featurehack.LiquidTextures; -import codechicken.core.internal.CCCEventHandler; -import codechicken.core.launch.CodeChickenCorePlugin; -import codechicken.lib.config.ConfigFile; -import com.google.common.eventbus.EventBus; -import com.google.common.eventbus.Subscribe; -import net.minecraft.launchwrapper.Launch; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.DummyModContainer; -import net.minecraftforge.fml.common.LoadController; -import net.minecraftforge.fml.common.MetadataCollection; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.versioning.ArtifactVersion; -import net.minecraftforge.fml.common.versioning.VersionParser; -import net.minecraftforge.fml.common.versioning.VersionRange; - -import java.io.File; -import java.util.LinkedList; -import java.util.List; - -public class CodeChickenCoreModContainer extends DummyModContainer { - public static ConfigFile config; - - public static void loadConfig() { - if (config == null) { - config = new ConfigFile(new File(CodeChickenCorePlugin.minecraftDir, "config/CodeChickenCore.cfg")).setComment("CodeChickenCore configuration file."); - } - } - - public CodeChickenCoreModContainer() { - super(MetadataCollection.from(MetadataCollection.class.getResourceAsStream("/cccmod.info"), "CodeChickenCore").getMetadataForId("CodeChickenCore", null)); - } - - @Override - public List getDependants() { - LinkedList deps = new LinkedList(); - //Don't add the dependants if we are in deobf. - if ((Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")) { - return deps; - } - if (!getVersion().contains("$")) { - deps.add(VersionParser.parseVersionReference("NotEnoughItems@[2.0.1,)")); - //deps.add(VersionParser.parseVersionReference("EnderStorage@[1.4.6,)")); - //deps.add(VersionParser.parseVersionReference("ChickenChunks@[1.3.5,)")); - //deps.add(VersionParser.parseVersionReference("Translocator@[1.1.2,)")); - //deps.add(VersionParser.parseVersionReference("WR-CBE|Core@[1.4.2,)")); - } - return deps; - } - - @Override - public boolean registerBus(EventBus bus, LoadController controller) { - bus.register(this); - return true; - } - - @Subscribe - public void preInit(FMLPreInitializationEvent event) { - if (event.getSide().isClient()) { - LiquidTextures.init(); - } - } - - @Subscribe - public void init(FMLInitializationEvent event) { - if (event.getSide().isClient()) { - if (config.getTag("checkUpdates").getBooleanValue(true)) { - CCUpdateChecker.updateCheck(getModId()); - } - //FMLCommonHandler.instance().bus().register(new CCCEventHandler()); - MinecraftForge.EVENT_BUS.register(new CCCEventHandler()); - } - } - - @Override - public VersionRange acceptableMinecraftVersionRange() { - return VersionParser.parseRange(CodeChickenCorePlugin.mcVersion); - } -} diff --git a/dependencies/main/java/codechicken/core/asm/DefaultImplementationTransformer.java b/dependencies/main/java/codechicken/core/asm/DefaultImplementationTransformer.java deleted file mode 100644 index 7259aaa6df..0000000000 --- a/dependencies/main/java/codechicken/core/asm/DefaultImplementationTransformer.java +++ /dev/null @@ -1,94 +0,0 @@ -package codechicken.core.asm; - -import codechicken.lib.asm.ASMHelper; -import codechicken.lib.asm.ClassHeirachyManager; -import codechicken.lib.asm.ObfMapping; -import net.minecraft.launchwrapper.IClassTransformer; -import net.minecraft.launchwrapper.LaunchClassLoader; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.MethodNode; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; - -public class DefaultImplementationTransformer implements IClassTransformer { - private static LaunchClassLoader cl = (LaunchClassLoader) ClassHeirachyManager.class.getClassLoader(); - - private static ClassNode getClassNode(String name) { - try { - return ASMHelper.createClassNode(cl.getClassBytes(name.replace('/', '.'))); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - static class InterfaceImpl { - public final String iname; - public ArrayList impls = new ArrayList(); - - public InterfaceImpl(String iname, String cname) { - this.iname = iname; - HashSet names = new HashSet(); - ClassNode inode = getClassNode(iname); - for (MethodNode method : inode.methods) { - names.add(method.name + method.desc); - } - - ClassNode cnode = getClassNode(cname); - for (MethodNode method : cnode.methods) { - if (names.contains(method.name + method.desc)) { - impls.add(method); - method.desc = new ObfMapping(cnode.name, method.name, method.desc).toRuntime().s_desc; - } - } - } - - public boolean patch(ClassNode cnode) { - LinkedList names = new LinkedList(); - for (MethodNode method : cnode.methods) { - ObfMapping m = new ObfMapping(cnode.name, method.name, method.desc).toRuntime(); - names.add(m.s_name + m.s_desc); - } - - boolean changed = false; - for (MethodNode impl : impls) { - if (names.contains(impl.name + impl.desc)) { - continue; - } - - MethodNode copy = new MethodNode(impl.access, impl.name, impl.desc, impl.signature, impl.exceptions == null ? null : impl.exceptions.toArray(new String[0])); - ASMHelper.copy(impl, copy); - cnode.methods.add(impl); - changed = true; - } - return changed; - } - } - - private static HashMap impls = new HashMap(); - - public static void registerDefaultImpl(String iname, String cname) { - impls.put(iname.replace('.', '/'), new InterfaceImpl(iname, cname)); - } - - @Override - public byte[] transform(String name, String transformedName, byte[] bytes) { - if (transformedName.startsWith("net.minecraft") || impls.isEmpty()) { - return bytes; - } - - ClassNode cnode = ASMHelper.createClassNode(bytes); - boolean changed = false; - for (String iname : cnode.interfaces) { - InterfaceImpl impl = impls.get(iname); - if (impl != null) { - changed |= impl.patch(cnode); - } - } - - return changed ? ASMHelper.createBytes(cnode, 0) : bytes; - } -} diff --git a/dependencies/main/java/codechicken/core/asm/DelegatedTransformer.java b/dependencies/main/java/codechicken/core/asm/DelegatedTransformer.java deleted file mode 100644 index 78ab1d99ef..0000000000 --- a/dependencies/main/java/codechicken/core/asm/DelegatedTransformer.java +++ /dev/null @@ -1,137 +0,0 @@ -package codechicken.core.asm; - -import net.minecraft.launchwrapper.IClassTransformer; -import net.minecraft.launchwrapper.Launch; -import net.minecraft.launchwrapper.LaunchClassLoader; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.Opcodes; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Map; -import java.util.Stack; -import java.util.jar.JarFile; -import java.util.zip.ZipEntry; - -import static codechicken.core.launch.CodeChickenCorePlugin.logger; - -public class DelegatedTransformer implements IClassTransformer { - private static ArrayList delegatedTransformers; - private static Method m_defineClass; - private static Field f_cachedClasses; - - public DelegatedTransformer() { - delegatedTransformers = new ArrayList(); - try { - m_defineClass = ClassLoader.class.getDeclaredMethod("defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE); - m_defineClass.setAccessible(true); - f_cachedClasses = LaunchClassLoader.class.getDeclaredField("cachedClasses"); - f_cachedClasses.setAccessible(true); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - @Override - public byte[] transform(String name, String tname, byte[] bytes) { - if (bytes == null) { - return null; - } - for (IClassTransformer trans : delegatedTransformers) { - bytes = trans.transform(name, tname, bytes); - } - return bytes; - } - - public static void addTransformer(String transformer, JarFile jar, File jarFile) { - logger.debug("Adding CCTransformer: " + transformer); - try { - byte[] bytes; - bytes = Launch.classLoader.getClassBytes(transformer); - - if (bytes == null) { - String resourceName = transformer.replace('.', '/') + ".class"; - ZipEntry entry = jar.getEntry(resourceName); - if (entry == null) { - throw new Exception("Failed to add transformer: " + transformer + ". Entry not found in jar file " + jarFile.getName()); - } - - bytes = readFully(jar.getInputStream(entry)); - } - - defineDependancies(bytes, jar, jarFile); - Class clazz = defineClass(transformer, bytes); - - if (!IClassTransformer.class.isAssignableFrom(clazz)) { - throw new Exception("Failed to add transformer: " + transformer + " is not an instance of IClassTransformer"); - } - - IClassTransformer classTransformer; - try { - classTransformer = (IClassTransformer) clazz.getDeclaredConstructor(File.class).newInstance(jarFile); - } catch (NoSuchMethodException nsme) { - classTransformer = (IClassTransformer) clazz.newInstance(); - } - delegatedTransformers.add(classTransformer); - } catch (Exception e) { - e.printStackTrace(); - } - } - - private static void defineDependancies(byte[] bytes, JarFile jar, File jarFile) throws Exception { - defineDependancies(bytes, jar, jarFile, new Stack()); - } - - private static void defineDependancies(byte[] bytes, JarFile jar, File jarFile, Stack depStack) throws Exception { - ClassReader reader = new ClassReader(bytes); - DependancyLister lister = new DependancyLister(Opcodes.ASM4); - reader.accept(lister, 0); - - depStack.push(reader.getClassName()); - - for (String dependancy : lister.getDependancies()) { - if (depStack.contains(dependancy)) { - continue; - } - - try { - Launch.classLoader.loadClass(dependancy.replace('/', '.')); - } catch (ClassNotFoundException cnfe) { - ZipEntry entry = jar.getEntry(dependancy + ".class"); - if (entry == null) { - throw new Exception("Dependency " + dependancy + " not found in jar file " + jarFile.getName()); - } - - byte[] depbytes = readFully(jar.getInputStream(entry)); - defineDependancies(depbytes, jar, jarFile, depStack); - - logger.debug("Defining dependancy: " + dependancy); - - defineClass(dependancy.replace('/', '.'), depbytes); - } - } - - depStack.pop(); - } - - private static Class defineClass(String classname, byte[] bytes) throws Exception { - Class clazz = (Class) m_defineClass.invoke(Launch.classLoader, classname, bytes, 0, bytes.length); - ((Map>) f_cachedClasses.get(Launch.classLoader)).put(classname, clazz); - return clazz; - } - - public static byte[] readFully(InputStream stream) throws IOException { - ByteArrayOutputStream bos = new ByteArrayOutputStream(stream.available()); - int r; - while ((r = stream.read()) != -1) { - bos.write(r); - } - - return bos.toByteArray(); - } -} diff --git a/dependencies/main/java/codechicken/core/asm/DependancyLister.java b/dependencies/main/java/codechicken/core/asm/DependancyLister.java deleted file mode 100644 index 80bd241090..0000000000 --- a/dependencies/main/java/codechicken/core/asm/DependancyLister.java +++ /dev/null @@ -1,79 +0,0 @@ -package codechicken.core.asm; - -import org.objectweb.asm.*; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class DependancyLister extends ClassVisitor { - private static Pattern classdesc = Pattern.compile("L(.+?);"); - - private class DependancyMethodLister extends MethodVisitor { - public DependancyMethodLister(int api) { - super(api); - } - - @Override - public void visitFieldInsn(int opcode, String owner, String name, String desc) { - dependDesc(desc); - } - - @Override - public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) { - dependDesc(desc); - } - - @Override - public void visitMethodInsn(int opcode, String owner, String name, String desc) { - depend(owner); - dependDesc(desc); - } - } - - private HashSet dependancies = new HashSet(); - - public DependancyLister(int api) { - super(api); - } - - @Override - public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { - dependDesc(desc); - return null; - } - - private void dependDesc(String desc) { - Matcher match = classdesc.matcher(desc); - while (match.find()) { - String s = match.group(); - depend(s.substring(1, s.length() - 1)); - } - } - - private void depend(String classname) { - dependancies.add(classname); - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - dependDesc(desc); - return new DependancyMethodLister(Opcodes.ASM4); - } - - @Override - public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { - depend(superName); - if (interfaces != null) { - for (String interfacename : interfaces) { - depend(interfacename); - } - } - } - - public List getDependancies() { - return new ArrayList(dependancies); - } -} diff --git a/dependencies/main/java/codechicken/core/asm/InterfaceDependancies.java b/dependencies/main/java/codechicken/core/asm/InterfaceDependancies.java deleted file mode 100644 index 5054647025..0000000000 --- a/dependencies/main/java/codechicken/core/asm/InterfaceDependancies.java +++ /dev/null @@ -1,12 +0,0 @@ -package codechicken.core.asm; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.TYPE }) -public @interface InterfaceDependancies { - -} diff --git a/dependencies/main/java/codechicken/core/asm/InterfaceDependancyTransformer.java b/dependencies/main/java/codechicken/core/asm/InterfaceDependancyTransformer.java deleted file mode 100644 index e3f873ad83..0000000000 --- a/dependencies/main/java/codechicken/core/asm/InterfaceDependancyTransformer.java +++ /dev/null @@ -1,51 +0,0 @@ -package codechicken.core.asm; - -import codechicken.lib.asm.ASMHelper; -import codechicken.lib.asm.ObfMapping; -import net.minecraft.launchwrapper.IClassTransformer; -import net.minecraft.launchwrapper.Launch; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.AnnotationNode; -import org.objectweb.asm.tree.ClassNode; - -import java.util.Iterator; - -public class InterfaceDependancyTransformer implements IClassTransformer { - @Override - public byte[] transform(String name, String tname, byte[] bytes) { - if (bytes == null) { - return null; - } - ClassNode cnode = ASMHelper.createClassNode(bytes); - - boolean hasDependancyInterfaces = false; - if (cnode.visibleAnnotations != null) { - for (AnnotationNode ann : cnode.visibleAnnotations) { - if (ann.desc.equals(Type.getDescriptor(InterfaceDependancies.class))) { - hasDependancyInterfaces = true; - break; - } - } - } - - if (!hasDependancyInterfaces) { - return bytes; - } - - hasDependancyInterfaces = false; - for (Iterator iterator = cnode.interfaces.iterator(); iterator.hasNext(); ) { - try { - Launch.classLoader.findClass(new ObfMapping(iterator.next()).toRuntime().javaClass()); - } catch (ClassNotFoundException cnfe) { - iterator.remove(); - hasDependancyInterfaces = true; - } - } - - if (!hasDependancyInterfaces) { - return bytes; - } - - return ASMHelper.createBytes(cnode, 0); - } -} diff --git a/dependencies/main/java/codechicken/core/asm/MCPDeobfuscationTransformer.java b/dependencies/main/java/codechicken/core/asm/MCPDeobfuscationTransformer.java deleted file mode 100644 index d28ea0492d..0000000000 --- a/dependencies/main/java/codechicken/core/asm/MCPDeobfuscationTransformer.java +++ /dev/null @@ -1,234 +0,0 @@ -package codechicken.core.asm; - -import codechicken.lib.asm.ASMHelper; -import codechicken.lib.asm.CC_ClassWriter; -import codechicken.lib.asm.ObfMapping; -import codechicken.obfuscator.IHeirachyEvaluator; -import codechicken.obfuscator.ObfuscationMap.ObfuscationEntry; -import codechicken.obfuscator.ObfuscationRun; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import net.minecraft.launchwrapper.IClassTransformer; -import net.minecraft.launchwrapper.Launch; -import net.minecraft.launchwrapper.LaunchClassLoader; -import net.minecraftforge.fml.common.asm.transformers.AccessTransformer; -import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.MethodInsnNode; -import org.objectweb.asm.tree.MethodNode; - -import java.io.IOException; -import java.lang.reflect.Field; -import java.util.*; -import java.util.Map.Entry; - -public class MCPDeobfuscationTransformer implements IClassTransformer, Opcodes, IHeirachyEvaluator { - public static class LoadPlugin implements IFMLLoadingPlugin { - @Override - public String[] getASMTransformerClass() { - return new String[0]; - } - - @Override - public String getModContainerClass() { - return null; - } - - @Override - public String getSetupClass() { - return null; - } - - @Override - public void injectData(Map data) { - load(); - } - - @Override - public String getAccessTransformerClass() { - return null; - } - } - - private static ObfuscationRun run; - private static List excludedPackages = new LinkedList(); - private static MCPDeobfuscationTransformer instance = new MCPDeobfuscationTransformer(); - - private static boolean activated; - - private static Field f_transformers; - private static Field f_modifiers; - private static Field f_Modifier_name; - private static Field f_Modifier_desc; - - static { - try { - f_transformers = LaunchClassLoader.class.getDeclaredField("transformers"); - f_modifiers = AccessTransformer.class.getDeclaredField("modifiers"); - Class c_Modifier = Class.forName(AccessTransformer.class.getName() + "$Modifier", false, Launch.classLoader); - f_Modifier_name = c_Modifier.getDeclaredField("name"); - f_Modifier_desc = c_Modifier.getDeclaredField("desc"); - - f_transformers.setAccessible(true); - f_modifiers.setAccessible(true); - f_Modifier_name.setAccessible(true); - f_Modifier_desc.setAccessible(true); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private static Object get(Field f, Object inst) { - try { - return f.get(inst); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private static void set(Field f, Object inst, Object value) { - try { - f.set(inst, value); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - @SuppressWarnings("unchecked") - private static List getTransformers() { - return (List) get(f_transformers, Launch.classLoader); - } - - public static void load() { - CodeChickenCoreModContainer.loadConfig(); - - if (CodeChickenCoreModContainer.config.getTag("dev.deobfuscate").setComment("set to true to completely deobfuscate mcp names").getBooleanValue(!ObfMapping.obfuscated)) { - run = new ObfuscationRun(false, ObfMapping.MCPRemapper.getConfFiles(), ObfuscationRun.fillDefaults(new HashMap())); - run.obf.setHeirachyEvaluator(instance); - run.setQuiet().parseMappings(); - Collections.addAll(excludedPackages, run.config.get("excludedPackages").split(";")); - - if (ObfMapping.obfuscated) { - ObfMapping.loadMCPRemapper(); - run.setSeargeConstants(); - getTransformers().add(instance); - } else { - getTransformers().add(0, instance);//insert transformer as first. - } - } - } - - @Override - public byte[] transform(String name, String transformedName, byte[] bytes) { - if (name.equals("net.minecraftforge.fml.common.Loader")) { - bytes = injectCallback(bytes); - activated = true; - } - - if (!activated || bytes == null) { - return bytes; - } - - ClassNode cnode = ASMHelper.createClassNode(bytes, ClassReader.EXPAND_FRAMES); - ClassWriter cw = new CC_ClassWriter(0, true); - run.remap(cnode, cw); - return cw.toByteArray(); - } - - private byte[] injectCallback(byte[] bytes) { - ClassNode cnode = ASMHelper.createClassNode(bytes); - MethodNode mnode = ASMHelper.findMethod(new ObfMapping(cnode.name, "", "()V"), cnode); - mnode.instructions.insert(new MethodInsnNode(INVOKESTATIC, "codechicken/core/asm/MCPDeobfuscationTransformer", "loadCallback", "()V")); - return ASMHelper.createBytes(cnode, 0); - } - - public static void loadCallback() { - if (ObfMapping.obfuscated) { - //move ourselves to the end - List transformers = getTransformers(); - transformers.remove(instance); - transformers.add(instance); - } else { - //remap access transformers - for (IClassTransformer t : getTransformers()) { - if (t instanceof AccessTransformer) { - remapAccessTransformer(t); - } - } - } - } - - @SuppressWarnings("unchecked") - private static void remapAccessTransformer(IClassTransformer t) { - Multimap modifiers = (Multimap) get(f_modifiers, t); - Multimap t_modifiers = HashMultimap.create(); - for (Entry entry : modifiers.entries()) { - Object mod = entry.getValue(); - String m_owner = entry.getKey().replace('.', '/'); - String m_name = (String) get(f_Modifier_name, mod); - String m_desc = ((String) get(f_Modifier_desc, mod)).replace('.', '/'); - ObfMapping map; - if (m_name.equals("*")) { - map = new ObfMapping(m_owner); - map.s_name = m_name; - map.s_desc = m_desc; - } else { - try { - map = new ObfMapping(m_owner, m_name, m_desc).toClassloading(); - } catch (Exception e) { - new Object(); - continue; - } - } - - set(f_Modifier_name, mod, map.s_name); - set(f_Modifier_desc, mod, map.s_desc); - t_modifiers.put(map.javaClass(), mod); - } - set(f_modifiers, t, t_modifiers); - } - - @Override - public List getParents(ObfuscationEntry desc) { - try { - String name = ObfMapping.obfuscated ? desc.obf.s_owner : desc.mcp.s_owner; - name = name.replace('/', '.'); - byte[] bytes = Launch.classLoader.getClassBytes(name); - if (bytes != null) { - return ObfuscationRun.getParents(ASMHelper.createClassNode(bytes)); - } - } catch (IOException e) { - } - return null; - } - - @Override - public boolean isLibClass(ObfuscationEntry desc) { - String name = desc.srg.s_owner; - for (String p : excludedPackages) { - if (name.startsWith(p)) { - return true; - } - } - - return false; - } - - public static String unmap(String name) { - if (run == null) { - return null; - } - ObfuscationEntry e = run.obf.lookupMcpClass(name); - if (e == null) { - return null; - } - return e.obf.s_owner; - } - - public static MCPDeobfuscationTransformer instance() { - return instance; - } -} diff --git a/dependencies/main/java/codechicken/core/asm/TweakTransformer.java b/dependencies/main/java/codechicken/core/asm/TweakTransformer.java deleted file mode 100644 index 598ce24fd5..0000000000 --- a/dependencies/main/java/codechicken/core/asm/TweakTransformer.java +++ /dev/null @@ -1,70 +0,0 @@ -package codechicken.core.asm; - -import codechicken.lib.asm.*; -import codechicken.lib.asm.ModularASMTransformer.MethodReplacer; -import codechicken.lib.asm.ModularASMTransformer.MethodTransformer; -import codechicken.lib.config.ConfigTag; -import net.minecraft.launchwrapper.IClassTransformer; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.tree.JumpInsnNode; -import org.objectweb.asm.tree.MethodNode; - -import java.util.Map; - -import static codechicken.lib.asm.InsnComparator.findOnce; - -public class TweakTransformer implements IClassTransformer, Opcodes { - private static ModularASMTransformer transformer = new ModularASMTransformer(); - private static Map blocks = ASMReader.loadResource("/assets/codechickencore/asm/tweaks.asm"); - public static ConfigTag tweaks; - - public static void load() { - CodeChickenCoreModContainer.loadConfig(); - tweaks = CodeChickenCoreModContainer.config.getTag("tweaks").setComment("Various tweaks that can be applied to game mechanics.").useBraces(); - tweaks.removeTag("persistantLava"); - - if (tweaks.getTag("environmentallyFriendlyCreepers").setComment("If set to true, creepers will not destroy landscape. (A version of mobGriefing setting just for creepers)").getBooleanValue(false)) { - transformer.add(new MethodReplacer(new ObfMapping("net/minecraft/entity/monster/EntityCreeper", "func_146077_cc", "()V"), blocks.get("d_environmentallyFriendlyCreepers"), blocks.get("environmentallyFriendlyCreepers"))); - } - - /*if (!tweaks.getTag("softLeafReplace") - .setComment("If set to false, leaves will only replace air when growing") - .getBooleanValue(false)) { - transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping("net/minecraft/block/Block", "canBeReplacedByLeaves", "(Lnet/minecraft/world/IBlockAccess;III)Z"), blocks.get("softLeafReplace"))); - } - - if (tweaks.getTag("doFireTickOut") - .setComment("If set to true and doFireTick is disabled in the game rules, fire will still dissipate if it's not over a fire source") - .getBooleanValue(true)) { - transformer.add(new MethodTransformer(new ObfMapping("net/minecraft/block/BlockFire", "func_149674_a", "(Lnet/minecraft/world/World;IIILjava/util/Random;)V")) - { - @Override - public void transform(MethodNode mv) { - ASMBlock needle = blocks.get("n_doFireTick"); - ASMBlock inject = blocks.get("doFireTick"); - - ASMBlock key = needle.applyLabels(findOnce(mv.instructions, needle.list)); - LabelNode jlabel = key.get("LRET"); - mv.instructions.insertBefore(jlabel, new JumpInsnNode(GOTO, inject.get("LSKIP"))); - mv.instructions.insert(jlabel, inject.list.list); - } - }); - }*/ - - if (tweaks.getTag("finiteWater").setComment("If set to true two adjacent water source blocks will not generate a third.").getBooleanValue(false)) { - transformer.add(new MethodTransformer(new ObfMapping("net/minecraft/block/BlockDynamicLiquid", "func_149674_a", "(Lnet/minecraft/world/World;IIILjava/util/Random;)V")) { - @Override - public void transform(MethodNode mv) { - InsnListSection key = findOnce(mv.instructions, blocks.get("finiteWater").list); - key.setLast(((JumpInsnNode) key.getLast()).label); - key.remove(); - } - }); - } - } - - @Override - public byte[] transform(String name, String tname, byte[] bytes) { - return transformer.transform(name, bytes); - } -} diff --git a/dependencies/main/java/codechicken/core/commands/CoreCommand.java b/dependencies/main/java/codechicken/core/commands/CoreCommand.java index f85a481eeb..b872312607 100644 --- a/dependencies/main/java/codechicken/core/commands/CoreCommand.java +++ b/dependencies/main/java/codechicken/core/commands/CoreCommand.java @@ -1,41 +1,42 @@ package codechicken.core.commands; -import codechicken.core.ServerUtils; +import codechicken.lib.util.ServerUtils; import net.minecraft.command.ICommand; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.WorldServer; import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.fml.common.FMLCommonHandler; import java.util.ArrayList; import java.util.List; public abstract class CoreCommand implements ICommand { public static void chatT(ICommandSender sender, String s, Object... params) { - sender.addChatMessage(new ChatComponentTranslation(s, params)); + sender.addChatMessage(new TextComponentTranslation(s, params)); } public static void chatOpsT(String s, Object... params) { for (EntityPlayerMP player : ServerUtils.getPlayers()) { - if (MinecraftServer.getServer().getConfigurationManager().canSendCommands(player.getGameProfile())) { - player.addChatMessage(new ChatComponentTranslation(s, params)); + if (FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().canSendCommands(player.getGameProfile())) { + player.addChatMessage(new TextComponentTranslation(s, params)); } } } - public abstract boolean OPOnly(); + public abstract boolean isOpOnly(); @Override - public String getCommandUsage(ICommandSender var1) { + public String getCommandUsage(ICommandSender commandSender) { return "/" + getCommandName() + " help"; } @Override - public void processCommand(ICommandSender sender, String[] args) { + public void execute(MinecraftServer server, ICommandSender sender, String[] args) { if (args.length < minimumParameters() || args.length == 1 && args[0].equals("help")) { printHelp(sender); return; @@ -76,7 +77,7 @@ public List getCommandAliases() { } @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) { + public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { return null; } @@ -86,13 +87,13 @@ public boolean isUsernameIndex(String[] args, int index) { } @Override - public boolean canCommandSenderUseCommand(ICommandSender var1) { - if (OPOnly()) { - if (var1 instanceof EntityPlayer) { - return MinecraftServer.getServer().getConfigurationManager().canSendCommands(((EntityPlayer) var1).getGameProfile()); + public boolean checkPermission(MinecraftServer server, ICommandSender commandSender) { + if (isOpOnly()) { + if (commandSender instanceof EntityPlayer) { + return FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().canSendCommands(((EntityPlayer) commandSender).getGameProfile()); } - return var1 instanceof MinecraftServer; + return commandSender instanceof MinecraftServer; } return true; } diff --git a/dependencies/main/java/codechicken/core/commands/PlayerCommand.java b/dependencies/main/java/codechicken/core/commands/PlayerCommand.java index 45600ad3fb..728ce340bf 100644 --- a/dependencies/main/java/codechicken/core/commands/PlayerCommand.java +++ b/dependencies/main/java/codechicken/core/commands/PlayerCommand.java @@ -5,13 +5,14 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.BlockPos; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.WorldServer; public abstract class PlayerCommand extends CoreCommand { @Override - public boolean canCommandSenderUseCommand(ICommandSender var1) { - return super.canCommandSenderUseCommand(var1) && var1 instanceof EntityPlayer; + public boolean checkPermission(MinecraftServer server, ICommandSender player) { + return super.checkPermission(server, player) && player instanceof EntityPlayer; } @Override diff --git a/dependencies/main/java/codechicken/core/commands/ServerCommand.java b/dependencies/main/java/codechicken/core/commands/ServerCommand.java index cb4a0dae3b..b1303e806a 100644 --- a/dependencies/main/java/codechicken/core/commands/ServerCommand.java +++ b/dependencies/main/java/codechicken/core/commands/ServerCommand.java @@ -5,18 +5,18 @@ public abstract class ServerCommand extends CoreCommand { @Override - public void processCommand(ICommandSender var1, String[] var2) { - handleCommand(var2, (MinecraftServer) var1); + public void execute(MinecraftServer server, ICommandSender sender, String[] args) { + handleCommand(args, (MinecraftServer) sender); } @Override - public boolean canCommandSenderUseCommand(ICommandSender var1) { - return super.canCommandSenderUseCommand(var1) && var1 instanceof MinecraftServer; + public boolean checkPermission(MinecraftServer server, ICommandSender sender) { + return super.checkPermission(server, sender) && sender instanceof MinecraftServer; } public abstract void handleCommand(String[] args, MinecraftServer listener); - public final boolean OPOnly() { + public final boolean isOpOnly() { return false; } } diff --git a/dependencies/main/java/codechicken/core/featurehack/GameDataManipulator.java b/dependencies/main/java/codechicken/core/featurehack/GameDataManipulator.java deleted file mode 100644 index 18dee0ce83..0000000000 --- a/dependencies/main/java/codechicken/core/featurehack/GameDataManipulator.java +++ /dev/null @@ -1,23 +0,0 @@ -package codechicken.core.featurehack; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.registry.GameData; - -public class GameDataManipulator { - public static void replaceItem(int id, Item item) { - try { - ResourceLocation name = (ResourceLocation) Item.itemRegistry.getNameForObject(Item.getItemById(id)); - Item.itemRegistry.registryObjects.put(name, item); - Item.itemRegistry.underlyingIntegerMap.put(item, id); - Block block = Block.getBlockById(id); - if (block != Blocks.AIR) { - GameData.getBlockItemMap().put(block, item); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/dependencies/main/java/codechicken/core/featurehack/LiquidTextures.java b/dependencies/main/java/codechicken/core/featurehack/LiquidTextures.java deleted file mode 100644 index c566236a04..0000000000 --- a/dependencies/main/java/codechicken/core/featurehack/LiquidTextures.java +++ /dev/null @@ -1,51 +0,0 @@ -package codechicken.core.featurehack; - -import codechicken.core.asm.TweakTransformer; -import codechicken.core.featurehack.mc.TextureLavaFX; -import codechicken.core.featurehack.mc.TextureLavaFlowFX; -import codechicken.core.featurehack.mc.TextureWaterFX; -import codechicken.core.featurehack.mc.TextureWaterFlowFX; -import codechicken.lib.render.TextureSpecial; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraftforge.client.event.TextureStitchEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -import java.util.Map; - -public class LiquidTextures { - public static TextureSpecial[] newTextures = new TextureSpecial[4]; - - public static boolean replaceLava; - public static boolean replaceWater; - - public static void init() { - replaceWater = TweakTransformer.tweaks.getTag("replaceWaterFX").setComment("Set this to true to use the pre1.5 water textures").getBooleanValue(false); - replaceLava = TweakTransformer.tweaks.getTag("replaceLavaFX").setComment("Set this to true to use the pre1.5 lava textures").getBooleanValue(false); - if (replaceWater) { - newTextures[0] = new TextureWaterFX().texture; - newTextures[1] = new TextureWaterFlowFX().texture; - } - if (replaceLava) { - newTextures[2] = new TextureLavaFX().texture; - newTextures[3] = new TextureLavaFlowFX().texture; - } - - if (replaceWater || replaceLava) { - MinecraftForge.EVENT_BUS.register(new LiquidTextures()); - } - } - - @SubscribeEvent - public void postStitch(TextureStitchEvent.Post event) { - Map uploadedSprites = event.map.mapUploadedSprites; - if (replaceWater) { - uploadedSprites.put("minecraft:blocks/water_still", newTextures[0]); - uploadedSprites.put("minecraft:blocks/water_flow", newTextures[1]); - } - if (replaceLava) { - uploadedSprites.put("minecraft:blocks/lava_still", newTextures[2]); - uploadedSprites.put("minecraft:blocks/lava_flow", newTextures[3]); - } - } -} diff --git a/dependencies/main/java/codechicken/core/featurehack/TweakTransformerHelper.java b/dependencies/main/java/codechicken/core/featurehack/TweakTransformerHelper.java deleted file mode 100644 index adef0c652c..0000000000 --- a/dependencies/main/java/codechicken/core/featurehack/TweakTransformerHelper.java +++ /dev/null @@ -1,32 +0,0 @@ -package codechicken.core.featurehack; - -//import static net.minecraftforge.common.util.ForgeDirection.UP; - -public class TweakTransformerHelper { - /*public static void quenchFireTick(World world, int x, int y, int z, Random rand) - { - Block base = world.getBlock(x, y - 1, z); - boolean supported = (base != null && base.isFireSource(world, x, y - 1, z, UP)); - - if (!Blocks.fire.canPlaceBlockAt(world, x, y, z) || - !supported && world.isRaining() && (world.canLightningStrikeAt(x, y, z) || world.canLightningStrikeAt(x - 1, y, z) || world.canLightningStrikeAt(x + 1, y, z) || world.canLightningStrikeAt(x, y, z - 1) || world.canLightningStrikeAt(x, y, z + 1))) - world.setBlockToAir(x, y, z); - else - { - int meta = world.getBlockMetadata(x, y, z); - if(meta < 15) - world.setBlockMetadataWithNotify(x, y, z, meta+rand.nextInt(3)/2, 0); - - world.scheduleBlockUpdate(x, y, z, Blocks.fire, Blocks.fire.tickRate(world) + rand.nextInt(10)); - - if(!supported && !Blocks.fire.canCatchFire(world, x, y - 1, z, UP) && meta == 15 && rand.nextInt(4) == 0) - world.setBlockToAir(x, y, z); - } - } - - public static boolean canPlaceBlockAt(World world, int x, int y, int z) - { - Block block = world.getBlock(x, y, z); - return block.isAir(world, x, y, z) || block.isReplaceable(world, x, y, z); - }*/ -} diff --git a/dependencies/main/java/codechicken/core/featurehack/mc/TextureLavaFX.java b/dependencies/main/java/codechicken/core/featurehack/mc/TextureLavaFX.java deleted file mode 100644 index 5a461412ac..0000000000 --- a/dependencies/main/java/codechicken/core/featurehack/mc/TextureLavaFX.java +++ /dev/null @@ -1,99 +0,0 @@ -package codechicken.core.featurehack.mc; - -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.render.TextureFX; -import net.minecraft.util.math.MathHelper; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class TextureLavaFX extends TextureFX { - protected float[] field_76876_g = new float[256]; - protected float[] field_76878_h = new float[256]; - protected float[] field_76879_i = new float[256]; - protected float[] field_76877_j = new float[256]; - - public TextureLavaFX() { - super(16, "lava_still_fx"); - setup(); - } - - @Override - public void setup() { - super.setup(); - field_76876_g = new float[tileSizeSquare]; - field_76878_h = new float[tileSizeSquare]; - field_76879_i = new float[tileSizeSquare]; - field_76877_j = new float[tileSizeSquare]; - } - - public void onTick() { - int var2; - float var3; - int var5; - int var6; - int var7; - int var8; - int var9; - - for (int var1 = 0; var1 < tileSizeBase; ++var1) { - for (var2 = 0; var2 < tileSizeBase; ++var2) { - var3 = 0.0F; - int var4 = (int) (MathHelper.sin(var2 * (float) Math.PI * 2.0F / 16.0F) * 1.2F); - var5 = (int) (MathHelper.sin(var1 * (float) Math.PI * 2.0F / 16.0F) * 1.2F); - - for (var6 = var1 - 1; var6 <= var1 + 1; ++var6) { - for (var7 = var2 - 1; var7 <= var2 + 1; ++var7) { - var8 = var6 + var4 & tileSizeMask; - var9 = var7 + var5 & tileSizeMask; - var3 += this.field_76876_g[var8 + var9 * tileSizeBase]; - } - } - - this.field_76878_h[var1 + var2 * tileSizeBase] = var3 / 10.0F + (this.field_76879_i[(var1 + 0 & tileSizeMask) + (var2 + 0 & tileSizeMask) * tileSizeBase] + this.field_76879_i[(var1 + 1 & tileSizeMask) + (var2 + 0 & tileSizeMask) * tileSizeBase] + this.field_76879_i[(var1 + 1 & tileSizeMask) + (var2 + 1 & tileSizeMask) * tileSizeBase] + this.field_76879_i[(var1 + 0 & tileSizeMask) + (var2 + 1 & tileSizeMask) * tileSizeBase]) / 4.0F * 0.8F; - this.field_76879_i[var1 + var2 * tileSizeBase] += this.field_76877_j[var1 + var2 * tileSizeBase] * 0.01F; - - if (this.field_76879_i[var1 + var2 * tileSizeBase] < 0.0F) { - this.field_76879_i[var1 + var2 * tileSizeBase] = 0.0F; - } - - this.field_76877_j[var1 + var2 * tileSizeBase] -= 0.06F; - - if (Math.random() < 0.005D) { - this.field_76877_j[var1 + var2 * tileSizeBase] = 1.5F; - } - } - } - - float[] var11 = this.field_76878_h; - this.field_76878_h = this.field_76876_g; - this.field_76876_g = var11; - - for (var2 = 0; var2 < tileSizeSquare; ++var2) { - var3 = this.field_76876_g[var2] * 2.0F; - - if (var3 > 1.0F) { - var3 = 1.0F; - } - - if (var3 < 0.0F) { - var3 = 0.0F; - } - - var5 = (int) (var3 * 100.0F + 155.0F); - var6 = (int) (var3 * var3 * 255.0F); - var7 = (int) (var3 * var3 * var3 * var3 * 128.0F); - - if (this.anaglyphEnabled) { - var8 = (var5 * 30 + var6 * 59 + var7 * 11) / 100; - var9 = (var5 * 30 + var6 * 70) / 100; - int var10 = (var5 * 30 + var7 * 70) / 100; - var5 = var8; - var6 = var9; - var7 = var10; - } - - imageData[var2] = new ColourRGBA(var5, var6, var7, -1).argb(); - } - } -} diff --git a/dependencies/main/java/codechicken/core/featurehack/mc/TextureLavaFlowFX.java b/dependencies/main/java/codechicken/core/featurehack/mc/TextureLavaFlowFX.java deleted file mode 100644 index 009dbb1f03..0000000000 --- a/dependencies/main/java/codechicken/core/featurehack/mc/TextureLavaFlowFX.java +++ /dev/null @@ -1,116 +0,0 @@ -package codechicken.core.featurehack.mc; - -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.render.TextureFX; -import net.minecraft.util.math.MathHelper; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class TextureLavaFlowFX extends TextureFX { - protected float[] field_76871_g = new float[256]; - protected float[] field_76874_h = new float[256]; - protected float[] field_76875_i = new float[256]; - protected float[] field_76872_j = new float[256]; - int field_76873_k = 0; - - //shadow - public int tileSizeBase = 16; - public int tileSizeSquare = 256; - public int tileSizeMask = 15; - public int tileSizeSquareMask = 255; - - public TextureLavaFlowFX() { - super(32, "lava_flow_fx"); - } - - @Override - public void setup() { - super.setup(); - field_76871_g = new float[tileSizeSquare]; - field_76874_h = new float[tileSizeSquare]; - field_76875_i = new float[tileSizeSquare]; - field_76872_j = new float[tileSizeSquare]; - field_76873_k = 0; - } - - public void onTick() { - ++this.field_76873_k; - int var2; - float var3; - int var5; - int var6; - int var7; - int var8; - int var9; - - for (int var1 = 0; var1 < tileSizeBase; ++var1) { - for (var2 = 0; var2 < tileSizeBase; ++var2) { - var3 = 0.0F; - int var4 = (int) (MathHelper.sin(var2 * (float) Math.PI * 2.0F / 16.0F) * 1.2F); - var5 = (int) (MathHelper.sin(var1 * (float) Math.PI * 2.0F / 16.0F) * 1.2F); - - for (var6 = var1 - 1; var6 <= var1 + 1; ++var6) { - for (var7 = var2 - 1; var7 <= var2 + 1; ++var7) { - var8 = var6 + var4 & tileSizeMask; - var9 = var7 + var5 & tileSizeMask; - var3 += this.field_76871_g[var8 + var9 * tileSizeBase]; - } - } - - this.field_76874_h[var1 + var2 * tileSizeBase] = var3 / 10.0F + (this.field_76875_i[(var1 + 0 & tileSizeMask) + (var2 + 0 & tileSizeMask) * tileSizeBase] + this.field_76875_i[(var1 + 1 & tileSizeMask) + (var2 + 0 & tileSizeMask) * tileSizeBase] + this.field_76875_i[(var1 + 1 & tileSizeMask) + (var2 + 1 & tileSizeMask) * tileSizeBase] + this.field_76875_i[(var1 + 0 & tileSizeMask) + (var2 + 1 & tileSizeMask) * tileSizeBase]) / 4.0F * 0.8F; - this.field_76875_i[var1 + var2 * tileSizeBase] += this.field_76872_j[var1 + var2 * tileSizeBase] * 0.01F; - - if (this.field_76875_i[var1 + var2 * tileSizeBase] < 0.0F) { - this.field_76875_i[var1 + var2 * tileSizeBase] = 0.0F; - } - - this.field_76872_j[var1 + var2 * tileSizeBase] -= 0.06F; - - if (Math.random() < 0.005D) { - this.field_76872_j[var1 + var2 * tileSizeBase] = 1.5F; - } - } - } - - float[] var11 = this.field_76874_h; - this.field_76874_h = this.field_76871_g; - this.field_76871_g = var11; - - for (var2 = 0; var2 < tileSizeSquare; ++var2) { - var3 = this.field_76871_g[(var2 - this.field_76873_k / 3 * tileSizeBase) & tileSizeSquareMask] * 2.0F; - - if (var3 > 1.0F) { - var3 = 1.0F; - } - - if (var3 < 0.0F) { - var3 = 0.0F; - } - - var5 = (int) (var3 * 100.0F + 155.0F); - var6 = (int) (var3 * var3 * 255.0F); - var7 = (int) (var3 * var3 * var3 * var3 * 128.0F); - - if (this.anaglyphEnabled) { - var8 = (var5 * 30 + var6 * 59 + var7 * 11) / 100; - var9 = (var5 * 30 + var6 * 70) / 100; - int var10 = (var5 * 30 + var7 * 70) / 100; - var5 = var8; - var6 = var9; - var7 = var10; - } - - int px = var2 & tileSizeMask; - int py = var2 / tileSizeBase; - writeColour(px, py, var5, var6, var7, -1); - writeColour(px + 16, py, var5, var6, var7, -1); - writeColour(px, py + 16, var5, var6, var7, -1); - writeColour(px + 16, py + 16, var5, var6, var7, -1); - } - } - - private void writeColour(int px, int py, int var5, int var6, int var7, int var8) { - imageData[py * 32 + px] = new ColourRGBA(var5, var6, var7, var8).argb(); - } -} diff --git a/dependencies/main/java/codechicken/core/featurehack/mc/TextureWaterFX.java b/dependencies/main/java/codechicken/core/featurehack/mc/TextureWaterFX.java deleted file mode 100644 index 34311c7ed0..0000000000 --- a/dependencies/main/java/codechicken/core/featurehack/mc/TextureWaterFX.java +++ /dev/null @@ -1,114 +0,0 @@ -package codechicken.core.featurehack.mc; - -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.render.TextureFX; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class TextureWaterFX extends TextureFX { - /** - * red RGB value for water texture - */ - protected float[] red = new float[256]; - - /** - * green RGB value for water texture - */ - protected float[] green = new float[256]; - - /** - * blue RGB value for water texture - */ - protected float[] blue = new float[256]; - - /** - * alpha RGB value for water texture - */ - protected float[] alpha = new float[256]; - - public TextureWaterFX() { - super(16, "water_still_fx"); - setup(); - } - - @Override - public void setup() { - super.setup(); - red = new float[tileSizeSquare]; - green = new float[tileSizeSquare]; - blue = new float[tileSizeSquare]; - alpha = new float[tileSizeSquare]; - } - - public void onTick() { - int var1; - int var2; - float var3; - int var5; - int var6; - - for (var1 = 0; var1 < tileSizeBase; ++var1) { - for (var2 = 0; var2 < tileSizeBase; ++var2) { - var3 = 0.0F; - - for (int var4 = var1 - 1; var4 <= var1 + 1; ++var4) { - var5 = var4 & tileSizeMask; - var6 = var2 & tileSizeMask; - var3 += this.red[var5 + var6 * tileSizeBase]; - } - - this.green[var1 + var2 * tileSizeBase] = var3 / 3.3F + this.blue[var1 + var2 * tileSizeBase] * 0.8F; - } - } - - for (var1 = 0; var1 < tileSizeBase; ++var1) { - for (var2 = 0; var2 < tileSizeBase; ++var2) { - this.blue[var1 + var2 * tileSizeBase] += this.alpha[var1 + var2 * tileSizeBase] * 0.05F; - - if (this.blue[var1 + var2 * tileSizeBase] < 0.0F) { - this.blue[var1 + var2 * tileSizeBase] = 0.0F; - } - - this.alpha[var1 + var2 * tileSizeBase] -= 0.1F; - - if (Math.random() < 0.05D) { - this.alpha[var1 + var2 * tileSizeBase] = 0.5F; - } - } - } - - float[] var12 = this.green; - this.green = this.red; - this.red = var12; - - for (var2 = 0; var2 < tileSizeSquare; ++var2) { - var3 = this.red[var2]; - - if (var3 > 1.0F) { - var3 = 1.0F; - } - - if (var3 < 0.0F) { - var3 = 0.0F; - } - - float var13 = var3 * var3; - var5 = (int) (32.0F + var13 * 32.0F); - var6 = (int) (50.0F + var13 * 64.0F); - int var7 = 255; - int var8 = (int) (146.0F + var13 * 50.0F); - - if (this.anaglyphEnabled) { - int var9 = (var5 * 30 + var6 * 59 + var7 * 11) / 100; - int var10 = (var5 * 30 + var6 * 70) / 100; - int var11 = (var5 * 30 + var7 * 70) / 100; - var5 = var9; - var6 = var10; - var7 = var11; - } - - imageData[var2] = new ColourRGBA(var5, var6, var7, var8).argb(); - } - } -} diff --git a/dependencies/main/java/codechicken/core/featurehack/mc/TextureWaterFlowFX.java b/dependencies/main/java/codechicken/core/featurehack/mc/TextureWaterFlowFX.java deleted file mode 100644 index 56038a02ce..0000000000 --- a/dependencies/main/java/codechicken/core/featurehack/mc/TextureWaterFlowFX.java +++ /dev/null @@ -1,116 +0,0 @@ -package codechicken.core.featurehack.mc; - -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.render.TextureFX; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class TextureWaterFlowFX extends TextureFX { - protected float[] field_76880_g = new float[256]; - protected float[] field_76883_h = new float[256]; - protected float[] field_76884_i = new float[256]; - protected float[] field_76881_j = new float[256]; - private int tickCounter = 0; - - //shadow - public int tileSizeBase = 16; - public int tileSizeSquare = 256; - public int tileSizeMask = 15; - public int tileSizeSquareMask = 255; - - public TextureWaterFlowFX() { - super(32, "water_flow_fx"); - } - - @Override - public void setup() { - super.setup(); - field_76880_g = new float[tileSizeSquare]; - field_76883_h = new float[tileSizeSquare]; - field_76884_i = new float[tileSizeSquare]; - field_76881_j = new float[tileSizeSquare]; - tickCounter = 0; - } - - public void onTick() { - ++this.tickCounter; - int var1; - int var2; - float var3; - int var5; - int var6; - - for (var1 = 0; var1 < tileSizeBase; ++var1) { - for (var2 = 0; var2 < tileSizeBase; ++var2) { - var3 = 0.0F; - - for (int var4 = var2 - 2; var4 <= var2; ++var4) { - var5 = var1 & tileSizeMask; - var6 = var4 & tileSizeMask; - var3 += this.field_76880_g[var5 + var6 * tileSizeBase]; - } - - this.field_76883_h[var1 + var2 * tileSizeBase] = var3 / 3.2F + this.field_76884_i[var1 + var2 * tileSizeBase] * 0.8F; - } - } - - for (var1 = 0; var1 < tileSizeBase; ++var1) { - for (var2 = 0; var2 < tileSizeBase; ++var2) { - this.field_76884_i[var1 + var2 * tileSizeBase] += this.field_76881_j[var1 + var2 * tileSizeBase] * 0.05F; - - if (this.field_76884_i[var1 + var2 * tileSizeBase] < 0.0F) { - this.field_76884_i[var1 + var2 * tileSizeBase] = 0.0F; - } - - this.field_76881_j[var1 + var2 * tileSizeBase] -= 0.3F; - - if (Math.random() < 0.2D) { - this.field_76881_j[var1 + var2 * tileSizeBase] = 0.5F; - } - } - } - - float[] var12 = this.field_76883_h; - this.field_76883_h = this.field_76880_g; - this.field_76880_g = var12; - - for (var2 = 0; var2 < tileSizeSquare; ++var2) { - var3 = this.field_76880_g[var2 - this.tickCounter * tileSizeBase & tileSizeSquareMask]; - - if (var3 > 1.0F) { - var3 = 1.0F; - } - - if (var3 < 0.0F) { - var3 = 0.0F; - } - - float var13 = var3 * var3; - var5 = (int) (32.0F + var13 * 32.0F); - var6 = (int) (50.0F + var13 * 64.0F); - int var7 = 255; - int var8 = (int) (146.0F + var13 * 50.0F); - - if (this.anaglyphEnabled) { - int var9 = (var5 * 30 + var6 * 59 + var7 * 11) / 100; - int var10 = (var5 * 30 + var6 * 70) / 100; - int var11 = (var5 * 30 + var7 * 70) / 100; - var5 = var9; - var6 = var10; - var7 = var11; - } - - int px = var2 & tileSizeMask; - int py = var2 / tileSizeBase; - writeColour(px, py, var5, var6, var7, var8); - writeColour(px + 16, py, var5, var6, var7, var8); - writeColour(px, py + 16, var5, var6, var7, var8); - writeColour(px + 16, py + 16, var5, var6, var7, var8); - } - } - - private void writeColour(int px, int py, int var5, int var6, int var7, int var8) { - imageData[py * 32 + px] = new ColourRGBA(var5, var6, var7, var8).argb(); - } -} diff --git a/dependencies/main/java/codechicken/core/fluid/ExtendedFluidTank.java b/dependencies/main/java/codechicken/core/fluid/ExtendedFluidTank.java index e2c83b8d88..0b05927421 100644 --- a/dependencies/main/java/codechicken/core/fluid/ExtendedFluidTank.java +++ b/dependencies/main/java/codechicken/core/fluid/ExtendedFluidTank.java @@ -1,7 +1,6 @@ package codechicken.core.fluid; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidTank; @@ -11,14 +10,12 @@ public class ExtendedFluidTank implements IFluidTank { private boolean changeType; private int capacity; - //TODO public ExtendedFluidTank(FluidStack type, int capacity) { if (type == null) { - fluid = new FluidStack(new Fluid("none", null, null), 0); + type = FluidUtils.emptyFluid(); changeType = true; - } else { - fluid = FluidUtils.copy(type, 0); } + fluid = FluidUtils.copy(type, 0); this.capacity = capacity; } @@ -37,12 +34,12 @@ public int getCapacity() { } public boolean canAccept(FluidStack type) { - return type == null || !type.getFluid().getName().equals("none") || (fluid.amount == 0 && changeType) || fluid.isFluidEqual(type); + return type == null || (fluid.amount == 0 && changeType) || fluid.isFluidEqual(type); } @Override public int fill(FluidStack resource, boolean doFill) { - if (resource == null || resource.getFluid().getName().equals("none")) { + if (resource == null) { return 0; } diff --git a/dependencies/main/java/codechicken/core/fluid/FluidUtils.java b/dependencies/main/java/codechicken/core/fluid/FluidUtils.java index bdcb289016..065d841744 100644 --- a/dependencies/main/java/codechicken/core/fluid/FluidUtils.java +++ b/dependencies/main/java/codechicken/core/fluid/FluidUtils.java @@ -4,7 +4,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumHand; import net.minecraftforge.fluids.*; +import net.minecraftforge.fluids.capability.IFluidHandler; public class FluidUtils { public static int B = FluidContainerRegistry.BUCKET_VOLUME; @@ -12,18 +14,18 @@ public class FluidUtils { public static FluidStack lava = new FluidStack(FluidRegistry.LAVA, 1000); public static boolean fillTankWithContainer(IFluidHandler tank, EntityPlayer player) { - ItemStack stack = player.getCurrentEquippedItem(); + ItemStack stack = player.getHeldItem(EnumHand.MAIN_HAND); FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(stack); if (liquid == null) { return false; } - if (tank.fill(null, liquid, false) != liquid.amount && !player.capabilities.isCreativeMode) { + if (tank.fill(liquid, false) != liquid.amount && !player.capabilities.isCreativeMode) { return false; } - tank.fill(null, liquid, true); + tank.fill(liquid, true); if (!player.capabilities.isCreativeMode) { InventoryUtils.consumeItem(player.inventory, player.inventory.currentItem); @@ -34,7 +36,7 @@ public static boolean fillTankWithContainer(IFluidHandler tank, EntityPlayer pla } public static boolean emptyTankIntoContainer(IFluidHandler tank, EntityPlayer player, FluidStack tankLiquid) { - ItemStack stack = player.getCurrentEquippedItem(); + ItemStack stack = player.getHeldItem(EnumHand.MAIN_HAND); if (!FluidContainerRegistry.isEmptyContainer(stack)) { return false; @@ -47,7 +49,7 @@ public static boolean emptyTankIntoContainer(IFluidHandler tank, EntityPlayer pl return false; } - tank.drain(null, liquid.amount, true); + tank.drain(liquid.amount, true); if (!player.capabilities.isCreativeMode) { if (stack.stackSize == 1) { @@ -84,9 +86,13 @@ public static int getLuminosity(FluidStack stack, double density) { return 0; } int light = fluid.getLuminosity(stack); - if (fluid.isGaseous()) { - light = (int) (light * density); - } + if (fluid.isGaseous()) { + light = (int) (light * density); + } return light; } + + public static FluidStack emptyFluid() { + return new FluidStack(water, 0); + } } diff --git a/dependencies/main/java/codechicken/core/fluid/TankAccess.java b/dependencies/main/java/codechicken/core/fluid/TankAccess.java index e55d1972e8..57460c8add 100644 --- a/dependencies/main/java/codechicken/core/fluid/TankAccess.java +++ b/dependencies/main/java/codechicken/core/fluid/TankAccess.java @@ -4,6 +4,7 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidHandler; +@Deprecated public class TankAccess { public IFluidHandler tank; public EnumFacing face; diff --git a/dependencies/main/java/codechicken/core/gui/GuiCCButton.java b/dependencies/main/java/codechicken/core/gui/GuiCCButton.java index c72046c4a3..e8fa8076e5 100644 --- a/dependencies/main/java/codechicken/core/gui/GuiCCButton.java +++ b/dependencies/main/java/codechicken/core/gui/GuiCCButton.java @@ -3,7 +3,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.ResourceLocation; +import net.minecraft.init.SoundEvents; public class GuiCCButton extends GuiWidget { public String text; @@ -32,7 +32,7 @@ public void setEnabled(boolean b) { public void mouseClicked(int x, int y, int button) { if (isEnabled && pointInside(x, y) && actionCommand != null) { sendAction(actionCommand, button); - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); } } diff --git a/dependencies/main/java/codechicken/core/gui/IGuiActionListener.java b/dependencies/main/java/codechicken/core/gui/IGuiActionListener.java index 3504f10691..04a187cda6 100644 --- a/dependencies/main/java/codechicken/core/gui/IGuiActionListener.java +++ b/dependencies/main/java/codechicken/core/gui/IGuiActionListener.java @@ -1,5 +1,5 @@ package codechicken.core.gui; public interface IGuiActionListener { - public void actionPerformed(String actionCommand, Object... params); + void actionPerformed(String actionCommand, Object... params); } \ No newline at end of file diff --git a/dependencies/main/java/codechicken/core/internal/CCCEventHandler.java b/dependencies/main/java/codechicken/core/internal/CCCEventHandler.java index 885570217c..31ddc556f9 100644 --- a/dependencies/main/java/codechicken/core/internal/CCCEventHandler.java +++ b/dependencies/main/java/codechicken/core/internal/CCCEventHandler.java @@ -1,39 +1,16 @@ package codechicken.core.internal; import codechicken.core.CCUpdateChecker; -import codechicken.core.GuiModListScroll; -import net.minecraftforge.client.event.GuiScreenEvent; -import net.minecraftforge.fml.client.GuiModList; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; public class CCCEventHandler { - public static int renderTime; - public static float renderFrame; @SubscribeEvent public void clientTick(TickEvent.ClientTickEvent event) { if (event.phase == Phase.END) { CCUpdateChecker.tick(); - renderTime++; - } - } - - @SubscribeEvent - public void renderTick(TickEvent.RenderTickEvent event) { - if (event.phase == Phase.START) { - renderFrame = event.renderTickTime; - } - } - - @SubscribeEvent - @SideOnly(Side.CLIENT) - public void posGuiRender(GuiScreenEvent.DrawScreenEvent.Post event) { - if (event.gui instanceof GuiModList) { - GuiModListScroll.draw((GuiModList) event.gui, event.mouseX, event.mouseY); } } } diff --git a/dependencies/main/java/codechicken/core/inventory/ContainerExtended.java b/dependencies/main/java/codechicken/core/inventory/ContainerExtended.java index 952cf62b97..fddda563c5 100644 --- a/dependencies/main/java/codechicken/core/inventory/ContainerExtended.java +++ b/dependencies/main/java/codechicken/core/inventory/ContainerExtended.java @@ -4,40 +4,37 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.ICrafting; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; +import net.minecraft.inventory.*; import net.minecraft.item.ItemStack; import java.util.Arrays; import java.util.LinkedList; import java.util.List; -public abstract class ContainerExtended extends Container implements ICrafting { +public abstract class ContainerExtended extends Container implements IContainerListener { public LinkedList playerCrafters = new LinkedList(); public ContainerExtended() { - crafters.add(this); + listeners.add(this); } @Override - public void onCraftGuiOpened(ICrafting icrafting) { + public void addListener(IContainerListener icrafting) { if (icrafting instanceof EntityPlayerMP) { playerCrafters.add((EntityPlayerMP) icrafting); sendContainerAndContentsToPlayer(this, getInventory(), Arrays.asList((EntityPlayerMP) icrafting)); detectAndSendChanges(); } else { - super.onCraftGuiOpened(icrafting); + super.addListener(icrafting); } } @Override - public void removeCraftingFromCrafters(ICrafting icrafting) { + public void removeListener(IContainerListener icrafting) { if (icrafting instanceof EntityPlayerMP) { playerCrafters.remove(icrafting); } else { - super.removeCraftingFromCrafters(icrafting); + super.removeListener(icrafting); } } @@ -96,20 +93,20 @@ public void sendSlotContents(Container container, int slot, ItemStack stack) { } @Override - public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player) { - if (par1 >= 0 && par1 < inventorySlots.size()) { - Slot slot = getSlot(par1); - if (slot instanceof SlotHandleClicks) { - return ((SlotHandleClicks) slot).slotClick(this, player, par2, par3); + public ItemStack slotClick(int slot, int dragType, ClickType clickType, EntityPlayer player) { + if (slot >= 0 && slot < inventorySlots.size()) { + Slot actualSlot = getSlot(slot); + if (actualSlot instanceof SlotHandleClicks) { + return ((SlotHandleClicks) actualSlot).slotClick(this, player, dragType, clickType); } } - return super.slotClick(par1, par2, par3, player); + return super.slotClick(slot, dragType, clickType, player); } @Override public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slotIndex) { ItemStack transferredStack = null; - Slot slot = (Slot) inventorySlots.get(slotIndex); + Slot slot = inventorySlots.get(slotIndex); if (slot != null && slot.getHasStack()) { ItemStack stack = slot.getStack(); @@ -141,7 +138,7 @@ public boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boo if (stack.isStackable())//search for stacks to increase { while (stack.stackSize > 0 && (reverse ? slotIndex >= startIndex : slotIndex < endIndex)) { - Slot slot = (Slot) inventorySlots.get(slotIndex); + Slot slot = inventorySlots.get(slotIndex); ItemStack slotStack = slot.getStack(); if (slotStack != null && slotStack.getItem() == stack.getItem() && @@ -171,7 +168,7 @@ public boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boo slotIndex = reverse ? endIndex - 1 : startIndex; while (stack.stackSize > 0 && (reverse ? slotIndex >= startIndex : slotIndex < endIndex)) { - Slot slot = (Slot) this.inventorySlots.get(slotIndex); + Slot slot = this.inventorySlots.get(slotIndex); if (!slot.getHasStack() && slot.isItemValid(stack)) { int maxStackSize = Math.min(stack.getMaxStackSize(), slot.getSlotStackLimit()); @@ -243,7 +240,7 @@ public void handleGuiChange(int ID, int value) { } public void sendProgressBarUpdate(int barID, int value) { - for (ICrafting crafting : (List) crafters) { + for (IContainerListener crafting : listeners) { crafting.sendProgressBarUpdate(this, barID, value); } } diff --git a/dependencies/main/java/codechicken/core/inventory/IContainerSyncVar.java b/dependencies/main/java/codechicken/core/inventory/IContainerSyncVar.java index c9912eef08..c1e3b708a0 100644 --- a/dependencies/main/java/codechicken/core/inventory/IContainerSyncVar.java +++ b/dependencies/main/java/codechicken/core/inventory/IContainerSyncVar.java @@ -3,11 +3,11 @@ import codechicken.lib.packet.PacketCustom; public interface IContainerSyncVar { - public boolean changed(); + boolean changed(); - public void reset(); + void reset(); - public void writeChange(PacketCustom packet); + void writeChange(PacketCustom packet); - public void readChange(PacketCustom packet); + void readChange(PacketCustom packet); } diff --git a/dependencies/main/java/codechicken/core/inventory/MappedInventoryAccess.java b/dependencies/main/java/codechicken/core/inventory/MappedInventoryAccess.java index 1cf5a1e7bc..e4922a57a9 100644 --- a/dependencies/main/java/codechicken/core/inventory/MappedInventoryAccess.java +++ b/dependencies/main/java/codechicken/core/inventory/MappedInventoryAccess.java @@ -3,15 +3,15 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.util.ITextComponent; +import net.minecraft.util.text.ITextComponent; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class MappedInventoryAccess implements IInventory { - public static interface InventoryAccessor { - public boolean canAccessSlot(int slot); + public interface InventoryAccessor { + boolean canAccessSlot(int slot); } public static final InventoryAccessor fullAccess = new InventoryAccessor() { diff --git a/dependencies/main/java/codechicken/core/inventory/SlotDummy.java b/dependencies/main/java/codechicken/core/inventory/SlotDummy.java index 8b0b5a6c73..6e2f364cd5 100644 --- a/dependencies/main/java/codechicken/core/inventory/SlotDummy.java +++ b/dependencies/main/java/codechicken/core/inventory/SlotDummy.java @@ -2,6 +2,7 @@ import codechicken.lib.inventory.InventoryUtils; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -18,9 +19,9 @@ public SlotDummy(IInventory inv, int slot, int x, int y, int limit) { } @Override - public ItemStack slotClick(ContainerExtended container, EntityPlayer player, int button, int modifier) { + public ItemStack slotClick(ContainerExtended container, EntityPlayer player, int button, ClickType clickType) { ItemStack held = player.inventory.getItemStack(); - boolean shift = modifier == 1; + boolean shift = clickType == ClickType.QUICK_MOVE; slotClick(held, button, shift); return null; } diff --git a/dependencies/main/java/codechicken/core/inventory/SlotDummyOutput.java b/dependencies/main/java/codechicken/core/inventory/SlotDummyOutput.java index 2899d6e4b2..30b5d3756f 100644 --- a/dependencies/main/java/codechicken/core/inventory/SlotDummyOutput.java +++ b/dependencies/main/java/codechicken/core/inventory/SlotDummyOutput.java @@ -1,6 +1,7 @@ package codechicken.core.inventory; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -10,7 +11,7 @@ public SlotDummyOutput(IInventory inv, int slot, int x, int y) { } @Override - public ItemStack slotClick(ContainerExtended container, EntityPlayer player, int button, int modifier) { + public ItemStack slotClick(ContainerExtended container, EntityPlayer player, int button, ClickType clickType) { return null; } } diff --git a/dependencies/main/java/codechicken/core/inventory/SlotHandleClicks.java b/dependencies/main/java/codechicken/core/inventory/SlotHandleClicks.java index 4c93479b02..ead7471e14 100644 --- a/dependencies/main/java/codechicken/core/inventory/SlotHandleClicks.java +++ b/dependencies/main/java/codechicken/core/inventory/SlotHandleClicks.java @@ -1,6 +1,7 @@ package codechicken.core.inventory; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -10,5 +11,5 @@ public SlotHandleClicks(IInventory inv, int slot, int x, int y) { super(inv, slot, x, y); } - public abstract ItemStack slotClick(ContainerExtended container, EntityPlayer player, int button, int modifier); + public abstract ItemStack slotClick(ContainerExtended container, EntityPlayer player, int button, ClickType clickType); } diff --git a/dependencies/main/java/codechicken/core/launch/CodeChickenCorePlugin.java b/dependencies/main/java/codechicken/core/launch/CodeChickenCorePlugin.java index 0e40d56785..f48bf9ee1e 100644 --- a/dependencies/main/java/codechicken/core/launch/CodeChickenCorePlugin.java +++ b/dependencies/main/java/codechicken/core/launch/CodeChickenCorePlugin.java @@ -1,41 +1,36 @@ package codechicken.core.launch; -import codechicken.core.asm.CodeChickenCoreModContainer; -import codechicken.core.asm.DelegatedTransformer; -import codechicken.core.asm.MCPDeobfuscationTransformer; -import codechicken.core.asm.TweakTransformer; -import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion; -import net.minecraftforge.fml.common.versioning.VersionParser; -import net.minecraftforge.fml.relauncher.CoreModManager; +import codechicken.core.CCUpdateChecker; +import codechicken.core.internal.CCCEventHandler; +import codechicken.lib.CodeChickenLib; +import codechicken.lib.config.ConfigFile; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.relauncher.FMLInjectionData; -import net.minecraftforge.fml.relauncher.IFMLCallHook; -import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; -import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import javax.swing.*; -import javax.swing.event.HyperlinkEvent; -import javax.swing.event.HyperlinkListener; -import java.awt.*; import java.io.File; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.util.List; -import java.util.Map; -import java.util.jar.Attributes; -import java.util.jar.JarFile; -import java.util.jar.Manifest; -@TransformerExclusions(value = { "codechicken.core.asm", "codechicken.obfuscator" }) -public class CodeChickenCorePlugin implements IFMLLoadingPlugin, IFMLCallHook { - public static final String mcVersion = "[1.8.9]"; +@Mod(modid = "CodeChickenCore", name = "CodeChicken Core", dependencies = "required-after:CodeChickenLib@[" + CodeChickenLib.version + ",)", acceptedMinecraftVersions = CodeChickenLib.mcVersion, certificateFingerprint = "f1850c39b2516232a2108a7bd84d1cb5df93b261") +public class CodeChickenCorePlugin { public static final String version = "${mod_version}"; public static File minecraftDir; public static String currentMcVersion; public static Logger logger = LogManager.getLogger("CodeChickenCore"); + public static ConfigFile config; + + public static void loadConfig() { + if (config == null) { + config = new ConfigFile(new File(minecraftDir, "config/CodeChickenCore.cfg")).setComment("CodeChickenCore configuration file."); + } + } + public CodeChickenCorePlugin() { if (minecraftDir != null) { return;//get called twice, once for IFMLCallHook @@ -44,126 +39,22 @@ public CodeChickenCorePlugin() { minecraftDir = (File) FMLInjectionData.data()[6]; currentMcVersion = (String) FMLInjectionData.data()[4]; - DepLoader.load(); - injectDeobfPlugin(); - } - - private void injectDeobfPlugin() { - try { - Class wrapperClass = Class.forName("net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper"); - Constructor wrapperConstructor = wrapperClass.getConstructor(String.class, IFMLLoadingPlugin.class, File.class, Integer.TYPE, String[].class); - Field f_loadPlugins = CoreModManager.class.getDeclaredField("loadPlugins"); - wrapperConstructor.setAccessible(true); - f_loadPlugins.setAccessible(true); - ((List) f_loadPlugins.get(null)).add(2, wrapperConstructor.newInstance("CCCDeobfPlugin", new MCPDeobfuscationTransformer.LoadPlugin(), null, 0, new String[0])); - } catch (Exception e) { - logger.error("Failed to inject MCPDeobfuscation Transformer", e); - } - } - - public static void versionCheck(String reqVersion, String mod) { - String mcVersion = (String) FMLInjectionData.data()[4]; - if (!VersionParser.parseRange(reqVersion).containsVersion(new DefaultArtifactVersion(mcVersion))) { - String err = "This version of " + mod + " does not support minecraft version " + mcVersion; - logger.error(err); - - JEditorPane ep = new JEditorPane("text/html", "" + - err + - "
Remove it from your coremods folder and check here for updates" + - ""); - - ep.setEditable(false); - ep.setOpaque(false); - ep.addHyperlinkListener(new HyperlinkListener() { - @Override - public void hyperlinkUpdate(HyperlinkEvent event) { - try { - if (event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) { - Desktop.getDesktop().browse(event.getURL().toURI()); - } - } catch (Exception ignored) { - } - } - }); - - JOptionPane.showMessageDialog(null, ep, "Fatal error", JOptionPane.ERROR_MESSAGE); - System.exit(1); - } - } - - @Override - public String[] getASMTransformerClass() { - versionCheck(mcVersion, "CodeChickenCore"); - return new String[] { "codechicken.core.asm.InterfaceDependancyTransformer", "codechicken.core.asm.TweakTransformer", "codechicken.core.asm.DelegatedTransformer", "codechicken.core.asm.DefaultImplementationTransformer" }; + loadConfig(); } - @Override - public String getAccessTransformerClass() { - return "codechicken.core.asm.CodeChickenAccessTransformer"; + @EventHandler + public void preInit(FMLPreInitializationEvent event) { + FingerprintChecker.runFingerprintChecks(); } - @Override - public String getModContainerClass() { - return "codechicken.core.asm.CodeChickenCoreModContainer"; - } - - @Override - public String getSetupClass() { - return getClass().getName(); - } - - @Override - public void injectData(Map data) { - } - - @Override - public Void call() { - CodeChickenCoreModContainer.loadConfig(); - TweakTransformer.load(); - scanCodeChickenMods(); - - return null; - } - - private void scanCodeChickenMods() { - File modsDir = new File(minecraftDir, "mods"); - for (File file : modsDir.listFiles()) { - scanMod(file); - } - File versionModsDir = new File(minecraftDir, "mods/" + currentMcVersion); - if (versionModsDir.exists()) { - for (File file : versionModsDir.listFiles()) { - scanMod(file); + @EventHandler + public void init(FMLInitializationEvent event) { + if (event.getSide().isClient()) { + if (config.getTag("checkUpdates").getBooleanValue(true)) { + CCUpdateChecker.updateCheck("CodeChickenCore"); } - } - } - private void scanMod(File file) { - if (!file.getName().endsWith(".jar") && !file.getName().endsWith(".zip")) { - return; - } - - try { - JarFile jar = new JarFile(file); - try { - Manifest manifest = jar.getManifest(); - if (manifest == null) { - return; - } - Attributes attr = manifest.getMainAttributes(); - if (attr == null) { - return; - } - - String transformer = attr.getValue("CCTransformer"); - if (transformer != null) { - DelegatedTransformer.addTransformer(transformer, jar, file); - } - } finally { - jar.close(); - } - } catch (Exception e) { - logger.error("CodeChickenCore: Failed to read jar file: " + file.getName(), e); + MinecraftForge.EVENT_BUS.register(new CCCEventHandler()); } } } diff --git a/dependencies/main/java/codechicken/core/launch/DepLoader.java b/dependencies/main/java/codechicken/core/launch/DepLoader.java index 36a111aa6c..e48106f64e 100644 --- a/dependencies/main/java/codechicken/core/launch/DepLoader.java +++ b/dependencies/main/java/codechicken/core/launch/DepLoader.java @@ -4,6 +4,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import net.minecraft.launchwrapper.LaunchClassLoader; +import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.common.asm.transformers.ModAccessTransformer; import net.minecraftforge.fml.common.versioning.ComparableVersion; import net.minecraftforge.fml.relauncher.*; @@ -32,6 +33,7 @@ import java.nio.ByteBuffer; import java.util.*; import java.util.List; +import java.util.Map.Entry; import java.util.jar.Attributes; import java.util.jar.JarFile; import java.util.regex.Matcher; @@ -44,12 +46,75 @@ * For autodownloading stuff. * This is really unoriginal, mostly ripped off FML, credits to cpw. */ +@Deprecated public class DepLoader implements IFMLLoadingPlugin, IFMLCallHook { private static ByteBuffer downloadBuffer = ByteBuffer.allocateDirect(1 << 23); private static final String owner = "DepLoader"; private static DepLoadInst inst; private static final Logger logger = LogManager.getLogger(owner); + public interface IYellAtPeople { + void addYellingData(String data); + + void displayYellingData(); + } + + public static class YellGui extends JOptionPane implements IYellAtPeople { + private ArrayList yellingData = new ArrayList(); + + @Override + public void addYellingData(String data) { + yellingData.add(data); + } + + @Override + public void displayYellingData() { + StringBuilder builder = new StringBuilder(); + builder.append(""); + for (String data : yellingData) { + builder.append("
"); + builder.append(data); + } + builder.append(""); + JEditorPane ep = new JEditorPane("text/html", builder.toString()); + ep.setAutoscrolls(true); + ep.setEditable(false); + ep.setOpaque(false); + ep.addHyperlinkListener(new HyperlinkListener() { + @Override + public void hyperlinkUpdate(HyperlinkEvent event) { + try { + if (event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) { + Desktop.getDesktop().browse(event.getURL().toURI()); + } + } catch (Exception ignored) { + } + } + }); + JOptionPane.showMessageDialog(null, ep, "DepLoader is Deprecated!", -1); + } + } + + public static class YellServer implements IYellAtPeople { + private ArrayList yellingData = new ArrayList(); + + @Override + public void addYellingData(String data) { + yellingData.add(data); + } + + @Override + public void displayYellingData() { + for (String string : yellingData) { + FMLLog.severe(string); + } + try { + Thread.sleep(10000); + } catch (InterruptedException ignored) { + } + } + } + public interface IDownloadDisplay { void resetProgress(int sizeGuess); @@ -175,11 +240,7 @@ public boolean shouldStopIt() { @Override public void showErrorDialog(String name, String url) { - JEditorPane ep = new JEditorPane("text/html", "" + - owner + " was unable to download required library " + name + - "
Check your internet connection and try restarting or download it manually from" + - "
" + url + " and put it in your mods folder" + - ""); + JEditorPane ep = new JEditorPane("text/html", "" + owner + " was unable to download required library " + name + "
Check your internet connection and try restarting or download it manually from" + "
" + url + " and put it in your mods folder" + ""); ep.setEditable(false); ep.setOpaque(false); @@ -510,6 +571,11 @@ public void load() { if (depMap.isEmpty()) { return; } + boolean dontYell = Boolean.parseBoolean(System.getProperty("deploader.dontYellAtPeople", "false")); + if (!dontYell) { + yellAtPeople(); + } + forceRemoveCCL(); loadDeps(); activateDeps(); @@ -558,19 +624,14 @@ private boolean searchCoreMod(File coreMod) { addClasspath(coreMod); try { - Class c = CoreModManager.class; if (!mfAttributes.containsKey(new Attributes.Name("FMLCorePluginContainsFMLMod"))) { FMLRelaunchLog.finer("Adding %s to the list of known coremods, it will not be examined again", coreMod.getName()); - Field f_loadedCoremods = c.getDeclaredField("ignoredModFiles"); - f_loadedCoremods.setAccessible(true); - ((List) f_loadedCoremods.get(null)).add(coreMod.getName()); + CoreModManager.getIgnoredMods().add(coreMod.getName()); } else { FMLRelaunchLog.finer("Found FMLCorePluginContainsFMLMod marker in %s, it will be examined later for regular @Mod instances", coreMod.getName()); - Field f_reparsedCoremods = c.getDeclaredField("candidateModFiles"); - f_reparsedCoremods.setAccessible(true); - ((List) f_reparsedCoremods.get(null)).add(coreMod.getName()); + CoreModManager.getReparseableCoremods().add(coreMod.getName()); } - Method m_loadCoreMod = c.getDeclaredMethod("loadCoreMod", LaunchClassLoader.class, String.class, File.class); + Method m_loadCoreMod = CoreModManager.class.getDeclaredMethod("loadCoreMod", LaunchClassLoader.class, String.class, File.class); m_loadCoreMod.setAccessible(true); m_loadCoreMod.invoke(null, loader, fmlCorePlugin, coreMod); } catch (Exception e) { @@ -710,6 +771,46 @@ private void addDep(Dependency newDep) { } } } + + public void yellAtPeople() { + IYellAtPeople yellAtPeople = FMLLaunchHandler.side().isClient() ? new YellGui() : new YellServer(); + yellAtPeople.addYellingData("The CodeChicken Dependency Downloader is being phased out and has detected mods using it."); + yellAtPeople.addYellingData("The downloader will function as normal but this message serves as a log of what mods are using it."); + yellAtPeople.addYellingData("If you are a mod dev, Please phase out all use of the dependency downloader."); + yellAtPeople.addYellingData("If you are a normal user, you can follow the instructions at the bottom of the window if you would like."); + yellAtPeople.addYellingData("The following mods are being requested to download..."); + yellAtPeople.addYellingData(""); + for (Entry entry : depMap.entrySet()) { + yellAtPeople.addYellingData("\"" + entry.getValue().source.getName() + "\"" + " Wants: " + entry.getKey() + "-" + entry.getValue().file.version); + } + yellAtPeople.addYellingData(""); + yellAtPeople.addYellingData(""); + yellAtPeople.addYellingData("Don't be alarmed by this window, it is simply so i can log what mods are using the Dependency Downloader."); + yellAtPeople.addYellingData("If you would like to report this please follow instructions listed here."); + yellAtPeople.addYellingData("Click the OK button to continue."); + + yellAtPeople.displayYellingData(); + } + + private void forceRemoveCCL() { + if (depSet.contains("CodeChickenLib")) { + depSet.remove("CodeChickenLib"); + depMap.remove("CodeChickenLib"); + } + try { + File[] files = v_modsDir.listFiles(); + if (files != null) { + for (File file : files) { + if (file.getName().contains("CodeChickenLib") && file.getName().endsWith(".jar")) { + FMLLog.info("Found old CCL [%s] attempting delete..", file.getName()); + deleteMod(file); + } + } + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } } public static void load() { diff --git a/dependencies/main/java/codechicken/core/launch/FingerprintChecker.java b/dependencies/main/java/codechicken/core/launch/FingerprintChecker.java new file mode 100644 index 0000000000..9a3a8305a5 --- /dev/null +++ b/dependencies/main/java/codechicken/core/launch/FingerprintChecker.java @@ -0,0 +1,86 @@ +package codechicken.core.launch; + +import codechicken.lib.fingerprint.FingerprintViolatedCrashCallable; +import com.google.common.collect.ImmutableList; +import net.minecraftforge.fml.common.*; +import org.apache.logging.log4j.Level; + +import java.security.cert.Certificate; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +/** + * Created by covers1624 on 13/12/2016. + * To be packaged in each mod runtime, used to cross verify jar fingerprints. + * Idea behind this: + * A malicious user would have to override the fingerprint data in all mod jars this is packaged with in order to avoid detection. + * This is not to be used as DRM. It is used simply to provide cross verification of jars. + */ +public class FingerprintChecker { + + private static final Map modCertMap = new HashMap(); + private static final List invalidMods = new ArrayList(); + + static { + //@formatter:off + modCertMap.put("CodeChickenLib" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("CodeChickenCore" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("ChickenChunks" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("EnderStorage" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("Translocator" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("NotEnoughItems" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("forgemultipartcbe" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + //@formatter:on + } + + public static void runFingerprintChecks() { + try { + ModContainer activeContainer = Loader.instance().activeModContainer(); + for (Entry modEntry : Loader.instance().getIndexedModList().entrySet()) { + for (Entry certEntry : modCertMap.entrySet()) { + if (modEntry.getKey().equals(certEntry.getKey())) { + Object modInstance = modEntry.getValue().getMod(); + if (modInstance == null) { + FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "Unable to do Fingerprint Verification for mod %s! ModContainer returned a null mod instance!", modEntry.getKey()); + break; + } + if (modInstance.getClass().getName().contains("net.minecraftforge.")) { + FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "Unable to do Fingerprint Verification for mod %s! ModContainer returned is a suspected FML class! [%s]", modEntry.getKey(), modInstance.getClass().getName()); + } + + Certificate[] certificates = modInstance.getClass().getProtectionDomain().getCodeSource().getCertificates(); + ImmutableList.Builder certBuilder = ImmutableList.builder(); + if (certificates != null) { + for (Certificate cert : certificates) { + certBuilder.add(CertificateHelper.getFingerprint(cert)); + } + } + + ImmutableList certList = certBuilder.build(); + + String expectedFingerprint = certEntry.getValue(); + + if (expectedFingerprint != null && !expectedFingerprint.isEmpty()) { + if (!certList.contains(expectedFingerprint)) { + FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "The fingerprint for mod %s is invalid! Expected: %s", modEntry.getKey(), expectedFingerprint); + invalidMods.add(modEntry.getKey()); + break; + } else { + FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.DEBUG, "Valid fingerprint found for mod %s.", modEntry.getKey()); + } + } + + break; + } + } + } + FMLCommonHandler.instance().registerCrashCallable(new FingerprintViolatedCrashCallable(activeContainer.getModId(), invalidMods)); + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/dependencies/main/java/codechicken/lib/CodeChickenLib.java b/dependencies/main/java/codechicken/lib/CodeChickenLib.java new file mode 100644 index 0000000000..cdf0daa298 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/CodeChickenLib.java @@ -0,0 +1,50 @@ +package codechicken.lib; + +import codechicken.lib.fingerprint.FingerprintChecker; +import codechicken.lib.internal.proxy.CommonProxy; +import codechicken.lib.util.FuelUtils; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.SidedProxy; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; +import net.minecraftforge.fml.common.registry.GameRegistry; +import net.minecraftforge.fml.relauncher.FMLInjectionData; + +import java.io.File; + +/** + * Created by covers1624 on 12/10/2016. + */ +@Mod (modid = CodeChickenLib.MOD_ID, name = CodeChickenLib.MOD_NAME, acceptedMinecraftVersions = CodeChickenLib.mcVersion, certificateFingerprint = "f1850c39b2516232a2108a7bd84d1cb5df93b261") +public class CodeChickenLib { + + public static final String MOD_ID = "CodeChickenLib"; + public static final String MOD_NAME = "CodeChicken Lib"; + public static final String version = "${mod_version}"; + public static final String mcVersion = "[1.10.2]"; + + public static final File minecraftDir = (File) FMLInjectionData.data()[6]; + + @SidedProxy (clientSide = "codechicken.lib.internal.proxy.ClientProxy", serverSide = "codechicken.lib.internal.proxy.CommonProxy") + public static CommonProxy proxy; + + @EventHandler + public void preInit(FMLPreInitializationEvent event) { + FingerprintChecker.runFingerprintChecks(); + GameRegistry.registerFuelHandler(new FuelUtils()); + proxy.preInit(); + } + + @EventHandler + public void init(FMLInitializationEvent event) { + proxy.init(); + } + + @EventHandler + public void onServerStartingEvent(FMLServerStartingEvent event) { + proxy.serverStarting(event); + } + +} diff --git a/dependencies/main/java/codechicken/lib/asm/ASMBlock.java b/dependencies/main/java/codechicken/lib/asm/ASMBlock.java index 6cffff09f2..981336a054 100644 --- a/dependencies/main/java/codechicken/lib/asm/ASMBlock.java +++ b/dependencies/main/java/codechicken/lib/asm/ASMBlock.java @@ -14,6 +14,7 @@ import static org.objectweb.asm.tree.AbstractInsnNode.*; public class ASMBlock { + public InsnListSection list; private BiMap labels; @@ -49,22 +50,22 @@ public LabelNode get(String s) { public void replaceLabels(Map labelMap, Set usedLabels) { for (AbstractInsnNode insn : list) { switch (insn.getType()) { - case LABEL: - AbstractInsnNode insn2 = insn.clone(labelMap); - if (insn2 == insn)//identity mapping - { - continue; - } - if (usedLabels.contains(insn2)) { - throw new IllegalStateException("LabelNode cannot be a part of two InsnLists"); - } - list.replace(insn, insn2); - break; - case JUMP_INSN: - case FRAME: - case LOOKUPSWITCH_INSN: - case TABLESWITCH_INSN: - list.replace(insn, insn.clone(labelMap)); + case LABEL: + AbstractInsnNode insn2 = insn.clone(labelMap); + if (insn2 == insn)//identity mapping + { + continue; + } + if (usedLabels.contains(insn2)) { + throw new IllegalStateException("LabelNode cannot be a part of two InsnLists"); + } + list.replace(insn, insn2); + break; + case JUMP_INSN: + case FRAME: + case LOOKUPSWITCH_INSN: + case TABLESWITCH_INSN: + list.replace(insn, insn.clone(labelMap)); } } @@ -166,12 +167,12 @@ public ASMBlock applyLabels(InsnListSection list2) { } switch (insn1.getType()) { - case LABEL: - labelMap.put((LabelNode) insn1, (LabelNode) insn2); - break; - case JUMP_INSN: - labelMap.put(((JumpInsnNode) insn1).label, ((JumpInsnNode) insn2).label); - break; + case LABEL: + labelMap.put((LabelNode) insn1, (LabelNode) insn2); + break; + case JUMP_INSN: + labelMap.put(((JumpInsnNode) insn1).label, ((JumpInsnNode) insn2).label); + break; } i++; k++; @@ -187,4 +188,4 @@ public ASMBlock applyLabels(InsnListSection list2) { public InsnList rawListCopy() { return list.copy().list; } -} \ No newline at end of file +} diff --git a/dependencies/main/java/codechicken/lib/asm/ASMHelper.java b/dependencies/main/java/codechicken/lib/asm/ASMHelper.java index cd168228ed..dd0b8f55ea 100644 --- a/dependencies/main/java/codechicken/lib/asm/ASMHelper.java +++ b/dependencies/main/java/codechicken/lib/asm/ASMHelper.java @@ -2,6 +2,7 @@ import codechicken.lib.config.ConfigFile; import codechicken.lib.config.DefaultingConfigFile; +import net.minecraft.launchwrapper.Launch; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.objectweb.asm.ClassReader; @@ -21,6 +22,7 @@ import java.util.Map; public class ASMHelper { + public static ConfigFile config = loadConfig(); public static Logger logger = LogManager.getLogger("CCL ASM"); @@ -28,7 +30,12 @@ private static ConfigFile loadConfig() { try {//weak reference for environments without FML File mcDir = (File) ((Object[]) Class.forName("net.minecraftforge.fml.relauncher.FMLInjectionData").getMethod("data").invoke(null))[6]; File file = new File(mcDir, "config/CodeChickenLib.cfg"); - if (ObfMapping.obfuscated) { + boolean obf = true; + try {//TODO Move the config initializer to a better spot.. + obf = Launch.classLoader.getClassBytes("net.minecraft.world.World") == null; + } catch (Exception ignored) { + } + if (obf) { return new DefaultingConfigFile(file); } else { return new ConfigFile(file).setComment("CodeChickenLib development configuration file."); @@ -38,8 +45,9 @@ private static ConfigFile loadConfig() { } } - public static interface Acceptor { - public void accept(ClassVisitor cv) throws IOException; + public interface Acceptor { + + void accept(ClassVisitor cv) throws IOException; } public static MethodNode findMethod(ObfMapping methodmap, ClassNode cnode) { diff --git a/dependencies/main/java/codechicken/lib/asm/ASMReader.java b/dependencies/main/java/codechicken/lib/asm/ASMReader.java index a0ea35e124..95acb61483 100644 --- a/dependencies/main/java/codechicken/lib/asm/ASMReader.java +++ b/dependencies/main/java/codechicken/lib/asm/ASMReader.java @@ -1,5 +1,6 @@ package codechicken.lib.asm; +import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.*; import java.io.BufferedReader; @@ -13,6 +14,7 @@ import static org.objectweb.asm.tree.AbstractInsnNode.*; public class ASMReader { + public static Map opCodes = new HashMap(); public static byte[] TYPE; @@ -229,62 +231,62 @@ public static Map loadResource(InputStream in, String res) { } else { int opcode = i_opcode; switch (TYPE[opcode]) { - case INSN: - insn = new InsnNode(opcode); - break; - case INT_INSN: - insn = new IntInsnNode(opcode, Integer.parseInt(split[1])); - break; - case VAR_INSN: - insn = new VarInsnNode(opcode, Integer.parseInt(split[1])); - break; - case TYPE_INSN: - insn = new ObfMapping(split[1]).toClassloading().toInsn(opcode); - break; - case FIELD_INSN: - case METHOD_INSN: - StringBuilder sb = new StringBuilder(); - for (int i = 1; i < split.length; i++) { - sb.append(split[i]); - } - insn = ObfMapping.fromDesc(sb.toString()).toClassloading().toInsn(opcode); - break; - case INVOKE_DYNAMIC_INSN: - throw new Exception("Found INVOKEDYNAMIC while reading"); - case JUMP_INSN: - insn = new JumpInsnNode(opcode, block.getOrAdd(split[1])); - break; - case LDC_INSN: - String cst = split[1]; - if (cst.equals("*")) { - insn = new LdcInsnNode(null); - } else if (cst.endsWith("\"")) { - insn = new LdcInsnNode(cst.substring(1, cst.length() - 1)); - } else if (cst.endsWith("L")) { - insn = new LdcInsnNode(Long.valueOf(cst.substring(0, cst.length() - 1))); - } else if (cst.endsWith("F")) { - insn = new LdcInsnNode(Float.valueOf(cst.substring(0, cst.length() - 1))); - } else if (cst.endsWith("D")) { - insn = new LdcInsnNode(Double.valueOf(cst.substring(0, cst.length() - 1))); - } else if (cst.contains(".")) { - insn = new LdcInsnNode(Double.valueOf(cst)); - } else { - insn = new LdcInsnNode(Integer.valueOf(cst)); - } - break; - case IINC_INSN: - insn = new IincInsnNode(opcode, Integer.parseInt(split[1])); - break; - case LABEL: - throw new Exception("Use L# for labels"); - case TABLESWITCH_INSN: - case LOOKUPSWITCH_INSN: - throw new Exception("I don't know how to deal with this insn type"); - case MULTIANEWARRAY_INSN: - insn = new MultiANewArrayInsnNode(split[1], Integer.parseInt(split[2])); - break; - case FRAME: - throw new Exception("Use ClassWriter.COMPUTE_FRAMES"); + case INSN: + insn = new InsnNode(opcode); + break; + case INT_INSN: + insn = new IntInsnNode(opcode, Integer.parseInt(split[1])); + break; + case VAR_INSN: + insn = new VarInsnNode(opcode, Integer.parseInt(split[1])); + break; + case TYPE_INSN: + insn = new ObfMapping(split[1]).toClassloading().toInsn(opcode); + break; + case FIELD_INSN: + case METHOD_INSN: + StringBuilder sb = new StringBuilder(); + for (int i = 1; i < split.length; i++) { + sb.append(split[i]); + } + insn = ObfMapping.fromDesc(sb.toString()).toClassloading().toInsn(opcode); + break; + case INVOKE_DYNAMIC_INSN: + throw new Exception("Found INVOKEDYNAMIC while reading"); + case JUMP_INSN: + insn = new JumpInsnNode(opcode, block.getOrAdd(split[1])); + break; + case LDC_INSN: + String cst = split[1]; + if (cst.equals("*")) { + insn = new LdcInsnNode(null); + } else if (cst.endsWith("\"")) { + insn = new LdcInsnNode(cst.substring(1, cst.length() - 1)); + } else if (cst.endsWith("L")) { + insn = new LdcInsnNode(Long.valueOf(cst.substring(0, cst.length() - 1))); + } else if (cst.endsWith("F")) { + insn = new LdcInsnNode(Float.valueOf(cst.substring(0, cst.length() - 1))); + } else if (cst.endsWith("D")) { + insn = new LdcInsnNode(Double.valueOf(cst.substring(0, cst.length() - 1))); + } else if (cst.contains(".")) { + insn = new LdcInsnNode(Double.valueOf(cst)); + } else { + insn = new LdcInsnNode(Integer.valueOf(cst)); + } + break; + case IINC_INSN: + insn = new IincInsnNode(opcode, Integer.parseInt(split[1])); + break; + case LABEL: + throw new Exception("Use L# for labels"); + case TABLESWITCH_INSN: + case LOOKUPSWITCH_INSN: + throw new Exception("I don't know how to deal with this insn type"); + case MULTIANEWARRAY_INSN: + insn = new MultiANewArrayInsnNode(split[1], Integer.parseInt(split[2])); + break; + case FRAME: + throw new Exception("Use ClassWriter.COMPUTE_FRAMES"); } } @@ -292,8 +294,7 @@ public static Map loadResource(InputStream in, String res) { block.list.add(insn); } } catch (Exception e) { - System.err.println("Error while reading ASM Block " + - current + " from " + res + ", line: " + line); + System.err.println("Error while reading ASM Block " + current + " from " + res + ", line: " + line); e.printStackTrace(); } } diff --git a/dependencies/main/java/codechicken/lib/asm/CCLCorePlugin.java b/dependencies/main/java/codechicken/lib/asm/CCLCorePlugin.java index 7b447ec67e..8da96d44be 100644 --- a/dependencies/main/java/codechicken/lib/asm/CCLCorePlugin.java +++ b/dependencies/main/java/codechicken/lib/asm/CCLCorePlugin.java @@ -1,15 +1,29 @@ package codechicken.lib.asm; +import net.minecraft.launchwrapper.Launch; +import net.minecraftforge.fml.relauncher.FMLInjectionData; +import net.minecraftforge.fml.relauncher.IFMLCallHook; import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import java.io.File; +import java.util.Arrays; +import java.util.List; import java.util.Map; +import java.util.jar.Attributes; +import java.util.jar.JarFile; +import java.util.jar.Manifest; + +@TransformerExclusions ({ "codechicken.lib.asm", "codechicken.lib.config", "codechicken.lib.fingerprint" }) +public class CCLCorePlugin implements IFMLLoadingPlugin, IFMLCallHook { + + public static Logger logger = LogManager.getLogger("CodeChicken Lib"); -@TransformerExclusions({ "codechicken.lib.asm", "codechicken.lib.config" }) -public class CCLCorePlugin implements IFMLLoadingPlugin { @Override public String[] getASMTransformerClass() { - return new String[] { "codechicken.lib.asm.ClassHeirachyManager", "codechicken.lib.asm.RenderHookTransformer" }; + return new String[] { "codechicken.lib.asm.ClassHeirachyManager", "codechicken.lib.asm.CCL_ASMTransformer" }; } @Override @@ -19,7 +33,7 @@ public String getModContainerClass() { @Override public String getSetupClass() { - return null; + return getClass().getName(); } @Override @@ -31,4 +45,59 @@ public void injectData(Map data) { public String getAccessTransformerClass() { return null; } + + @Override + public Void call() throws Exception { + scanMods(); + new ASMHelper(); + return null; + } + + private void scanMods() { + File modsDir = new File((File) FMLInjectionData.data()[6], "mods"); + for (File file : modsDir.listFiles()) { + scanMod(file); + } + File versionModsDir = new File(modsDir, (String) FMLInjectionData.data()[4]); + if (versionModsDir.exists()) { + File[] files = versionModsDir.listFiles(); + if (files != null) { + for (File file : files) { + scanMod(file); + } + } + } + } + + private void scanMod(File file) { + if (!file.getName().endsWith(".jar") && !file.getName().endsWith(".zip")) { + return; + } + + try { + JarFile jar = new JarFile(file); + try { + Manifest manifest = jar.getManifest(); + if (manifest == null) { + return; + } + Attributes attr = manifest.getMainAttributes(); + if (attr == null) { + return; + } + + String transformer = attr.getValue("CCTransformerExclusions"); + if (transformer != null) { + List exclusions = Arrays.asList(transformer.split(",")); + for (String ex : exclusions) { + Launch.classLoader.addTransformerExclusion(ex); + } + } + } finally { + jar.close(); + } + } catch (Exception e) { + logger.error("CodeChickenLib: Failed to read jar file: " + file.getName(), e); + } + } } diff --git a/dependencies/main/java/codechicken/lib/asm/CCL_ASMTransformer.java b/dependencies/main/java/codechicken/lib/asm/CCL_ASMTransformer.java new file mode 100644 index 0000000000..a1c5c03f41 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/asm/CCL_ASMTransformer.java @@ -0,0 +1,31 @@ +package codechicken.lib.asm; + +import codechicken.lib.asm.ModularASMTransformer.MethodInjector; +import net.minecraft.launchwrapper.IClassTransformer; + +import java.util.Map; + +/** + * Created by covers1624 on 15/02/2017. + * + * Internal CCL class for ASM. + */ +public class CCL_ASMTransformer implements IClassTransformer { + + private ModularASMTransformer transformer = new ModularASMTransformer(); + + public CCL_ASMTransformer() { + Map blocks = ASMReader.loadResource("/assets/ccl/asm/hooks.asm"); + + ObfMapping mapping = new ObfMapping("net/minecraft/client/renderer/block/model/ModelBlockDefinition", "func_178331_a", "(Ljava/io/Reader;)Lnet/minecraft/client/renderer/block/model/ModelBlockDefinition;"); + transformer.add(new MethodInjector(mapping, blocks.get("i_BlockStateLoader"), true)); + + mapping = new ObfMapping("net/minecraft/client/renderer/ItemRenderer", "func_187461_a", "(Lnet/minecraft/item/ItemStack;)V"); + transformer.add(new MethodInjector(mapping, blocks.get("i_renderMapFirstPerson"), true)); + } + + @Override + public byte[] transform(String name, String transformedName, byte[] basicClass) { + return transformer.transform(name, basicClass); + } +} diff --git a/dependencies/main/java/codechicken/lib/asm/CC_ClassWriter.java b/dependencies/main/java/codechicken/lib/asm/CC_ClassWriter.java index d0c7db4370..f0da66770a 100644 --- a/dependencies/main/java/codechicken/lib/asm/CC_ClassWriter.java +++ b/dependencies/main/java/codechicken/lib/asm/CC_ClassWriter.java @@ -3,6 +3,7 @@ import org.objectweb.asm.ClassWriter; public class CC_ClassWriter extends ClassWriter { + private final boolean runtime; public CC_ClassWriter(int flags) { diff --git a/dependencies/main/java/codechicken/lib/asm/ClassHeirachyManager.java b/dependencies/main/java/codechicken/lib/asm/ClassHeirachyManager.java index 31b1dbbe43..ee16cbc3da 100644 --- a/dependencies/main/java/codechicken/lib/asm/ClassHeirachyManager.java +++ b/dependencies/main/java/codechicken/lib/asm/ClassHeirachyManager.java @@ -14,7 +14,9 @@ * This is added as a class transformer if CodeChickenCore is installed. Adding it as a class transformer will speed evaluation up slightly by automatically caching superclasses when they are first loaded. */ public class ClassHeirachyManager implements IClassTransformer { + public static class SuperCache { + String superclass; public HashSet parents = new HashSet(); private boolean flattened; diff --git a/dependencies/main/java/codechicken/lib/asm/ImportantInsnVisitor.java b/dependencies/main/java/codechicken/lib/asm/ImportantInsnVisitor.java index 9368bfc45d..c6b32eda54 100644 --- a/dependencies/main/java/codechicken/lib/asm/ImportantInsnVisitor.java +++ b/dependencies/main/java/codechicken/lib/asm/ImportantInsnVisitor.java @@ -6,7 +6,9 @@ import org.objectweb.asm.tree.MethodNode; public class ImportantInsnVisitor extends ClassVisitor { + public class ImportantInsnMethodVisitor extends MethodVisitor { + MethodVisitor delegate; public ImportantInsnMethodVisitor(int access, String name, String desc, String signature, String[] exceptions) { diff --git a/dependencies/main/java/codechicken/lib/asm/InsnComparator.java b/dependencies/main/java/codechicken/lib/asm/InsnComparator.java index 8474c1610e..1c735e5003 100644 --- a/dependencies/main/java/codechicken/lib/asm/InsnComparator.java +++ b/dependencies/main/java/codechicken/lib/asm/InsnComparator.java @@ -2,6 +2,7 @@ import com.google.common.base.Function; import com.google.common.collect.Maps; +import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.*; import java.util.*; @@ -9,6 +10,7 @@ import static org.objectweb.asm.tree.AbstractInsnNode.*; public class InsnComparator { + public static boolean varInsnEqual(VarInsnNode insn1, VarInsnNode insn2) { return insn1.var == -1 || insn2.var == -1 || insn1.var == insn2.var; } @@ -43,34 +45,34 @@ public static boolean insnEqual(AbstractInsnNode node1, AbstractInsnNode node2) } switch (node2.getType()) { - case VAR_INSN: - return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2); - case TYPE_INSN: - return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2); - case FIELD_INSN: - return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2); - case METHOD_INSN: - return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2); - case LDC_INSN: - return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2); - case IINC_INSN: - return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2); - case INT_INSN: - return intInsnEqual((IntInsnNode) node1, (IntInsnNode) node2); - default: - return true; + case VAR_INSN: + return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2); + case TYPE_INSN: + return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2); + case FIELD_INSN: + return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2); + case METHOD_INSN: + return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2); + case LDC_INSN: + return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2); + case IINC_INSN: + return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2); + case INT_INSN: + return intInsnEqual((IntInsnNode) node1, (IntInsnNode) node2); + default: + return true; } } public static boolean insnImportant(AbstractInsnNode insn, Set controlFlowLabels) { switch (insn.getType()) { - case LINE: - case FRAME: - return false; - case LABEL: - return controlFlowLabels.contains(insn); - default: - return true; + case LINE: + case FRAME: + return false; + case LABEL: + return controlFlowLabels.contains(insn); + default: + return true; } } @@ -82,24 +84,24 @@ public static Set getControlFlowLabels(InsnList list) { HashSet controlFlowLabels = new HashSet(); for (AbstractInsnNode insn = list.getFirst(); insn != null; insn = insn.getNext()) { switch (insn.getType()) { - case JUMP_INSN: - JumpInsnNode jinsn = (JumpInsnNode) insn; - controlFlowLabels.add(jinsn.label); - break; - case TABLESWITCH_INSN: - TableSwitchInsnNode tsinsn = (TableSwitchInsnNode) insn; - controlFlowLabels.add(tsinsn.dflt); - for (LabelNode label : tsinsn.labels) { - controlFlowLabels.add(label); - } - break; - case LOOKUPSWITCH_INSN: - LookupSwitchInsnNode lsinsn = (LookupSwitchInsnNode) insn; - controlFlowLabels.add(lsinsn.dflt); - for (LabelNode label : lsinsn.labels) { - controlFlowLabels.add(label); - } - break; + case JUMP_INSN: + JumpInsnNode jinsn = (JumpInsnNode) insn; + controlFlowLabels.add(jinsn.label); + break; + case TABLESWITCH_INSN: + TableSwitchInsnNode tsinsn = (TableSwitchInsnNode) insn; + controlFlowLabels.add(tsinsn.dflt); + for (LabelNode label : tsinsn.labels) { + controlFlowLabels.add(label); + } + break; + case LOOKUPSWITCH_INSN: + LookupSwitchInsnNode lsinsn = (LookupSwitchInsnNode) insn; + controlFlowLabels.add(lsinsn.dflt); + for (LabelNode label : lsinsn.labels) { + controlFlowLabels.add(label); + } + break; } } return controlFlowLabels; diff --git a/dependencies/main/java/codechicken/lib/asm/InsnListSection.java b/dependencies/main/java/codechicken/lib/asm/InsnListSection.java index 38b0d2d311..dd47505336 100644 --- a/dependencies/main/java/codechicken/lib/asm/InsnListSection.java +++ b/dependencies/main/java/codechicken/lib/asm/InsnListSection.java @@ -1,6 +1,7 @@ package codechicken.lib.asm; import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.tree.AbstractInsnNode; import org.objectweb.asm.tree.*; import org.objectweb.asm.util.Textifier; import org.objectweb.asm.util.TraceMethodVisitor; @@ -19,7 +20,9 @@ * A section of an InsnList, may become invalid if the insn list is modified */ public class InsnListSection implements Iterable { + private class InsnListSectionIterator implements Iterator { + int i = 0; @Override @@ -185,43 +188,43 @@ public HashMap identityLabelMap() { HashMap labelMap = new HashMap(); for (AbstractInsnNode insn : this) { switch (insn.getType()) { - case LABEL: - labelMap.put((LabelNode) insn, (LabelNode) insn); - break; - case JUMP_INSN: - labelMap.put(((JumpInsnNode) insn).label, ((JumpInsnNode) insn).label); - break; - case LOOKUPSWITCH_INSN: - LookupSwitchInsnNode linsn = (LookupSwitchInsnNode) insn; - labelMap.put(linsn.dflt, linsn.dflt); - for (LabelNode label : linsn.labels) { - labelMap.put(label, label); - } - break; - case TABLESWITCH_INSN: - TableSwitchInsnNode tinsn = (TableSwitchInsnNode) insn; - labelMap.put(tinsn.dflt, tinsn.dflt); - for (LabelNode label : tinsn.labels) { - labelMap.put(label, label); - } - break; - case FRAME: - FrameNode fnode = (FrameNode) insn; - if (fnode.local != null) { - for (Object o : fnode.local) { - if (o instanceof LabelNode) { - labelMap.put((LabelNode) o, (LabelNode) o); + case LABEL: + labelMap.put((LabelNode) insn, (LabelNode) insn); + break; + case JUMP_INSN: + labelMap.put(((JumpInsnNode) insn).label, ((JumpInsnNode) insn).label); + break; + case LOOKUPSWITCH_INSN: + LookupSwitchInsnNode linsn = (LookupSwitchInsnNode) insn; + labelMap.put(linsn.dflt, linsn.dflt); + for (LabelNode label : linsn.labels) { + labelMap.put(label, label); + } + break; + case TABLESWITCH_INSN: + TableSwitchInsnNode tinsn = (TableSwitchInsnNode) insn; + labelMap.put(tinsn.dflt, tinsn.dflt); + for (LabelNode label : tinsn.labels) { + labelMap.put(label, label); + } + break; + case FRAME: + FrameNode fnode = (FrameNode) insn; + if (fnode.local != null) { + for (Object o : fnode.local) { + if (o instanceof LabelNode) { + labelMap.put((LabelNode) o, (LabelNode) o); + } } } - } - if (fnode.stack != null) { - for (Object o : fnode.stack) { - if (o instanceof LabelNode) { - labelMap.put((LabelNode) o, (LabelNode) o); + if (fnode.stack != null) { + for (Object o : fnode.stack) { + if (o instanceof LabelNode) { + labelMap.put((LabelNode) o, (LabelNode) o); + } } } - } - break; + break; } } @@ -254,4 +257,4 @@ public InsnListSection copy(Map labelMap) { public Iterator iterator() { return new InsnListSectionIterator(); } -} \ No newline at end of file +} diff --git a/dependencies/main/java/codechicken/lib/asm/LocalVariablesSorterVisitor.java b/dependencies/main/java/codechicken/lib/asm/LocalVariablesSorterVisitor.java index 81c2eefbd0..2b1fb1aad3 100644 --- a/dependencies/main/java/codechicken/lib/asm/LocalVariablesSorterVisitor.java +++ b/dependencies/main/java/codechicken/lib/asm/LocalVariablesSorterVisitor.java @@ -8,6 +8,7 @@ import java.util.Set; public class LocalVariablesSorterVisitor extends ClassVisitor { + public Set methods; public String owner; @@ -33,4 +34,3 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si } } - \ No newline at end of file diff --git a/dependencies/main/java/codechicken/core/asm/MethodASMifier.java b/dependencies/main/java/codechicken/lib/asm/MethodASMifier.java similarity index 96% rename from dependencies/main/java/codechicken/core/asm/MethodASMifier.java rename to dependencies/main/java/codechicken/lib/asm/MethodASMifier.java index aacd600dcd..9d00a50527 100644 --- a/dependencies/main/java/codechicken/core/asm/MethodASMifier.java +++ b/dependencies/main/java/codechicken/lib/asm/MethodASMifier.java @@ -1,6 +1,5 @@ -package codechicken.core.asm; +package codechicken.lib.asm; -import codechicken.lib.asm.ObfMapping; import net.minecraft.launchwrapper.Launch; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; @@ -14,6 +13,7 @@ import static org.objectweb.asm.Opcodes.ASM4; public class MethodASMifier extends ClassVisitor { + PrintWriter printWriter; ObfMapping method; Printer asmifier; diff --git a/dependencies/main/java/codechicken/lib/asm/ModularASMTransformer.java b/dependencies/main/java/codechicken/lib/asm/ModularASMTransformer.java index 0c019f017e..91edeafb34 100644 --- a/dependencies/main/java/codechicken/lib/asm/ModularASMTransformer.java +++ b/dependencies/main/java/codechicken/lib/asm/ModularASMTransformer.java @@ -8,12 +8,20 @@ import org.objectweb.asm.tree.MethodNode; import java.io.File; +import java.io.FileOutputStream; import java.util.*; import static codechicken.lib.asm.ASMHelper.*; +//TODO Java doc all the internal class constructors. public class ModularASMTransformer { + + /** + * Contains a list of transformers for a given class. + * Also contains some basic logic for doing the actual transform. + */ public static class ClassNodeTransformerList { + List transformers = new LinkedList(); HashSet methodsToSort = new HashSet(); @@ -39,18 +47,29 @@ public byte[] transform(byte[] bytes) { } bytes = createBytes(cnode, writeFlags); - if (config.getTag("dump_asm").getBooleanValue(true)) { + if (config.getTag("dump_asm_raw").getBooleanValue(false)) { + File file = new File("asm/ccl_modular/" + cnode.name.replace('/', '#') + ".class"); + FileOutputStream fos = new FileOutputStream(file); + fos.write(bytes); + fos.flush(); + fos.close(); + + } else if (config.getTag("dump_asm").getBooleanValue(true)) { dump(bytes, new File("asm/ccl_modular/" + cnode.name.replace('/', '#') + ".txt"), false, false); } return bytes; - } catch (RuntimeException e) { + } catch (Exception e) { dump(bytes, new File("asm/ccl_modular/" + cnode.name.replace('/', '#') + ".txt"), false, false); - throw e; + throw new RuntimeException(e); } } } + /** + * Parent to all transformer's. + */ public static abstract class ClassNodeTransformer { + public int writeFlags; public ClassNodeTransformer(int writeFlags) { @@ -69,7 +88,11 @@ public void addMethodsToSort(Set set) { } } + /** + * Base Method transformer. + */ public static abstract class MethodTransformer extends ClassNodeTransformer { + public final ObfMapping method; public MethodTransformer(ObfMapping method) { @@ -98,7 +121,11 @@ public void transform(ClassNode cnode) { public abstract void transform(MethodNode mv); } + /** + * Writes a method containing the provided InsnList with the ObfMapping as the method name and desc. + */ public static class MethodWriter extends ClassNodeTransformer { + public final int access; public final ObfMapping method; public final String[] exceptions; @@ -161,7 +188,12 @@ public void write(MethodNode mv) { } } + /** + * Injects a call before or after the needle. + * If needle is null it will inject at the start or end of the method. + */ public static class MethodInjector extends MethodTransformer { + public ASMBlock needle; public ASMBlock injection; public boolean before; @@ -214,7 +246,12 @@ public void transform(MethodNode mv) { } } + /** + * Replaces a specific needle with a specific replacement. + * Can replace more than one needle. + */ public static class MethodReplacer extends MethodTransformer { + public ASMBlock needle; public ASMBlock replacement; @@ -243,7 +280,12 @@ public void transform(MethodNode mv) { } } + /** + * Writes a field to a class. + * ObfMapping contains the class to put the field. + */ public static class FieldWriter extends ClassNodeTransformer { + public final ObfMapping field; public final int access; public final Object value; @@ -271,6 +313,11 @@ public void transform(ClassNode cnode) { public HashMap transformers = new HashMap(); + /** + * Adds a ClassNodeTransformer to this transformer. + * + * @param t Transformer to add. + */ public void add(ClassNodeTransformer t) { ClassNodeTransformerList list = transformers.get(t.className()); if (list == null) { @@ -279,6 +326,14 @@ public void add(ClassNodeTransformer t) { list.add(t); } + /** + * Runs the transform. + * + * @param name name of the class being loaded. + * @param bytes Class bytes. + * @return Returns null if the class passed is null, returns original class if there are no transformers for a given class. + * Otherwise returns transformed class. + */ public byte[] transform(String name, byte[] bytes) { if (bytes == null) { return null; diff --git a/dependencies/main/java/codechicken/lib/asm/ObfMapping.java b/dependencies/main/java/codechicken/lib/asm/ObfMapping.java index 5754e69e1c..7d4414ed0f 100644 --- a/dependencies/main/java/codechicken/lib/asm/ObfMapping.java +++ b/dependencies/main/java/codechicken/lib/asm/ObfMapping.java @@ -25,7 +25,9 @@ import java.util.Map.Entry; public class ObfMapping { + public static class ObfRemapper extends Remapper { + private HashMap fields = new HashMap(); private HashMap funcs = new HashMap(); @@ -89,20 +91,20 @@ public boolean isObf(String typeName) { } public static class MCPRemapper extends Remapper implements LineProcessor { + public static File[] getConfFiles() { // check for GradleStart system vars - if (!Strings.isNullOrEmpty(System.getProperty("net.minecraftforge.gradle.GradleStart.srgDir"))) { - File srgDir = new File(System.getProperty("net.minecraftforge.gradle.GradleStart.srgDir")); + if (!Strings.isNullOrEmpty(System.getProperty("net.minecraftforge.gradle.GradleStart.srg.notch-srg"))) { + File notchSrg = new File(System.getProperty("net.minecraftforge.gradle.GradleStart.srg.notch-srg")); File csvDir = new File(System.getProperty("net.minecraftforge.gradle.GradleStart.csvDir")); - if (srgDir.exists() && csvDir.exists()) { - File srg = new File(srgDir, "notch-srg.srg"); + if (notchSrg.exists() && csvDir.exists()) { File fieldCsv = new File(csvDir, "fields.csv"); File methodCsv = new File(csvDir, "methods.csv"); - if (srg.exists() && fieldCsv.exists() && methodCsv.exists()) { - return new File[] { srg, fieldCsv, methodCsv }; + if (notchSrg.exists() && fieldCsv.exists() && methodCsv.exists()) { + return new File[] { notchSrg, fieldCsv, methodCsv }; } } } @@ -137,21 +139,20 @@ public static File[] getConfFiles() { public static File confDirectoryGuess(int i, ConfigTag tag) { File mcDir = (File) FMLInjectionData.data()[6]; switch (i) { - case 0: - return tag.value != null ? new File(tag.getValue()) : null; - case 1: - return new File(mcDir, "../conf"); - case 2: - return new File(mcDir, "../build/unpacked/conf"); - case 3: - return new File(System.getProperty("user.home"), ".gradle/caches/minecraft/net/minecraftforge/forge/" + - FMLInjectionData.data()[4] + "-" + ForgeVersion.getVersion() + "/unpacked/conf"); - default: - JFileChooser fc = new JFileChooser(mcDir); - fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - fc.setDialogTitle("Select an mcp conf dir for the deobfuscator."); - int ret = fc.showDialog(null, "Select"); - return ret == JFileChooser.APPROVE_OPTION ? fc.getSelectedFile() : null; + case 0: + return tag.value != null ? new File(tag.getValue()) : null; + case 1: + return new File(mcDir, "../conf"); + case 2: + return new File(mcDir, "../build/unpacked/conf"); + case 3: + return new File(System.getProperty("user.home"), ".gradle/caches/minecraft/net/minecraftforge/forge/" + FMLInjectionData.data()[4] + "-" + ForgeVersion.getVersion() + "/unpacked/conf"); + default: + JFileChooser fc = new JFileChooser(mcDir); + fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + fc.setDialogTitle("Select an mcp conf dir for the deobfuscator."); + int ret = fc.showDialog(null, "Select"); + return ret == JFileChooser.APPROVE_OPTION ? fc.getSelectedFile() : null; } } diff --git a/dependencies/main/java/codechicken/lib/asm/RenderHookTransformer.java b/dependencies/main/java/codechicken/lib/asm/RenderHookTransformer.java deleted file mode 100644 index 8d8a7c68ce..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/RenderHookTransformer.java +++ /dev/null @@ -1,20 +0,0 @@ -package codechicken.lib.asm; - -import codechicken.lib.asm.ModularASMTransformer.MethodInjector; -import net.minecraft.launchwrapper.IClassTransformer; - -import java.util.Map; - -public class RenderHookTransformer implements IClassTransformer { - private ModularASMTransformer transformer = new ModularASMTransformer(); - - public RenderHookTransformer() { - Map blocks = ASMReader.loadResource("/assets/ccl/asm/hooks.asm"); - transformer.add(new MethodInjector(new ObfMapping("net/minecraft/client/renderer/entity/RenderItem", "func_180454_a", "(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V"), blocks.get("n_IItemRenderer"), blocks.get("IItemRenderer"), true)); - } - - @Override - public byte[] transform(String name, String tname, byte[] bytes) { - return transformer.transform(name, bytes); - } -} diff --git a/dependencies/main/java/codechicken/core/ClassDiscoverer.java b/dependencies/main/java/codechicken/lib/asm/discovery/ClassDiscoverer.java similarity index 84% rename from dependencies/main/java/codechicken/core/ClassDiscoverer.java rename to dependencies/main/java/codechicken/lib/asm/discovery/ClassDiscoverer.java index 15ac276dc5..5632a15a60 100644 --- a/dependencies/main/java/codechicken/core/ClassDiscoverer.java +++ b/dependencies/main/java/codechicken/lib/asm/discovery/ClassDiscoverer.java @@ -1,7 +1,8 @@ -package codechicken.core; +package codechicken.lib.asm.discovery; -import codechicken.core.launch.CodeChickenCorePlugin; import codechicken.lib.asm.ASMHelper; +import codechicken.lib.asm.CCLCorePlugin; +import codechicken.lib.util.CommonUtils; import net.minecraft.launchwrapper.Launch; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModClassLoader; @@ -18,6 +19,7 @@ import java.util.zip.ZipInputStream; public class ClassDiscoverer { + public IStringMatcher matcher; public String[] superclasses; public ArrayList> classes; @@ -31,7 +33,7 @@ public ClassDiscoverer(IStringMatcher matcher, Class... superclasses) { } classes = new ArrayList>(); - modClassLoader = (ModClassLoader) Loader.instance().getModClassLoader(); + modClassLoader = Loader.instance().getModClassLoader(); } public ClassDiscoverer(Class... superclasses) { @@ -68,7 +70,7 @@ private void checkAddClass(String resource) { addClass(classname); } catch (IOException e) { - CodeChickenCorePlugin.logger.error("Unable to load class: " + resource, e); + CCLCorePlugin.logger.error("Unable to load class: " + resource, e); } } @@ -77,7 +79,7 @@ private void addClass(String classname) { Class class1 = Class.forName(classname, true, modClassLoader); classes.add(class1); } catch (Throwable t) { - CodeChickenCorePlugin.logger.error("Unable to load class: " + classname, t); + CCLCorePlugin.logger.error("Unable to load class: " + classname, t); } } @@ -92,14 +94,14 @@ private void findClasspathMods() { searched.add(source.getAbsolutePath()); if (source.isFile()) { - CodeChickenCorePlugin.logger.debug("Found a mod container %s, examining for codechicken classes", source.getAbsolutePath()); + CCLCorePlugin.logger.debug("Found a mod container %s, examining for codechicken classes", source.getAbsolutePath()); try { readFromZipFile(source); } catch (Exception e) { - CodeChickenCorePlugin.logger.error("Failed to scan " + source.getAbsolutePath() + ", the zip file is invalid", e); + CCLCorePlugin.logger.error("Failed to scan " + source.getAbsolutePath() + ", the zip file is invalid", e); } } else if (source.isDirectory()) { - CodeChickenCorePlugin.logger.debug("Found a minecraft related directory at %s, examining for codechicken classes", source.getAbsolutePath()); + CCLCorePlugin.logger.debug("Found a minecraft related directory at %s, examining for codechicken classes", source.getAbsolutePath()); readFromDirectory(source, source); } } diff --git a/dependencies/main/java/codechicken/lib/asm/discovery/IStringMatcher.java b/dependencies/main/java/codechicken/lib/asm/discovery/IStringMatcher.java new file mode 100644 index 0000000000..45f69d3fdb --- /dev/null +++ b/dependencies/main/java/codechicken/lib/asm/discovery/IStringMatcher.java @@ -0,0 +1,7 @@ +package codechicken.lib.asm.discovery; + +//TODO Predicate? +public interface IStringMatcher { + + boolean matches(String test); +} diff --git a/dependencies/main/java/codechicken/lib/block/BlockMultiTile.java b/dependencies/main/java/codechicken/lib/block/BlockMultiTile.java new file mode 100644 index 0000000000..7c3f4c7e70 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/BlockMultiTile.java @@ -0,0 +1,55 @@ +package codechicken.lib.block; + +import net.minecraft.block.Block; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.registry.GameRegistry; +import org.apache.logging.log4j.Level; + +/** + * Created by covers1624 on 3/27/2016. + */ +public class BlockMultiTile extends Block implements ITileEntityProvider { + + @SuppressWarnings ("unchecked") + private Class[] tileEntityMap = new Class[16]; + + public BlockMultiTile(Material material) { + super(material); + } + + public void registerSubItemAndTile(int meta, String name, Class clazz) { + GameRegistry.registerTileEntity(clazz, Loader.instance().activeModContainer().getModId() + ":" + name); + addSubItemAndTile(meta, name, clazz); + } + + public void addSubItemAndTile(int meta, String name, Class clazz) { + addTileEntityMapping(meta, clazz); + setItemName(meta, name); + } + + public void setItemName(int meta, String name) { + Item item = Item.getItemFromBlock(this); + ((ItemBlockMultiType) item).registerSubItem(meta, name); + } + + public void addTileEntityMapping(int meta, Class clazz) { + this.tileEntityMap[meta] = clazz; + } + + @Override + public TileEntity createNewTileEntity(World worldIn, int meta) { + Class clazz = tileEntityMap[meta]; + try { + return clazz.getDeclaredConstructor(new Class[0]).newInstance(); + } catch (Exception e) { + FMLLog.log("CodeChicken Lib", Level.FATAL, "Unable to create tile with meta of %s", meta); + return null; + } + } +} diff --git a/dependencies/main/java/codechicken/lib/block/IParticleProvider.java b/dependencies/main/java/codechicken/lib/block/IParticleProvider.java new file mode 100644 index 0000000000..ff261266ed --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/IParticleProvider.java @@ -0,0 +1,10 @@ +package codechicken.lib.block; + +/** + * Created by covers1624 on 20/11/2016. + */ +public interface IParticleProvider extends IType { + + String getParticleTexture(); + +} diff --git a/dependencies/main/java/codechicken/lib/block/IType.java b/dependencies/main/java/codechicken/lib/block/IType.java new file mode 100644 index 0000000000..6445f14a91 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/IType.java @@ -0,0 +1,15 @@ +package codechicken.lib.block; + +import net.minecraft.block.properties.IProperty; +import net.minecraft.util.IStringSerializable; + +/** + * Created by covers1624 on 20/11/2016. + */ +public interface IType extends IStringSerializable { + + IProperty getTypeProperty(); + + int meta(); + +} diff --git a/dependencies/main/java/codechicken/lib/block/ItemBlockMultiType.java b/dependencies/main/java/codechicken/lib/block/ItemBlockMultiType.java new file mode 100644 index 0000000000..26aa8e5181 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/ItemBlockMultiType.java @@ -0,0 +1,55 @@ +package codechicken.lib.block; + +import net.minecraft.block.Block; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by covers1624 on 3/27/2016. + */ +//TODO Merge Model variant code in to here. maybe. +public class ItemBlockMultiType extends ItemBlock { + + private HashMap names = new HashMap(); + + public ItemBlockMultiType(Block block) { + super(block); + setMaxDamage(0); + setHasSubtypes(true); + } + + @Override + public int getMetadata(int meta) { + return meta; + } + + public ItemBlockMultiType registerBulkArray(String[] names) { + for (int i = 0; i < names.length; i++) { + registerSubItem(i, names[i]); + } + return this; + } + + public ItemBlockMultiType registerSubItem(int meta, String name) { + names.put(meta, name); + return this; + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + return "tile." + names.get(stack.getItemDamage()); + } + + @Override + public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) { + for (Map.Entry entry : names.entrySet()) { + subItems.add(new ItemStack(this, 1, entry.getKey())); + } + } +} diff --git a/dependencies/main/java/codechicken/lib/block/StateReference.java b/dependencies/main/java/codechicken/lib/block/StateReference.java new file mode 100644 index 0000000000..85bb6aa5bc --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/StateReference.java @@ -0,0 +1,14 @@ +package codechicken.lib.block; + +import codechicken.lib.block.property.PropertyEnumFacingAll; +import codechicken.lib.block.property.PropertyEnumFacingHoz; + +/** + * Created by covers1624 on 3/28/2016. + */ +public class StateReference { + + public static final PropertyEnumFacingHoz FACING_HOZ = PropertyEnumFacingHoz.create("facinghoz"); + public static final PropertyEnumFacingAll FACING_ALL = PropertyEnumFacingAll.create("facingall"); + +} diff --git a/dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingAll.java b/dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingAll.java new file mode 100644 index 0000000000..f5779280db --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingAll.java @@ -0,0 +1,21 @@ +package codechicken.lib.block.property; + +import com.google.common.collect.Lists; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.util.EnumFacing; + +import java.util.Collection; + +/** + * Created by covers1624 on 3/27/2016. + */ +public class PropertyEnumFacingAll extends PropertyDirection { + + protected PropertyEnumFacingAll(String name, Collection values) { + super(name, values); + } + + public static PropertyEnumFacingAll create(String name) { + return new PropertyEnumFacingAll(name, Lists.newArrayList(EnumFacing.VALUES)); + } +} diff --git a/dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingHoz.java b/dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingHoz.java new file mode 100644 index 0000000000..0502626042 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingHoz.java @@ -0,0 +1,22 @@ +package codechicken.lib.block.property; + +import com.google.common.collect.Lists; +import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.util.EnumFacing; + +import java.util.Collection; + +/** + * Created by covers1624 on 3/27/2016. + */ +public class PropertyEnumFacingHoz extends PropertyDirection { + + protected PropertyEnumFacingHoz(String name, Collection values) { + super(name, values); + } + + public static PropertyEnumFacingHoz create(String name) { + return new PropertyEnumFacingHoz(name, Lists.newArrayList(EnumFacing.HORIZONTALS)); + } + +} diff --git a/dependencies/main/java/codechicken/lib/block/property/PropertyInteger.java b/dependencies/main/java/codechicken/lib/block/property/PropertyInteger.java new file mode 100644 index 0000000000..586f9f50ef --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/PropertyInteger.java @@ -0,0 +1,48 @@ +package codechicken.lib.block.property; + +import com.google.common.base.Optional; +import com.google.common.collect.ImmutableSet; +import net.minecraft.block.properties.PropertyHelper; + +import java.util.Collection; + +/** + * Created by covers1624 on 5/23/2016. + */ +public class PropertyInteger extends PropertyHelper { + + private final ImmutableSet valueSet; + + public PropertyInteger(String name, Collection values) { + super(name, Integer.class); + valueSet = ImmutableSet.copyOf(values); + } + + //EG, 16 = 0 - 15, 4 = 0 - 3 + public PropertyInteger(String name, int max) { + super(name, Integer.class); + ImmutableSet.Builder builder = ImmutableSet.builder(); + for (int i = 0; i < max; i++) { + builder.add(i); + } + valueSet = builder.build(); + } + + @Override + public Collection getAllowedValues() { + return valueSet; + } + + @Override + public Optional parseValue(String value) { + if (valueSet.contains(Integer.valueOf(value))) { + return Optional.of(Integer.valueOf(value)); + } + return Optional.absent(); + } + + @Override + public String getName(Integer value) { + return String.valueOf(value); + } +} diff --git a/dependencies/main/java/codechicken/lib/block/property/PropertyString.java b/dependencies/main/java/codechicken/lib/block/property/PropertyString.java new file mode 100644 index 0000000000..9c263e1e2c --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/PropertyString.java @@ -0,0 +1,52 @@ +package codechicken.lib.block.property; + +import com.google.common.base.Optional; +import com.google.common.collect.ImmutableList; +import net.minecraft.block.properties.PropertyHelper; + +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; + +/** + * Created by covers1624 on 2/6/2016. + */ +public class PropertyString extends PropertyHelper { + + private final List valuesSet; + + public PropertyString(String name, Collection values) { + super(name, String.class); + valuesSet = new LinkedList(values); + } + + public PropertyString(String name, String... values) { + super(name, String.class); + valuesSet = new LinkedList(); + Collections.addAll(valuesSet, values); + } + + public List values() { + return ImmutableList.copyOf(valuesSet); + } + + @Override + public Collection getAllowedValues() { + return ImmutableList.copyOf(valuesSet); + } + + @Override + public Optional parseValue(String value) { + if (valuesSet.contains(value)) { + return Optional.of(value); + } + return Optional.absent(); + } + + @Override + public String getName(String value) { + return value; + } +} + diff --git a/dependencies/main/java/codechicken/lib/block/property/TileEntityProperty.java b/dependencies/main/java/codechicken/lib/block/property/TileEntityProperty.java new file mode 100644 index 0000000000..bda47941f1 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/TileEntityProperty.java @@ -0,0 +1,39 @@ +package codechicken.lib.block.property; + +import com.google.common.base.Objects; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.property.IUnlistedProperty; + +/** + * Created by covers1624 on 5/10/2016. + * Used to store a TileEntity as an UnlistedProperty for the use of baking models, useful for anything to do with tile access dependent baking. + */ +public class TileEntityProperty implements IUnlistedProperty { + + private String name; + + public TileEntityProperty(String name) { + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public boolean isValid(TileEntity value) { + return true; + } + + @Override + public Class getType() { + return TileEntity.class; + } + + @Override + public String valueToString(TileEntity value) { + Object worldID = value.hasWorldObj() ? value.getWorld().provider.getDimension() : "NoWorld!"; + return Objects.toStringHelper(value).add("position", value.getPos().toString()).add("worldID", worldID).toString(); + } +} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedBooleanProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedBooleanProperty.java new file mode 100644 index 0000000000..8303399732 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedBooleanProperty.java @@ -0,0 +1,21 @@ +package codechicken.lib.block.property.unlisted; + +/** + * Created by covers1624 on 28/10/2016. + */ +public class UnlistedBooleanProperty extends UnlistedPropertyBase { + + public UnlistedBooleanProperty(String name) { + super(name); + } + + @Override + public Class getType() { + return Boolean.class; + } + + @Override + public String valueToString(Boolean value) { + return value.toString(); + } +} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteArrayProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteArrayProperty.java new file mode 100644 index 0000000000..307af6758c --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteArrayProperty.java @@ -0,0 +1,31 @@ +package codechicken.lib.block.property.unlisted; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; + +/** + * Created by covers1624 on 21/02/2017. + */ +public class UnlistedByteArrayProperty extends UnlistedPropertyBase { + + public UnlistedByteArrayProperty(String name) { + super(name); + } + + @Override + public Class getType() { + return byte[].class; + } + + @Override + public String valueToString(byte[] value) { + ToStringHelper helper = Objects.toStringHelper("ByteArray"); + if (value != null) { + for (int i1 = 0; i1 < value.length; i1++) { + byte i = value[i1]; + helper.add("Index:" + i1, i); + } + } + return helper.toString(); + } +} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteProperty.java new file mode 100644 index 0000000000..41c1c33f46 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteProperty.java @@ -0,0 +1,21 @@ +package codechicken.lib.block.property.unlisted; + +/** + * Created by covers1624 on 28/10/2016. + */ +public class UnlistedByteProperty extends UnlistedPropertyBase { + + public UnlistedByteProperty(String name) { + super(name); + } + + @Override + public Class getType() { + return Byte.class; + } + + @Override + public String valueToString(Byte value) { + return value.toString(); + } +} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedEnumFacingProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedEnumFacingProperty.java new file mode 100644 index 0000000000..f9b81b5661 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedEnumFacingProperty.java @@ -0,0 +1,23 @@ +package codechicken.lib.block.property.unlisted; + +import net.minecraft.util.EnumFacing; + +/** + * Created by covers1624 on 23/11/2016. + */ +public class UnlistedEnumFacingProperty extends UnlistedPropertyBase { + + public UnlistedEnumFacingProperty(String name) { + super(name); + } + + @Override + public Class getType() { + return EnumFacing.class; + } + + @Override + public String valueToString(EnumFacing value) { + return value.toString(); + } +} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedFluidStackProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedFluidStackProperty.java new file mode 100644 index 0000000000..bbdc89c46f --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedFluidStackProperty.java @@ -0,0 +1,24 @@ +package codechicken.lib.block.property.unlisted; + +import com.google.common.base.Objects; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by covers1624 on 30/10/2016. + */ +public class UnlistedFluidStackProperty extends UnlistedPropertyBase { + + public UnlistedFluidStackProperty(String name) { + super(name); + } + + @Override + public Class getType() { + return FluidStack.class; + } + + @Override + public String valueToString(FluidStack value) { + return Objects.toStringHelper("FluidStack").add("Fluid", value.getFluid().getName()).add("Amount", value.amount).add("Tag", value.tag.toString()).toString(); + } +} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntArrayProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntArrayProperty.java new file mode 100644 index 0000000000..9fa4a9251c --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntArrayProperty.java @@ -0,0 +1,31 @@ +package codechicken.lib.block.property.unlisted; + +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; + +/** + * Created by covers1624 on 21/02/2017. + */ +public class UnlistedIntArrayProperty extends UnlistedPropertyBase { + + public UnlistedIntArrayProperty(String name) { + super(name); + } + + @Override + public Class getType() { + return int[].class; + } + + @Override + public String valueToString(int[] value) { + ToStringHelper helper = Objects.toStringHelper("IntArray"); + if (value != null) { + for (int i1 = 0; i1 < value.length; i1++) { + int i = value[i1]; + helper.add("Index:" + i1, i); + } + } + return helper.toString(); + } +} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntegerProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntegerProperty.java new file mode 100644 index 0000000000..7ebb17fbe2 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntegerProperty.java @@ -0,0 +1,21 @@ +package codechicken.lib.block.property.unlisted; + +/** + * Created by covers1624 on 28/10/2016. + */ +public class UnlistedIntegerProperty extends UnlistedPropertyBase { + + public UnlistedIntegerProperty(String name) { + super(name); + } + + @Override + public Class getType() { + return Integer.class; + } + + @Override + public String valueToString(Integer value) { + return value.toString(); + } +} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedMapProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedMapProperty.java new file mode 100644 index 0000000000..28b5961feb --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedMapProperty.java @@ -0,0 +1,41 @@ +package codechicken.lib.block.property.unlisted; + +import java.util.Map; + +/** + * Created by covers1624 on 25/10/2016. + */ +public class UnlistedMapProperty extends UnlistedPropertyBase { + + private IMapStringGenerator generator = null; + + public UnlistedMapProperty(String name) { + super(name); + } + + public UnlistedMapProperty setStringGenerator(IMapStringGenerator generator) { + if (generator == null) { + this.generator = generator; + } + return this; + } + + @Override + public Class getType() { + return Map.class; + } + + @Override + public String valueToString(Map value) { + if (value == null) { + return "null"; + } + return generator != null ? generator.makeString(value) : value.toString(); + } + + public interface IMapStringGenerator { + + String makeString(Map map); + } + +} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedPropertyBase.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedPropertyBase.java new file mode 100644 index 0000000000..4604b82797 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedPropertyBase.java @@ -0,0 +1,25 @@ +package codechicken.lib.block.property.unlisted; + +import net.minecraftforge.common.property.IUnlistedProperty; + +/** + * Created by covers1624 on 30/10/2016. + */ +public abstract class UnlistedPropertyBase implements IUnlistedProperty { + + protected final String name; + + public UnlistedPropertyBase(String name) { + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public boolean isValid(V value) { + return true; + } +} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedResourceLocationProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedResourceLocationProperty.java new file mode 100644 index 0000000000..39b68fa0a2 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedResourceLocationProperty.java @@ -0,0 +1,23 @@ +package codechicken.lib.block.property.unlisted; + +import net.minecraft.util.ResourceLocation; + +/** + * Created by covers1624 on 28/10/2016. + */ +public class UnlistedResourceLocationProperty extends UnlistedPropertyBase { + + public UnlistedResourceLocationProperty(String name) { + super(name); + } + + @Override + public Class getType() { + return ResourceLocation.class; + } + + @Override + public String valueToString(ResourceLocation value) { + return value.toString(); + } +} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedSpriteProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedSpriteProperty.java new file mode 100644 index 0000000000..8dc3333f75 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedSpriteProperty.java @@ -0,0 +1,27 @@ +package codechicken.lib.block.property.unlisted; + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +/** + * Created by covers1624 on 25/10/2016. + */ +@SideOnly (Side.CLIENT) +public class UnlistedSpriteProperty extends UnlistedPropertyBase { + + public UnlistedSpriteProperty(String name) { + super(name); + } + + @SuppressWarnings ("unchecked") + public Class getType() { + return TextureAtlasSprite.class; + } + + @Override + public String valueToString(TextureAtlasSprite value) { + return value.toString(); + } + +} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedStringProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedStringProperty.java new file mode 100644 index 0000000000..29214ec712 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedStringProperty.java @@ -0,0 +1,21 @@ +package codechicken.lib.block.property.unlisted; + +/** + * Created by covers1624 on 28/10/2016. + */ +public class UnlistedStringProperty extends UnlistedPropertyBase { + + public UnlistedStringProperty(String name) { + super(name); + } + + @Override + public Class getType() { + return String.class; + } + + @Override + public String valueToString(String value) { + return value; + } +} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedTileEntityProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedTileEntityProperty.java new file mode 100644 index 0000000000..9c4948a43c --- /dev/null +++ b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedTileEntityProperty.java @@ -0,0 +1,23 @@ +package codechicken.lib.block.property.unlisted; + +import net.minecraft.tileentity.TileEntity; + +/** + * Created by covers1624 on 28/02/2017. + */ +public class UnlistedTileEntityProperty extends UnlistedPropertyBase { + + public UnlistedTileEntityProperty(String name) { + super(name); + } + + @Override + public Class getType() { + return TileEntity.class; + } + + @Override + public String valueToString(TileEntity value) { + return value.toString(); + } +} diff --git a/dependencies/main/java/codechicken/lib/colour/Colour.java b/dependencies/main/java/codechicken/lib/colour/Colour.java index bd59c2aa23..569854789e 100644 --- a/dependencies/main/java/codechicken/lib/colour/Colour.java +++ b/dependencies/main/java/codechicken/lib/colour/Colour.java @@ -11,6 +11,7 @@ import java.util.regex.Pattern; public abstract class Colour implements Copyable { + public static IConfigType configRGB = new IConfigType() { @Override public String configValue(Colour entry) { @@ -54,18 +55,20 @@ public Colour(Colour colour) { a = colour.a; } - @SideOnly(Side.CLIENT) + @SideOnly (Side.CLIENT) public void glColour() { GlStateManager.color((r & 0xFF) / 255F, (g & 0xFF) / 255F, (b & 0xFF) / 255F, (a & 0xFF) / 255F); } - @SideOnly(Side.CLIENT) + @SideOnly (Side.CLIENT) public void glColour(int a) { GlStateManager.color((r & 0xFF) / 255F, (g & 0xFF) / 255F, (b & 0xFF) / 255F, a / 255F); } public abstract int pack(); + public abstract float[] packArray(); + @Override public String toString() { return getClass().getSimpleName() + "[0x" + Integer.toHexString(pack()).toUpperCase() + "]"; @@ -141,6 +144,8 @@ public int rgba() { return (r & 0xFF) << 24 | (g & 0xFF) << 16 | (b & 0xFF) << 8 | (a & 0xFF); } + public abstract Colour set(int colour); + public Colour set(Colour colour) { r = colour.r; g = colour.g; @@ -149,6 +154,54 @@ public Colour set(Colour colour) { return this; } + public static int packRGBA(byte r, byte g, byte b, byte a) { + return (r & 0xFF) << 24 | (g & 0xFF) << 16 | (b & 0xFF) << 8 | (a & 0xFF); + } + + public static int packARGB(byte r, byte g, byte b, byte a) { + return (a & 0xFF) << 24 | (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF); + } + + public static int packRGBA(int r, int g, int b, int a) { + return r << 24 | g << 16 | b << 8 | a; + } + + public static int packARGB(int r, int g, int b, int a) { + return a << 24 | r << 16 | g << 8 | b; + } + + public static int packRGBA(double r, double g, double b, double a) { + return (int) (r * 255) << 24 | (int) (g * 255) << 16 | (int) (b * 255) << 8 | (int) (a * 255); + } + + public static int packARGB(double r, double g, double b, double a) { + return (int) (a * 255) << 24 | (int) (r * 255) << 16 | (int) (g * 255) << 8 | (int) (b * 255); + } + + public static int packRGBA(float[] data) { + return packRGBA(data[0], data[1], data[2], data[3]); + } + + public static int packARGB(float[] data) { + return packARGB(data[0], data[1], data[2], data[3]); + } + + public static void glColourRGBA(int colour) { + float r = ((colour >> 24) & 0xFF) / 255F; + float g = ((colour >> 16) & 0xFF) / 255F; + float b = ((colour >> 8) & 0xFF) / 255F; + float a = (colour & 0xFF) / 255F; + GlStateManager.color(r, g, b, a); + } + + public static void glColourARGB(int colour) { + float r = ((colour >> 16) & 0xFF) / 255F; + float g = ((colour >> 8) & 0xFF) / 255F; + float b = (colour & 0xFF) / 255F; + float a = ((colour >> 24 & 0xFF)) / 255F; + GlStateManager.color(r, g, b, a); + } + public boolean equals(Colour colour) { return colour != null && rgba() == colour.rgba(); } diff --git a/dependencies/main/java/codechicken/lib/colour/ColourARGB.java b/dependencies/main/java/codechicken/lib/colour/ColourARGB.java index 765c31a431..9d3a9ddbc9 100644 --- a/dependencies/main/java/codechicken/lib/colour/ColourARGB.java +++ b/dependencies/main/java/codechicken/lib/colour/ColourARGB.java @@ -1,6 +1,7 @@ package codechicken.lib.colour; public class ColourARGB extends Colour { + public ColourARGB(int colour) { super((colour >> 16) & 0xFF, (colour >> 8) & 0xFF, colour & 0xFF, (colour >> 24) & 0xFF); } @@ -17,10 +18,19 @@ public ColourARGB copy() { return new ColourARGB(this); } + @Override + public Colour set(int colour) { + return set(new ColourARGB(colour)); + } + public int pack() { return pack(this); } + public float[] packArray() { + return new float[] { (a & 0xFF) / 255, (r & 0xFF) / 255, (g & 0xFF) / 255, (b & 0xFF) / 255 }; + } + public static int pack(Colour colour) { return (colour.a & 0xFF) << 24 | (colour.r & 0xFF) << 16 | (colour.g & 0xFF) << 8 | (colour.b & 0xFF); } diff --git a/dependencies/main/java/codechicken/lib/colour/ColourRGBA.java b/dependencies/main/java/codechicken/lib/colour/ColourRGBA.java index bd2a26edca..328c57cf4a 100644 --- a/dependencies/main/java/codechicken/lib/colour/ColourRGBA.java +++ b/dependencies/main/java/codechicken/lib/colour/ColourRGBA.java @@ -1,6 +1,7 @@ package codechicken.lib.colour; public class ColourRGBA extends Colour { + public ColourRGBA(int colour) { super((colour >> 24) & 0xFF, (colour >> 16) & 0xFF, (colour >> 8) & 0xFF, colour & 0xFF); } @@ -13,6 +14,10 @@ public ColourRGBA(int r, int g, int b, int a) { super(r, g, b, a); } + public ColourRGBA(float[] data) { + this(data[0], data[1], data[2], data[3]); + } + public ColourRGBA(ColourRGBA colour) { super(colour); } @@ -21,11 +26,20 @@ public int pack() { return pack(this); } + public float[] packArray() { + return new float[] { (r & 0xFF) / 255, (g & 0xFF) / 255, (b & 0xFF) / 255, (a & 0xFF) / 255 }; + } + @Override public Colour copy() { return new ColourRGBA(this); } + @Override + public Colour set(int colour) { + return set(new ColourRGBA(colour)); + } + public static int pack(Colour colour) { return (colour.r & 0xFF) << 24 | (colour.g & 0xFF) << 16 | (colour.b & 0xFF) << 8 | (colour.a & 0xFF); } diff --git a/dependencies/main/java/codechicken/lib/colour/CustomGradient.java b/dependencies/main/java/codechicken/lib/colour/CustomGradient.java index 86d2dd9b63..382e8323e4 100644 --- a/dependencies/main/java/codechicken/lib/colour/CustomGradient.java +++ b/dependencies/main/java/codechicken/lib/colour/CustomGradient.java @@ -1,12 +1,13 @@ package codechicken.lib.colour; import codechicken.lib.math.MathHelper; -import codechicken.lib.render.TextureUtils; +import codechicken.lib.texture.TextureUtils; import net.minecraft.util.ResourceLocation; import java.awt.image.BufferedImage; public class CustomGradient { + public int[] gradient; public CustomGradient(ResourceLocation textureFile) { diff --git a/dependencies/main/java/codechicken/lib/colour/EnumColour.java b/dependencies/main/java/codechicken/lib/colour/EnumColour.java new file mode 100644 index 0000000000..5bb9923438 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/colour/EnumColour.java @@ -0,0 +1,193 @@ +package codechicken.lib.colour; + +import codechicken.lib.util.TripleABC; +import com.google.common.collect.ImmutableList; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IStringSerializable; +import net.minecraftforge.oredict.OreDictionary; + +/** + * Created by covers1624 on 16/09/2016. + */ +public enum EnumColour implements IStringSerializable { + //Formatted like this due to the cancerous nature of the constructors.. + //TODO Should we have our own localizations for this? + //@formatter:off + WHITE ("white", "dyeWhite", "item.fireworksCharge.white", 0xFFFFFF), + ORANGE ("orange", "dyeOrange", "item.fireworksCharge.orange", 0xC06300), + MAGENTA ("magenta", "dyeMagenta", "item.fireworksCharge.magenta", 0xB51AB5), + LIGHT_BLUE("light_blue", "dyeLightBlue", "item.fireworksCharge.lightBlue", 0x6F84F1), + YELLOW ("yellow", "dyeYellow", "item.fireworksCharge.yellow", 0xBFBF00), + LIME ("lime", "dyeLime", "item.fireworksCharge.lime", 0x6BF100), + PINK ("pink", "dyePink", "item.fireworksCharge.pink", 0xF14675), + GRAY ("gray", "dyeGray", "item.fireworksCharge.gray", 0x535353), + LIGHT_GRAY("light_gray", "dyeLightGray", "item.fireworksCharge.silver", 0x939393), + CYAN ("cyan", "dyeCyan", "item.fireworksCharge.cyan", 0x008787), + PURPLE ("purple", "dyePurple", "item.fireworksCharge.purple", 0x5E00C0), + BLUE ("blue", "dyeBlue", "item.fireworksCharge.blue", 0x1313C0), + BROWN ("brown", "dyeBrown", "item.fireworksCharge.brown", 0x4F2700), + GREEN ("green", "dyeGreen", "item.fireworksCharge.green", 0x088700), + RED ("red", "dyeRed", "item.fireworksCharge.red", 0xA20F06), + BLACK ("black", "dyeBlack", "item.fireworksCharge.black", 0x1F1F1F); + //@formatter:on + + private String minecraftName; + private String oreDictionaryName; + private String unlocalizedName; + private int rgb; + + private static final ImmutableList> mixMap; + + EnumColour(String minecraftName, String oreDictionaryName, String unlocalizedName, int rgb) { + this.minecraftName = minecraftName; + this.oreDictionaryName = oreDictionaryName; + this.unlocalizedName = unlocalizedName; + this.rgb = rgb; + } + + @Override + public String getName() { + return minecraftName; + } + + public String getMinecraftName() { + return minecraftName; + } + + public String getOreDictionaryName() { + return oreDictionaryName; + } + + public String getUnlocalizedName() { + return unlocalizedName; + } + + public int getWoolDamage() { + return ordinal(); + } + + public int getDyeDamage() { + return 15 - ordinal(); + } + + public int rgba() { + return rgba(0xFF); + } + + public int rgba(int alpha) { + return rgb << 8 | (alpha & 0xFF); + } + + public int argb() { + return argb(0xFF); + } + + public int argb(int alpha) { + return (alpha & 0xFF) << 24 | rgb; + } + + public int rgb() { + return rgb; + } + + public float rF() { + return (rgb >> 16 & 255) / 255.0f; + } + + public float gF() { + return (rgb >> 8 & 255) / 255.0f; + } + + public float bF() { + return (rgb & 255) / 255.0f; + } + + public ColourRGBA getColour() { + return getColour(0xFF); + } + + public ColourRGBA getColour(int alpha) { + return new ColourRGBA(rgba(alpha)); + } + + public EnumColour mix(EnumColour b) { + return mix(this, b); + } + + public static EnumColour mix(EnumColour a, EnumColour b) { + if (a == b) { + return a; + } + synchronized (mixMap) { + for (TripleABC triple : mixMap) { + if ((triple.getA().equals(a) && triple.getB().equals(b)) || (triple.getA().equals(b) && triple.getB().equals(a))) { + return triple.getC(); + } + } + } + return null; + } + + public static EnumColour fromWoolID(int id) { + return values()[id]; + } + + public static EnumColour fromDyeID(int id) { + return values()[15 - id]; + } + + public static EnumColour fromOreDictID(String id) { + for (EnumColour c : values()) { + if (c.getOreDictionaryName().equals(id)) { + return c; + } + } + return null; + } + + public static EnumColour fromStack(ItemStack stack) { + for (int id : OreDictionary.getOreIDs(stack)) { + EnumColour c = fromOreDictID(OreDictionary.getOreName(id)); + if (c != null) { + return c; + } + } + return null; + } + + public static EnumColour fromName(String name) { + for (EnumColour colour : values()) { + if (colour.getName().equalsIgnoreCase(name)) { + return colour; + } + } + return null; + } + + static { + ImmutableList.Builder> builder = ImmutableList.builder(); + //WHITE + builder.add(getTriple(YELLOW, RED, ORANGE)); + builder.add(getTriple(PINK, PURPLE, MAGENTA)); + builder.add(getTriple(WHITE, BLUE, LIGHT_BLUE)); + //YELLOW + builder.add(getTriple(WHITE, GREEN, LIME)); + builder.add(getTriple(WHITE, RED, PINK)); + builder.add(getTriple(WHITE, BLACK, GRAY)); + builder.add(getTriple(WHITE, GRAY, LIGHT_GRAY)); + builder.add(getTriple(BLUE, GREEN, CYAN)); + builder.add(getTriple(BLUE, RED, PURPLE)); + //Blue + builder.add(getTriple(ORANGE, RED, BROWN)); + builder.add(getTriple(YELLOW, BLUE, GREEN)); + //RED + //BLACK + + mixMap = builder.build(); + } + + private static TripleABC getTriple(EnumColour a, EnumColour b, EnumColour result) { + return new TripleABC(a, b, result); + } + +} diff --git a/dependencies/main/java/codechicken/lib/config/ConfigFile.java b/dependencies/main/java/codechicken/lib/config/ConfigFile.java index 6e26f28406..4e01079084 100644 --- a/dependencies/main/java/codechicken/lib/config/ConfigFile.java +++ b/dependencies/main/java/codechicken/lib/config/ConfigFile.java @@ -3,6 +3,7 @@ import java.io.*; public class ConfigFile extends ConfigTagParent { + public static final byte[] crlf = new byte[] { 0xD, 0xA }; public File file; @@ -113,4 +114,4 @@ public void saveConfig() { public boolean isLoading() { return loading; } -} \ No newline at end of file +} diff --git a/dependencies/main/java/codechicken/lib/config/ConfigTag.java b/dependencies/main/java/codechicken/lib/config/ConfigTag.java index 1e55b3fc69..1dd11d13bd 100644 --- a/dependencies/main/java/codechicken/lib/config/ConfigTag.java +++ b/dependencies/main/java/codechicken/lib/config/ConfigTag.java @@ -3,10 +3,22 @@ import java.io.PrintWriter; public class ConfigTag extends ConfigTagParent { + + public ConfigTagParent parent; + public String name; + public String qualifiedname; + public String value; + public boolean brace; + public boolean newline; + public int position = Integer.MAX_VALUE; + + private int IDBase; + public interface IConfigType { - public String configValue(T entry); - public T valueOf(String text) throws Exception; + String configValue(T entry); + + T valueOf(String text) throws Exception; } public ConfigTag(ConfigTagParent parent, String name) { @@ -237,14 +249,4 @@ public ConfigTag setBaseID(int i) { IDBase = i; return this; } - - public ConfigTagParent parent; - public String name; - public String qualifiedname; - public String value; - public boolean brace; - public boolean newline; - public int position = Integer.MAX_VALUE; - - private int IDBase; } diff --git a/dependencies/main/java/codechicken/lib/config/ConfigTagParent.java b/dependencies/main/java/codechicken/lib/config/ConfigTagParent.java index 2b91b4f138..be5d683f7d 100644 --- a/dependencies/main/java/codechicken/lib/config/ConfigTagParent.java +++ b/dependencies/main/java/codechicken/lib/config/ConfigTagParent.java @@ -7,7 +7,9 @@ import java.util.Map.Entry; public abstract class ConfigTagParent { + public static class TagOrderComparator implements Comparator { + int sortMode; public TagOrderComparator(int sortMode) { @@ -22,19 +24,19 @@ public int compare(ConfigTag o1, ConfigTag o2) { return o1.brace ? 1 : -1;//braced one goes after } switch (sortMode) { - case 1: - if (o1.value == o2.value) { - return 0; - } - if (o1.value == null) { - return 1; - } - if (o2.value == null) { - return -1; - } - return o1.value.compareTo(o2.value); - default: - return o1.name.compareTo(o2.name); + case 1: + if (o1.value.equals(o2.value)) { + return 0; + } + if (o1.value == null) { + return 1; + } + if (o2.value == null) { + return -1; + } + return o1.value.compareTo(o2.value); + default: + return o1.name.compareTo(o2.name); } } diff --git a/dependencies/main/java/codechicken/lib/config/DefaultingConfigFile.java b/dependencies/main/java/codechicken/lib/config/DefaultingConfigFile.java index c1bc7c4f7d..829aa40eee 100644 --- a/dependencies/main/java/codechicken/lib/config/DefaultingConfigFile.java +++ b/dependencies/main/java/codechicken/lib/config/DefaultingConfigFile.java @@ -3,6 +3,7 @@ import java.io.File; public class DefaultingConfigFile extends ConfigFile { + public DefaultingConfigFile(File file) { super(); if (file.exists()) { diff --git a/dependencies/main/java/codechicken/lib/config/SimpleProperties.java b/dependencies/main/java/codechicken/lib/config/SimpleProperties.java index 4a3bc4e79b..652d088eeb 100644 --- a/dependencies/main/java/codechicken/lib/config/SimpleProperties.java +++ b/dependencies/main/java/codechicken/lib/config/SimpleProperties.java @@ -6,6 +6,7 @@ import java.util.Map.Entry; public class SimpleProperties { + public HashMap propertyMap = new HashMap(); public File propertyFile; public boolean saveOnChange = false; diff --git a/dependencies/main/java/codechicken/lib/data/MCDataHandler.java b/dependencies/main/java/codechicken/lib/data/MCDataHandler.java new file mode 100644 index 0000000000..30e2d984fc --- /dev/null +++ b/dependencies/main/java/codechicken/lib/data/MCDataHandler.java @@ -0,0 +1,8 @@ +package codechicken.lib.data; + +/** + * Created by covers1624 on 5/28/2016. + */ +public interface MCDataHandler extends MCDataInput, MCDataOutput { + +} diff --git a/dependencies/main/java/codechicken/lib/data/MCDataIO.java b/dependencies/main/java/codechicken/lib/data/MCDataIO.java index c51491cd19..a5d3de4329 100644 --- a/dependencies/main/java/codechicken/lib/data/MCDataIO.java +++ b/dependencies/main/java/codechicken/lib/data/MCDataIO.java @@ -8,6 +8,7 @@ import net.minecraftforge.fluids.FluidStack; public class MCDataIO { + /** * PacketBuffer.readVarIntFromBuffer */ @@ -58,10 +59,10 @@ public static ItemStack readItemStack(MCDataInput in) { public static FluidStack readFluidStack(MCDataInput in) { FluidStack fluid = null; - short fluidID = in.readShort(); + String fluidName = in.readString(); - if (fluidID >= 0) { - fluid = new FluidStack(FluidRegistry.getFluid(fluidID), in.readVarInt(), in.readNBTTagCompound()); + if (fluidName.length() > 0) { + fluid = new FluidStack(FluidRegistry.getFluid(fluidName), in.readVarInt(), in.readNBTTagCompound()); } return fluid; @@ -122,10 +123,10 @@ public static void writeItemStack(MCDataOutput out, ItemStack stack) { } public static void writeFluidStack(MCDataOutput out, FluidStack fluid) { - if (fluid == null) { - out.writeShort(-1); + if (fluid == null || FluidRegistry.getFluidName(fluid) == null) { + out.writeString(""); } else { - out.writeShort(fluid.getFluid().getID()); + out.writeString(FluidRegistry.getFluidName(fluid)); out.writeVarInt(fluid.amount); out.writeNBTTagCompound(fluid.tag); } diff --git a/dependencies/main/java/codechicken/lib/data/MCDataInput.java b/dependencies/main/java/codechicken/lib/data/MCDataInput.java index 8d353860f3..aea7147c9c 100644 --- a/dependencies/main/java/codechicken/lib/data/MCDataInput.java +++ b/dependencies/main/java/codechicken/lib/data/MCDataInput.java @@ -1,46 +1,47 @@ package codechicken.lib.data; -import codechicken.lib.vec.BlockCoord; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fluids.FluidStack; public interface MCDataInput { - public long readLong(); - public int readInt(); + long readLong(); - public short readShort(); + int readInt(); - public int readUShort(); + short readShort(); - public byte readByte(); + int readUShort(); - public short readUByte(); + byte readByte(); - public double readDouble(); + short readUByte(); - public float readFloat(); + double readDouble(); - public boolean readBoolean(); + float readFloat(); - public char readChar(); + boolean readBoolean(); - public int readVarShort(); + char readChar(); - public int readVarInt(); + int readVarShort(); - public long readVarLong(); + int readVarInt(); - public byte[] readArray(int length); + long readVarLong(); - public String readString(); + byte[] readArray(int length); - public BlockCoord readCoord(); + String readString(); - public NBTTagCompound readNBTTagCompound(); + BlockPos readPos(); - public ItemStack readItemStack(); + NBTTagCompound readNBTTagCompound(); - public FluidStack readFluidStack(); + ItemStack readItemStack(); + + FluidStack readFluidStack(); } diff --git a/dependencies/main/java/codechicken/lib/data/MCDataInputStream.java b/dependencies/main/java/codechicken/lib/data/MCDataInputStream.java index 5c53cab1c3..210a36c895 100644 --- a/dependencies/main/java/codechicken/lib/data/MCDataInputStream.java +++ b/dependencies/main/java/codechicken/lib/data/MCDataInputStream.java @@ -3,6 +3,7 @@ import java.io.InputStream; public class MCDataInputStream extends InputStream { + private MCDataInput in; public MCDataInputStream(MCDataInput in) { diff --git a/dependencies/main/java/codechicken/lib/data/MCDataOutput.java b/dependencies/main/java/codechicken/lib/data/MCDataOutput.java index 5a0e65a1d0..3f178e617d 100644 --- a/dependencies/main/java/codechicken/lib/data/MCDataOutput.java +++ b/dependencies/main/java/codechicken/lib/data/MCDataOutput.java @@ -1,45 +1,44 @@ package codechicken.lib.data; -import codechicken.lib.vec.BlockCoord; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fluids.FluidStack; public interface MCDataOutput { - public MCDataOutput writeLong(long l); - public MCDataOutput writeInt(int i); + MCDataOutput writeLong(long l); - public MCDataOutput writeShort(int s); + MCDataOutput writeInt(int i); - public MCDataOutput writeByte(int b); + MCDataOutput writeShort(int s); - public MCDataOutput writeDouble(double d); + MCDataOutput writeByte(int b); - public MCDataOutput writeFloat(float f); + MCDataOutput writeDouble(double d); - public MCDataOutput writeBoolean(boolean b); + MCDataOutput writeFloat(float f); - public MCDataOutput writeChar(char c); + MCDataOutput writeBoolean(boolean b); - public MCDataOutput writeVarInt(int i); + MCDataOutput writeChar(char c); - public MCDataOutput writeVarShort(int s); + MCDataOutput writeVarInt(int i); - public MCDataOutput writeArray(byte[] array); + MCDataOutput writeVarShort(int s); - public MCDataOutput writeString(String s); + MCDataOutput writeArray(byte[] array); - public MCDataOutput writeCoord(int x, int y, int z); + MCDataOutput writeString(String s); - public MCDataOutput writeCoord(BlockCoord coord); + MCDataOutput writePos(BlockPos pos); - public MCDataOutput writeNBTTagCompound(NBTTagCompound tag); + MCDataOutput writeNBTTagCompound(NBTTagCompound tag); /** * Supports large stacks by writing stackSize as a varInt */ - public MCDataOutput writeItemStack(ItemStack stack); + MCDataOutput writeItemStack(ItemStack stack); - public MCDataOutput writeFluidStack(FluidStack liquid); + MCDataOutput writeFluidStack(FluidStack liquid); } diff --git a/dependencies/main/java/codechicken/lib/data/MCDataOutputStream.java b/dependencies/main/java/codechicken/lib/data/MCDataOutputStream.java index 1f425c6622..ec9cfd86b4 100644 --- a/dependencies/main/java/codechicken/lib/data/MCDataOutputStream.java +++ b/dependencies/main/java/codechicken/lib/data/MCDataOutputStream.java @@ -3,6 +3,7 @@ import java.io.OutputStream; public class MCDataOutputStream extends OutputStream { + private MCDataOutput out; public MCDataOutputStream(MCDataOutput out) { diff --git a/dependencies/main/java/codechicken/lib/data/MCDataOutputWrapper.java b/dependencies/main/java/codechicken/lib/data/MCDataOutputWrapper.java index f0a163e4cb..a48e1366b8 100644 --- a/dependencies/main/java/codechicken/lib/data/MCDataOutputWrapper.java +++ b/dependencies/main/java/codechicken/lib/data/MCDataOutputWrapper.java @@ -1,16 +1,17 @@ package codechicken.lib.data; -import codechicken.lib.vec.BlockCoord; import io.netty.handler.codec.EncoderException; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fluids.FluidStack; import java.io.DataOutput; import java.io.IOException; public class MCDataOutputWrapper implements MCDataOutput { + public DataOutput dataout; public MCDataOutputWrapper(DataOutput out) { @@ -111,17 +112,11 @@ public MCDataOutputWrapper writeArray(byte[] barray) { return this; } - public MCDataOutputWrapper writeCoord(int x, int y, int z) { - writeInt(x); - writeInt(y); - writeInt(z); - return this; - } - - public MCDataOutputWrapper writeCoord(BlockCoord coord) { - writeInt(coord.x); - writeInt(coord.y); - writeInt(coord.z); + @Override + public MCDataOutputWrapper writePos(BlockPos pos) { + writeInt(pos.getX()); + writeInt(pos.getY()); + writeInt(pos.getZ()); return this; } diff --git a/dependencies/main/java/codechicken/lib/data/NBTHelper.java b/dependencies/main/java/codechicken/lib/data/NBTHelper.java new file mode 100644 index 0000000000..0e3d633743 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/data/NBTHelper.java @@ -0,0 +1,33 @@ +package codechicken.lib.data; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +/** + * Created by covers1624 on 6/3/2016. + */ +public class NBTHelper { + + public static void writeFluidStack(NBTTagCompound tag, FluidStack fluid) { + if (fluid == null || FluidRegistry.getFluidName(fluid) == null) { + tag.setString("id", ""); + } else { + tag.setString("id", FluidRegistry.getFluidName(fluid)); + tag.setInteger("amount", fluid.amount); + tag.setTag("tag", fluid.tag); + } + } + + public static FluidStack readFluidStack(NBTTagCompound tag) { + FluidStack fluid = null; + String fluidName = tag.getString("id"); + + if (fluidName.length() > 0) { + fluid = new FluidStack(FluidRegistry.getFluid(fluidName), tag.getInteger("amount"), tag.getCompoundTag("tag")); + } + + return fluid; + } + +} diff --git a/dependencies/main/java/codechicken/lib/fingerprint/FingerprintChecker.java b/dependencies/main/java/codechicken/lib/fingerprint/FingerprintChecker.java new file mode 100644 index 0000000000..4517df72e4 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/fingerprint/FingerprintChecker.java @@ -0,0 +1,85 @@ +package codechicken.lib.fingerprint; + +import com.google.common.collect.ImmutableList; +import net.minecraftforge.fml.common.*; +import org.apache.logging.log4j.Level; + +import java.security.cert.Certificate; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +/** + * Created by covers1624 on 13/12/2016. + * To be packaged in each mod runtime, used to cross verify jar fingerprints. + * Idea behind this: + * A malicious user would have to override the fingerprint data in all mod jars this is packaged with in order to avoid detection. + * This is not to be used as DRM. It is used simply to provide cross verification of jars. + */ +public class FingerprintChecker { + + private static final Map modCertMap = new HashMap(); + private static final List invalidMods = new ArrayList(); + + static { + //@formatter:off + modCertMap.put("CodeChickenLib" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("CodeChickenCore" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("ChickenChunks" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("EnderStorage" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("Translocator" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("NotEnoughItems" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("forgemultipartcbe" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + //@formatter:on + } + + public static void runFingerprintChecks() { + try { + ModContainer activeContainer = Loader.instance().activeModContainer(); + for (Entry modEntry : Loader.instance().getIndexedModList().entrySet()) { + for (Entry certEntry : modCertMap.entrySet()) { + if (modEntry.getKey().equals(certEntry.getKey())) { + Object modInstance = modEntry.getValue().getMod(); + if (modInstance == null) { + FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "Unable to do Fingerprint Verification for mod %s! ModContainer returned a null mod instance!", modEntry.getKey()); + break; + } + if (modInstance.getClass().getName().contains("net.minecraftforge.")) { + FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "Unable to do Fingerprint Verification for mod %s! ModContainer returned is a suspected FML class! [%s]", modEntry.getKey(), modInstance.getClass().getName()); + } + + Certificate[] certificates = modInstance.getClass().getProtectionDomain().getCodeSource().getCertificates(); + ImmutableList.Builder certBuilder = ImmutableList.builder(); + if (certificates != null) { + for (Certificate cert : certificates) { + certBuilder.add(CertificateHelper.getFingerprint(cert)); + } + } + + ImmutableList certList = certBuilder.build(); + + String expectedFingerprint = certEntry.getValue(); + + if (expectedFingerprint != null && !expectedFingerprint.isEmpty()) { + if (!certList.contains(expectedFingerprint)) { + FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "The fingerprint for mod %s is invalid! Expected: %s", modEntry.getKey(), expectedFingerprint); + invalidMods.add(modEntry.getKey()); + break; + } else { + FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.DEBUG, "Valid fingerprint found for mod %s.", modEntry.getKey()); + } + } + + break; + } + } + } + FMLCommonHandler.instance().registerCrashCallable(new FingerprintViolatedCrashCallable(activeContainer.getModId(), invalidMods)); + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/dependencies/main/java/codechicken/lib/fingerprint/FingerprintViolatedCrashCallable.java b/dependencies/main/java/codechicken/lib/fingerprint/FingerprintViolatedCrashCallable.java new file mode 100644 index 0000000000..b0e4653e46 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/fingerprint/FingerprintViolatedCrashCallable.java @@ -0,0 +1,37 @@ +package codechicken.lib.fingerprint; + +import com.google.common.collect.ImmutableList; +import net.minecraftforge.fml.common.ICrashCallable; + +import java.util.List; + +/** + * Created by covers1624 on 12/12/2016. + * TODO, report all good when no invalid mods are found. + */ +public class FingerprintViolatedCrashCallable implements ICrashCallable { + + private final String mod; + private final ImmutableList invalidMods; + + public FingerprintViolatedCrashCallable(String mod, List invalidMods) { + this.mod = mod; + this.invalidMods = ImmutableList.copyOf(invalidMods); + } + + @Override + public String getLabel() { + return mod + " Invalid Fingerprint Reports"; + } + + @Override + public String call() throws Exception { + StringBuilder builder = new StringBuilder(); + for (String invalidMod : invalidMods) { + builder.append("\n\t\t"); + builder.append(invalidMod); + builder.append(" has an invalid fingerprint."); + } + return builder.toString(); + } +} diff --git a/dependencies/main/java/codechicken/lib/gui/GuiDraw.java b/dependencies/main/java/codechicken/lib/gui/GuiDraw.java index 19621ca448..1606a47873 100644 --- a/dependencies/main/java/codechicken/lib/gui/GuiDraw.java +++ b/dependencies/main/java/codechicken/lib/gui/GuiDraw.java @@ -1,24 +1,36 @@ package codechicken.lib.gui; +import codechicken.lib.colour.Colour; import codechicken.lib.math.MathHelper; -import codechicken.lib.render.CCRenderState; +import codechicken.lib.texture.TextureUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.TextFormatting; +import net.minecraftforge.client.event.RenderTooltipEvent; +import net.minecraftforge.common.MinecraftForge; import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import javax.annotation.Nullable; import java.awt.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class GuiDraw { + public static class GuiHook extends Gui { + public void setZLevel(float f) { zLevel = f; } @@ -45,6 +57,10 @@ public static void drawRect(int x, int y, int w, int h, int colour) { drawGradientRect(x, y, w, h, colour, colour); } + public static void drawGradientRectDirect(int left, int top, int right, int bottom, int colour1, int colour2) { + gui.drawGradientRect(left, top, right, bottom, colour1, colour2); + } + public static void drawGradientRect(int x, int y, int w, int h, int colour1, int colour2) { gui.drawGradientRect(x, y, x + w, y + h, colour1, colour2); } @@ -53,6 +69,24 @@ public static void drawTexturedModalRect(int x, int y, int tx, int ty, int w, in gui.drawTexturedModalRect(x, y, tx, ty, w, h); } + public static void drawLine(int x1, int y1, int x2, int y2, float thickness, int colour) { + GlStateManager.glLineWidth(thickness); + GlStateManager.disableTexture2D(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + Colour.glColourRGBA(colour); + + VertexBuffer vb = Tessellator.getInstance().getBuffer(); + vb.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); + vb.pos(x1, y1, gui.getZLevel()).endVertex(); + vb.pos(x2, y2, gui.getZLevel()).endVertex(); + vb.finishDrawing(); + + GlStateManager.resetColor(); + GlStateManager.disableBlend(); + GlStateManager.enableTexture2D(); + } + public static void drawString(String text, int x, int y, int colour, boolean shadow) { if (shadow) { fontRenderer.drawStringWithShadow(text, x, y, colour); @@ -90,15 +124,20 @@ public static void drawStringR(String text, int x, int y, int colour) { } public static int getStringWidth(String s) { - return fontRenderer.getStringWidth(s); + if (s == null || s.equals("")) { + return 0; + } + return fontRenderer.getStringWidth(TextFormatting.getTextWithoutFormattingCodes(s)); } + //TODO, getDisplaySize. public static Dimension displaySize() { Minecraft mc = Minecraft.getMinecraft(); ScaledResolution res = new ScaledResolution(mc); return new Dimension(res.getScaledWidth(), res.getScaledHeight()); } + //TODO, getDisplayRes public static Dimension displayRes() { Minecraft mc = Minecraft.getMinecraft(); return new Dimension(mc.displayWidth, mc.displayHeight); @@ -115,11 +154,11 @@ public static Point getMousePosition() { } public static void changeTexture(String s) { - CCRenderState.changeTexture(s); + TextureUtils.changeTexture(s); } public static void changeTexture(ResourceLocation r) { - CCRenderState.changeTexture(r); + TextureUtils.changeTexture(r); } public static void drawTip(int x, int y, String text) { @@ -133,29 +172,36 @@ public static void drawTip(int x, int y, String text) { /** * Have a string in the tooltip list with TOOLTIP_HANDLER + getTipLineId(handler) for a custom handler */ + @Deprecated public static final String TOOLTIP_HANDLER = "\u00A7x"; + @Deprecated private static List tipLineHandlers = new ArrayList(); - public static interface ITooltipLineHandler { - public Dimension getSize(); + @Deprecated//This is dead as there are forge events. + public interface ITooltipLineHandler { - public void draw(int x, int y); + Dimension getSize(); + + void draw(int x, int y); } + @Deprecated public static int getTipLineId(ITooltipLineHandler handler) { - tipLineHandlers.add(handler); - return tipLineHandlers.size() - 1; + return -1; } public static ITooltipLineHandler getTipLine(String line) { - if (!line.startsWith(TOOLTIP_HANDLER)) { - return null; - } - return tipLineHandlers.get(Integer.parseInt(line.substring(2))); + return null; } + @Deprecated public static void drawMultilineTip(int x, int y, List list) { - if (list.isEmpty()) { + drawMultilineTip(null, x, y, list); + } + + public static void drawMultilineTip(@Nullable ItemStack stack, int x, int y, List lines) { + //TODO TOOLTIP_LINESPACE support, pr forge to clip the box in the top bound of the screen + TOOLTIP_LINESPACE + /*if (lines.isEmpty()) { return; } @@ -165,10 +211,10 @@ public static void drawMultilineTip(int x, int y, List list) { int w = 0; int h = -2; - for (int i = 0; i < list.size(); i++) { - String s = list.get(i); + for (int i = 0; i < lines.size(); i++) { + String s = lines.get(i); ITooltipLineHandler line = getTipLine(s); - Dimension d = line != null ? line.getSize() : new Dimension(getStringWidth(s), list.get(i).endsWith(TOOLTIP_LINESPACE) && i + 1 < list.size() ? 12 : 10); + Dimension d = line != null ? line.getSize() : new Dimension(getStringWidth(s), lines.get(i).endsWith(TOOLTIP_LINESPACE) && i + 1 < lines.size() ? 12 : 10); w = Math.max(w, d.width); h += d.height; } @@ -185,7 +231,7 @@ public static void drawMultilineTip(int x, int y, List list) { gui.incZLevel(300); drawTooltipBox(x - 4, y - 4, w + 7, h + 7); - for (String s : list) { + for (String s : lines) { ITooltipLineHandler line = getTipLine(s); if (line != null) { line.draw(x, y); @@ -199,11 +245,149 @@ public static void drawMultilineTip(int x, int y, List list) { tipLineHandlers.clear(); gui.incZLevel(-300); + GlStateManager.enableDepth(); + RenderHelper.enableStandardItemLighting(); + GlStateManager.enableRescaleNormal();*/ + + ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft()); + int screenWidth = res.getScaledWidth(); + int screenHeight = res.getScaledHeight(); + + if (lines.isEmpty()) { + return; + } + + RenderTooltipEvent.Pre event = new RenderTooltipEvent.Pre(stack, lines, x, y, screenWidth, screenHeight, -1, fontRenderer); + if (MinecraftForge.EVENT_BUS.post(event)) { + return; + } + x = event.getX(); + y = event.getY(); + screenWidth = event.getScreenWidth(); + screenHeight = event.getScreenHeight(); + int maxTextWidth = event.getMaxWidth(); + FontRenderer font = event.getFontRenderer(); + + GlStateManager.disableRescaleNormal(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); + + if (x < 8) { + x = 8; + } + y = MathHelper.clip(y, 8, displaySize().height - 8); + int tooltipTextWidth = 0; + + for (String textLine : lines) { + int textLineWidth = font.getStringWidth(textLine); + + if (textLineWidth > tooltipTextWidth) { + tooltipTextWidth = textLineWidth; + } + } + + boolean needsWrap = false; + + int titleLinesCount = 1; + int tooltipX = x + 12; + if (tooltipX + tooltipTextWidth + 4 > screenWidth) { + tooltipX = x - 16 - tooltipTextWidth; + if (tooltipX < 4) // if the tooltip doesn't fit on the screen + { + if (x > screenWidth / 2) { + tooltipTextWidth = x - 12 - 8; + } else { + tooltipTextWidth = screenWidth - 16 - x; + } + needsWrap = true; + } + } + + if (maxTextWidth > 0 && tooltipTextWidth > maxTextWidth) { + tooltipTextWidth = maxTextWidth; + needsWrap = true; + } + + if (needsWrap) { + int wrappedTooltipWidth = 0; + List wrappedTextLines = new ArrayList(); + for (int i = 0; i < lines.size(); i++) { + String textLine = lines.get(i); + List wrappedLine = font.listFormattedStringToWidth(textLine, tooltipTextWidth); + if (i == 0) { + titleLinesCount = wrappedLine.size(); + } + + for (String line : wrappedLine) { + int lineWidth = font.getStringWidth(line); + if (lineWidth > wrappedTooltipWidth) { + wrappedTooltipWidth = lineWidth; + } + wrappedTextLines.add(line); + } + } + tooltipTextWidth = wrappedTooltipWidth; + lines = wrappedTextLines; + + if (x > screenWidth / 2) { + tooltipX = x - 16 - tooltipTextWidth; + } else { + tooltipX = x; + } + } + + int tooltipY = y; + int tooltipHeight = 8; + + if (lines.size() > 1) { + tooltipHeight += (lines.size() - 1) * 10; + if (lines.size() > titleLinesCount) { + tooltipHeight += 2; // gap between title lines and next lines + } + } + + if (tooltipY + tooltipHeight + 6 > screenHeight) { + tooltipY = screenHeight - tooltipHeight - 6; + } + + int backgroundColor = 0xF0100010; + drawGradientRectDirect(tooltipX - 3, tooltipY - 4, tooltipX + tooltipTextWidth + 3, tooltipY - 3, backgroundColor, backgroundColor); + drawGradientRectDirect(tooltipX - 3, tooltipY + tooltipHeight + 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 4, backgroundColor, backgroundColor); + drawGradientRectDirect(tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); + drawGradientRectDirect(tooltipX - 4, tooltipY - 3, tooltipX - 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); + drawGradientRectDirect(tooltipX + tooltipTextWidth + 3, tooltipY - 3, tooltipX + tooltipTextWidth + 4, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); + int borderColorStart = 0x505000FF; + int borderColorEnd = (borderColorStart & 0xFEFEFE) >> 1 | borderColorStart & 0xFF000000; + drawGradientRectDirect(tooltipX - 3, tooltipY - 3 + 1, tooltipX - 3 + 1, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); + drawGradientRectDirect(tooltipX + tooltipTextWidth + 2, tooltipY - 3 + 1, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); + drawGradientRectDirect(tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY - 3 + 1, borderColorStart, borderColorStart); + drawGradientRectDirect(tooltipX - 3, tooltipY + tooltipHeight + 2, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd); + + MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostBackground(stack, lines, tooltipX, tooltipY, font, tooltipTextWidth, tooltipHeight)); + int tooltipTop = tooltipY; + + for (int lineNumber = 0; lineNumber < lines.size(); ++lineNumber) { + String line = lines.get(lineNumber); + font.drawStringWithShadow(line, (float) tooltipX, (float) tooltipY, -1); + + if (lineNumber + 1 == titleLinesCount) { + tooltipY += 2; + } + + tooltipY += 10; + } + + MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostText(stack, lines, tooltipX, tooltipTop, font, tooltipTextWidth, tooltipHeight)); + + GlStateManager.enableLighting(); GlStateManager.enableDepth(); RenderHelper.enableStandardItemLighting(); GlStateManager.enableRescaleNormal(); + } + @Deprecated//TODO 1.11, update this to do what is done in the other method(vague, i know what it means tho :P) public static void drawTooltipBox(int x, int y, int w, int h) { int bg = 0xf0100010; drawGradientRect(x + 1, y, w - 1, 1, bg, bg); diff --git a/dependencies/main/java/codechicken/core/IGuiPacketSender.java b/dependencies/main/java/codechicken/lib/gui/IGuiPacketSender.java similarity index 83% rename from dependencies/main/java/codechicken/core/IGuiPacketSender.java rename to dependencies/main/java/codechicken/lib/gui/IGuiPacketSender.java index b8b0902c35..aca3fe929c 100644 --- a/dependencies/main/java/codechicken/core/IGuiPacketSender.java +++ b/dependencies/main/java/codechicken/lib/gui/IGuiPacketSender.java @@ -1,7 +1,8 @@ -package codechicken.core; +package codechicken.lib.gui; import net.minecraft.entity.player.EntityPlayerMP; public interface IGuiPacketSender { + void sendPacket(EntityPlayerMP player, int windowId); } diff --git a/dependencies/main/java/codechicken/lib/gui/SimpleCreativeTab.java b/dependencies/main/java/codechicken/lib/gui/SimpleCreativeTab.java new file mode 100644 index 0000000000..c6bbb4776e --- /dev/null +++ b/dependencies/main/java/codechicken/lib/gui/SimpleCreativeTab.java @@ -0,0 +1,81 @@ +package codechicken.lib.gui; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.registry.ForgeRegistries; + +/** + * Created by covers1624 on 7/11/2016. + * Provides a Simple way to create a CreativeTab + * TODO BlockState parsing. + */ +public class SimpleCreativeTab extends CreativeTabs { + + private ItemStack tabIcon; + private final String name; + private final int meta; + + /** + * Create a SimpleCreativeTab! + * The tab icon will be "baked" when the icon is requested the first time. + * If the item cannot be found it will throw a RuntimeException, This can be avoided by setting "-Dccl.ignoreInvalidTabItem=true" in your command line args, this will default the tab to Redstone. + * + * @param tabLabel The label to be displayed, This WILL be localized by minecraft. + * @param tabIcon The item to find in the Item Registry e.g "minecraft:redstone" or "chickenchunks:chickenChunkLoader" + */ + public SimpleCreativeTab(String tabLabel, String tabIcon) { + this(tabLabel, tabIcon, 0); + } + + /** + * Create a SimpleCreativeTab! + * The tab icon will be "baked" when the icon is requested the first time. + * If the item cannot be found it will throw a RuntimeException, This can be avoided by setting "-Dccl.ignoreInvalidTabItem=true" in your command line args, this will default the tab to Redstone. + * + * @param tabLabel The label to be displayed, This WILL be localized by minecraft. + * @param tabIcon The item to find in the Item Registry e.g "minecraft:redstone" or "chickenchunks:chickenChunkLoader" + * @param meta The metadata of the item. + */ + public SimpleCreativeTab(String tabLabel, String tabIcon, int meta) { + super(tabLabel); + this.name = tabIcon; + this.meta = meta; + } + + /** + * "Bakes" the SimpleCreativeTab when the icon is requested the first time. + * If the item cannot be found it will throw a RuntimeException. + * This can be avoided by setting "-Dccl.ignoreInvalidTabItem=true" in your command line args. + * This will default the tab to Redstone. + */ + private void bakeTab() { + ResourceLocation location = new ResourceLocation(name); + Item item = ForgeRegistries.ITEMS.getValue(location); + if (item == null) { + if (Boolean.parseBoolean(System.getProperty("ccl.ignoreInvalidTabItem", "false"))) { + FMLLog.warning("Unable to find [%s] in the Item Registry. Please ensure the name for the item is correct. Unable to craft SimpleCreativeTab icon."); + tabIcon = new ItemStack(Items.REDSTONE); + } else { + throw new RuntimeException("Unable to find [%s] in the Item Registry. Please ensure the name for the item is correct. Unable to craft SimpleCreativeTab icon!"); + } + } + tabIcon = new ItemStack(item, 1, meta); + } + + @Override + public Item getTabIconItem() { + return Items.REDSTONE; + } + + @Override + public ItemStack getIconItemStack() { + if (tabIcon == null) { + bakeTab(); + } + return tabIcon; + } +} diff --git a/dependencies/main/java/codechicken/lib/internal/command/DevEnvCommand.java b/dependencies/main/java/codechicken/lib/internal/command/DevEnvCommand.java new file mode 100644 index 0000000000..0e3c264640 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/internal/command/DevEnvCommand.java @@ -0,0 +1,90 @@ +package codechicken.lib.internal.command; + +import codechicken.lib.raytracer.RayTracer; +import codechicken.lib.thread.TaskProfiler; +import codechicken.lib.thread.TaskProfiler.ProfilerResult; +import codechicken.lib.util.BlockStateUtils; +import net.minecraft.block.state.IBlockState; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.TextComponentString; + +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by covers1624 on 9/01/2017. + */ +public class DevEnvCommand implements ICommand { + + @Override + public String getCommandName() { + return "devStuff"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "Does dev stuff."; + } + + @Override + public List getCommandAliases() { + return new ArrayList(); + } + + @Override + public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { + if (sender instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) sender; + RayTraceResult trace = RayTracer.retrace(player); + if (trace == null) { + addMessage(sender, "Null trace."); + return; + } + IBlockState state = player.worldObj.getBlockState(trace.getBlockPos()); + addMessage(sender, state); + TaskProfiler timer = new TaskProfiler(); + timer.startOnce("task"); + int hash = BlockStateUtils.hashBlockState(state.getBlock().getExtendedState(state, player.worldObj, trace.getBlockPos())); + ProfilerResult result = timer.endOnce(); + + addMessage(sender, "Hash: " + hash); + + addMessage(sender, "Time: " + result.time / 1000); + + } else { + addMessage(sender, "You are not an EntityPlayer.."); + } + + } + + private static void addMessage(ICommandSender sender, Object object, Object... format) { + sender.addChatMessage(new TextComponentString(String.format(String.valueOf(object), format))); + } + + @Override + public boolean checkPermission(MinecraftServer server, ICommandSender sender) { + return true; + } + + @Override + public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos) { + return new ArrayList(); + } + + @Override + public boolean isUsernameIndex(String[] args, int index) { + return false; + } + + @Override + public int compareTo(ICommand o) { + return 0; + } +} diff --git a/dependencies/main/java/codechicken/lib/internal/command/client/DumpModelLocationsCommand.java b/dependencies/main/java/codechicken/lib/internal/command/client/DumpModelLocationsCommand.java new file mode 100644 index 0000000000..38dff396a2 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/internal/command/client/DumpModelLocationsCommand.java @@ -0,0 +1,76 @@ +package codechicken.lib.internal.command.client; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.statemap.BlockStateMapper; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentString; +import net.minecraftforge.fml.common.FMLLog; + +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.List; +import java.util.Map.Entry; + +/** + * Created by covers1624 on 19/12/2016. + * TODO Items. + */ +public class DumpModelLocationsCommand implements ICommand { + + @Override + public String getCommandName() { + return "dumpModelLocations"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "Takes the item in your hand and dumps all model locations."; + } + + @Override + public List getCommandAliases() { + return new ArrayList(); + } + + @Override + public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { + ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItemMainhand(); + if (stack != null && stack.getItem() instanceof ItemBlock) { + Block block = Block.getBlockFromItem(stack.getItem()); + BlockStateMapper stateMapper = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getBlockStateMapper(); + for (Entry entry : stateMapper.getVariants(block).entrySet()) { + sender.addChatMessage(new TextComponentString(entry.getKey().toString() + " | " + entry.getValue().toString())); + FMLLog.info(entry.getKey().toString() + " | " + entry.getValue().toString()); + } + } + } + + @Override + public boolean checkPermission(MinecraftServer server, ICommandSender sender) { + return true; + } + + @Override + public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos) { + return new ArrayList(); + } + + @Override + public boolean isUsernameIndex(String[] args, int index) { + return false; + } + + @Override + public int compareTo(ICommand o) { + return 0; + } +} diff --git a/dependencies/main/java/codechicken/lib/internal/command/client/NukeCCModelCacheCommand.java b/dependencies/main/java/codechicken/lib/internal/command/client/NukeCCModelCacheCommand.java new file mode 100644 index 0000000000..83a0b15ee5 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/internal/command/client/NukeCCModelCacheCommand.java @@ -0,0 +1,60 @@ +package codechicken.lib.internal.command.client; + +import codechicken.lib.model.blockbakery.BlockBakery; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentString; + +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by covers1624 on 30/12/2016. + */ +public class NukeCCModelCacheCommand implements ICommand { + + @Override + public String getCommandName() { + return "nukeCCModelCache"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "Clears all of CCL's BakedModel cache, requiring models to be re-baked.\nReally only useful for debugging in dev.\nOnly works on blocks / items that use CCL's BakedModel pipe."; + } + + @Override + public List getCommandAliases() { + return new ArrayList(); + } + + @Override + public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { + BlockBakery.nukeModelCache(); + sender.addChatMessage(new TextComponentString("Model cache nuked!")); + } + + @Override + public boolean checkPermission(MinecraftServer server, ICommandSender sender) { + return true; + } + + @Override + public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos) { + return new ArrayList(); + } + + @Override + public boolean isUsernameIndex(String[] args, int index) { + return false; + } + + @Override + public int compareTo(ICommand o) { + return 0; + } +} diff --git a/dependencies/main/java/codechicken/lib/internal/proxy/ClientProxy.java b/dependencies/main/java/codechicken/lib/internal/proxy/ClientProxy.java new file mode 100644 index 0000000000..f6513ccff7 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/internal/proxy/ClientProxy.java @@ -0,0 +1,37 @@ +package codechicken.lib.internal.proxy; + +import codechicken.lib.internal.command.client.DumpModelLocationsCommand; +import codechicken.lib.internal.command.client.NukeCCModelCacheCommand; +import codechicken.lib.model.blockbakery.BlockBakery; +import codechicken.lib.model.blockbakery.loader.CCBakeryModelLoader; +import codechicken.lib.model.cube.CCCubeLoader; +import codechicken.lib.render.CCRenderEventHandler; +import codechicken.lib.render.block.CCExtendedBlockRendererDispatcher; +import codechicken.lib.render.item.CCRenderItem; +import codechicken.lib.render.item.map.MapRenderRegistry; +import net.minecraftforge.client.ClientCommandHandler; +import net.minecraftforge.client.model.ModelLoaderRegistry; +import net.minecraftforge.common.MinecraftForge; + +/** + * Created by covers1624 on 23/11/2016. + */ +public class ClientProxy extends CommonProxy { + + @Override + public void preInit() { + BlockBakery.init(); + CCRenderEventHandler.init(); + MinecraftForge.EVENT_BUS.register(new MapRenderRegistry()); + ModelLoaderRegistry.registerLoader(CCCubeLoader.INSTANCE); + ModelLoaderRegistry.registerLoader(CCBakeryModelLoader.INSTANCE); + ClientCommandHandler.instance.registerCommand(new DumpModelLocationsCommand()); + ClientCommandHandler.instance.registerCommand(new NukeCCModelCacheCommand()); + } + + @Override + public void init() { + CCExtendedBlockRendererDispatcher.init(); + CCRenderItem.init(); + } +} diff --git a/dependencies/main/java/codechicken/lib/internal/proxy/CommonProxy.java b/dependencies/main/java/codechicken/lib/internal/proxy/CommonProxy.java new file mode 100644 index 0000000000..b21701d0b4 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/internal/proxy/CommonProxy.java @@ -0,0 +1,24 @@ +package codechicken.lib.internal.proxy; + +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; + +/** + * Created by covers1624 on 23/11/2016. + */ +public class CommonProxy { + + public void preInit() { + + } + + public void init() { + + } + + public void serverStarting(FMLServerStartingEvent event) { + //if (!ObfMapping.obfuscated) { + // event.registerServerCommand(new DevEnvCommand()); + //} + } + +} diff --git a/dependencies/main/java/codechicken/lib/inventory/InventoryCopy.java b/dependencies/main/java/codechicken/lib/inventory/InventoryCopy.java index 31eea1dfed..748497df28 100644 --- a/dependencies/main/java/codechicken/lib/inventory/InventoryCopy.java +++ b/dependencies/main/java/codechicken/lib/inventory/InventoryCopy.java @@ -3,13 +3,14 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ITextComponent; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; /** * Creates a copy of an IInventory for extended simulation */ public class InventoryCopy implements IInventory { + public boolean[] accessible; public ItemStack[] items; public IInventory inv; @@ -63,7 +64,7 @@ public ItemStack decrStackSize(int slot, int amount) { @Override public ItemStack removeStackFromSlot(int slot) { - return InventoryUtils.getStackInSlotOnClosing(this, slot); + return InventoryUtils.removeStackFromSlot(this, slot); } @Override @@ -129,6 +130,6 @@ public boolean hasCustomName() { @Override public ITextComponent getDisplayName() { - return new ChatComponentText(getName()); + return new TextComponentString(getName()); } } diff --git a/dependencies/main/java/codechicken/lib/inventory/InventoryNBT.java b/dependencies/main/java/codechicken/lib/inventory/InventoryNBT.java index 7b5732a3cd..470f62b9a1 100644 --- a/dependencies/main/java/codechicken/lib/inventory/InventoryNBT.java +++ b/dependencies/main/java/codechicken/lib/inventory/InventoryNBT.java @@ -4,13 +4,14 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ITextComponent; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; /** * IInventory implementation which saves and loads from an NBT tag */ public class InventoryNBT implements IInventory { + protected ItemStack[] items; protected NBTTagCompound tag; @@ -47,7 +48,7 @@ public ItemStack decrStackSize(int slot, int amount) { @Override public ItemStack removeStackFromSlot(int slot) { - return InventoryUtils.getStackInSlotOnClosing(this, slot); + return InventoryUtils.removeStackFromSlot(this, slot); } @Override @@ -118,6 +119,6 @@ public boolean hasCustomName() { @Override public ITextComponent getDisplayName() { - return new ChatComponentText(getName()); + return new TextComponentString(getName()); } } diff --git a/dependencies/main/java/codechicken/lib/inventory/InventoryRange.java b/dependencies/main/java/codechicken/lib/inventory/InventoryRange.java index 8c33fabe6c..5155bf1a0c 100644 --- a/dependencies/main/java/codechicken/lib/inventory/InventoryRange.java +++ b/dependencies/main/java/codechicken/lib/inventory/InventoryRange.java @@ -9,14 +9,20 @@ * Inventory wrapper for unified ISided/IInventory access */ public class InventoryRange { + public IInventory inv; public EnumFacing face; public ISidedInventory sidedInv; public int[] slots; + @Deprecated// Use EnumFacing version. public InventoryRange(IInventory inv, int side) { + this(inv, EnumFacing.values()[side]); + } + + public InventoryRange(IInventory inv, EnumFacing side) { this.inv = inv; - this.face = EnumFacing.values()[side]; + this.face = side; if (inv instanceof ISidedInventory) { sidedInv = (ISidedInventory) inv; slots = sidedInv.getSlotsForFace(face); @@ -29,7 +35,7 @@ public InventoryRange(IInventory inv, int side) { } public InventoryRange(IInventory inv) { - this(inv, 0); + this(inv, EnumFacing.DOWN); } public InventoryRange(IInventory inv, int fslot, int lslot) { diff --git a/dependencies/main/java/codechicken/lib/inventory/InventorySimple.java b/dependencies/main/java/codechicken/lib/inventory/InventorySimple.java index f21e421f02..2eb52f9b5f 100644 --- a/dependencies/main/java/codechicken/lib/inventory/InventorySimple.java +++ b/dependencies/main/java/codechicken/lib/inventory/InventorySimple.java @@ -3,13 +3,19 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ITextComponent; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.items.wrapper.InvWrapper; /** * Simple IInventory implementation with an array of items, name and maximum stack size */ -public class InventorySimple implements IInventory { +public class InventorySimple implements IInventory, ICapabilityProvider { + public ItemStack[] items; public int limit; public String name; @@ -65,7 +71,7 @@ public ItemStack decrStackSize(int slot, int amount) { @Override public ItemStack removeStackFromSlot(int slot) { - return InventoryUtils.getStackInSlotOnClosing(this, slot); + return InventoryUtils.removeStackFromSlot(this, slot); } @Override @@ -117,6 +123,9 @@ public int getFieldCount() { @Override public void clear() { + for (int i = 0; i < items.length; i++) { + items[i] = null; + } } @Override @@ -131,6 +140,20 @@ public boolean hasCustomName() { @Override public ITextComponent getDisplayName() { - return new ChatComponentText(getName()); + return new TextComponentString(getName()); + } + + @Override + public boolean hasCapability(Capability capability, EnumFacing facing) { + return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY; + } + + @SuppressWarnings ("unchecked") + @Override + public T getCapability(Capability capability, EnumFacing facing) { + if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + return (T) new InvWrapper(this); + } + return null; } } diff --git a/dependencies/main/java/codechicken/lib/inventory/InventoryUtils.java b/dependencies/main/java/codechicken/lib/inventory/InventoryUtils.java index c5fee40612..37ce96c924 100644 --- a/dependencies/main/java/codechicken/lib/inventory/InventoryUtils.java +++ b/dependencies/main/java/codechicken/lib/inventory/InventoryUtils.java @@ -6,21 +6,43 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.InventoryLargeChest; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTPrimitive; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing.Plane; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.items.IItemHandler; +import net.minecraftforge.items.wrapper.EmptyHandler; +import net.minecraftforge.items.wrapper.InvWrapper; +import net.minecraftforge.items.wrapper.SidedInvWrapper; public class InventoryUtils { + + public static boolean hasItemHandlerCap(TileEntity tileEntity, EnumFacing face) { + return tileEntity != null && (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, face) || tileEntity instanceof ISidedInventory || tileEntity instanceof IInventory); + } + + public static IItemHandler getItemHandlerCap(TileEntity tileEntity, EnumFacing face) { + if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, face)) { + return tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, face); + } else if (tileEntity instanceof ISidedInventory) { + return new SidedInvWrapper(((ISidedInventory) tileEntity), face); + } else if (tileEntity instanceof IInventory) { + return new InvWrapper(((IInventory) tileEntity)); + } + return new EmptyHandler(); + } + /** * Constructor for ItemStack with tag */ @@ -34,7 +56,7 @@ public static ItemStack newItemStack(Item item, int size, int damage, NBTTagComp * Gets the actual damage of an item without asking the Item */ public static int actualDamage(ItemStack stack) { - return Items.diamond.getDamage(stack); + return Items.DIAMOND.getDamage(stack); } /** @@ -65,7 +87,7 @@ public static ItemStack decrStackSize(IInventory inv, int slot, int size) { /** * Static default implementation for IInventory method */ - public static ItemStack getStackInSlotOnClosing(IInventory inv, int slot) { + public static ItemStack removeStackFromSlot(IInventory inv, int slot) { ItemStack stack = inv.getStackInSlot(slot); inv.setInventorySlotContents(slot, null); return stack; @@ -136,7 +158,7 @@ public static void readItemStacksFromTag(ItemStack[] items, NBTTagList tagList) int b = tag.getShort("Slot"); items[b] = ItemStack.loadItemStackFromNBT(tag); if (tag.hasKey("Quantity")) { - items[b].stackSize = ((NBTBase.NBTPrimitive) tag.getTag("Quantity")).getInt(); + items[b].stackSize = ((NBTPrimitive) tag.getTag("Quantity")).getInt(); } } } @@ -265,7 +287,10 @@ public static boolean areStacksIdentical(ItemStack stack1, ItemStack stack2) { * Gets an IInventory from a coordinate with support for double chests */ public static IInventory getInventory(World world, BlockPos pos) { - TileEntity tile = world.getTileEntity(pos); + return getInventory(world.getTileEntity(pos)); + } + + public static IInventory getInventory(TileEntity tile) { if (!(tile instanceof IInventory)) { return null; } @@ -274,7 +299,6 @@ public static IInventory getInventory(World world, BlockPos pos) { return getChest((TileEntityChest) tile); } return (IInventory) tile; - } public static IInventory getChest(TileEntityChest chest) { @@ -287,10 +311,7 @@ public static IInventory getChest(TileEntityChest chest) { } public static boolean canStack(ItemStack stack1, ItemStack stack2) { - return stack1 == null || stack2 == null || - (stack1.getItem() == stack2.getItem() && - (!stack2.getHasSubtypes() || stack2.getItemDamage() == stack1.getItemDamage()) && - ItemStack.areItemStackTagsEqual(stack2, stack1)) && stack1.isStackable(); + return stack1 == null || stack2 == null || (stack1.getItem() == stack2.getItem() && (!stack2.getHasSubtypes() || stack2.getItemDamage() == stack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(stack2, stack1)) && stack1.isStackable(); } /** @@ -316,13 +337,13 @@ public static int stackSize(IInventory inv, int slot) { } /** - * Drops all items from inv using getStackInSlotOnClosing + * Drops all items from inv using removeStackFromSlot */ public static void dropOnClose(EntityPlayer player, IInventory inv) { for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.removeStackFromSlot(i); if (stack != null) { - player.dropPlayerItemWithRandomChoice(stack, false); + player.dropItem(stack, false); } } } @@ -330,13 +351,13 @@ public static void dropOnClose(EntityPlayer player, IInventory inv) { public static NBTTagCompound savePersistant(ItemStack stack, NBTTagCompound tag) { stack.writeToNBT(tag); tag.removeTag("id"); - tag.setString("name", Item.itemRegistry.getNameForObject(stack.getItem()).toString()); + tag.setString("name", stack.getItem().getRegistryName().toString()); return tag; } public static ItemStack loadPersistant(NBTTagCompound tag) { String name = tag.getString("name"); - Item item = (Item) Item.itemRegistry.getObject(new ResourceLocation(name)); + Item item = Item.REGISTRY.getObject(new ResourceLocation(name)); if (item == null) { return null; } diff --git a/dependencies/main/java/codechicken/lib/inventory/ItemKey.java b/dependencies/main/java/codechicken/lib/inventory/ItemKey.java index 82ed7276e5..2e3beb3418 100644 --- a/dependencies/main/java/codechicken/lib/inventory/ItemKey.java +++ b/dependencies/main/java/codechicken/lib/inventory/ItemKey.java @@ -12,6 +12,7 @@ * Comparable ItemStack with a hashCode implementation. */ public class ItemKey implements Comparable { + public ItemStack stack; private int hashcode = 0; @@ -39,9 +40,7 @@ public boolean equals(Object obj) { } ItemKey k = (ItemKey) obj; - return stack.getItem() == k.stack.getItem() && - actualDamage(stack) == actualDamage(k.stack) && - Objects.equal(stack.getTagCompound(), k.stack.getTagCompound()); + return stack.getItem() == k.stack.getItem() && actualDamage(stack) == actualDamage(k.stack) && Objects.equal(stack.getTagCompound(), k.stack.getTagCompound()); } @Override diff --git a/dependencies/main/java/codechicken/lib/item/ItemMultiType.java b/dependencies/main/java/codechicken/lib/item/ItemMultiType.java new file mode 100644 index 0000000000..bbbaae0f14 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/item/ItemMultiType.java @@ -0,0 +1,147 @@ +package codechicken.lib.item; + +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by covers1624 on 3/27/2016. + * TODO cleanup. + */ +public class ItemMultiType extends Item { + + private HashMap names = new HashMap(); + private HashMap rarityMap = new HashMap(); + private int nextVariant = 0; + private boolean hasRegistered = false; + private boolean registerToStackRegistry = false; + + /** + * @param registryName The name to be registered with." + */ + public ItemMultiType(CreativeTabs tab, String registryName) { + setRegistryName(registryName); + setMaxDamage(0); + setHasSubtypes(true); + setCreativeTab(tab); + setUnlocalizedName(new ResourceLocation(registryName).getResourcePath()); + setMaxStackSize(64); + } + + @Override + public ItemMultiType setUnlocalizedName(String unlocalizedName) { + super.setUnlocalizedName(unlocalizedName); + return this; + } + + public ItemMultiType setUseStackRegistry() { + registerToStackRegistry = true; + return this; + } + + public ItemStack registerSubItem(int meta, String name) { + if (names.containsKey(meta)) { + FMLLog.warning("[ItemMultiType.%s]: Variant %s with meta %s is already registered to %s with meta %s", getRegistryName(), name, meta, names.get(meta), meta); + } + names.put(meta, name); + ItemStack stack = new ItemStack(this, 1, meta); + incVariant(); + return stack; + } + + public ItemStack registerSubItem(int meta, String name, EnumRarity rarity) { + rarityMap.put(meta, rarity); + return registerSubItem(meta, name); + } + + public ItemStack registerSubItemOreDict(int meta, String name) { + ItemStack stack = registerSubItem(meta, name); + OreDictionary.registerOre(name, stack); + if (registerToStackRegistry) { + ItemStackRegistry.registerCustomItemStack(name, stack); + } + return stack; + } + + public ItemStack registerSubItemOreDict(int meta, String name, EnumRarity rarity) { + rarityMap.put(meta, rarity); + return registerSubItemOreDict(meta, name); + } + + public ItemStack registerSubItem(String name) { + return registerSubItem(nextVariant, name); + } + + public ItemStack registerSubItem(String name, EnumRarity rarity) { + rarityMap.put(nextVariant, rarity); + return registerSubItem(name); + } + + public ItemStack registerSubItemOreDict(String name) { + ItemStack stack = registerSubItem(nextVariant, name); + OreDictionary.registerOre(name, stack); + if (registerToStackRegistry) { + ItemStackRegistry.registerCustomItemStack(name, stack); + } + return stack; + } + + public ItemStack registerSubItemOreDict(String name, EnumRarity rarity) { + rarityMap.put(nextVariant, rarity); + return registerSubItemOreDict(name); + } + + private void incVariant() { + if (names.containsKey(nextVariant)) { + nextVariant++; + while (names.containsKey(nextVariant)) { + nextVariant++; + } + } + } + + @SuppressWarnings ("ConstantConditions") + @SideOnly (Side.CLIENT) + public void registerModelVariants() { + if (!hasRegistered) { + for (Map.Entry entry : names.entrySet()) { + ModelResourceLocation location = new ModelResourceLocation(getRegistryName(), "type=" + entry.getValue().toLowerCase()); + ModelLoader.setCustomModelResourceLocation(this, entry.getKey(), location); + } + hasRegistered = true; + } + } + + @Override + public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) { + for (Map.Entry entry : names.entrySet()) { + subItems.add(new ItemStack(itemIn, 1, entry.getKey())); + } + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + int meta = stack.getItemDamage(); + return getUnlocalizedName() + "." + names.get(meta); + } + + @Override + public EnumRarity getRarity(ItemStack stack) { + if (rarityMap.containsKey(stack.getItemDamage())) { + return rarityMap.get(stack.getItemDamage()); + } + return super.getRarity(stack); + } +} diff --git a/dependencies/main/java/codechicken/lib/item/ItemStackRegistry.java b/dependencies/main/java/codechicken/lib/item/ItemStackRegistry.java new file mode 100644 index 0000000000..4c1e9b5bfa --- /dev/null +++ b/dependencies/main/java/codechicken/lib/item/ItemStackRegistry.java @@ -0,0 +1,52 @@ +package codechicken.lib.item; + +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Table; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.registry.ForgeRegistries; + +/** + * Created by covers1624 on 22/10/2016. + * TODO, We need to find another way to do this. + */ +public class ItemStackRegistry { + + private static Table stackRegistry = HashBasedTable.create(); + + public static void registerCustomItemStack(String name, ItemStack stack) { + stackRegistry.put(Loader.instance().activeModContainer().getModId(), name, stack); + } + + public static ItemStack findItemStack(String modId, String name, int stackSize) { + ItemStack foundStack = findItemStack(modId, name); + if (foundStack != null) { + ItemStack copy = foundStack.copy(); + copy.stackSize = Math.min(stackSize, copy.getMaxStackSize()); + return copy; + } + return null; + } + + public static ItemStack findItemStack(String modId, String name) { + ItemStack stack = stackRegistry.get(modId, name); + if (stack == null) { + Item item = ForgeRegistries.ITEMS.getValue(new ResourceLocation(modId, name)); + if (item != null) { + stack = new ItemStack(item, 0, 0); + } + } + if (stack == null) { + Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(modId, name)); + if (block != null && block != Blocks.AIR) { + stack = new ItemStack(block, 0, Short.MAX_VALUE); + } + } + return stack; + } + +} diff --git a/dependencies/main/java/codechicken/lib/item/filtering/IItemFilter.java b/dependencies/main/java/codechicken/lib/item/filtering/IItemFilter.java new file mode 100644 index 0000000000..7834b6c7fb --- /dev/null +++ b/dependencies/main/java/codechicken/lib/item/filtering/IItemFilter.java @@ -0,0 +1,20 @@ +package codechicken.lib.item.filtering; + +import net.minecraft.item.ItemStack; + +/** + * This is an item filter. + * Implement it and do stuff, Its pretty simple. + * There are some default filters provided as well. + */ +public interface IItemFilter { + + /** + * Checks to see if the item matches the filter. + * True means the item is allowed, false the item is not allowed. + * + * @param item Item to check. + * @return True if the item matches the filter. + */ + boolean matches(ItemStack item); +} diff --git a/dependencies/main/java/codechicken/lib/item/filtering/IItemFilterProvider.java b/dependencies/main/java/codechicken/lib/item/filtering/IItemFilterProvider.java new file mode 100644 index 0000000000..6f9df2aba1 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/item/filtering/IItemFilterProvider.java @@ -0,0 +1,13 @@ +package codechicken.lib.item.filtering; + +/** + * Defines a class that can obtain filters, Really only used in NEI but here because reasons. + */ +public interface IItemFilterProvider { + + /** + * Provides an item filter. May be called from any thread. Returned filter should only reference objects with immutable state. + */ + IItemFilter getFilter(); + +} diff --git a/dependencies/main/java/codechicken/lib/lighting/LC.java b/dependencies/main/java/codechicken/lib/lighting/LC.java index 869a5e5e49..828e76d971 100644 --- a/dependencies/main/java/codechicken/lib/lighting/LC.java +++ b/dependencies/main/java/codechicken/lib/lighting/LC.java @@ -1,11 +1,12 @@ package codechicken.lib.lighting; -import codechicken.lib.render.CCModel; import codechicken.lib.util.Copyable; +import codechicken.lib.util.VectorUtils; import codechicken.lib.vec.Rotation; import codechicken.lib.vec.Vector3; public class LC implements Copyable { + public int side; public float fa; public float fb; @@ -38,7 +39,7 @@ public LC set(LC lc) { } public LC compute(Vector3 vec, Vector3 normal) { - int side = CCModel.findSide(normal); + int side = VectorUtils.findSide(normal); if (side < 0) { return set(12, 1, 0, 0, 0); } @@ -48,24 +49,24 @@ public LC compute(Vector3 vec, Vector3 normal) { public LC compute(Vector3 vec, int side) { boolean offset = false; switch (side) { - case 0: - offset = vec.y <= 0; - break; - case 1: - offset = vec.y >= 1; - break; - case 2: - offset = vec.z <= 0; - break; - case 3: - offset = vec.z >= 1; - break; - case 4: - offset = vec.x <= 0; - break; - case 5: - offset = vec.x >= 1; - break; + case 0: + offset = vec.y <= 0; + break; + case 1: + offset = vec.y >= 1; + break; + case 2: + offset = vec.z <= 0; + break; + case 3: + offset = vec.z >= 1; + break; + case 4: + offset = vec.x <= 0; + break; + case 5: + offset = vec.x >= 1; + break; } if (!offset) { side += 6; @@ -87,4 +88,4 @@ public LC computeO(Vector3 vec, int side) { public LC copy() { return new LC(side, fa, fb, fc, fd); } -} \ No newline at end of file +} diff --git a/dependencies/main/java/codechicken/lib/lighting/LightMatrix.java b/dependencies/main/java/codechicken/lib/lighting/LightMatrix.java index bca3c02aa1..24b7505c26 100644 --- a/dependencies/main/java/codechicken/lib/lighting/LightMatrix.java +++ b/dependencies/main/java/codechicken/lib/lighting/LightMatrix.java @@ -2,16 +2,17 @@ import codechicken.lib.colour.ColourRGBA; import codechicken.lib.render.CCRenderState; -import codechicken.lib.vec.BlockCoord; +import codechicken.lib.render.pipeline.IVertexOperation; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; /** * Note that when using the class as a vertex transformer, the vertices are assumed to be within the BB (x, y, z) -> (x+1, y+1, z+1) */ -public class LightMatrix implements CCRenderState.IVertexOperation { +public class LightMatrix implements IVertexOperation { + public static final int operationIndex = CCRenderState.registerOperation(); public int computed = 0; @@ -19,7 +20,7 @@ public class LightMatrix implements CCRenderState.IVertexOperation { public int[][] brightness = new int[13][4]; public IBlockAccess access; - public BlockCoord pos = new BlockCoord(); + public BlockPos pos = BlockPos.ORIGIN; private int sampled = 0; private float[] aSamples = new float[27]; @@ -28,11 +29,32 @@ public class LightMatrix implements CCRenderState.IVertexOperation { /** * The 9 positions in the sample array for each side, sides >= 6 are centered on sample 13 (the block itself) */ - public static final int[][] ssamplem = new int[][] { { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, { 18, 19, 20, 21, 22, 23, 24, 25, 26 }, { 0, 9, 18, 1, 10, 19, 2, 11, 20 }, { 6, 15, 24, 7, 16, 25, 8, 17, 26 }, { 0, 3, 6, 9, 12, 15, 18, 21, 24 }, { 2, 5, 8, 11, 14, 17, 20, 23, 26 }, { 9, 10, 11, 12, 13, 14, 15, 16, 17 }, { 9, 10, 11, 12, 13, 14, 15, 16, 17 }, { 3, 12, 21, 4, 13, 22, 5, 14, 23 }, { 3, 12, 21, 4, 13, 22, 5, 14, 23 }, { 1, 4, 7, 10, 13, 16, 19, 22, 25 }, { 1, 4, 7, 10, 13, 16, 19, 22, 25 }, { 13, 13, 13, 13, 13, 13, 13, 13, 13 } }; + //@formatter:off + public static final int[][] ssamplem = new int[][]{ + { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, + {18,19,20,21,22,23,24,25,26 }, + { 0, 9,18, 1,10,19, 2,11,20 }, + { 6,15,24, 7,16,25, 8,17,26 }, + { 0, 3, 6, 9,12,15,18,21,24 }, + { 2, 5, 8,11,14,17,20,23,26 }, + { 9,10,11,12,13,14,15,16,17 }, + { 9,10,11,12,13,14,15,16,17 }, + { 3,12,21, 4,13,22, 5,14,23 }, + { 3,12,21, 4,13,22, 5,14,23 }, + { 1, 4, 7,10,13,16,19,22,25 }, + { 1, 4, 7,10,13,16,19,22,25 }, + {13,13,13,13,13,13,13,13,13 }}; public static final int[][] qsamplem = new int[][] {//the positions in the side sample array for each corner - { 0, 1, 3, 4 }, { 5, 1, 2, 4 }, { 6, 7, 3, 4 }, { 5, 7, 8, 4 } }; - public static final float[] sideao = new float[] { 0.5F, 1F, 0.8F, 0.8F, 0.6F, 0.6F, 0.5F, 1F, 0.8F, 0.8F, 0.6F, 0.6F, 1F }; - + {0,1,3,4}, + {5,1,2,4}, + {6,7,3,4}, + {5,7,8,4}}; + public static final float[] sideao = new float[]{ + 0.5F, 1F, 0.8F, 0.8F, 0.6F, 0.6F, + 0.5F, 1F, 0.8F, 0.8F, 0.6F, 0.6F, + 1F }; + + //@formatter:on /*static { int[][] os = new int[][]{ @@ -42,7 +64,7 @@ public class LightMatrix implements CCRenderState.IVertexOperation { {0,0, 1}, {-1,0,0}, { 1,0,0}}; - + for(int s = 0; s < 12; s++) { int[] d0 = s < 6 ? new int[]{os[s][0]+1, os[s][1]+1, os[s][2]+1} : new int[]{1, 1, 1}; @@ -55,19 +77,19 @@ public class LightMatrix implements CCRenderState.IVertexOperation { System.out.println(Arrays.deepToString(ssamplem)); }*/ - public void locate(IBlockAccess a, int x, int y, int z) { + public void locate(IBlockAccess a, BlockPos bPos) { access = a; - pos.set(x, y, z); + pos = bPos; computed = 0; sampled = 0; } public void sample(int i) { if ((sampled & 1 << i) == 0) { - BlockPos bp = new BlockPos(pos.x + (i % 3) - 1, pos.y + (i / 9) - 1, pos.z + (i / 3 % 3) - 1); + BlockPos bp = new BlockPos(pos.getX() + (i % 3) - 1, pos.getY() + (i / 9) - 1, pos.getZ() + (i / 3 % 3) - 1); IBlockState b = access.getBlockState(bp); - bSamples[i] = access.getCombinedLight(bp, b.getBlock().getLightValue(access, bp)); - aSamples[i] = b.getBlock().getAmbientOcclusionLightValue(); + bSamples[i] = access.getCombinedLight(bp, b.getLightValue(access, bp)); + aSamples[i] = b.getBlock().getAmbientOcclusionLightValue(b); sampled |= 1 << i; } } @@ -97,7 +119,7 @@ public void sideSample(int side) { } } - private void interp(int s, int q, int a, int b, int c, int d) { + protected void interp(int s, int q, int a, int b, int c, int d) { sample(a); sample(b); sample(c); @@ -124,28 +146,28 @@ public static int interpBrightness(int a, int b, int c, int d) { } @Override - public boolean load() { - if (!CCRenderState.computeLighting) { + public boolean load(CCRenderState state) { + if (!state.computeLighting) { return false; } - CCRenderState.pipeline.addDependency(CCRenderState.colourAttrib); - CCRenderState.pipeline.addDependency(CCRenderState.lightCoordAttrib); + state.pipeline.addDependency(state.colourAttrib); + state.pipeline.addDependency(state.lightCoordAttrib); return true; } @Override - public void operate() { - LC lc = CCRenderState.lc; + public void operate(CCRenderState state) { + LC lc = state.lc; float[] a = ao(lc.side); float f = (a[0] * lc.fa + a[1] * lc.fb + a[2] * lc.fc + a[3] * lc.fd); int[] b = brightness(lc.side); - CCRenderState.setColour(ColourRGBA.multiplyC(CCRenderState.colour, f)); - CCRenderState.setBrightness((int) (b[0] * lc.fa + b[1] * lc.fb + b[2] * lc.fc + b[3] * lc.fd) & 0xFF00FF); + state.colour = ColourRGBA.multiplyC(state.colour, f); + state.brightness = (int) (b[0] * lc.fa + b[1] * lc.fb + b[2] * lc.fc + b[3] * lc.fd) & 0xFF00FF; } @Override public int operationID() { return operationIndex; } -} \ No newline at end of file +} diff --git a/dependencies/main/java/codechicken/lib/lighting/LightModel.java b/dependencies/main/java/codechicken/lib/lighting/LightModel.java index 4c2d9c5587..32a35352ed 100644 --- a/dependencies/main/java/codechicken/lib/lighting/LightModel.java +++ b/dependencies/main/java/codechicken/lib/lighting/LightModel.java @@ -1,13 +1,16 @@ package codechicken.lib.lighting; import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.Rotation; import codechicken.lib.vec.Vector3; -public class LightModel implements CCRenderState.IVertexOperation { +public class LightModel implements IVertexOperation { + public static final int operationIndex = CCRenderState.registerOperation(); public static class Light { + public Vector3 ambient = new Vector3(); public Vector3 diffuse = new Vector3(); public Vector3 position; @@ -78,19 +81,19 @@ public int apply(int colour, Vector3 normal) { } @Override - public boolean load() { - if (!CCRenderState.computeLighting) { + public boolean load(CCRenderState state) { + if (!state.computeLighting) { return false; } - CCRenderState.pipeline.addDependency(CCRenderState.normalAttrib); - CCRenderState.pipeline.addDependency(CCRenderState.colourAttrib); + state.pipeline.addDependency(state.normalAttrib); + state.pipeline.addDependency(state.colourAttrib); return true; } @Override - public void operate() { - CCRenderState.setColour(apply(CCRenderState.colour, CCRenderState.normal)); + public void operate(CCRenderState state) { + state.colour = apply(state.colour, state.normal); } @Override diff --git a/dependencies/main/java/codechicken/lib/lighting/PlanarLightMatrix.java b/dependencies/main/java/codechicken/lib/lighting/PlanarLightMatrix.java index ce43b59ea1..d04823d84c 100644 --- a/dependencies/main/java/codechicken/lib/lighting/PlanarLightMatrix.java +++ b/dependencies/main/java/codechicken/lib/lighting/PlanarLightMatrix.java @@ -1,17 +1,17 @@ package codechicken.lib.lighting; import codechicken.lib.render.CCRenderState; -import codechicken.lib.vec.BlockCoord; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; public class PlanarLightMatrix extends PlanarLightModel { + public static final int operationIndex = CCRenderState.registerOperation(); public static PlanarLightMatrix instance = new PlanarLightMatrix(); public IBlockAccess access; - public BlockCoord pos = new BlockCoord(); + public BlockPos pos = BlockPos.ORIGIN; private int sampled = 0; public int[] brightness = new int[6]; @@ -20,33 +20,32 @@ public PlanarLightMatrix() { super(PlanarLightModel.standardLightModel.colours); } - public PlanarLightMatrix locate(IBlockAccess a, int x, int y, int z) { + public PlanarLightMatrix locate(IBlockAccess a, BlockPos bPos) { access = a; - pos.set(x, y, z); + pos = bPos; sampled = 0; return this; } public int brightness(int side) { if ((sampled & 1 << side) == 0) { - BlockPos bp = pos.pos(); - IBlockState b = access.getBlockState(bp); - brightness[side] = access.getCombinedLight(bp, b.getBlock().getLightValue(access, bp)); + IBlockState b = access.getBlockState(pos); + brightness[side] = access.getCombinedLight(pos, b.getBlock().getLightValue(b, access, pos)); sampled |= 1 << side; } return brightness[side]; } @Override - public boolean load() { - CCRenderState.pipeline.addDependency(CCRenderState.sideAttrib); + public boolean load(CCRenderState state) { + state.pipeline.addDependency(state.sideAttrib); return true; } @Override - public void operate() { - super.operate(); - CCRenderState.setBrightness(brightness(CCRenderState.side)); + public void operate(CCRenderState state) { + super.operate(state); + state.brightness = brightness(state.side); } @Override diff --git a/dependencies/main/java/codechicken/lib/lighting/PlanarLightModel.java b/dependencies/main/java/codechicken/lib/lighting/PlanarLightModel.java index 8fc2dafee2..d280d9d9bd 100644 --- a/dependencies/main/java/codechicken/lib/lighting/PlanarLightModel.java +++ b/dependencies/main/java/codechicken/lib/lighting/PlanarLightModel.java @@ -2,11 +2,13 @@ import codechicken.lib.colour.ColourRGBA; import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; /** * Faster precomputed version of LightModel that only works for axis planar sides */ -public class PlanarLightModel implements CCRenderState.IVertexOperation { +public class PlanarLightModel implements IVertexOperation { + public static PlanarLightModel standardLightModel = LightModel.standardLightModel.reducePlanar(); public int[] colours; @@ -16,19 +18,19 @@ public PlanarLightModel(int[] colours) { } @Override - public boolean load() { - if (!CCRenderState.computeLighting) { + public boolean load(CCRenderState state) { + if (!state.computeLighting) { return false; } - CCRenderState.pipeline.addDependency(CCRenderState.sideAttrib); - CCRenderState.pipeline.addDependency(CCRenderState.colourAttrib); + state.pipeline.addDependency(state.sideAttrib); + state.pipeline.addDependency(state.colourAttrib); return true; } @Override - public void operate() { - CCRenderState.setColour(ColourRGBA.multiply(CCRenderState.colour, colours[CCRenderState.side])); + public void operate(CCRenderState state) { + state.colour = ColourRGBA.multiply(state.colour, colours[state.side]); } @Override diff --git a/dependencies/main/java/codechicken/lib/lighting/SimpleBrightnessModel.java b/dependencies/main/java/codechicken/lib/lighting/SimpleBrightnessModel.java index 7783437ce9..71efc8e026 100644 --- a/dependencies/main/java/codechicken/lib/lighting/SimpleBrightnessModel.java +++ b/dependencies/main/java/codechicken/lib/lighting/SimpleBrightnessModel.java @@ -1,50 +1,53 @@ package codechicken.lib.lighting; import codechicken.lib.render.CCRenderState; -import codechicken.lib.vec.BlockCoord; +import codechicken.lib.render.pipeline.IVertexOperation; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; /** - * Faster precomputed version of LightModel that only works for axis planar sides + * Simple brightness model that only works for axis planar sides */ -public class SimpleBrightnessModel implements CCRenderState.IVertexOperation { +public class SimpleBrightnessModel implements IVertexOperation { + public static final int operationIndex = CCRenderState.registerOperation(); public static SimpleBrightnessModel instance = new SimpleBrightnessModel(); public IBlockAccess access; - public BlockCoord pos = new BlockCoord(); + public BlockPos pos = BlockPos.ORIGIN; private int sampled = 0; private int[] samples = new int[6]; - private BlockCoord c = new BlockCoord(); + private BlockPos c = BlockPos.ORIGIN; - public void locate(IBlockAccess a, int x, int y, int z) { + public void locate(IBlockAccess a, BlockPos bPos) { access = a; - pos.set(x, y, z); + pos = bPos; sampled = 0; } public int sample(int side) { if ((sampled & 1 << side) == 0) { - BlockPos bp = c.set(pos).offset(side).pos(); - IBlockState b = access.getBlockState(bp); - samples[side] = access.getCombinedLight(bp, b.getBlock().getLightValue(access, bp)); + c = pos.offset(EnumFacing.VALUES[side]); + IBlockState b = access.getBlockState(c); + samples[side] = access.getCombinedLight(c, b.getBlock().getLightValue(b, access, c)); sampled |= 1 << side; } return samples[side]; } @Override - public boolean load() { - CCRenderState.pipeline.addDependency(CCRenderState.sideAttrib); + public boolean load(CCRenderState state) { + + state.pipeline.addDependency(state.sideAttrib); return true; } @Override - public void operate() { - CCRenderState.setBrightness(sample(CCRenderState.side)); + public void operate(CCRenderState state) { + state.brightness = sample(state.side); } @Override diff --git a/dependencies/main/java/codechicken/lib/math/MathHelper.java b/dependencies/main/java/codechicken/lib/math/MathHelper.java index a2ca169140..ff6b591e5e 100644 --- a/dependencies/main/java/codechicken/lib/math/MathHelper.java +++ b/dependencies/main/java/codechicken/lib/math/MathHelper.java @@ -1,6 +1,10 @@ package codechicken.lib.math; +import net.minecraft.util.math.BlockPos; + +//TODO cleanup. public class MathHelper { + public static final double phi = 1.618033988749894; public static final double pi = Math.PI; public static final double todeg = 57.29577951308232; @@ -126,10 +130,104 @@ public static double clip(double value, double min, double max) { } /** - * @return a <= x <= b + * @param value The value + * @param min The min value + * @param max The max value + * @return The clipped value between min and max + */ + public static float clip(float value, float min, float max) { + if (value > max) { + value = max; + } + if (value < min) { + value = min; + } + return value; + } + + /** + * @param value The value + * @param min The min value + * @param max The max value + * @return The clipped value between min and max + */ + public static int clip(int value, int min, int max) { + if (value > max) { + value = max; + } + if (value < min) { + value = min; + } + return value; + } + + /** + * Maps a value range to another value range. + * + * @param valueIn The value to map. + * @param inMin The minimum of the input value range. + * @param inMax The maximum of the input value range + * @param outMin The minimum of the output value range. + * @param outMax The maximum of the output value range. + * @return The mapped value. + */ + public static double map(double valueIn, double inMin, double inMax, double outMin, double outMax) { + return (valueIn - inMin) * (outMax - outMin) / (inMax - inMin) + outMin; + } + + /** + * Maps a value range to another value range. + * + * @param valueIn The value to map. + * @param inMin The minimum of the input value range. + * @param inMax The maximum of the input value range + * @param outMin The minimum of the output value range. + * @param outMax The maximum of the output value range. + * @return The mapped value. */ - public static boolean between(double a, double x, double b) { - return a <= x && x <= b; + public static float map(float valueIn, float inMin, float inMax, float outMin, float outMax) { + return (valueIn - inMin) * (outMax - outMin) / (inMax - inMin) + outMin; + } + + /** + * Rounds the number of decimal places based on the given multiplier.
+ * e.g.
+ * Input: 17.5245743
+ * multiplier: 1000
+ * Output: 17.534
+ * multiplier: 10
+ * Output 17.5

+ * + * @param number The input value. + * @param multiplier The multiplier. + * @return The input rounded to a number of decimal places based on the multiplier. + */ + public static double round(double number, double multiplier) { + return Math.round(number * multiplier) / multiplier; + } + + /** + * Rounds the number of decimal places based on the given multiplier.
+ * e.g.
+ * Input: 17.5245743
+ * multiplier: 1000
+ * Output: 17.534
+ * multiplier: 10
+ * Output 17.5

+ * + * @param number The input value. + * @param multiplier The multiplier. + * @return The input rounded to a number of decimal places based on the multiplier. + */ + public static float round(float number, float multiplier) { + return Math.round(number * multiplier) / multiplier; + } + + /** + * @return min <= value <= max + */ + public static boolean between(double min, double value, double max) { + return min <= value && value <= max; } public static int approachExpI(int a, int b, double ratio) { @@ -142,8 +240,28 @@ public static int retreatExpI(int a, int b, int c, double ratio, int kick) { return r == a ? b : r; } - public static int floor_double(double d) { - return net.minecraft.util.MathHelper.floor_double(d); + public static int floor(double d) { + return net.minecraft.util.math.MathHelper.floor_double(d); + } + + public static int floor(float d) { + return net.minecraft.util.math.MathHelper.floor_float(d); + } + + public static int ceil(double d) { + return net.minecraft.util.math.MathHelper.ceiling_double_int(d); + } + + public static int ceil(float d) { + return net.minecraft.util.math.MathHelper.ceiling_float_int(d); + } + + public static float sqrt(float f) { + return net.minecraft.util.math.MathHelper.sqrt_float(f); + } + + public static float sqrt(double f) { + return net.minecraft.util.math.MathHelper.sqrt_double(f); } public static int roundAway(double d) { @@ -157,4 +275,38 @@ public static int compare(int a, int b) { public static int compare(double a, double b) { return a == b ? 0 : a < b ? -1 : 1; } + + public static int absSum(BlockPos pos) { + return (pos.getX() < 0 ? -pos.getX() : pos.getX()) + (pos.getY() < 0 ? -pos.getY() : pos.getY()) + (pos.getZ() < 0 ? -pos.getZ() : pos.getZ()); + } + + public static boolean isAxial(BlockPos pos) { + return pos.getX() == 0 ? (pos.getY() == 0 || pos.getZ() == 0) : (pos.getY() == 0 && pos.getZ() == 0); + } + + public static int toSide(BlockPos pos) { + if (!isAxial(pos)) { + return -1; + } + if (pos.getY() < 0) { + return 0; + } + if (pos.getY() > 0) { + return 1; + } + if (pos.getZ() < 0) { + return 2; + } + if (pos.getZ() > 0) { + return 3; + } + if (pos.getX() < 0) { + return 4; + } + if (pos.getX() > 0) { + return 5; + } + + return -1; + } } diff --git a/dependencies/main/java/codechicken/lib/model/BakedModelProperties.java b/dependencies/main/java/codechicken/lib/model/BakedModelProperties.java new file mode 100644 index 0000000000..eb33d7a3e9 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/BakedModelProperties.java @@ -0,0 +1,60 @@ +package codechicken.lib.model; + +import codechicken.lib.util.Copyable; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; + +/** + * Created by covers1624 on 19/11/2016. + */ +public class BakedModelProperties implements Copyable { + + private final boolean isAO; + private final boolean isGui3D; + private final boolean isBuiltInRenderer; + private final TextureAtlasSprite particle; + + public BakedModelProperties(boolean isAO, boolean isGui3D) { + this(isAO, isGui3D, false, null); + } + + public BakedModelProperties(BakedModelProperties properties, TextureAtlasSprite sprite) { + this(properties.isAmbientOcclusion(), properties.isGui3d(), properties.isBuiltInRenderer(), sprite); + } + + public BakedModelProperties(boolean isAO, boolean isGui3D, TextureAtlasSprite sprite) { + this(isAO, isGui3D, false, sprite); + } + + public BakedModelProperties(boolean isAO, boolean isGui3D, boolean isBuiltInRenderer, TextureAtlasSprite particle) { + this.isAO = isAO; + this.isGui3D = isGui3D; + this.isBuiltInRenderer = isBuiltInRenderer; + this.particle = particle; + } + + public static BakedModelProperties createFromModel(IBakedModel model) { + return new BakedModelProperties(model.isAmbientOcclusion(), model.isGui3d(), model.isBuiltInRenderer(), model.getParticleTexture()); + } + + public boolean isAmbientOcclusion() { + return isAO; + } + + public boolean isGui3d() { + return isGui3D; + } + + public boolean isBuiltInRenderer() { + return isBuiltInRenderer; + } + + public TextureAtlasSprite getParticleTexture() { + return particle; + } + + @Override + public BakedModelProperties copy() { + return new BakedModelProperties(isAO, isGui3D, isBuiltInRenderer, particle); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/CCMultiModel.java b/dependencies/main/java/codechicken/lib/model/CCMultiModel.java new file mode 100644 index 0000000000..d9276c4cc7 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/CCMultiModel.java @@ -0,0 +1,91 @@ +package codechicken.lib.model; + +import codechicken.lib.model.bakedmodels.PerspectiveAwareMultiModel; +import codechicken.lib.texture.TextureUtils; +import com.google.common.base.Function; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.IModel; +import net.minecraftforge.common.model.IModelState; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** + * Created by covers1624 on 16/12/2016. + */ +public class CCMultiModel implements IModel { + + private final IModel base; + private final BakedModelProperties baseProperties; + private final List subModels; + + public CCMultiModel(IModel base, BakedModelProperties baseProperties, List subModels) { + this.base = base; + this.baseProperties = baseProperties; + this.subModels = subModels; + } + + @Override + public Collection getDependencies() { + List deps = new ArrayList(); + if (base != null) { + deps.addAll(base.getDependencies()); + } + for (IModel subModel : subModels) { + deps.addAll(subModel.getDependencies()); + } + return deps; + } + + @Override + public Collection getTextures() { + List deps = new ArrayList(); + if (base != null) { + deps.addAll(base.getTextures()); + } + for (IModel subModel : subModels) { + deps.addAll(subModel.getTextures()); + } + return deps; + } + + @Override + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { + IBakedModel baseBakedModel = null; + if (base != null) { + baseBakedModel = base.bake(state, format, bakedTextureGetter); + } + List subBakedModels = new ArrayList(); + TextureAtlasSprite particle = null; + if (baseBakedModel != null) { + particle = baseBakedModel.getParticleTexture(); + } + for (IModel subModel : subModels) { + TextureAtlasSprite particleCandidate = null; + IBakedModel bakedSubModel = subModel.bake(subModel.getDefaultState(), format, bakedTextureGetter); + subBakedModels.add(bakedSubModel); + if (particle == null || particle == TextureUtils.getMissingSprite()) { + if (particleCandidate == null || particleCandidate == TextureUtils.getMissingSprite()) { + particleCandidate = bakedSubModel.getParticleTexture(); + } + if (particleCandidate != null || particleCandidate != TextureUtils.getMissingSprite()) { + particle = particleCandidate; + } + } + } + if (particle == null) { + particle = TextureUtils.getMissingSprite(); + } + + return new PerspectiveAwareMultiModel(baseBakedModel, subBakedModels, state, new BakedModelProperties(baseProperties, particle)); + } + + @Override + public IModelState getDefaultState() { + return base.getDefaultState(); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/CCOverrideBakedBlockModel.java b/dependencies/main/java/codechicken/lib/model/CCOverrideBakedBlockModel.java new file mode 100644 index 0000000000..c9b6c08db0 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/CCOverrideBakedBlockModel.java @@ -0,0 +1,83 @@ +package codechicken.lib.model; + +import codechicken.lib.model.loader.CCBakedModelLoader; +import codechicken.lib.texture.TextureUtils; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumFacing; + +import javax.annotation.Nullable; +import java.util.LinkedList; +import java.util.List; + +/** + * Created by covers1624 on 7/31/2016. + */ +@Deprecated +public class CCOverrideBakedBlockModel implements IBakedModel { + + private final String particle; + private final boolean isAmbientOcclusion; + private final ItemOverrideList overrideList; + + public CCOverrideBakedBlockModel(String particle) { + this(particle, ItemOverrideList.NONE); + } + + public CCOverrideBakedBlockModel(String particle, ItemOverrideList overrideList) { + this(particle, false, overrideList); + } + + public CCOverrideBakedBlockModel(String particle, boolean isAmbientOcclusion, ItemOverrideList overrideList) { + this.particle = particle; + this.isAmbientOcclusion = isAmbientOcclusion; + this.overrideList = overrideList; + } + + @Override + public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { + LinkedList quads = new LinkedList(); + if (state == null) { + return quads; + } + IBakedModel correctModel = CCBakedModelLoader.getModel(state); + if (correctModel != null) { + quads.addAll(correctModel.getQuads(state, side, rand)); + } + return quads; + } + + @Override + public boolean isAmbientOcclusion() { + return isAmbientOcclusion; + } + + @Override + public boolean isGui3d() { + return false; + } + + @Override + public boolean isBuiltInRenderer() { + return false; + } + + @Override + public TextureAtlasSprite getParticleTexture() { + return TextureUtils.getTexture(particle); + } + + @Override + public ItemCameraTransforms getItemCameraTransforms() { + return ItemCameraTransforms.DEFAULT; + } + + @Override + public ItemOverrideList getOverrides() { + return overrideList; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/CCOverrideBakedModel.java b/dependencies/main/java/codechicken/lib/model/CCOverrideBakedModel.java new file mode 100644 index 0000000000..ceb085d8a2 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/CCOverrideBakedModel.java @@ -0,0 +1,13 @@ +package codechicken.lib.model; + +/** + * Created by covers1624 on 7/25/2016. + * Default implementation for CCOverrideListHandler. + */ +@Deprecated +public class CCOverrideBakedModel extends SimpleOverrideBakedModel { + + public CCOverrideBakedModel() { + super(new CCOverrideListHandler()); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/CCOverrideListHandler.java b/dependencies/main/java/codechicken/lib/model/CCOverrideListHandler.java new file mode 100644 index 0000000000..3744845c32 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/CCOverrideListHandler.java @@ -0,0 +1,32 @@ +package codechicken.lib.model; + +import codechicken.lib.model.loader.CCBakedModelLoader; +import com.google.common.collect.ImmutableList; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemOverride; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +/** + * Created by covers1624 on 7/25/2016. + *

+ * Default implementation for CCBakedModelLoader. + */ +@Deprecated +public class CCOverrideListHandler extends ItemOverrideList { + + public CCOverrideListHandler() { + super(ImmutableList.of()); + } + + @Override + public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) { + IBakedModel model = CCBakedModelLoader.getModel(stack); + if (model == null) { + return originalModel; + } + return model; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/DummyBakedModel.java b/dependencies/main/java/codechicken/lib/model/DummyBakedModel.java new file mode 100644 index 0000000000..1743131235 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/DummyBakedModel.java @@ -0,0 +1,56 @@ +package codechicken.lib.model; + +import com.google.common.collect.ImmutableList; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumFacing; + +import javax.annotation.Nullable; +import java.util.List; + +/** + * Created by covers1624 on 7/25/2016. + * A baked model to make minecraft shut the fuck up with baked model errors. + * TODO, Json support. + */ +public class DummyBakedModel implements IBakedModel { + + @Override + public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { + return ImmutableList.of(); + } + + @Override + public boolean isAmbientOcclusion() { + return false; + } + + @Override + public boolean isGui3d() { + return false; + } + + @Override + public boolean isBuiltInRenderer() { + return false; + } + + @Override + public TextureAtlasSprite getParticleTexture() { + return null; + } + + @Override + public ItemCameraTransforms getItemCameraTransforms() { + return ItemCameraTransforms.DEFAULT; + } + + @Override + public ItemOverrideList getOverrides() { + return ItemOverrideList.NONE; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/ModelRegistryHelper.java b/dependencies/main/java/codechicken/lib/model/ModelRegistryHelper.java new file mode 100644 index 0000000000..14e750105f --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/ModelRegistryHelper.java @@ -0,0 +1,107 @@ +package codechicken.lib.model; + +import codechicken.lib.render.item.IItemRenderer; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.util.TransformUtils; +import com.google.common.base.Function; +import com.google.common.collect.Maps; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.ItemMeshDefinition; +import net.minecraft.client.renderer.block.model.BuiltInModel; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.statemap.IStateMapper; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.IRegistry; +import net.minecraftforge.client.event.ModelBakeEvent; +import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; + +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +//TODO General cleanup, move to a less modular fashion now that CCL is a ModContainer. +public class ModelRegistryHelper { + + private static List> registerModels = new LinkedList>(); + private static List modelBakeCallbacks = new LinkedList(); + + static { + MinecraftForge.EVENT_BUS.register(new ModelRegistryHelper()); + } + + public static void registerCallback(IModelBakeCallback callback) { + modelBakeCallbacks.add(callback); + } + + public static void register(ModelResourceLocation location, IBakedModel model) { + registerModels.add(new ImmutablePair(location, model)); + } + + /** + * Inserts the item renderer at itemRegistry.getNameForObject(block)#inventory and binds it to the item with a custom mesh definition + */ + public static void registerItemRenderer(Item item, IItemRenderer renderer) { + final ModelResourceLocation modelLoc = new ModelResourceLocation(item.getRegistryName(), "inventory"); + register(modelLoc, renderer); + ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() { + @Override + public ModelResourceLocation getModelLocation(ItemStack stack) { + return modelLoc; + } + }); + } + + @SubscribeEvent + public void onModelBake(ModelBakeEvent event) { + for (Pair pair : registerModels) { + event.getModelRegistry().putObject(pair.getKey(), pair.getValue()); + } + for (IModelBakeCallback callback : modelBakeCallbacks) { + callback.onModelBake(event.getModelRegistry()); + } + } + + /** + * Creates a dummy model at blockRegistry.getNameForObject(block)#particle for all states of the block overriding getParticleTexture + */ + public static void setParticleTexture(Block block, final ResourceLocation tex) { + final ModelResourceLocation modelLoc = new ModelResourceLocation(block.getRegistryName(), "particle"); + register(modelLoc, new BuiltInModel(TransformUtils.DEFAULT_BLOCK.toVanillaTransform(), ItemOverrideList.NONE) { + @Override + public TextureAtlasSprite getParticleTexture() { + return TextureUtils.getTexture(tex); + } + }); + ModelLoader.setCustomStateMapper(block, new IStateMapper() { + @Override + public Map putStateModelLocations(Block blockIn) { + return Maps.toMap(blockIn.getBlockState().getValidStates(), new Function() { + @Override + public ModelResourceLocation apply(IBlockState input) { + return modelLoc; + } + }); + } + }); + } + + public interface IModelBakeCallback { + + /** + * A Simple callback for model baking. + * + * @param modelRegistry + */ + void onModelBake(IRegistry modelRegistry); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/PerspectiveAwareModelProperties.java b/dependencies/main/java/codechicken/lib/model/PerspectiveAwareModelProperties.java new file mode 100644 index 0000000000..152a8c4125 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/PerspectiveAwareModelProperties.java @@ -0,0 +1,34 @@ +package codechicken.lib.model; + +import codechicken.lib.util.TransformUtils; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraftforge.common.model.IModelState; + +/** + * Created by covers1624 on 21/02/2017. + */ +public class PerspectiveAwareModelProperties { + + public static final PerspectiveAwareModelProperties DEFAULT_ITEM = new PerspectiveAwareModelProperties(TransformUtils.DEFAULT_ITEM, true, false); + public static final PerspectiveAwareModelProperties DEFAULT_BLOCK = new PerspectiveAwareModelProperties(TransformUtils.DEFAULT_BLOCK, true, true); + + private final IModelState modelState; + private final BakedModelProperties properties; + + public PerspectiveAwareModelProperties(IModelState state, boolean isAO, boolean isGui3D) { + this(state, isAO, isGui3D, false, null); + } + + public PerspectiveAwareModelProperties(IModelState state, boolean isAO, boolean isGui3D, boolean isBuiltInRenderer, TextureAtlasSprite particle) { + this.modelState = state; + properties = new BakedModelProperties(isAO, isGui3D, isBuiltInRenderer, particle); + } + + public IModelState getModelState() { + return modelState; + } + + public BakedModelProperties getProperties() { + return properties; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/SimpleBakedBlockModel.java b/dependencies/main/java/codechicken/lib/model/SimpleBakedBlockModel.java new file mode 100644 index 0000000000..16b18a5299 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/SimpleBakedBlockModel.java @@ -0,0 +1,66 @@ +package codechicken.lib.model; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumFacing; + +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +/** + * Created by covers1624 on 8/4/2016. + */ +@Deprecated +public class SimpleBakedBlockModel implements IBakedModel { + + public List quads; + + public SimpleBakedBlockModel(List quads) { + //Copy the quads because reasons. + this.quads = new LinkedList(quads); + } + + @Override + public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { + if (side == null) { + return quads; + } + return new ArrayList(); + } + + @Override + public boolean isAmbientOcclusion() { + return false; + } + + @Override + public boolean isGui3d() { + return false; + } + + @Override + public boolean isBuiltInRenderer() { + return false; + } + + @Override + public TextureAtlasSprite getParticleTexture() { + return null; + } + + @Override + public ItemCameraTransforms getItemCameraTransforms() { + return null; + } + + @Override + public ItemOverrideList getOverrides() { + return null; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/SimpleBakedItemModel.java b/dependencies/main/java/codechicken/lib/model/SimpleBakedItemModel.java new file mode 100644 index 0000000000..ffc54b986a --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/SimpleBakedItemModel.java @@ -0,0 +1,100 @@ +package codechicken.lib.model; + +import codechicken.lib.util.TransformUtils; +import com.google.common.base.Function; +import com.google.common.collect.ImmutableList; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.IPerspectiveAwareModel; +import net.minecraftforge.client.model.ItemLayerModel; +import org.apache.commons.lang3.tuple.Pair; + +import javax.annotation.Nullable; +import javax.vecmath.Matrix4f; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by covers1624 on 7/18/2016. + * TODO, Cleanup and move to bakedmodels package. + */ +public class SimpleBakedItemModel implements IPerspectiveAwareModel { + + private ImmutableList quads; + private TextureAtlasSprite sprite; + private ResourceLocation spriteName; + + public SimpleBakedItemModel(ResourceLocation sprite) { + spriteName = sprite; + } + + @Override + public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { + if (state == null && side == null) { + if (quads == null) { + bake(); + } + return quads; + } + return new ArrayList(); + } + + @Override + public boolean isAmbientOcclusion() { + return false; + } + + @Override + public boolean isGui3d() { + return false; + } + + @Override + public boolean isBuiltInRenderer() { + return false; + } + + @Override + public TextureAtlasSprite getParticleTexture() { + return sprite; + } + + @Override + public ItemCameraTransforms getItemCameraTransforms() { + return ItemCameraTransforms.DEFAULT; + } + + @Override + public ItemOverrideList getOverrides() { + return ItemOverrideList.NONE; + } + + @Override + public Pair handlePerspective(TransformType cameraTransformType) { + return MapWrapper.handlePerspective(this, TransformUtils.DEFAULT_ITEM.getTransforms(), cameraTransformType); + } + + private void bake() { + Function bakedTextureGetter = new Function() { + @Override + public TextureAtlasSprite apply(ResourceLocation input) { + return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString()); + } + }; + IBakedModel layerModel = new ItemLayerModel(ImmutableList.of(spriteName)).bake(TransformUtils.DEFAULT_ITEM, DefaultVertexFormats.ITEM, bakedTextureGetter); + ImmutableList.Builder quadBuilder = ImmutableList.builder(); + quadBuilder.addAll(layerModel.getQuads(null, null, 0)); + this.quads = quadBuilder.build(); + this.sprite = bakedTextureGetter.apply(spriteName); + } + +} diff --git a/dependencies/main/java/codechicken/lib/model/SimpleOverrideBakedModel.java b/dependencies/main/java/codechicken/lib/model/SimpleOverrideBakedModel.java new file mode 100644 index 0000000000..eeb6c66dce --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/SimpleOverrideBakedModel.java @@ -0,0 +1,61 @@ +package codechicken.lib.model; + +import com.google.common.collect.ImmutableList; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumFacing; + +import java.util.List; + +/** + * Created by covers1624 on 7/25/2016. + * This defines a model that's soul purpose is to act as a wrapper for an ItemOverrideList. + * TODO Cleanup, BakedModelProperties support and move to bakedmodels package. + */ +public class SimpleOverrideBakedModel implements IBakedModel { + + private ItemOverrideList overrideList; + + public SimpleOverrideBakedModel(ItemOverrideList overrideList) { + this.overrideList = overrideList; + } + + @Override + public List getQuads(IBlockState state, EnumFacing side, long rand) { + return ImmutableList.of(); + } + + @Override + public boolean isAmbientOcclusion() { + return false; + } + + @Override + public boolean isGui3d() { + return false; + } + + @Override + public boolean isBuiltInRenderer() { + return false; + } + + @Override + public TextureAtlasSprite getParticleTexture() { + return null; + } + + @Override + public ItemCameraTransforms getItemCameraTransforms() { + return ItemCameraTransforms.DEFAULT; + } + + @Override + public ItemOverrideList getOverrides() { + return overrideList; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/SimplePerspectiveAwareBakedModel.java b/dependencies/main/java/codechicken/lib/model/SimplePerspectiveAwareBakedModel.java new file mode 100644 index 0000000000..9c2dc1c6ea --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/SimplePerspectiveAwareBakedModel.java @@ -0,0 +1,91 @@ +package codechicken.lib.model; + +import codechicken.lib.render.CCModelState; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.client.model.IPerspectiveAwareModel; +import net.minecraftforge.common.model.TRSRTransformation; +import org.apache.commons.lang3.tuple.Pair; + +import javax.annotation.Nullable; +import javax.vecmath.Matrix4f; +import java.util.List; + +/** + * Created by covers1624 on 7/25/2016. + * A simple IPerspectiveAwareModel see SimplePerspectiveAwareLayerModelBakery for baking to this. + *

+ * Basically a wrapper for baked quads and IPerspectiveAwareModel. + */ +@Deprecated +public class SimplePerspectiveAwareBakedModel implements IPerspectiveAwareModel { + + private final ImmutableMap transforms; + private final ImmutableList quads; + private final TextureAtlasSprite particle; + + public SimplePerspectiveAwareBakedModel(List quads, CCModelState modelState) { + this(quads, null, modelState.getTransforms()); + } + + public SimplePerspectiveAwareBakedModel(List quads, ImmutableMap transforms) { + this(quads, null, transforms); + } + + public SimplePerspectiveAwareBakedModel(List quads, TextureAtlasSprite particle, ImmutableMap transforms) { + this.transforms = transforms; + this.quads = ImmutableList.copyOf(quads); + this.particle = particle; + } + + @Override + public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { + if (side == null) { + return quads; + } + return ImmutableList.of(); + } + + @Override + public Pair handlePerspective(TransformType cameraTransformType) { + return MapWrapper.handlePerspective(this, transforms, cameraTransformType); + } + + @Override + public boolean isAmbientOcclusion() { + return false; + } + + @Override + public boolean isGui3d() { + return false; + } + + @Override + public boolean isBuiltInRenderer() { + return false; + } + + @Override + public TextureAtlasSprite getParticleTexture() { + return particle; + } + + @Override + public ItemCameraTransforms getItemCameraTransforms() { + return ItemCameraTransforms.DEFAULT; + } + + @Override + public ItemOverrideList getOverrides() { + return ItemOverrideList.NONE; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/StateOverrideIModel.java b/dependencies/main/java/codechicken/lib/model/StateOverrideIModel.java new file mode 100644 index 0000000000..67cc3c3027 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/StateOverrideIModel.java @@ -0,0 +1,77 @@ +package codechicken.lib.model; + +import com.google.common.base.Function; +import com.google.common.collect.ImmutableMap; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.*; +import net.minecraftforge.common.model.IModelState; + +import java.util.Collection; + +/** + * Created by covers1624 on 17/12/2016. + * TODO Decide on a standard place for CCL's IModels. + */ +public class StateOverrideIModel implements IModel, IRetexturableModel, IModelCustomData, IModelSimpleProperties, IModelUVLock { + + private IModel wrapped; + private final IModelState wrappedState; + + public StateOverrideIModel(IModel wrapped, IModelState wrappedState) { + this.wrapped = wrapped; + this.wrappedState = wrappedState; + } + + @Override + public Collection getDependencies() { + return wrapped.getDependencies(); + } + + @Override + public Collection getTextures() { + return wrapped.getTextures(); + } + + @Override + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { + return wrapped.bake(state, format, bakedTextureGetter); + } + + @Override + public IModelState getDefaultState() { + return wrappedState; + } + + @Override + public IModel retexture(ImmutableMap textures) { + wrapped = ModelProcessingHelper.retexture(wrapped, textures); + return this; + } + + @Override + public IModel uvlock(boolean value) { + wrapped = ModelProcessingHelper.uvlock(wrapped, value); + return this; + } + + @Override + public IModel smoothLighting(boolean value) { + wrapped = ModelProcessingHelper.smoothLighting(wrapped, value); + return this; + } + + @Override + public IModel gui3d(boolean value) { + wrapped = ModelProcessingHelper.gui3d(wrapped, value); + return this; + } + + @Override + public IModel process(ImmutableMap customData) { + wrapped = ModelProcessingHelper.customData(wrapped, customData); + return this; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/bakedmodels/AbstractBakedPropertiesModel.java b/dependencies/main/java/codechicken/lib/model/bakedmodels/AbstractBakedPropertiesModel.java new file mode 100644 index 0000000000..7e8f2428d6 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/bakedmodels/AbstractBakedPropertiesModel.java @@ -0,0 +1,43 @@ +package codechicken.lib.model.bakedmodels; + +import codechicken.lib.model.BakedModelProperties; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; + +/** + * Created by covers1624 on 1/02/2017. + */ +public abstract class AbstractBakedPropertiesModel implements IBakedModel { + + private final BakedModelProperties properties; + + public AbstractBakedPropertiesModel(BakedModelProperties properties) { + this.properties = properties; + } + + @Override + public boolean isAmbientOcclusion() { + return properties.isAmbientOcclusion(); + } + + @Override + public boolean isGui3d() { + return properties.isGui3d(); + } + + @Override + public boolean isBuiltInRenderer() { + return properties.isBuiltInRenderer(); + } + + @Override + public TextureAtlasSprite getParticleTexture() { + return properties.getParticleTexture(); + } + + @Override + public ItemCameraTransforms getItemCameraTransforms() { + return ItemCameraTransforms.DEFAULT; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareBakedModel.java b/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareBakedModel.java new file mode 100644 index 0000000000..d53dd1589c --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareBakedModel.java @@ -0,0 +1,94 @@ +package codechicken.lib.model.bakedmodels; + +import codechicken.lib.model.BakedModelProperties; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.client.model.IPerspectiveAwareModel; +import net.minecraftforge.common.model.IModelState; +import org.apache.commons.lang3.tuple.Pair; + +import javax.annotation.Nullable; +import javax.vecmath.Matrix4f; +import java.util.List; +import java.util.Map; + +/** + * Created by covers1624 on 25/11/2016. + */ +public class PerspectiveAwareBakedModel implements IPerspectiveAwareModel { + + private final ImmutableMap> faceQuads; + private final ImmutableList generalQuads; + private final IModelState state; + private final BakedModelProperties properties; + + public PerspectiveAwareBakedModel(Map> faceQuads, IModelState state, BakedModelProperties properties) { + this(faceQuads, ImmutableList.of(), state, properties); + } + + public PerspectiveAwareBakedModel(List generalQuads, IModelState state, BakedModelProperties properties) { + this(ImmutableMap.>of(), generalQuads, state, properties); + } + + public PerspectiveAwareBakedModel(Map> faceQuads, List generalQuads, IModelState state, BakedModelProperties properties) { + this.faceQuads = ImmutableMap.copyOf(faceQuads); + this.generalQuads = ImmutableList.copyOf(generalQuads); + this.state = state; + this.properties = properties.copy(); + } + + @Override + public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { + if (side == null) { + return generalQuads; + } else { + if (faceQuads.containsKey(side)) { + return faceQuads.get(side); + } + } + return ImmutableList.of(); + } + + @Override + public Pair handlePerspective(TransformType cameraTransformType) { + return MapWrapper.handlePerspective(this, state, cameraTransformType); + } + + @Override + public boolean isAmbientOcclusion() { + return properties.isAmbientOcclusion(); + } + + @Override + public boolean isGui3d() { + return properties.isGui3d(); + } + + @Override + public boolean isBuiltInRenderer() { + return properties.isBuiltInRenderer(); + } + + @Override + public TextureAtlasSprite getParticleTexture() { + return properties.getParticleTexture(); + } + + @Override + public ItemCameraTransforms getItemCameraTransforms() { + return ItemCameraTransforms.DEFAULT; + } + + @Override + public ItemOverrideList getOverrides() { + return ItemOverrideList.NONE; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModel.java b/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModel.java new file mode 100644 index 0000000000..f4ebc24937 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModel.java @@ -0,0 +1,100 @@ +package codechicken.lib.model.bakedmodels; + +import codechicken.lib.model.BakedModelProperties; +import com.google.common.collect.ImmutableMap; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.client.MinecraftForgeClient; +import net.minecraftforge.client.model.IPerspectiveAwareModel; +import net.minecraftforge.common.model.IModelState; +import org.apache.commons.lang3.tuple.Pair; + +import javax.annotation.Nullable; +import javax.vecmath.Matrix4f; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Created by covers1624 on 19/11/2016. + */ +public class PerspectiveAwareLayeredModel implements IPerspectiveAwareModel { + + private final ImmutableMap>> layerFaceQuadMap; + private final ImmutableMap> layerGeneralQuads; + private final IModelState state; + private final BakedModelProperties properties; + + public PerspectiveAwareLayeredModel(Map>> layerFaceQuadMap, IModelState state, BakedModelProperties properties) { + this(layerFaceQuadMap, ImmutableMap.>of(), state, properties); + } + + public PerspectiveAwareLayeredModel(Map>> layerFaceQuadMap, Map> layerGeneralQuads, IModelState state, BakedModelProperties properties) { + this.layerFaceQuadMap = ImmutableMap.copyOf(layerFaceQuadMap); + this.layerGeneralQuads = ImmutableMap.copyOf(layerGeneralQuads); + this.state = state; + this.properties = properties.copy(); + + } + + @Override + public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { + BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer(); + if (layer == null) { + layer = BlockRenderLayer.SOLID;//Default to solid. Constructor param?? + } + if (side == null) { + if (layerGeneralQuads.containsKey(layer)) { + return layerGeneralQuads.get(layer); + } + } else if (layerFaceQuadMap.containsKey(layer)) { + Map> faceQuadMap = layerFaceQuadMap.get(layer); + if (faceQuadMap.containsKey(side)) { + return faceQuadMap.get(side); + } + } + return new ArrayList(); + } + + @Override + public boolean isAmbientOcclusion() { + return properties.isAmbientOcclusion(); + } + + @Override + public boolean isGui3d() { + return properties.isGui3d(); + } + + @Override + public boolean isBuiltInRenderer() { + return properties.isBuiltInRenderer(); + } + + @Override + public TextureAtlasSprite getParticleTexture() { + return properties.getParticleTexture(); + } + + @Override + public ItemCameraTransforms getItemCameraTransforms() { + return ItemCameraTransforms.DEFAULT; + } + + @Override + public ItemOverrideList getOverrides() { + return ItemOverrideList.NONE; + } + + @Override + public Pair handlePerspective(TransformType cameraTransformType) { + return MapWrapper.handlePerspective(this, state, cameraTransformType); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModelWrapper.java b/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModelWrapper.java new file mode 100644 index 0000000000..abd2ff03ac --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModelWrapper.java @@ -0,0 +1,87 @@ +package codechicken.lib.model.bakedmodels; + +import codechicken.lib.model.BakedModelProperties; +import com.google.common.collect.ImmutableMap; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.client.MinecraftForgeClient; +import net.minecraftforge.client.model.IPerspectiveAwareModel; +import net.minecraftforge.common.model.IModelState; +import org.apache.commons.lang3.tuple.Pair; + +import javax.annotation.Nullable; +import javax.vecmath.Matrix4f; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Created by covers1624 on 19/11/2016. + */ +public class PerspectiveAwareLayeredModelWrapper implements IPerspectiveAwareModel { + + private final ImmutableMap layerModelMap; + private final IModelState state; + private final BakedModelProperties properties; + + public PerspectiveAwareLayeredModelWrapper(Map layerModelMap, IModelState state, BakedModelProperties properties) { + + this.layerModelMap = ImmutableMap.copyOf(layerModelMap); + this.state = state; + this.properties = properties.copy(); + } + + @Override + public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { + BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer(); + if (layer == null) { + layer = BlockRenderLayer.SOLID; + } + if (layerModelMap.containsKey(layer)) { + return layerModelMap.get(layer).getQuads(state, side, rand); + } + return new ArrayList(); + } + + @Override + public boolean isAmbientOcclusion() { + return properties.isAmbientOcclusion(); + } + + @Override + public boolean isGui3d() { + return properties.isGui3d(); + } + + @Override + public boolean isBuiltInRenderer() { + return properties.isBuiltInRenderer(); + } + + @Override + public TextureAtlasSprite getParticleTexture() { + return properties.getParticleTexture(); + } + + @Override + public ItemCameraTransforms getItemCameraTransforms() { + return ItemCameraTransforms.DEFAULT; + } + + @Override + public ItemOverrideList getOverrides() { + return ItemOverrideList.NONE; + } + + @Override + public Pair handlePerspective(TransformType cameraTransformType) { + return MapWrapper.handlePerspective(this, state, cameraTransformType); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareMultiModel.java b/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareMultiModel.java new file mode 100644 index 0000000000..03111eb066 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareMultiModel.java @@ -0,0 +1,84 @@ +package codechicken.lib.model.bakedmodels; + +import codechicken.lib.model.BakedModelProperties; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.client.model.IPerspectiveAwareModel; +import net.minecraftforge.common.model.IModelState; +import org.apache.commons.lang3.tuple.Pair; + +import javax.annotation.Nullable; +import javax.vecmath.Matrix4f; +import java.util.LinkedList; +import java.util.List; + +/** + * Created by covers1624 on 16/12/2016. + */ +public class PerspectiveAwareMultiModel implements IPerspectiveAwareModel { + + private final IBakedModel baseModel; + private final List subModels; + private final IModelState baseState; + private final BakedModelProperties properties; + + public PerspectiveAwareMultiModel(IBakedModel baseModel, List subModels, IModelState baseState, BakedModelProperties properties) { + this.baseModel = baseModel; + this.subModels = subModels; + this.baseState = baseState; + this.properties = properties; + } + + @Override + public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { + List quads = new LinkedList(); + if (baseModel != null) { + quads.addAll(baseModel.getQuads(state, side, rand)); + } + for (IBakedModel subModel : subModels) { + quads.addAll(subModel.getQuads(state, side, rand)); + } + return quads; + } + + @Override + public boolean isAmbientOcclusion() { + return properties.isAmbientOcclusion(); + } + + @Override + public boolean isGui3d() { + return properties.isGui3d(); + } + + @Override + public boolean isBuiltInRenderer() { + return properties.isBuiltInRenderer(); + } + + @Override + public TextureAtlasSprite getParticleTexture() { + return properties.getParticleTexture(); + } + + @Override + public ItemCameraTransforms getItemCameraTransforms() { + return ItemCameraTransforms.DEFAULT; + } + + @Override + public ItemOverrideList getOverrides() { + return ItemOverrideList.NONE; + } + + @Override + public Pair handlePerspective(TransformType cameraTransformType) { + return MapWrapper.handlePerspective(this, baseState, cameraTransformType); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareOverrideModel.java b/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareOverrideModel.java new file mode 100644 index 0000000000..562d187ea7 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareOverrideModel.java @@ -0,0 +1,59 @@ +package codechicken.lib.model.bakedmodels; + +import codechicken.lib.model.BakedModelProperties; +import com.google.common.collect.ImmutableList; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.client.model.IPerspectiveAwareModel; +import net.minecraftforge.common.model.IModelState; +import org.apache.commons.lang3.tuple.Pair; + +import javax.annotation.Nullable; +import javax.vecmath.Matrix4f; +import java.util.List; + +/** + * Created by covers1624 on 1/02/2017. + */ +public class PerspectiveAwareOverrideModel extends AbstractBakedPropertiesModel implements IPerspectiveAwareModel { + + private final ItemOverrideList overrideList; + private final IModelState state; + private final List quads; + + public PerspectiveAwareOverrideModel(ItemOverrideList overrideList, IModelState state, BakedModelProperties properties) { + super(properties); + this.state = state; + this.overrideList = overrideList; + this.quads = ImmutableList.of(); + } + + public PerspectiveAwareOverrideModel(ItemOverrideList overrideList, IModelState state, BakedModelProperties properties, List quads) { + super(properties); + this.state = state; + this.overrideList = overrideList; + this.quads = quads; + } + + @Override + public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { + if (state == null && side == null) { + return quads; + } + return ImmutableList.of(); + } + + @Override + public ItemOverrideList getOverrides() { + return overrideList; + } + + @Override + public Pair handlePerspective(TransformType cameraTransformType) { + return MapWrapper.handlePerspective(this, state, cameraTransformType); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/BlockModelBakery.java b/dependencies/main/java/codechicken/lib/model/bakery/BlockModelBakery.java new file mode 100644 index 0000000000..2ca6e1dbaf --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/bakery/BlockModelBakery.java @@ -0,0 +1,628 @@ +package codechicken.lib.model.bakery; + +import codechicken.lib.colour.Colour; +import codechicken.lib.colour.ColourRGBA; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.util.EnumFacing; + +import java.util.LinkedList; + +/** + * Created by covers1624 on 8/3/2016. + * TODO, Move the back end of this to the BakingVertexBuffer wrapped through the CCL render pipe. + */ +@Deprecated// Use CCModel.generateBlock(0, new Cuboid6()).apply +public class BlockModelBakery { + + public boolean flipTexture; + public boolean renderFromInside = false; + + public double renderMinX; + public double renderMaxX; + public double renderMinY; + public double renderMaxY; + public double renderMinZ; + public double renderMaxZ; + + public int uvRotateEast, uvRotateWest, uvRotateSouth, uvRotateNorth, uvRotateTop, uvRotateBottom; + + public Colour colourTopLeft = new ColourRGBA(0xFFFFFFFF); + public Colour colourBottomLeft = new ColourRGBA(0xFFFFFFFF); + public Colour colourBottomRight = new ColourRGBA(0xFFFFFFFF); + public Colour colourTopRight = new ColourRGBA(0xFFFFFFFF); + + private CCQuadBakery quadBakery; + private LinkedList quadList = new LinkedList(); + + public BlockModelBakery() { + this(DefaultVertexFormats.BLOCK); + } + + public BlockModelBakery(VertexFormat format) { + quadBakery = new CCQuadBakery(format, null); + reset(); + } + + public void reset() { + quadList.clear(); + colourTopLeft = new ColourRGBA(0xFFFFFFFF); + colourBottomLeft = new ColourRGBA(0xFFFFFFFF); + colourBottomRight = new ColourRGBA(0xFFFFFFFF); + colourTopRight = new ColourRGBA(0xFFFFFFFF); + + uvRotateEast = 0; + uvRotateWest = 0; + uvRotateSouth = 0; + uvRotateNorth = 0; + uvRotateTop = 0; + uvRotateBottom = 0; + + flipTexture = false; + renderFromInside = false; + + setRenderBounds(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); + } + + public LinkedList finishBaking() { + return new LinkedList(quadList); + } + + public CCQuadBakery getQuadBakery() { + return quadBakery; + } + + public void setRenderBounds(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { + + this.renderMinX = minX; + this.renderMaxX = maxX; + this.renderMinY = minY; + this.renderMaxY = maxY; + this.renderMinZ = minZ; + this.renderMaxZ = maxZ; + + } + + public void bakeFace(TextureAtlasSprite sprite, EnumFacing face) { + switch (face) { + + case DOWN: + bakeFaceYNeg(sprite); + break; + case UP: + bakeFaceYPos(sprite); + break; + case NORTH: + bakeFaceZNeg(sprite); + break; + case SOUTH: + bakeFaceZPos(sprite); + break; + case WEST: + bakeFaceXNeg(sprite); + break; + case EAST: + bakeFaceXPos(sprite); + break; + } + } + + public void bakeFaceYNeg(TextureAtlasSprite sprite) { + bakeFaceYNeg(0, 0, 0, sprite); + } + + public void bakeFaceYNeg(double posX, double posY, double posZ, TextureAtlasSprite sprite) { + quadBakery.startBakingQuads().setSprite(sprite); + + double d3 = (double) sprite.getInterpolatedU(this.renderMinX * 16.0D); + double d4 = (double) sprite.getInterpolatedU(this.renderMaxX * 16.0D); + double d5 = (double) sprite.getInterpolatedV(this.renderMinZ * 16.0D); + double d6 = (double) sprite.getInterpolatedV(this.renderMaxZ * 16.0D); + double d7; + if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D) { + d3 = (double) sprite.getMinU(); + d4 = (double) sprite.getMaxU(); + } + + if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) { + d5 = (double) sprite.getMinV(); + d6 = (double) sprite.getMaxV(); + } + + if (this.flipTexture) { + d7 = d3; + d3 = d4; + d4 = d7; + } + + d7 = d4; + double d8 = d3; + double d9 = d5; + double d10 = d6; + + if (this.uvRotateBottom == 2) { + d3 = (double) sprite.getInterpolatedU(this.renderMinZ * 16.0D); + d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxX * 16.0D); + d4 = (double) sprite.getInterpolatedU(this.renderMaxZ * 16.0D); + d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinX * 16.0D); + d9 = d5; + d10 = d6; + d7 = d3; + d8 = d4; + d5 = d6; + d6 = d9; + } else if (this.uvRotateBottom == 1) { + d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D); + d5 = (double) sprite.getInterpolatedV(this.renderMinX * 16.0D); + d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMinZ * 16.0D); + d6 = (double) sprite.getInterpolatedV(this.renderMaxX * 16.0D); + d7 = d4; + d8 = d3; + d3 = d4; + d4 = d8; + d9 = d6; + d10 = d5; + } else if (this.uvRotateBottom == 3) { + d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMinX * 16.0D); + d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxX * 16.0D); + d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMinZ * 16.0D); + d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D); + d7 = d4; + d8 = d3; + d9 = d5; + d10 = d6; + } + + double d11 = posX + this.renderMinX; + double d12 = posX + this.renderMaxX; + double d13 = posY + this.renderMinY; + double d14 = posZ + this.renderMinZ; + double d15 = posZ + this.renderMaxZ; + + if (this.renderFromInside) { + d11 = posX + this.renderMaxX; + d12 = posX + this.renderMinX; + } + + quadBakery.setColour(colourTopLeft).addVertexWithUV(d11, d13, d15, d8, d10); + quadBakery.setColour(colourBottomLeft).addVertexWithUV(d11, d13, d14, d3, d5); + quadBakery.setColour(colourBottomRight).addVertexWithUV(d12, d13, d14, d7, d9); + quadBakery.setColour(colourTopRight).addVertexWithUV(d12, d13, d15, d4, d6); + + quadList.addAll(quadBakery.finishBaking()); + } + + public void bakeFaceYPos(TextureAtlasSprite sprite) { + bakeFaceYPos(0, 0, 0, sprite); + } + + public void bakeFaceYPos(double posX, double posY, double posZ, TextureAtlasSprite sprite) { + quadBakery.startBakingQuads().setSprite(sprite); + + double d3 = (double) sprite.getInterpolatedU(this.renderMinX * 16.0D); + double d4 = (double) sprite.getInterpolatedU(this.renderMaxX * 16.0D); + double d5 = (double) sprite.getInterpolatedV(this.renderMinZ * 16.0D); + double d6 = (double) sprite.getInterpolatedV(this.renderMaxZ * 16.0D); + double d7; + + if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D) { + d3 = (double) sprite.getMinU(); + d4 = (double) sprite.getMaxU(); + } + + if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) { + d5 = (double) sprite.getMinV(); + d6 = (double) sprite.getMaxV(); + } + + if (this.flipTexture) { + d7 = d3; + d3 = d4; + d4 = d7; + } + + d7 = d4; + double d8 = d3; + double d9 = d5; + double d10 = d6; + + if (this.uvRotateTop == 1) { + d3 = (double) sprite.getInterpolatedU(this.renderMinZ * 16.0D); + d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxX * 16.0D); + d4 = (double) sprite.getInterpolatedU(this.renderMaxZ * 16.0D); + d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinX * 16.0D); + d9 = d5; + d10 = d6; + d7 = d3; + d8 = d4; + d5 = d6; + d6 = d9; + } else if (this.uvRotateTop == 2) { + d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D); + d5 = (double) sprite.getInterpolatedV(this.renderMinX * 16.0D); + d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMinZ * 16.0D); + d6 = (double) sprite.getInterpolatedV(this.renderMaxX * 16.0D); + d7 = d4; + d8 = d3; + d3 = d4; + d4 = d8; + d9 = d6; + d10 = d5; + } else if (this.uvRotateTop == 3) { + d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMinX * 16.0D); + d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxX * 16.0D); + d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMinZ * 16.0D); + d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D); + d7 = d4; + d8 = d3; + d9 = d5; + d10 = d6; + } + + double d11 = posX + this.renderMinX; + double d12 = posX + this.renderMaxX; + double d13 = posY + this.renderMaxY; + double d14 = posZ + this.renderMinZ; + double d15 = posZ + this.renderMaxZ; + + if (this.renderFromInside) { + d11 = posX + this.renderMaxX; + d12 = posX + this.renderMinX; + } + + quadBakery.setColour(colourTopLeft).addVertexWithUV(d12, d13, d15, d4, d6); + quadBakery.setColour(colourBottomLeft).addVertexWithUV(d12, d13, d14, d7, d9); + quadBakery.setColour(colourBottomRight).addVertexWithUV(d11, d13, d14, d3, d5); + quadBakery.setColour(colourTopRight).addVertexWithUV(d11, d13, d15, d8, d10); + + quadList.addAll(quadBakery.finishBaking()); + } + + public void bakeFaceZNeg(TextureAtlasSprite sprite) { + bakeFaceZNeg(0, 0, 0, sprite); + } + + public void bakeFaceZNeg(double posX, double posY, double posZ, TextureAtlasSprite sprite) { + quadBakery.startBakingQuads().setSprite(sprite); + + double d3 = (double) sprite.getInterpolatedU(this.renderMinX * 16.0D); + double d4 = (double) sprite.getInterpolatedU(this.renderMaxX * 16.0D); + + double d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); + double d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinY * 16.0D); + double d7; + + if (this.flipTexture) { + d7 = d3; + d3 = d4; + d4 = d7; + } + + if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D) { + d3 = (double) sprite.getMinU(); + d4 = (double) sprite.getMaxU(); + } + + if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) { + d5 = (double) sprite.getMinV(); + d6 = (double) sprite.getMaxV(); + } + + d7 = d4; + double d8 = d3; + double d9 = d5; + double d10 = d6; + + if (this.uvRotateEast == 2) { + d3 = (double) sprite.getInterpolatedU(this.renderMinY * 16.0D); + d4 = (double) sprite.getInterpolatedU(this.renderMaxY * 16.0D); + d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMinX * 16.0D); + d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxX * 16.0D); + d9 = d5; + d10 = d6; + d7 = d3; + d8 = d4; + d5 = d6; + d6 = d9; + } else if (this.uvRotateEast == 1) { + d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxY * 16.0D); + d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMinY * 16.0D); + d5 = (double) sprite.getInterpolatedV(this.renderMaxX * 16.0D); + d6 = (double) sprite.getInterpolatedV(this.renderMinX * 16.0D); + d7 = d4; + d8 = d3; + d3 = d4; + d4 = d8; + d9 = d6; + d10 = d5; + } else if (this.uvRotateEast == 3) { + d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMinX * 16.0D); + d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxX * 16.0D); + d5 = (double) sprite.getInterpolatedV(this.renderMaxY * 16.0D); + d6 = (double) sprite.getInterpolatedV(this.renderMinY * 16.0D); + d7 = d4; + d8 = d3; + d9 = d5; + d10 = d6; + } + + double d11 = posX + this.renderMinX; + double d12 = posX + this.renderMaxX; + double d13 = posY + this.renderMinY; + double d14 = posY + this.renderMaxY; + double d15 = posZ + this.renderMinZ; + + if (this.renderFromInside) { + d11 = posX + this.renderMaxX; + d12 = posX + this.renderMinX; + } + + quadBakery.setColour(colourTopLeft).addVertexWithUV(d11, d14, d15, d7, d9); + quadBakery.setColour(colourBottomLeft).addVertexWithUV(d12, d14, d15, d3, d5); + quadBakery.setColour(colourBottomRight).addVertexWithUV(d12, d13, d15, d8, d10); + quadBakery.setColour(colourTopRight).addVertexWithUV(d11, d13, d15, d4, d6); + + quadList.addAll(quadBakery.finishBaking()); + } + + public void bakeFaceZPos(TextureAtlasSprite sprite) { + bakeFaceZPos(0, 0, 0, sprite); + } + + public void bakeFaceZPos(double posX, double posY, double posZ, TextureAtlasSprite sprite) { + quadBakery.startBakingQuads().setSprite(sprite); + + double d3 = (double) sprite.getInterpolatedU(this.renderMinX * 16.0D); + double d4 = (double) sprite.getInterpolatedU(this.renderMaxX * 16.0D); + double d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); + double d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinY * 16.0D); + double d7; + + if (this.flipTexture) { + d7 = d3; + d3 = d4; + d4 = d7; + } + + if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D) { + d3 = (double) sprite.getMinU(); + d4 = (double) sprite.getMaxU(); + } + + if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) { + d5 = (double) sprite.getMinV(); + d6 = (double) sprite.getMaxV(); + } + + d7 = d4; + double d8 = d3; + double d9 = d5; + double d10 = d6; + + if (this.uvRotateWest == 1) { + d3 = (double) sprite.getInterpolatedU(this.renderMinY * 16.0D); + d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinX * 16.0D); + d4 = (double) sprite.getInterpolatedU(this.renderMaxY * 16.0D); + d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxX * 16.0D); + d9 = d5; + d10 = d6; + d7 = d3; + d8 = d4; + d5 = d6; + d6 = d9; + } else if (this.uvRotateWest == 2) { + d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxY * 16.0D); + d5 = (double) sprite.getInterpolatedV(this.renderMinX * 16.0D); + d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMinY * 16.0D); + d6 = (double) sprite.getInterpolatedV(this.renderMaxX * 16.0D); + d7 = d4; + d8 = d3; + d3 = d4; + d4 = d8; + d9 = d6; + d10 = d5; + } else if (this.uvRotateWest == 3) { + d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMinX * 16.0D); + d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxX * 16.0D); + d5 = (double) sprite.getInterpolatedV(this.renderMaxY * 16.0D); + d6 = (double) sprite.getInterpolatedV(this.renderMinY * 16.0D); + d7 = d4; + d8 = d3; + d9 = d5; + d10 = d6; + } + + double d11 = posX + this.renderMinX; + double d12 = posX + this.renderMaxX; + double d13 = posY + this.renderMinY; + double d14 = posY + this.renderMaxY; + double d15 = posZ + this.renderMaxZ; + + if (this.renderFromInside) { + d11 = posX + this.renderMaxX; + d12 = posX + this.renderMinX; + } + + quadBakery.setColour(colourTopLeft).addVertexWithUV(d11, d14, d15, d3, d5); + quadBakery.setColour(colourBottomLeft).addVertexWithUV(d11, d13, d15, d8, d10); + quadBakery.setColour(colourBottomRight).addVertexWithUV(d12, d13, d15, d4, d6); + quadBakery.setColour(colourTopRight).addVertexWithUV(d12, d14, d15, d7, d9); + + quadList.addAll(quadBakery.finishBaking()); + } + + public void bakeFaceXNeg(TextureAtlasSprite sprite) { + bakeFaceXNeg(0, 0, 0, sprite); + } + + public void bakeFaceXNeg(double posX, double posY, double posZ, TextureAtlasSprite sprite) { + quadBakery.startBakingQuads().setSprite(sprite); + + double d3 = (double) sprite.getInterpolatedU(this.renderMinZ * 16.0D); + double d4 = (double) sprite.getInterpolatedU(this.renderMaxZ * 16.0D); + double d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); + double d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinY * 16.0D); + double d7; + + if (this.flipTexture) { + d7 = d3; + d3 = d4; + d4 = d7; + } + + if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) { + d3 = (double) sprite.getMinU(); + d4 = (double) sprite.getMaxU(); + } + + if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) { + d5 = (double) sprite.getMinV(); + d6 = (double) sprite.getMaxV(); + } + + d7 = d4; + double d8 = d3; + double d9 = d5; + double d10 = d6; + + if (this.uvRotateNorth == 1) { + d3 = (double) sprite.getInterpolatedU(this.renderMinY * 16.0D); + d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D); + d4 = (double) sprite.getInterpolatedU(this.renderMaxY * 16.0D); + d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinZ * 16.0D); + d9 = d5; + d10 = d6; + d7 = d3; + d8 = d4; + d5 = d6; + d6 = d9; + } else if (this.uvRotateNorth == 2) { + d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxY * 16.0D); + d5 = (double) sprite.getInterpolatedV(this.renderMinZ * 16.0D); + d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMinY * 16.0D); + d6 = (double) sprite.getInterpolatedV(this.renderMaxZ * 16.0D); + d7 = d4; + d8 = d3; + d3 = d4; + d4 = d8; + d9 = d6; + d10 = d5; + } else if (this.uvRotateNorth == 3) { + d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMinZ * 16.0D); + d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D); + d5 = (double) sprite.getInterpolatedV(this.renderMaxY * 16.0D); + d6 = (double) sprite.getInterpolatedV(this.renderMinY * 16.0D); + d7 = d4; + d8 = d3; + d9 = d5; + d10 = d6; + } + + double d11 = posX + this.renderMinX; + double d12 = posY + this.renderMinY; + double d13 = posY + this.renderMaxY; + double d14 = posZ + this.renderMinZ; + double d15 = posZ + this.renderMaxZ; + + if (this.renderFromInside) { + d14 = posZ + this.renderMaxZ; + d15 = posZ + this.renderMinZ; + } + + quadBakery.setColour(colourTopLeft).addVertexWithUV(d11, d13, d15, d7, d9); + quadBakery.setColour(colourBottomLeft).addVertexWithUV(d11, d13, d14, d3, d5); + quadBakery.setColour(colourBottomRight).addVertexWithUV(d11, d12, d14, d8, d10); + quadBakery.setColour(colourTopRight).addVertexWithUV(d11, d12, d15, d4, d6); + + quadList.addAll(quadBakery.finishBaking()); + } + + public void bakeFaceXPos(TextureAtlasSprite sprite) { + bakeFaceXPos(0, 0, 0, sprite); + } + + public void bakeFaceXPos(double posX, double posY, double posZ, TextureAtlasSprite sprite) { + quadBakery.startBakingQuads().setSprite(sprite); + + double d3 = (double) sprite.getInterpolatedU(this.renderMinZ * 16.0D); + double d4 = (double) sprite.getInterpolatedU(this.renderMaxZ * 16.0D); + + double d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); + double d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinY * 16.0D); + double d7; + + if (this.flipTexture) { + d7 = d3; + d3 = d4; + d4 = d7; + } + + if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) { + d3 = (double) sprite.getMinU(); + d4 = (double) sprite.getMaxU(); + } + + if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) { + d5 = (double) sprite.getMinV(); + d6 = (double) sprite.getMaxV(); + } + + d7 = d4; + double d8 = d3; + double d9 = d5; + double d10 = d6; + + if (this.uvRotateSouth == 2) { + d3 = (double) sprite.getInterpolatedU(this.renderMinY * 16.0D); + d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMinZ * 16.0D); + d4 = (double) sprite.getInterpolatedU(this.renderMaxY * 16.0D); + d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D); + d9 = d5; + d10 = d6; + d7 = d3; + d8 = d4; + d5 = d6; + d6 = d9; + } else if (this.uvRotateSouth == 1) { + d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxY * 16.0D); + d5 = (double) sprite.getInterpolatedV(this.renderMaxZ * 16.0D); + d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMinY * 16.0D); + d6 = (double) sprite.getInterpolatedV(this.renderMinZ * 16.0D); + d7 = d4; + d8 = d3; + d3 = d4; + d4 = d8; + d9 = d6; + d10 = d5; + } else if (this.uvRotateSouth == 3) { + d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMinZ * 16.0D); + d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D); + d5 = (double) sprite.getInterpolatedV(this.renderMaxY * 16.0D); + d6 = (double) sprite.getInterpolatedV(this.renderMinY * 16.0D); + d7 = d4; + d8 = d3; + d9 = d5; + d10 = d6; + } + + double d11 = posX + this.renderMaxX; + double d12 = posY + this.renderMinY; + double d13 = posY + this.renderMaxY; + double d14 = posZ + this.renderMinZ; + double d15 = posZ + this.renderMaxZ; + + if (this.renderFromInside) { + d14 = posZ + this.renderMaxZ; + d15 = posZ + this.renderMinZ; + } + + quadBakery.setColour(colourTopLeft).addVertexWithUV(d11, d12, d15, d8, d10); + quadBakery.setColour(colourBottomLeft).addVertexWithUV(d11, d12, d14, d4, d6); + quadBakery.setColour(colourBottomRight).addVertexWithUV(d11, d13, d14, d7, d9); + quadBakery.setColour(colourTopRight).addVertexWithUV(d11, d13, d15, d3, d5); + + quadList.addAll(quadBakery.finishBaking()); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/CCModelBakery.java b/dependencies/main/java/codechicken/lib/model/bakery/CCModelBakery.java new file mode 100644 index 0000000000..888de94afd --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/bakery/CCModelBakery.java @@ -0,0 +1,96 @@ +package codechicken.lib.model.bakery; + +import codechicken.lib.render.CCModel; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.buffer.BakingVertexBuffer; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.render.pipeline.IVertexSource; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.vertex.VertexFormat; + +import java.util.List; + +/** + * Created by covers1624 on 8/20/2016. + * Uses the CCL RenderPipe to bake a CCModel to an array of BakedQuads with the provided VertexFormat. + */ +@Deprecated// Use CCRenderState with a BakingVertexBuffer bound. +public class CCModelBakery { + + /** + * Bakes a CCModel to a List of BakedQuads. + * Assumes DefaultVertexFormats.BLOCK. + * Assumes you want to bake the entire model. + * + * @param model Model to bake. + * @param ops Any Operations to apply. + * @return The BakedQuads for the model. + */ + public static List bakeModel(CCModel model, IVertexOperation... ops) { + return bakeModel(model, 0, model.getVertices().length, ops); + } + + /** + * Bakes a CCModel to a List of BakedQuads. + * Assumes DefaultVertexFormats.BLOCK. + * + * @param model Model to bake. + * @param start The first vertex index to bake. + * @param end The Vertex index to bake until. + * @param ops Any Operations to apply. + * @return The BakedQuads for the model. + */ + public static List bakeModel(CCModel model, int start, int end, IVertexOperation... ops) { + return bakeModel(model, DefaultVertexFormats.ITEM, start, end, ops); + } + + /** + * Bakes a CCModel to a List of BakedQuads. + * Assumes you want to bake the entire model. + * + * @param model Model to bake. + * @param format VertexFormat to bake to. + * @param ops Any Operations to apply. + * @return The BakedQuads for the model. + */ + public static List bakeModel(CCModel model, VertexFormat format, IVertexOperation... ops) { + return bakeModel(model, format, 0, model.getVertices().length, ops); + } + + /** + * Bakes a IVertexSource model to a List of BakedQuads. + * + * @param model Vertex source to bake. + * @param format VertexFormat to bake to. + * @param start The first vertex index to bake. + * @param end The Vertex index to bake until. + * @param ops Any Operations to apply. + * @return The BakedQuads for the model. + */ + public static List bakeModel(CCModel model, VertexFormat format, int start, int end, IVertexOperation... ops) { + return bakeModel(model, model.vp == 3, format, start, end, ops); + } + + /** + * Bakes a IVertexSource model to a List of BakedQuads. + * + * @param model Vertex source to bake. + * @param isTriangles Specifies if the model's vertices are triangles. + * @param format VertexFormat to bake to, You almost always want this to be ITEM. + * @param start The first vertex index to bake. + * @param end The Vertex index to bake until. + * @param ops Any Operations to apply. + * @return The BakedQuads for the model. + */ + public static List bakeModel(IVertexSource model, boolean isTriangles, VertexFormat format, int start, int end, IVertexOperation... ops) { + BakingVertexBuffer buffer = BakingVertexBuffer.create(); + buffer.begin(isTriangles ? 4 : 7, format); + CCRenderState ccrs = CCRenderState.instance(); + ccrs.bind(buffer); + ccrs.setPipeline(model, start, end, ops); + ccrs.render(); + buffer.finishDrawing(); + return buffer.bake(); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/CCQuad.java b/dependencies/main/java/codechicken/lib/model/bakery/CCQuad.java new file mode 100644 index 0000000000..09a5511b5b --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/bakery/CCQuad.java @@ -0,0 +1,309 @@ +package codechicken.lib.model.bakery; + +import codechicken.lib.colour.Colour; +import codechicken.lib.colour.ColourRGBA; +import codechicken.lib.util.ArrayUtils; +import codechicken.lib.util.Copyable; +import codechicken.lib.util.VectorUtils; +import codechicken.lib.vec.Transformation; +import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.Vertex5; +import codechicken.lib.vec.uv.UV; +import codechicken.lib.vec.uv.UVTransformation; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.renderer.vertex.VertexFormatElement; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.client.model.pipeline.IVertexConsumer; +import net.minecraftforge.client.model.pipeline.IVertexProducer; +import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; + +import java.util.LinkedList; +import java.util.List; + +/** + * Created by covers1624 on 8/20/2016. + * Basically just a holder for quads before baking. + */ +public class CCQuad implements Copyable, IVertexProducer { + + public Vertex5[] vertices = new Vertex5[4]; + public Vector3[] normals = new Vector3[4]; + public Colour[] colours = new Colour[4]; + public Integer[] lightMaps = new Integer[4]; + + public EnumFacing face = null; + public int tintIndex = -1; + public boolean applyDifuseLighting = true; + public TextureAtlasSprite sprite; + + public CCQuad() { + } + + public CCQuad(Vertex5... vertices) { + if (vertices.length > 4) { + throw new IllegalArgumentException("CCQuad is a... Quad.. only 3 or 4 vertices allowed!"); + } + for (int i = 0; i < 4; i++) { + this.vertices[i] = vertices[i].copy(); + } + } + + public CCQuad(BakedQuad quad) { + this(); + + VertexFormat format = quad.getFormat(); + face = quad.getFace(); + tintIndex = quad.getTintIndex(); + sprite = quad.getSprite(); + ArrayUtils.fillArray(vertices, new Vertex5()); + UnpackingVertexConsumer consumer = new UnpackingVertexConsumer(quad.getFormat()); + quad.pipe(consumer); + float[][][] unpackedData = consumer.getUnpackedData(); + for (int v = 0; v < 4; v++) { + for (int e = 0; e < format.getElementCount(); e++) { + float[] data = unpackedData[v][e]; + switch (format.getElement(e).getUsage()) { + case POSITION: + vertices[v].vec.set(data); + break; + case NORMAL: + normals[v] = new Vector3(data); + break; + case COLOR: + colours[v] = new ColourRGBA(data[0], data[1], data[2], data[3]); + break; + case UV: + if (format.getElement(e).getIndex() == 0) { + vertices[v].uv.set(data[0], data[1]); + } else {//TODO This SHOULD be fine..... + lightMaps[v] = (int) (data[1] * 65535 / 32) << 20 | (int) (data[0] * 65535 / 32) << 4; + } + break; + default: + break; + } + } + } + if (!format.hasColor()) { + ArrayUtils.fillArray(colours, new ColourRGBA(0xFFFFFFFF)); + } + if (!format.hasUvOffset(1)) { + ArrayUtils.fillArray(lightMaps, 0); + } + if (!format.hasNormal()) { + computeNormals(); + } + } + + public CCQuad(CCQuad quad) { + this(); + for (int i = 0; i < vertices.length; i++) { + vertices[i] = quad.vertices[i].copy(); + } + for (int i = 0; i < vertices.length; i++) { + normals[i] = quad.normals[i].copy(); + } + for (int i = 0; i < vertices.length; i++) { + colours[i] = quad.colours[i].copy(); + } + System.arraycopy(quad.lightMaps, 0, lightMaps, 0, vertices.length); + face = quad.face; + tintIndex = quad.tintIndex; + applyDifuseLighting = quad.applyDifuseLighting; + sprite = quad.sprite; + } + + public void apply(Transformation... transforms) { + for (Transformation t : transforms) { + apply(t); + } + } + + public void apply(UVTransformation... transforms) { + for (UVTransformation t : transforms) { + apply(t); + } + } + + public void apply(Transformation t) { + quadulate(); + if (ArrayUtils.countNoNull(normals) != 4) { + computeNormals(); + } + for (int i = 0; i < 4; i++) { + Vertex5 vert = vertices[i]; + Vector3 normal = normals[i]; + t.apply(vert.vec); + t.applyN(normal); + } + } + + public void apply(UVTransformation t) { + quadulate(); + for (int i = 0; i < 4; i++) { + Vertex5 vert = vertices[i]; + t.apply(vert.uv); + } + } + + public boolean isQuads() { + int counter = ArrayUtils.countNoNull(vertices); + return counter == 4; + } + + public boolean hasTint() { + return tintIndex != -1; + } + + /** + * Quadulates the quad by copying any element at index 2 to index 3 only if there are 3 of any given element. + */ + public void quadulate() { + int verticesCount = ArrayUtils.countNoNull(vertices); + int normalCount = ArrayUtils.countNoNull(normals); + int colourCount = ArrayUtils.countNoNull(colours); + int lightMapCount = ArrayUtils.countNoNull(lightMaps); + if (verticesCount == 3) { + vertices[3] = vertices[2].copy(); + } + if (normalCount == 3) { + normals[3] = normals[2].copy(); + } + if (colourCount == 3) { + colours[3] = colours[2].copy(); + } + if (lightMapCount == 3) { + lightMaps[3] = lightMaps[2]; + } + } + + /** + * Creates a set of normals for the quad. + * Will attempt to Quadulate the model first. + */ + public void computeNormals() { + if (ArrayUtils.countNoNull(normals) != 4) { + quadulate(); + Vector3 normal = VectorUtils.calculateNormal(vertices[0].vec, vertices[1].vec, vertices[3].vec); + + for (int i = 0; i < 4; i++) { + normals[i] = normal.copy(); + } + } + } + + public EnumFacing getQuadFace() { + if (face == null) { + if (ArrayUtils.countNoNull(normals) != 4) { + computeNormals(); + } + face = VectorUtils.calcNormalSide(normals[0]); + } + return face; + } + + public BakedQuad bake() { + return bake(DefaultVertexFormats.BLOCK); + } + + public BakedQuad bake(VertexFormat format) { + quadulate(); + computeNormals(); + UnpackedBakedQuad.Builder quadBuilder = new UnpackedBakedQuad.Builder(format); + quadBuilder.setApplyDiffuseLighting(applyDifuseLighting); + quadBuilder.setTexture(sprite); + quadBuilder.setQuadOrientation(getQuadFace()); + quadBuilder.setQuadTint(tintIndex); + for (int v = 0; v < 4; v++) { + for (int e = 0; e < format.getElementCount(); e++) { + VertexFormatElement element = format.getElement(e); + switch (element.getUsage()) { + case POSITION: + Vector3 pos = vertices[v].vec; + quadBuilder.put(e, (float) pos.x, (float) pos.y, (float) pos.z, 1); + break; + case NORMAL: + Vector3 normal = normals[v]; + quadBuilder.put(e, (float) normal.x, (float) normal.y, (float) normal.z, 0); + break; + case COLOR: + Colour colour = colours[v]; + quadBuilder.put(e, (colour.r & 0xFF) / 255, (colour.g & 0xFF) / 255, (colour.b & 0xFF) / 255, (colour.a & 0xFF) / 255); + break; + case UV: + if (element.getIndex() == 0) { + UV uv = vertices[v].uv; + quadBuilder.put(e, (float) uv.u, (float) uv.v, 0, 1); + } else { + int brightness = lightMaps[v]; + quadBuilder.put(e, (float) ((brightness >> 4) & 15 * 32) / 65535, (float) ((brightness >> 20) & 15 * 32) / 65535, 0, 1); + } + break; + case PADDING: + case GENERIC: + default: + quadBuilder.put(e); + } + } + } + return quadBuilder.build(); + } + + @Override + public void pipe(IVertexConsumer consumer) { + quadulate(); + computeNormals(); + consumer.setApplyDiffuseLighting(applyDifuseLighting); + consumer.setTexture(sprite); + consumer.setQuadOrientation(getQuadFace()); + consumer.setQuadTint(tintIndex); + for (int v = 0; v < 4; v++) { + for (int e = 0; e < consumer.getVertexFormat().getElementCount(); e++) { + VertexFormatElement element = consumer.getVertexFormat().getElement(e); + switch (element.getUsage()) { + case POSITION: + Vector3 pos = vertices[v].vec; + consumer.put(e, (float) pos.x, (float) pos.y, (float) pos.z, 1); + break; + case NORMAL: + Vector3 normal = normals[v]; + consumer.put(e, (float) normal.x, (float) normal.y, (float) normal.z, 0); + break; + case COLOR: + Colour colour = colours[v]; + consumer.put(e, (colour.r & 0xFF) / 255, (colour.g & 0xFF) / 255, (colour.b & 0xFF) / 255, (colour.a & 0xFF) / 255); + break; + case UV: + if (element.getIndex() == 0) { + UV uv = vertices[v].uv; + consumer.put(e, (float) uv.u, (float) uv.v, 0, 1); + } else { + int brightness = lightMaps[v]; + consumer.put(e, (float) ((brightness >> 4) & 15 * 32) / 65535, (float) ((brightness >> 20) & 15 * 32) / 65535, 0, 1); + } + break; + case PADDING: + case GENERIC: + default: + consumer.put(e); + } + } + } + } + + public static List fromArray(List bakedQuads) { + List quads = new LinkedList(); + for (BakedQuad quad : bakedQuads) { + quads.add(new CCQuad(quad)); + } + return quads; + } + + @Override + public CCQuad copy() { + return new CCQuad(this); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/CCQuadBakery.java b/dependencies/main/java/codechicken/lib/model/bakery/CCQuadBakery.java new file mode 100644 index 0000000000..7b66783ef1 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/bakery/CCQuadBakery.java @@ -0,0 +1,202 @@ +package codechicken.lib.model.bakery; + +import codechicken.lib.colour.Colour; +import codechicken.lib.colour.ColourRGBA; +import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.Vertex5; +import codechicken.lib.vec.uv.UV; +import com.google.common.collect.ImmutableList; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.util.EnumFacing; + +import java.util.LinkedList; + +/** + * Created by covers1624 on 8/2/2016. + * Bakes Quads.. + */ +@Deprecated//TODO a Tessellator style BakingVertexBuffer. +public class CCQuadBakery { + + private VertexFormat format; + private TextureAtlasSprite sprite; + private EnumFacing face; + + //Temp storage + private UV uv = new UV(); + private Vector3 normal = null; + private Colour colour = new ColourRGBA(0xFFFFFFFF); + private int brightness = 0; + + private boolean isBakingTriModel = false; + private boolean applyDifuseLighting = true; + private LinkedList bakedQuads = null; + + //Active storage. + private CCQuad quad = null; + private int index = 0; + + public CCQuadBakery(TextureAtlasSprite sprite) { + this(DefaultVertexFormats.BLOCK, sprite); + } + + public CCQuadBakery(VertexFormat format, TextureAtlasSprite sprite) { + this.format = format; + this.sprite = sprite; + } + + public CCQuadBakery startBakingQuads() { + return startBaking(false); + } + + public CCQuadBakery startBakingTriangles() { + return startBaking(true); + } + + //TODO Have the QuadBakery bake from any DrawMode to any DrawMode and from any VertexFormat to any VertexFormat. + //TODO Maybe a custom BakedQuad that holds all the raw info still, might make it more possible / cleaner for a VF > VF converter. + private CCQuadBakery startBaking(boolean isTriangles) { + if (quad != null || bakedQuads != null) { + throw new IllegalStateException("Quads are still baking or baking has not finished yet!"); + } + isBakingTriModel = isTriangles; + bakedQuads = new LinkedList(); + return this; + } + + public ImmutableList finishBaking() { + if (quad != null) { + throw new IllegalStateException("Quads are still baking!"); + } + if (bakedQuads == null) { + throw new IllegalStateException("The bakery has no baked quads!"); + } + ImmutableList returnQuads = ImmutableList.copyOf(bakedQuads); + reset(); + return returnQuads; + } + + public boolean hasIncompleteQuad() { + return quad != null; + } + + public void reset() { + applyDifuseLighting = true; + isBakingTriModel = false; + bakedQuads = null; + quad = null; + index = 0; + } + + public CCQuadBakery setSprite(TextureAtlasSprite sprite) { + if (this.sprite == sprite) { + return this; + } + if (quad != null) { + throw new IllegalStateException("Unable to set sprite whilst quad is still baking!"); + } + this.sprite = sprite; + return this; + } + + public CCQuadBakery setFace(EnumFacing face) { + if (quad != null) { + throw new IllegalStateException("Unable to set face whilst quad is still baking!"); + } + this.face = face; + return this; + } + + public CCQuadBakery disableDifuseLighting() { + return setDifuseLightingState(false); + } + + public CCQuadBakery setDifuseLightingState(boolean state) { + applyDifuseLighting = state; + return this; + } + + public CCQuadBakery setColour(int colour) { + return setColour(new ColourRGBA(colour)); + } + + public CCQuadBakery setColour(Colour colour) { + this.colour = colour.copy(); + return this; + } + + public CCQuadBakery setLightMap(int brightness) { + this.brightness = brightness; + return this; + //return setLightMap(new UV((double) ((brightness >> 4) & 15 * 32) / 65535, (double) ((brightness >> 20) & 15 * 32) / 65535)); + } + + public CCQuadBakery setNormal(Vector3 normal) { + this.normal = normal; + return this; + } + + public CCQuadBakery setUV(double u, double v) { + return setUV(new UV(u, v)); + } + + public CCQuadBakery setUV(UV uv) { + this.uv = uv.copy(); + return this; + } + + public CCQuadBakery addVertexWithUV(Vector3 vertex, double u, double v) { + return addVertexWithUV(vertex, new UV(u, v)); + } + + public CCQuadBakery addVertexWithUV(double x, double y, double z, UV uv) { + return addVertexWithUV(new Vector3(x, y, z), uv); + } + + public CCQuadBakery addVertexWithUV(double x, double y, double z, double u, double v) { + return addVertexWithUV(new Vector3(x, y, z), new UV(u, v)); + } + + public CCQuadBakery addVertexWithUV(Vector3 vertex, UV uv) { + return addVertexWithUV(new Vertex5(vertex, uv)); + } + + public CCQuadBakery addVertexWithUV(Vertex5 vertex) { + setUV(vertex.uv); + return addVertex(vertex.vec); + } + + public CCQuadBakery addVertex(double x, double y, double z) { + return addVertex(new Vector3(x, y, z)); + } + + public CCQuadBakery addVertex(Vector3 vertex) { + if (quad == null) { + quad = new CCQuad(); + if (face != null) { + quad.face = face; + } + quad.sprite = sprite; + quad.applyDifuseLighting = applyDifuseLighting; + index = 0; + } + quad.vertices[index] = new Vertex5(vertex.copy(), uv.copy()); + quad.normals[index] = normal != null ? normal.copy() : null; + quad.colours[index] = colour.copy(); + quad.lightMaps[index] = brightness; + index++; + + int max = isBakingTriModel ? 3 : 4; + + if (index == max) { + index = 0; + bakedQuads.add(quad.bake(format)); + quad = null; + } + return this; + } + +} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/ItemModelBakery.java b/dependencies/main/java/codechicken/lib/model/bakery/ItemModelBakery.java new file mode 100644 index 0000000000..e8b847cc83 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/bakery/ItemModelBakery.java @@ -0,0 +1,42 @@ +package codechicken.lib.model.bakery; + +import codechicken.lib.util.TransformUtils; +import com.google.common.base.Optional; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraftforge.client.model.ItemLayerModel; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.IModelState; + +import java.util.LinkedList; +import java.util.List; + +/** + * Created by covers1624 on 13/02/2017. + */ +public class ItemModelBakery { + + public static List bakeItem(List sprites) { + return bakeItem(sprites, DefaultVertexFormats.ITEM, TransformUtils.DEFAULT_ITEM); + } + + public static List bakeItem(List sprites, IModelState state) { + return bakeItem(sprites, DefaultVertexFormats.ITEM, state); + } + + public static List bakeItem(List sprites, VertexFormat format) { + return bakeItem(sprites, format, TransformUtils.DEFAULT_ITEM); + } + + public static List bakeItem(List sprites, VertexFormat format, IModelState state) { + List quads = new LinkedList(); + for (int i = 0; i < sprites.size(); i++) { + TextureAtlasSprite sprite = sprites.get(i); + quads.addAll(ItemLayerModel.getQuadsForSprite(i, sprite, format, state.apply(Optional.absent()))); + } + return quads; + } + +} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/PlanarFaceBakery.java b/dependencies/main/java/codechicken/lib/model/bakery/PlanarFaceBakery.java new file mode 100644 index 0000000000..c95f8b34f3 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/bakery/PlanarFaceBakery.java @@ -0,0 +1,227 @@ +package codechicken.lib.model.bakery; + +import codechicken.lib.colour.Colour; +import codechicken.lib.colour.ColourRGBA; +import codechicken.lib.util.VertexDataUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.Vertex5; +import codechicken.lib.vec.uv.IconTransformation; +import codechicken.lib.vec.uv.UV; +import codechicken.lib.vec.uv.UVTransformation; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.renderer.vertex.VertexFormatElement; +import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.client.model.pipeline.LightUtil; +import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; + +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; + +/** + * Created by covers1624 on 26/10/2016. + */ +//TODO General cleanup. +public class PlanarFaceBakery { + + public static BakedQuad bakeFace(EnumFacing face, TextureAtlasSprite sprite) { + return bakeFace(face, sprite, DefaultVertexFormats.ITEM); + } + + public static BakedQuad bakeFace(EnumFacing face, TextureAtlasSprite sprite, VertexFormat format) { + return bakeFace(face, sprite, format, 0xFFFFFFFF); + } + + public static BakedQuad bakeFace(EnumFacing face, TextureAtlasSprite sprite, VertexFormat format, int colour) { + return bakeFace(face, sprite, format, new ColourRGBA(colour)); + } + + public static BakedQuad bakeFace(EnumFacing face, TextureAtlasSprite sprite, VertexFormat format, Colour colour) { + UVTransformation t = new IconTransformation(sprite); + + double x1 = Cuboid6.full.min.x; + double x2 = Cuboid6.full.max.x; + double y1 = Cuboid6.full.min.y; + double y2 = Cuboid6.full.max.y; + double z1 = Cuboid6.full.min.z; + double z2 = Cuboid6.full.max.z; + double u1; + double u2; + double v1; + double v2; + Vertex5 vert1; + Vertex5 vert2; + Vertex5 vert3; + Vertex5 vert4; + + switch (face) { + case DOWN: + u1 = x1; + v1 = z1; + u2 = x2; + v2 = z2; + vert1 = new Vertex5(x1, y1, z2, u1, v2); + vert2 = new Vertex5(x1, y1, z1, u1, v1); + vert3 = new Vertex5(x2, y1, z1, u2, v1); + vert4 = new Vertex5(x2, y1, z2, u2, v2); + return buildQuad(format, sprite, face, colour, t, vert1, vert2, vert3, vert4); + case UP: + u1 = x1; + v1 = z1; + u2 = x2; + v2 = z2; + vert1 = new Vertex5(x2, y2, z2, u2, v2); + vert2 = new Vertex5(x2, y2, z1, u2, v1); + vert3 = new Vertex5(x1, y2, z1, u1, v1); + vert4 = new Vertex5(x1, y2, z2, u1, v2); + return buildQuad(format, sprite, face, colour, t, vert1, vert2, vert3, vert4); + case NORTH: + u1 = 1 - x1; + v1 = 1 - y2; + u2 = 1 - x2; + v2 = 1 - y1; + vert1 = new Vertex5(x1, y1, z1, u1, v2); + vert2 = new Vertex5(x1, y2, z1, u1, v1); + vert3 = new Vertex5(x2, y2, z1, u2, v1); + vert4 = new Vertex5(x2, y1, z1, u2, v2); + return buildQuad(format, sprite, face, colour, t, vert1, vert2, vert3, vert4); + case SOUTH: + u1 = x1; + v1 = 1 - y2; + u2 = x2; + v2 = 1 - y1; + vert1 = new Vertex5(x2, y1, z2, u2, v2); + vert2 = new Vertex5(x2, y2, z2, u2, v1); + vert3 = new Vertex5(x1, y2, z2, u1, v1); + vert4 = new Vertex5(x1, y1, z2, u1, v2); + return buildQuad(format, sprite, face, colour, t, vert1, vert2, vert3, vert4); + case WEST: + u1 = z1; + v1 = 1 - y2; + u2 = z2; + v2 = 1 - y1; + vert1 = new Vertex5(x1, y1, z2, u2, v2); + vert2 = new Vertex5(x1, y2, z2, u2, v1); + vert3 = new Vertex5(x1, y2, z1, u1, v1); + vert4 = new Vertex5(x1, y1, z1, u1, v2); + return buildQuad(format, sprite, face, colour, t, vert1, vert2, vert3, vert4); + + case EAST: + u1 = 1 - z1; + v1 = 1 - y2; + u2 = 1 - z2; + v2 = 1 - y1; + vert1 = new Vertex5(x2, y1, z1, u1, v2); + vert2 = new Vertex5(x2, y2, z1, u1, v1); + vert3 = new Vertex5(x2, y2, z2, u2, v1); + vert4 = new Vertex5(x2, y1, z2, u2, v2); + return buildQuad(format, sprite, face, colour, t, vert1, vert2, vert3, vert4); + } + //This case will never happen. only here due to INTELLIJ NOT SHUTTING UP ABOUT POTENTIAL NULLPOINTERS! + return new BakedQuad(null, 1, null, null, true, null); + } + + private static BakedQuad buildQuad(VertexFormat format, TextureAtlasSprite sprite, EnumFacing face, Colour colour, UVTransformation t, Vertex5 v1, Vertex5 v2, Vertex5 v3, Vertex5 v4) { + UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); + builder.setQuadTint(-1); + builder.setQuadOrientation(face); + builder.setTexture(sprite); + + t.apply(v1.uv); + t.apply(v2.uv); + t.apply(v3.uv); + t.apply(v4.uv); + putVertex(builder, format, face, v1, colour); + putVertex(builder, format, face, v2, colour); + putVertex(builder, format, face, v3, colour); + putVertex(builder, format, face, v4, colour); + + return VertexDataUtils.copyQuad(builder.build()); + } + + private static void putVertex(UnpackedBakedQuad.Builder builder, VertexFormat format, EnumFacing face, Vertex5 vert, Colour colour) { + for (int e = 0; e < format.getElementCount(); e++) { + VertexFormatElement element = format.getElement(e); + switch (element.getUsage()) { + + case POSITION: + Vector3 vec = vert.vec; + builder.put(e, (float) vec.x, (float) vec.y, (float) vec.z, 1); + break; + case NORMAL: + builder.put(e, face.getFrontOffsetX(), face.getFrontOffsetY(), face.getFrontOffsetZ(), 0); + break; + case COLOR: + builder.put(e, (colour.r & 0xFF) / 255F, (colour.g & 0xFF) / 255F, (colour.b & 0xFF) / 255F, (colour.a & 0xFF) / 255F); + break; + case UV: + UV uv = vert.uv; + builder.put(e, (float) uv.u, (float) uv.v, 0, 1); + break; + default: + builder.put(e); + break; + } + } + } + + public static List shadeQuadFaces(BakedQuad... quads) { + return shadeQuadFaces(Arrays.asList(quads)); + } + + public static List shadeQuadFaces(List quads) { + LinkedList shadedQuads = new LinkedList(); + for (BakedQuad quad : quads) { + int[] rawData = quad.getVertexData(); + for (int v = 0; v < 4; v++) { + for (int e = 0; e < quad.getFormat().getElementCount(); e++) { + VertexFormatElement element = quad.getFormat().getElement(e); + if (element.getUsage() == EnumUsage.COLOR) { + float[] data = new float[4]; + LightUtil.unpack(rawData, data, quad.getFormat(), v, e); + + data = diffuseFaceLight(quad.getFace(), data); + + LightUtil.pack(data, rawData, quad.getFormat(), v, e); + } + } + } + shadedQuads.add(new BakedQuad(rawData, quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad.getFormat())); + } + + return shadedQuads; + } + + private static float[] diffuseFaceLight(EnumFacing face, float[] colour) { + double diffuse; + switch (face) { + case DOWN: + diffuse = 0.5D; + break; + case NORTH: + case SOUTH: + diffuse = 0.8D; + break; + case WEST: + case EAST: + diffuse = 0.6D; + break; + case UP: + default: + diffuse = 1.0D; + break; + } + + colour[0] *= diffuse; + colour[1] *= diffuse; + colour[2] *= diffuse; + + return colour; + } + +} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/SimplePerspectiveAwareLayerModelBakery.java b/dependencies/main/java/codechicken/lib/model/bakery/SimplePerspectiveAwareLayerModelBakery.java new file mode 100644 index 0000000000..74820a10f2 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/bakery/SimplePerspectiveAwareLayerModelBakery.java @@ -0,0 +1,40 @@ +package codechicken.lib.model.bakery; + +import codechicken.lib.model.BakedModelProperties; +import codechicken.lib.model.bakedmodels.PerspectiveAwareBakedModel; +import codechicken.lib.texture.TextureUtils; +import com.google.common.collect.ImmutableList; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.ItemLayerModel; +import net.minecraftforge.common.model.IModelState; + +import java.util.Arrays; + +/** + * Created by covers1624 on 7/25/2016. + */ +//TODO Find better name and integrate with IModel / Jsons. +public class SimplePerspectiveAwareLayerModelBakery { + + private final ResourceLocation baseTexture; + private final ResourceLocation[] layers; + + public SimplePerspectiveAwareLayerModelBakery(ResourceLocation baseTexture, ResourceLocation... layers) { + this.baseTexture = baseTexture; + this.layers = layers; + } + + public IBakedModel bake(IModelState state) { + + ImmutableList.Builder quadBuilder = ImmutableList.builder(); + ImmutableList textureLayers = ImmutableList.builder().add(baseTexture).addAll(Arrays.asList(layers)).build(); + + IBakedModel layerModel = new ItemLayerModel(textureLayers).bake(state, DefaultVertexFormats.ITEM, TextureUtils.bakedTextureGetter); + quadBuilder.addAll(layerModel.getQuads(null, null, 0)); + + return new PerspectiveAwareBakedModel(quadBuilder.build(), state, BakedModelProperties.createFromModel(layerModel)); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/UnpackingVertexConsumer.java b/dependencies/main/java/codechicken/lib/model/bakery/UnpackingVertexConsumer.java new file mode 100644 index 0000000000..d294c5a059 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/bakery/UnpackingVertexConsumer.java @@ -0,0 +1,66 @@ +package codechicken.lib.model.bakery; + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.client.model.pipeline.IVertexConsumer; + +/** + * Created by covers1624 on 5/11/2016. + * TODO Document. + */ +public class UnpackingVertexConsumer implements IVertexConsumer { + + public int tintIndex; + public EnumFacing face; + public VertexFormat format; + public boolean applyDiffuesLight; + public TextureAtlasSprite sprite; + + public float[][][] unpackedData; + + private int vertices = 0; + + public UnpackingVertexConsumer(VertexFormat format) { + this.format = format; + unpackedData = new float[4][format.getElementCount()][4]; + } + + @Override + public VertexFormat getVertexFormat() { + return format; + } + + @Override + public void setQuadTint(int tint) { + tintIndex = tint; + } + + @Override + public void setQuadOrientation(EnumFacing orientation) { + face = orientation; + } + + @Override + public void setApplyDiffuseLighting(boolean diffuse) { + applyDiffuesLight = diffuse; + } + + @Override + public void setTexture(TextureAtlasSprite texture) { + sprite = texture; + } + + @Override + public void put(int element, float... data) { + System.arraycopy(data, 0, unpackedData[vertices][element], 0, data.length); + if (element == getVertexFormat().getElementCount() - 1) { + vertices++; + } + } + + public float[][][] getUnpackedData() { + return unpackedData; + } + +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakery.java b/dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakery.java new file mode 100644 index 0000000000..eff3d97101 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakery.java @@ -0,0 +1,343 @@ +package codechicken.lib.model.blockbakery; + +import codechicken.lib.model.BakedModelProperties; +import codechicken.lib.model.ModelRegistryHelper; +import codechicken.lib.model.ModelRegistryHelper.IModelBakeCallback; +import codechicken.lib.model.PerspectiveAwareModelProperties; +import codechicken.lib.model.bakedmodels.PerspectiveAwareBakedModel; +import codechicken.lib.model.bakedmodels.PerspectiveAwareLayeredModel; +import codechicken.lib.model.bakery.PlanarFaceBakery; +import codechicken.lib.texture.IItemBlockTextureProvider; +import codechicken.lib.texture.IWorldBlockTextureProvider; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.util.TransformUtils; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.registry.IRegistry; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.client.model.ModelLoaderRegistry; +import net.minecraftforge.common.property.IExtendedBlockState; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; + +/** + * Created by covers1624 on 25/10/2016. + */ +//TODO, We need a hook for CCRenderItem to allow switching the model being rendered on ItemOverrideList.handleItemState, possibly an interface. +//TODO, BlockBakery > CachedModelBakery? dunno. +@SideOnly (Side.CLIENT) +public class BlockBakery implements IResourceManagerReloadListener { + + private static boolean DEBUG = Boolean.parseBoolean(System.getProperty("ccl.debugBakeryLogging")); + + private static Cache keyModelCache = CacheBuilder.newBuilder().expireAfterAccess(30, TimeUnit.MINUTES).build(); + + private static Map itemKeyGeneratorMap = new HashMap(); + private static Map blockKeyGeneratorMap = new HashMap(); + private static IBakedModel missingModel; + + public static final IBlockStateKeyGenerator defaultBlockKeyGenerator = new IBlockStateKeyGenerator() { + @Override + public String generateKey(IExtendedBlockState state) { + if (state.getBlock() instanceof IWorldBlockTextureProvider) { + Map> layerFaceSpriteMap = state.getValue(BlockBakeryProperties.LAYER_FACE_SPRITE_MAP); + StringBuilder builder = new StringBuilder(state.getBlock().getRegistryName() + ","); + for (Entry> layerEntry : layerFaceSpriteMap.entrySet()) { + builder.append(layerEntry.getKey().toString()).append(","); + for (Entry faceSpriteEntry : layerEntry.getValue().entrySet()) { + builder.append(faceSpriteEntry.getKey()).append(",").append(faceSpriteEntry.getValue().getIconName()).append(","); + } + } + return builder.toString(); + } + return state.getBlock().getRegistryName().toString() + "|" + state.getBlock().getMetaFromState(state); + } + }; + + public static final IItemStackKeyGenerator defaultItemKeyGenerator = new IItemStackKeyGenerator() { + @Override + public String generateKey(ItemStack stack) { + return stack.getItem().getRegistryName().toString() + "|" + stack.getMetadata(); + } + }; + + public static void init() { + TextureUtils.registerReloadListener(new BlockBakery()); + ModelRegistryHelper.registerCallback(new IModelBakeCallback() { + @Override + public void onModelBake(IRegistry modelRegistry) { + missingModel = ModelLoaderRegistry.getMissingModel().bake(TransformUtils.DEFAULT_BLOCK, DefaultVertexFormats.ITEM, TextureUtils.bakedTextureGetter); + } + }); + } + + public static IBlockStateKeyGenerator getKeyGenerator(Block block) { + if (blockKeyGeneratorMap.containsKey(block)) { + return blockKeyGeneratorMap.get(block); + } + return defaultBlockKeyGenerator; + } + + public static IItemStackKeyGenerator getKeyGenerator(Item item) { + if (itemKeyGeneratorMap.containsKey(item)) { + return itemKeyGeneratorMap.get(item); + } + return defaultItemKeyGenerator; + } + + public static void registerBlockKeyGenerator(Block block, IBlockStateKeyGenerator generator) { + if (blockKeyGeneratorMap.containsKey(block)) { + throw new IllegalArgumentException("Unable to register IBlockStateKeyGenerator as one is already registered for block:" + block.getRegistryName()); + } + blockKeyGeneratorMap.put(block, generator); + } + + public static void registerItemKeyGenerator(Item item, IItemStackKeyGenerator generator) { + if (itemKeyGeneratorMap.containsKey(item)) { + throw new IllegalArgumentException("Unable to register IItemStackKeyGenerator as one is already registered for item: " + item.getRegistryName()); + } + itemKeyGeneratorMap.put(item, generator); + } + + //TODO, Move this to pass IExtendedBlockState, IBlockAccess, BlockPos. Leave tile usage to + public static IBlockState handleExtendedState(IExtendedBlockState state, TileEntity tileEntity) { + Block block = state.getBlock(); + + if (block instanceof IBakeryBlock) { + return ((IBakeryBlock) block).getCustomBakery().handleState(state, tileEntity); + } else if (block instanceof IWorldBlockTextureProvider) { + IWorldBlockTextureProvider provider = ((IWorldBlockTextureProvider) block); + Map> layerFaceSpriteMap = new HashMap>(); + for (BlockRenderLayer layer : BlockRenderLayer.values()) { + if (block.canRenderInLayer(state, layer)) { + Map faceSpriteMap = new HashMap(); + for (EnumFacing face : EnumFacing.VALUES) { + TextureAtlasSprite sprite = provider.getTexture(face, state, layer, tileEntity.getWorld(), tileEntity.getPos()); + if (sprite != null) { + faceSpriteMap.put(face, sprite); + } + } + layerFaceSpriteMap.put(layer, faceSpriteMap); + } + } + state = state.withProperty(BlockBakeryProperties.LAYER_FACE_SPRITE_MAP, layerFaceSpriteMap); + } + return state; + } + + public static IBakedModel getCachedItemModel(ItemStack stack) { + IBakedModel model; + IItemStackKeyGenerator generator = getKeyGenerator(stack.getItem()); + String key = generator.generateKey(stack); + model = keyModelCache.getIfPresent(key); + if (model == null) { + model = generateItemModel(stack); + if (DEBUG) { + FMLLog.info("Baking item model: " + key); + } + if (model != missingModel) { + keyModelCache.put(key, model); + } + } + return model; + + } + + public static IBakedModel generateItemModel(ItemStack stack) { + Item item = stack.getItem(); + if (item instanceof ItemBlock) { + Block block = Block.getBlockFromItem(item); + if (block instanceof IBakeryBlock) { + ICustomBlockBakery bakery = ((IBakeryBlock) block).getCustomBakery(); + List generalQuads = new LinkedList(); + Map> faceQuads = new HashMap>(); + generalQuads.addAll(bakery.bakeItemQuads(null, stack)); + + for (EnumFacing face : EnumFacing.VALUES) { + List quads = new LinkedList(); + + quads.addAll(PlanarFaceBakery.shadeQuadFaces(bakery.bakeItemQuads(face, stack))); + + faceQuads.put(face, quads); + } + + BakedModelProperties properties = new BakedModelProperties(true, true, null); + return new PerspectiveAwareBakedModel(faceQuads, generalQuads, TransformUtils.DEFAULT_BLOCK, properties); + + } else if (block instanceof IItemBlockTextureProvider) { + IItemBlockTextureProvider provider = ((IItemBlockTextureProvider) block); + Map> faceQuadMap = new HashMap>(); + for (EnumFacing face : EnumFacing.VALUES) { + List faceQuads = new LinkedList(); + + faceQuads.addAll(PlanarFaceBakery.shadeQuadFaces(PlanarFaceBakery.bakeFace(face, provider.getTexture(face, stack), DefaultVertexFormats.ITEM))); + + faceQuadMap.put(face, faceQuads); + } + BakedModelProperties properties = new BakedModelProperties(true, true, null); + return new PerspectiveAwareBakedModel(faceQuadMap, TransformUtils.DEFAULT_BLOCK, properties); + } + } else { + if (item instanceof IBakeryItem) { + IItemBakery bakery = ((IBakeryItem) item).getBakery(); + List generalQuads = new LinkedList(); + Map> faceQuads = new HashMap>(); + generalQuads.addAll(bakery.bakeItemQuads(null, stack)); + + for (EnumFacing face : EnumFacing.VALUES) { + List quads = new LinkedList(); + + quads.addAll(bakery.bakeItemQuads(face, stack)); + + faceQuads.put(face, quads); + } + + PerspectiveAwareModelProperties bakeryProperties = PerspectiveAwareModelProperties.DEFAULT_ITEM; + + try { + bakeryProperties = bakery.getModelProperties(stack); + } catch (Exception ignored) { + } + + BakedModelProperties properties = bakeryProperties.getProperties(); + return new PerspectiveAwareBakedModel(faceQuads, generalQuads, bakeryProperties.getModelState(), properties); + } + } + return missingModel; + } + + public static IBakedModel getCachedModel(IExtendedBlockState state) { + IBakedModel model; + IBlockStateKeyGenerator keyGenerator = getKeyGenerator(state.getBlock()); + String key = keyGenerator.generateKey(state); + model = keyModelCache.getIfPresent(key); + if (model == null) { + model = generateModel(state); + if (DEBUG) { + FMLLog.info("Baking block model: " + key); + } + if (model != missingModel) { + keyModelCache.put(key, model); + } + } + return model; + } + + public static IBakedModel generateModel(IExtendedBlockState state) { + if (state.getBlock() instanceof IBakeryBlock) { + ICustomBlockBakery bakery = ((IBakeryBlock) state.getBlock()).getCustomBakery(); + if (bakery instanceof ISimpleBlockBakery) { + ISimpleBlockBakery simpleBakery = ((ISimpleBlockBakery) bakery); + List generalQuads = new LinkedList(); + Map> faceQuads = new HashMap>(); + generalQuads.addAll(simpleBakery.bakeQuads(null, state)); + + for (EnumFacing face : EnumFacing.VALUES) { + List quads = new LinkedList(); + + quads.addAll(simpleBakery.bakeQuads(face, state)); + + faceQuads.put(face, quads); + } + BakedModelProperties properties = new BakedModelProperties(true, true, null); + return new PerspectiveAwareBakedModel(faceQuads, generalQuads, TransformUtils.DEFAULT_BLOCK, properties); + } + if (bakery instanceof ILayeredBlockBakery) { + ILayeredBlockBakery layeredBakery = ((ILayeredBlockBakery) bakery); + Map>> layerFaceQuadMap = new HashMap>>(); + Map> layerGeneralQuads = new HashMap>(); + for (BlockRenderLayer layer : BlockRenderLayer.values()) { + if (state.getBlock().canRenderInLayer(state, layer)) { + LinkedList quads = new LinkedList(); + quads.addAll(layeredBakery.bakeLayerFace(null, layer, state)); + layerGeneralQuads.put(layer, quads); + } + } + + for (BlockRenderLayer layer : BlockRenderLayer.values()) { + if (state.getBlock().canRenderInLayer(state, layer)) { + Map> faceQuadMap = new HashMap>(); + for (EnumFacing face : EnumFacing.VALUES) { + List quads = new LinkedList(); + quads.addAll(layeredBakery.bakeLayerFace(face, layer, state)); + faceQuadMap.put(face, quads); + } + layerFaceQuadMap.put(layer, faceQuadMap); + } + } + BakedModelProperties properties = new BakedModelProperties(true, true, null); + return new PerspectiveAwareLayeredModel(layerFaceQuadMap, layerGeneralQuads, TransformUtils.DEFAULT_BLOCK, properties); + } + } + if (state.getBlock() instanceof IWorldBlockTextureProvider) { + Map>> layerFaceQuadMap = generateLayerFaceQuadMap(state); + BakedModelProperties properties = new BakedModelProperties(true, true, null); + return new PerspectiveAwareLayeredModel(layerFaceQuadMap, TransformUtils.DEFAULT_BLOCK, properties); + } /*else if (state.getBlock() instanceof IBlockTextureProvider) { + IBlockTextureProvider provider = ((IBlockTextureProvider) state.getBlock()); + int meta = state.getBlock().getMetaFromState(state); + + Map> quadFaceMap = new HashMap>(); + for (EnumFacing face : EnumFacing.VALUES) { + LinkedList quads = new LinkedList(); + + quads.add(PlanarFaceBakery.bakeFace(face, provider.getTexture(face, meta))); + + quadFaceMap.put(face, quads); + } + BakedModelProperties properties = new BakedModelProperties(true, true, null); + return new PerspectiveAwareBakedModel(quadFaceMap, TransformUtils.DEFAULT_BLOCK, properties); + + }*/ + return missingModel; + } + + public static Map>> generateLayerFaceQuadMap(IExtendedBlockState state) { + Map> layerFaceSpriteMap = state.getValue(BlockBakeryProperties.LAYER_FACE_SPRITE_MAP); + Map>> layerFaceQuadMap = new HashMap>>(); + for (BlockRenderLayer layer : layerFaceSpriteMap.keySet()) { + Map faceSpriteMap = layerFaceSpriteMap.get(layer); + Map> faceQuadMap = new HashMap>(); + for (EnumFacing face : faceSpriteMap.keySet()) { + List quads = new LinkedList(); + quads.add(PlanarFaceBakery.bakeFace(face, faceSpriteMap.get(face))); + faceQuadMap.put(face, quads); + } + layerFaceQuadMap.put(layer, faceQuadMap); + } + return layerFaceQuadMap; + } + + @Override + public void onResourceManagerReload(IResourceManager resourceManager) { + nukeModelCache(); + } + + public static void nukeModelCache() { + keyModelCache.invalidateAll(); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakeryProperties.java b/dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakeryProperties.java new file mode 100644 index 0000000000..d8934a8e8e --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakeryProperties.java @@ -0,0 +1,38 @@ +package codechicken.lib.model.blockbakery; + +import codechicken.lib.block.property.unlisted.UnlistedMapProperty; +import codechicken.lib.block.property.unlisted.UnlistedMapProperty.IMapStringGenerator; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; + +import java.util.Map; +import java.util.Map.Entry; + +/** + * Created by covers1624 on 26/12/2016. + * TODO, Maybe move away from this, Instead of storing the entire render context inside the state, store the important data, then compute if necessary, will require changes basically everywhere. + */ +public class BlockBakeryProperties { + + public static final UnlistedMapProperty LAYER_FACE_SPRITE_MAP; + + static { + LAYER_FACE_SPRITE_MAP = new UnlistedMapProperty("layer_face_sprite"); + + LAYER_FACE_SPRITE_MAP.setStringGenerator(new IMapStringGenerator() { + @SuppressWarnings ("unchecked") + @Override + public String makeString(Map map) { + StringBuilder builder = new StringBuilder(); + for (Entry> layerEntry : ((Map>) map).entrySet()) { + builder.append(layerEntry.getKey().toString()).append(","); + for (Entry faceSpriteEntry : layerEntry.getValue().entrySet()) { + builder.append(faceSpriteEntry.getKey()).append(",").append(faceSpriteEntry.getValue().getIconName()).append(","); + } + } + return builder.toString(); + } + }); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/CCBakeryModel.java b/dependencies/main/java/codechicken/lib/model/blockbakery/CCBakeryModel.java new file mode 100644 index 0000000000..3ccb0ee243 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/CCBakeryModel.java @@ -0,0 +1,71 @@ +package codechicken.lib.model.blockbakery; + +import codechicken.lib.texture.TextureUtils; +import com.google.common.collect.ImmutableList; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.*; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; +import net.minecraftforge.common.property.IExtendedBlockState; + +import javax.annotation.Nullable; +import java.util.List; + +/** + * Created by covers1624 on 26/10/2016. + */ +public class CCBakeryModel implements IBakedModel { + + private final String particle; + + public CCBakeryModel(String particle) { + this.particle = particle; + } + + @Override + public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { + return BlockBakery.getCachedModel((IExtendedBlockState) state).getQuads(state, side, rand); + } + + @Override + public boolean isAmbientOcclusion() { + return true; + } + + @Override + public boolean isGui3d() { + return false; + } + + @Override + public boolean isBuiltInRenderer() { + return false; + } + + @Override + public TextureAtlasSprite getParticleTexture() { + return TextureUtils.getTexture(particle); + } + + @Override + public ItemCameraTransforms getItemCameraTransforms() { + return ItemCameraTransforms.DEFAULT; + } + + @Override + public ItemOverrideList getOverrides() { + return new ItemOverrideList(ImmutableList.of()) { + @Override + public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) { + IBakedModel model = BlockBakery.getCachedItemModel(stack); + if (model == null) { + return originalModel; + } + return model; + } + }; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryBlock.java b/dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryBlock.java new file mode 100644 index 0000000000..800c67131a --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryBlock.java @@ -0,0 +1,18 @@ +package codechicken.lib.model.blockbakery; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +/** + * Created by covers1624 on 28/10/2016. + * TODO Document. + * TODO, Refactor, IBakeryBlock > IBakeryProvider + * TODO, Item and block implementation support. + */ +public interface IBakeryBlock { + + @SideOnly (Side.CLIENT) + //TODO ICustomBakery + ICustomBlockBakery getCustomBakery(); + +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryItem.java b/dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryItem.java new file mode 100644 index 0000000000..4c872c5a9b --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryItem.java @@ -0,0 +1,18 @@ +package codechicken.lib.model.blockbakery; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +/** + * Implement this on an item and register a model with an ItemOverrideList.handleItemState calling BlockBakery.getCachedItemModel to use this. + * Make sure you register an IItemStackKeyGenerator + * + * Created by covers1624 on 12/02/2017. + */ +@Deprecated//Still safe to use, 1.11 will have lots of changes to this entire pipeline. +public interface IBakeryItem { + + @SideOnly (Side.CLIENT) + IItemBakery getBakery(); + +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/IBlockStateKeyGenerator.java b/dependencies/main/java/codechicken/lib/model/blockbakery/IBlockStateKeyGenerator.java new file mode 100644 index 0000000000..cbd299a6e9 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/IBlockStateKeyGenerator.java @@ -0,0 +1,13 @@ +package codechicken.lib.model.blockbakery; + +import net.minecraftforge.common.property.IExtendedBlockState; + +/** + * Created by covers1624 on 26/11/2016. + * TODO Document. + */ +public interface IBlockStateKeyGenerator { + + String generateKey(IExtendedBlockState state); + +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/ICustomBlockBakery.java b/dependencies/main/java/codechicken/lib/model/blockbakery/ICustomBlockBakery.java new file mode 100644 index 0000000000..caa2d8f3d2 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/ICustomBlockBakery.java @@ -0,0 +1,27 @@ +package codechicken.lib.model.blockbakery; + +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.common.property.IExtendedBlockState; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import java.util.List; + +/** + * Created by covers1624 on 28/10/2016. + * TODO Document. + * TODO ICustomBlockBakery > IItemBakery + * TODO new Base class ICustomBakery + */ +public interface ICustomBlockBakery { + + //TODO Move to IBlockBakery. + @SideOnly (Side.CLIENT) + IExtendedBlockState handleState(IExtendedBlockState state, TileEntity tileEntity); + + @SideOnly (Side.CLIENT) + List bakeItemQuads(EnumFacing face, ItemStack stack); +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/IItemBakery.java b/dependencies/main/java/codechicken/lib/model/blockbakery/IItemBakery.java new file mode 100644 index 0000000000..a3f4fa20d2 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/IItemBakery.java @@ -0,0 +1,29 @@ +package codechicken.lib.model.blockbakery; + +import codechicken.lib.model.PerspectiveAwareModelProperties; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import java.util.List; + +/** + * Created by covers1624 on 12/02/2017. + */ +public interface IItemBakery { + + @SideOnly (Side.CLIENT) + List bakeItemQuads(EnumFacing face, ItemStack stack); + + /** + * Allows ItemModels to define a custom properties. Suitable for thinks like fake blocks. + * As this method has been added after release, we could potentially break binary compatibility. + * Suitable checks have been added where this method is called to preserve such compatibility. + * + * @return The transforms to use for the model. + */ + @SideOnly (Side.CLIENT) + PerspectiveAwareModelProperties getModelProperties(ItemStack stack); +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/IItemStackKeyGenerator.java b/dependencies/main/java/codechicken/lib/model/blockbakery/IItemStackKeyGenerator.java new file mode 100644 index 0000000000..6f76a3d17a --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/IItemStackKeyGenerator.java @@ -0,0 +1,13 @@ +package codechicken.lib.model.blockbakery; + +import net.minecraft.item.ItemStack; + +/** + * Created by covers1624 on 2/11/2016. + * TODO Document. + */ +public interface IItemStackKeyGenerator { + + String generateKey(ItemStack stack); + +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/ILayeredBlockBakery.java b/dependencies/main/java/codechicken/lib/model/blockbakery/ILayeredBlockBakery.java new file mode 100644 index 0000000000..b2a74cf450 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/ILayeredBlockBakery.java @@ -0,0 +1,21 @@ +package codechicken.lib.model.blockbakery; + +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.common.property.IExtendedBlockState; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import java.util.List; + +/** + * Created by covers1624 on 28/10/2016. + * TODO Document. + */ +public interface ILayeredBlockBakery extends ICustomBlockBakery { + + @SideOnly (Side.CLIENT) + List bakeLayerFace(EnumFacing face, BlockRenderLayer layer, IExtendedBlockState state); + +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/ISimpleBlockBakery.java b/dependencies/main/java/codechicken/lib/model/blockbakery/ISimpleBlockBakery.java new file mode 100644 index 0000000000..056e344a06 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/ISimpleBlockBakery.java @@ -0,0 +1,19 @@ +package codechicken.lib.model.blockbakery; + +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.common.property.IExtendedBlockState; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import java.util.List; + +/** + * Created by covers1624 on 28/10/2016. + * TODO Document. + */ +public interface ISimpleBlockBakery extends ICustomBlockBakery { + + @SideOnly (Side.CLIENT) + List bakeQuads(EnumFacing face, IExtendedBlockState state); +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/SimpleBlockRenderer.java b/dependencies/main/java/codechicken/lib/model/blockbakery/SimpleBlockRenderer.java new file mode 100644 index 0000000000..80ca2ecc5e --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/SimpleBlockRenderer.java @@ -0,0 +1,90 @@ +package codechicken.lib.model.blockbakery; + +import codechicken.lib.render.CCModel; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.buffer.BakingVertexBuffer; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.util.TripleABC; +import codechicken.lib.util.VertexDataUtils; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Rotation; +import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.uv.UVTransformation; +import com.google.common.collect.ImmutableList; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.common.property.IExtendedBlockState; + +import java.util.List; + +/** + * Created by covers1624 on 26/12/2016. + * TODO Document. + */ +public abstract class SimpleBlockRenderer implements ISimpleBlockBakery, IIconRegister { + + //TODO Face based models. + private static final CCModel[][] models = new CCModel[6][4]; + + static { + CCModel model = CCModel.quadModel(24).generateBlock(0, Cuboid6.full); + for (int s = 0; s < 6; s++) { + for (int r = 0; r < 4; r++) { + CCModel m = model.copy().apply(Rotation.sideOrientation(s, r).at(Vector3.center)); + m.computeNormals(); + models[s][r] = m; + } + } + } + + public abstract TripleABC getWorldTransforms(IExtendedBlockState state); + + public abstract TripleABC getItemTransforms(ItemStack stack); + + public abstract boolean shouldCull(); + + @Override + public IExtendedBlockState handleState(IExtendedBlockState state, TileEntity tileEntity) { + return state; + } + + @Override + public List bakeQuads(EnumFacing face, IExtendedBlockState state) { + BakingVertexBuffer buffer = BakingVertexBuffer.create(); + TripleABC worldData = getWorldTransforms(state); + CCRenderState ccrs = CCRenderState.instance(); + ccrs.reset(); + ccrs.startDrawing(0x7, DefaultVertexFormats.ITEM, buffer); + models[worldData.getA()][worldData.getB()].render(ccrs, worldData.getC()); + buffer.finishDrawing(); + List quads = buffer.bake(); + if (face == null && !shouldCull()) { + return quads; + } else if (face != null) { + return VertexDataUtils.sortFaceData(quads).get(face); + } + return ImmutableList.of(); + } + + @Override + public List bakeItemQuads(EnumFacing face, ItemStack stack) { + BakingVertexBuffer buffer = BakingVertexBuffer.create(); + TripleABC worldData = getItemTransforms(stack); + CCRenderState ccrs = CCRenderState.instance(); + ccrs.reset(); + ccrs.startDrawing(0x7, DefaultVertexFormats.ITEM, buffer); + models[worldData.getA()][worldData.getB()].render(ccrs, worldData.getC()); + buffer.finishDrawing(); + List quads = buffer.bake(); + + if (face == null && !shouldCull()) { + return quads; + } else if (face != null) { + return VertexDataUtils.sortFaceData(quads).get(face); + } + return ImmutableList.of(); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/loader/BakeryModel.java b/dependencies/main/java/codechicken/lib/model/blockbakery/loader/BakeryModel.java new file mode 100644 index 0000000000..fbad1bd4c5 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/loader/BakeryModel.java @@ -0,0 +1,44 @@ +package codechicken.lib.model.blockbakery.loader; + +import codechicken.lib.model.blockbakery.CCBakeryModel; +import com.google.common.base.Function; +import com.google.common.collect.ImmutableList; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.IModel; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; + +import java.util.Collection; + +/** + * Basically a wrapper to allow the use of the BlockBakery from a json file. + * Created by covers1624 on 13/02/2017. + */ +public class BakeryModel implements IModel { + + public static final BakeryModel INSTANCE = new BakeryModel(); + + @Override + public Collection getDependencies() { + return ImmutableList.of(); + } + + @Override + public Collection getTextures() { + return ImmutableList.of(); + } + + @Override + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { + return new CCBakeryModel(""); + } + + @Override + public IModelState getDefaultState() { + //This doesn't matter as we are a wrapper. + return TRSRTransformation.identity(); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/loader/CCBakeryModelLoader.java b/dependencies/main/java/codechicken/lib/model/blockbakery/loader/CCBakeryModelLoader.java new file mode 100644 index 0000000000..5f051ff131 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/loader/CCBakeryModelLoader.java @@ -0,0 +1,30 @@ +package codechicken.lib.model.blockbakery.loader; + +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.ICustomModelLoader; +import net.minecraftforge.client.model.IModel; + +/** + * Basically a wrapper to allow the use of the BlockBakery from a json file. + * Created by covers1624 on 13/02/2017. + */ +public class CCBakeryModelLoader implements ICustomModelLoader { + + public static final CCBakeryModelLoader INSTANCE = new CCBakeryModelLoader(); + + @Override + public void onResourceManagerReload(IResourceManager resourceManager) { + } + + @Override + public boolean accepts(ResourceLocation modelLocation) { + String path = modelLocation.getResourcePath(); + return modelLocation.getResourceDomain().equals("ccl") && (path.equals("bakery") || path.equals("models/block/bakery") || path.equals("models/item/bakery")); + } + + @Override + public IModel loadModel(ResourceLocation modelLocation) throws Exception { + return BakeryModel.INSTANCE; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockBakery.java b/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockBakery.java new file mode 100644 index 0000000000..b074d3051c --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockBakery.java @@ -0,0 +1,121 @@ +package codechicken.lib.model.blockbakery.sub; + +import codechicken.lib.model.blockbakery.*; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import com.google.common.collect.ImmutableList; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.common.property.IExtendedBlockState; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by covers1624 on 26/12/2016. + * TODO Document. + */ +public class SubBlockBakery implements ILayeredBlockBakery, IIconRegister { + + private final Map subBakeries = new HashMap(); + private final SubBlockStateKeyGenerator blockKeyGenerator = new SubBlockStateKeyGenerator(); + private final SubItemStackKeyGenerator itemKeyGenerator = new SubItemStackKeyGenerator(); + + public void registerSubBakery(int meta, ICustomBlockBakery bakery) { + subBakeries.put(meta, bakery); + } + + public void registerSubBakery(int meta, ICustomBlockBakery bakery, IBlockStateKeyGenerator blockKeyGen) { + registerSubBakery(meta, bakery, blockKeyGen, null); + } + + public void registerSubBakery(int meta, ICustomBlockBakery bakery, IItemStackKeyGenerator itemKeyGen) { + registerSubBakery(meta, bakery, null, itemKeyGen); + } + + public void registerSubBakery(int meta, ICustomBlockBakery bakery, IBlockStateKeyGenerator blockKeyGen, IItemStackKeyGenerator itemKeyGen) { + subBakeries.put(meta, bakery); + if (blockKeyGen != null) { + blockKeyGenerator.register(meta, blockKeyGen); + } + if (itemKeyGen != null) { + itemKeyGenerator.register(meta, itemKeyGen); + } + } + + public SubBlockBakery registerKeyGens(Block block) { + registerBlockKeyGen(block); + registerItemKeyGen(Item.getItemFromBlock(block)); + return this; + } + + public SubBlockBakery registerBlockKeyGen(Block block) { + BlockBakery.registerBlockKeyGenerator(block, blockKeyGenerator); + return this; + } + + public SubBlockBakery registerItemKeyGen(Item block) { + BlockBakery.registerItemKeyGenerator(block, itemKeyGenerator); + return this; + } + + public SubBlockStateKeyGenerator getBlockKeyGen() { + return blockKeyGenerator; + } + + public SubItemStackKeyGenerator getItemKeyGen() { + return itemKeyGenerator; + } + + @Override + @SideOnly (Side.CLIENT) + public List bakeLayerFace(EnumFacing face, BlockRenderLayer layer, IExtendedBlockState state) { + ICustomBlockBakery bakery = subBakeries.get(state.getBlock().getMetaFromState(state)); + if (bakery instanceof ISimpleBlockBakery) { + if (state.getBlock().canRenderInLayer(state, layer)) { + return ((ISimpleBlockBakery) bakery).bakeQuads(face, state); + } + } else if (bakery instanceof ILayeredBlockBakery) { + return ((ILayeredBlockBakery) bakery).bakeLayerFace(face, layer, state); + } + return ImmutableList.of(); + } + + @Override + @SideOnly (Side.CLIENT) + public IExtendedBlockState handleState(IExtendedBlockState state, TileEntity tileEntity) { + ICustomBlockBakery bakery = subBakeries.get(state.getBlock().getMetaFromState(state)); + if (bakery == null) { + return state; + } + return bakery.handleState(state, tileEntity); + } + + @Override + @SideOnly (Side.CLIENT) + public List bakeItemQuads(EnumFacing face, ItemStack stack) { + ICustomBlockBakery bakery = subBakeries.get(stack.getMetadata()); + if (bakery == null) { + return ImmutableList.of(); + } + return bakery.bakeItemQuads(face, stack); + } + + @Override + @SideOnly (Side.CLIENT) + public void registerIcons(TextureMap textureMap) { + for (ICustomBlockBakery bakery : subBakeries.values()) { + if (bakery instanceof IIconRegister) { + ((IIconRegister) bakery).registerIcons(textureMap); + } + } + } +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockStateKeyGenerator.java b/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockStateKeyGenerator.java new file mode 100644 index 0000000000..a3d347bd1b --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockStateKeyGenerator.java @@ -0,0 +1,31 @@ +package codechicken.lib.model.blockbakery.sub; + +import codechicken.lib.model.blockbakery.BlockBakery; +import codechicken.lib.model.blockbakery.IBlockStateKeyGenerator; +import net.minecraftforge.common.property.IExtendedBlockState; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by covers1624 on 27/12/2016. + * TODO Document. + */ +public class SubBlockStateKeyGenerator implements IBlockStateKeyGenerator { + + private final Map subKeyGenMap = new HashMap(); + + public void register(int meta, IBlockStateKeyGenerator subGenerator) { + subKeyGenMap.put(meta, subGenerator); + } + + @Override + public String generateKey(IExtendedBlockState state) { + int meta = state.getBlock().getMetaFromState(state); + if (subKeyGenMap.containsKey(meta)) { + IBlockStateKeyGenerator keyGenerator = subKeyGenMap.get(meta); + return keyGenerator.generateKey(state); + } + return BlockBakery.defaultBlockKeyGenerator.generateKey(state); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubItemStackKeyGenerator.java b/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubItemStackKeyGenerator.java new file mode 100644 index 0000000000..c7b4845401 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubItemStackKeyGenerator.java @@ -0,0 +1,31 @@ +package codechicken.lib.model.blockbakery.sub; + +import codechicken.lib.model.blockbakery.BlockBakery; +import codechicken.lib.model.blockbakery.IItemStackKeyGenerator; +import net.minecraft.item.ItemStack; + +import java.util.HashMap; +import java.util.Map; + +/** + * Created by covers1624 on 30/12/2016. + * TODO Document. + */ +public class SubItemStackKeyGenerator implements IItemStackKeyGenerator { + + private final Map subKeyGenMap = new HashMap(); + + public void register(int meta, IItemStackKeyGenerator subGenerator) { + subKeyGenMap.put(meta, subGenerator); + } + + @Override + public String generateKey(ItemStack stack) { + int meta = stack.getMetadata(); + if (subKeyGenMap.containsKey(meta)) { + IItemStackKeyGenerator generator = subKeyGenMap.get(meta); + return generator.generateKey(stack); + } + return BlockBakery.defaultItemKeyGenerator.generateKey(stack); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/blockstate/CCBlockStateLoader.java b/dependencies/main/java/codechicken/lib/model/blockstate/CCBlockStateLoader.java new file mode 100644 index 0000000000..6bcbb35e07 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockstate/CCBlockStateLoader.java @@ -0,0 +1,279 @@ +package codechicken.lib.model.blockstate; + +import codechicken.lib.util.ArrayUtils; +import com.google.common.base.Throwables; +import com.google.common.collect.Lists; +import com.google.gson.*; +import com.google.gson.stream.JsonReader; +import net.minecraft.client.renderer.block.model.ModelBlockDefinition; +import net.minecraft.client.renderer.block.model.ModelRotation; +import net.minecraft.client.renderer.block.model.Variant; +import net.minecraft.client.renderer.block.model.VariantList; +import net.minecraft.util.JsonUtils; +import net.minecraftforge.client.model.BlockStateLoader; +import net.minecraftforge.common.model.TRSRTransformation; +import org.apache.commons.io.IOUtils; + +import java.io.Reader; +import java.io.StringReader; +import java.util.*; +import java.util.Map.Entry; + +/** + * Created by covers1624 on 17/11/2016. + * TODO, ASM copy instructions from ModelBlockDefinition to bouncer method here, in case someone is doing the same thing as me. + * TODO, Vanilla Predicate support inside json. Maybe allow variants inside predicates?? + * TODO, Allow all unhandled BlockState Json data to be passed to custom IModels. + * TODO, Allow automatic assigning of IItemRenderer callbacks from json. + * TODO, Allow the BlockBakery to assign blocks models from json. + * TODO, Custom Sided particle system from json maybe / support for sided particles loaded from this loader. + */ +public class CCBlockStateLoader { + + public static final Gson GSON = new GsonBuilder().registerTypeAdapter(CCVariant.class, new CCVariant.Deserializer()).create(); + + public static ModelBlockDefinition handleLoad(Reader reader, Gson vanillaGSON) { + try { + String json = IOUtils.toString(reader); + ModelBlockDefinition cclDef = load(json); + if (cclDef != null) { + return cclDef; + } + return BlockStateLoader.load(new StringReader(json), vanillaGSON); + } catch (Exception e) { + Throwables.propagate(e); + } + return null; + } + + public static ModelBlockDefinition load(String json) { + try { + JsonParser parser = new JsonParser(); + JsonReader reader = new JsonReader(new StringReader(json)); + reader.setLenient(true); + JsonObject object = parser.parse(reader).getAsJsonObject(); + if (JsonUtils.hasField(object, "ccl_marker")) { + + String marker = JsonUtils.getString(object, "ccl_marker"); + List variantSets = new ArrayList(); + for (JsonElement element : object.getAsJsonArray("variant_sets")) { + variantSets.add(element.getAsString()); + } + + String textureDomain = ""; + if (object.has("texture_domain")) { + textureDomain = object.get("texture_domain").getAsString(); + } + + CCVariant defaultVariant = null; + if (object.has("defaults")) { + defaultVariant = GSON.fromJson(object.get("defaults"), CCVariant.class); + } + Map> variants = parseVariants(object.getAsJsonObject("variants")); + + Map>> subModels = parseSubModels(object.getAsJsonObject("sub_model")); + + Map compiledVariants = new LinkedHashMap(); + Map> compiledSubModelVariants = new LinkedHashMap>(); + + List possibleCombos = new ArrayList(); + + for (String variantSet : variantSets) { + Map> variantValueMap = generateVariantValueMap(Arrays.asList(variantSet.split(",")), variants, subModels); + possibleCombos.addAll(generatePossibleCombos(variantValueMap)); + } + + for (String var : possibleCombos) { + Map kvArray = ArrayUtils.convertKeyValueArrayToMap(var.split(",")); + CCVariant finalVariant = new CCVariant(); + if (defaultVariant != null) { + finalVariant = defaultVariant.copy(); + } + compiledVariants.put(var, compileVariant(finalVariant.copy(), kvArray, variants)); + + } + for (Entry>> subModelVariantEntry : subModels.entrySet()) { + Map compiledVariants2 = new LinkedHashMap(); + for (String var : possibleCombos) { + Map kvArray = ArrayUtils.convertKeyValueArrayToMap(var.split(",")); + CCVariant finalVariant = new CCVariant(); + if (defaultVariant != null) { + finalVariant = defaultVariant.copy(); + } + compiledVariants2.put(var, compileVariant(finalVariant.copy(), kvArray, subModelVariantEntry.getValue())); + } + compiledSubModelVariants.put(subModelVariantEntry.getKey(), compiledVariants2); + } + + Map variantList = new HashMap(); + for (Entry entry : compiledVariants.entrySet()) { + Map subModelVariants = getSubModelsForKey(entry.getKey(), compiledSubModelVariants); + List vars = new ArrayList(); + CCVariant variant = entry.getValue(); + + boolean uvLock = variant.uvLock.or(false); + boolean smooth = variant.smooth.or(true); + boolean gui3d = variant.gui3d.or(true); + int weight = variant.weight.or(1); + + if (variant.model != null && subModelVariants.size() == 0 && variant.textures.size() == 0 && variant.customData.size() == 0 && variant.state.orNull() instanceof ModelRotation) { + vars.add(new Variant(variant.model, ((ModelRotation) variant.state.get()), uvLock, weight)); + } else if (subModelVariants.size() == 0) { + vars.add(new CCFinalVariant(variant.model, variant.state.or(TRSRTransformation.identity()), uvLock, smooth, gui3d, weight, variant.textures, textureDomain, variant.customData)); + } else { + vars.add(new CCFinalMultiVariant(variant, textureDomain, subModelVariants)); + } + variantList.put(entry.getKey(), new VariantList(vars)); + } + return new ModelBlockDefinition(variantList, null); + + } + } catch (Exception e) { + e.printStackTrace(); + Throwables.propagate(e); + } + return null; + } + + public static Map> parseVariants(JsonObject variantElement) { + Map> variants = new LinkedHashMap>(); + for (Entry variantsEntry : variantElement.entrySet()) { + String variantName = variantsEntry.getKey(); + Map variantValues = variants.get(variantName); + if (variantValues == null) { + variantValues = new LinkedHashMap(); + variants.put(variantName, variantValues); + } + for (Entry variantEntry : variantsEntry.getValue().getAsJsonObject().entrySet()) { + String variantValue = variantEntry.getKey(); + CCVariant variant = GSON.fromJson(variantEntry.getValue(), CCVariant.class); + variantValues.put(variantValue, variant); + } + } + return variants; + } + + public static Map>> parseSubModels(JsonObject object) { + Map>> subModels = new LinkedHashMap>>(); + + if (object != null) { + for (Entry subModelEntry : object.entrySet()) { + subModels.put(subModelEntry.getKey(), parseVariants(subModelEntry.getValue().getAsJsonObject().getAsJsonObject("variants"))); + } + } + + return subModels; + } + + public static CCVariant compileVariant(CCVariant finalVariant, Map kvArray, Map> variants) { + for (Entry entry : kvArray.entrySet()) { + for (Entry> variantsEntry : variants.entrySet()) { + if (entry.getKey().equals(variantsEntry.getKey())) { + Map variantMap = variantsEntry.getValue(); + if (variantMap.containsKey(entry.getValue())) { + finalVariant = finalVariant.with(variantMap.get(entry.getValue())); + } + } + } + } + for (Entry entry : kvArray.entrySet()) { + for (Entry> variantsEntry : variants.entrySet()) { + if (entry.getKey().equals(variantsEntry.getKey())) { + Map variantMap = variantsEntry.getValue(); + if (variantMap.containsKey(entry.getValue())) { + finalVariant = variantMap.get(entry.getValue()).applySubOverrides(finalVariant, kvArray); + } + } + } + } + return finalVariant; + } + + public static Map getSubModelsForKey(String key, Map> subModels) { + Map subModelVariants = new LinkedHashMap(); + for (Entry> subModelEntry : subModels.entrySet()) { + for (Entry variantEntry : subModelEntry.getValue().entrySet()) { + if (variantEntry.getKey().equals(key)) { + subModelVariants.put(subModelEntry.getKey(), variantEntry.getValue()); + } + } + } + return subModelVariants; + } + + /** + * Generates a list of strings for all possible combos of Key=Value. + * Per key value list can have more than 1 valid value. + *

+ * Credits to brandon3055 who wrote this for me! + * + * @param variantValueMap A map of all possible Keys to all possible values per key. + * @return A compiled list of all possible combos. + */ + public static List generatePossibleCombos(Map> variantValueMap) { + List possibleCombos = new ArrayList(); + + List keys = Lists.newArrayList(variantValueMap.keySet()); + + int comboCount = 1; + for (String key : variantValueMap.keySet()) { + comboCount *= variantValueMap.get(key).size(); + } + + int[] indexes = new int[variantValueMap.size()]; + for (int l = 0; l < comboCount; l++) { + for (int in = 0; in < indexes.length; in++) { + indexes[in]++; + if (indexes[in] >= variantValueMap.get(keys.get(in)).size()) { + indexes[in] = 0; + } else { + break; + } + } + + String combo = ""; + for (int i = 0; i < indexes.length; i++) { + combo += keys.get(i) + "=" + variantValueMap.get(keys.get(i)).get(indexes[i]) + ","; + } + possibleCombos.add(combo.substring(0, combo.length() - 1)); + } + return possibleCombos; + } + + /** + * Generates a map of Key -> List(Value) from the provided CCVariants. + * + * @param keys The keys to get all values for. + * @param variants The CCVariants parsed from json. + * @return Map of Key to value lists. + */ + public static Map> generateVariantValueMap(List keys, Map> variants, Map>> subModels) { + Map> variantValueMap = new LinkedHashMap>(); + for (String variant : keys) { + List variantValues = new ArrayList(); + for (String variantName : variants.keySet()) { + if (variantName.equals(variant) && variants.containsKey(variant)) { + variantValues.addAll(variants.get(variant).keySet()); + } + + for (CCVariant subVariant : variants.get(variantName).values()) { + variantValues.addAll(subVariant.getPossibleVariantValues(variant)); + } + } + for (Map> subModelVariants : subModels.values()) { + for (String variantName : subModelVariants.keySet()) { + if (variantName.equals(variant) && subModelVariants.containsKey(variant)) { + variantValues.addAll(subModelVariants.get(variant).keySet()); + } + + for (CCVariant subVariant : subModelVariants.get(variantName).values()) { + variantValues.addAll(subVariant.getPossibleVariantValues(variant)); + } + } + } + variantValueMap.put(variant, variantValues); + } + return variantValueMap; + } + +} diff --git a/dependencies/main/java/codechicken/lib/model/blockstate/CCFinalMultiVariant.java b/dependencies/main/java/codechicken/lib/model/blockstate/CCFinalMultiVariant.java new file mode 100644 index 0000000000..096092a693 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockstate/CCFinalMultiVariant.java @@ -0,0 +1,72 @@ +package codechicken.lib.model.blockstate; + +import codechicken.lib.model.BakedModelProperties; +import codechicken.lib.model.CCMultiModel; +import codechicken.lib.model.StateOverrideIModel; +import net.minecraft.client.renderer.block.model.ModelRotation; +import net.minecraft.client.renderer.block.model.Variant; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.IModel; +import net.minecraftforge.client.model.ModelLoaderRegistry; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; + +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +/** + * Created by covers1624 on 16/12/2016. + */ +public class CCFinalMultiVariant extends Variant { + + private Variant baseVariant; + private BakedModelProperties baseProperties; + private List finalVariants = new LinkedList(); + private IModelState state; + + public CCFinalMultiVariant(CCVariant baseVariant, String textureDomain, Map subModels) { + super(baseVariant.model == null ? new ResourceLocation("builtin/missing") : baseVariant.model, baseVariant.state.get() instanceof ModelRotation ? ((ModelRotation) baseVariant.state.get()) : ModelRotation.X0_Y0, baseVariant.uvLock.or(false), baseVariant.weight.or(1)); + state = baseVariant.state.get(); + this.baseVariant = makeFinalVariant(baseVariant, textureDomain); + this.baseProperties = new BakedModelProperties(baseVariant.smooth.or(true), baseVariant.gui3d.or(true)); + for (CCVariant subModel : subModels.values()) { + finalVariants.add(makeFinalVariant(baseVariant.copy().with(subModel), textureDomain)); + } + } + + @Override + public IModel process(IModel base) { + boolean hasBase = base != ModelLoaderRegistry.getMissingModel(); + if (hasBase) { + base = baseVariant.process(base); + } + + List subModels = new LinkedList(); + for (Variant variant : finalVariants) { + if (!variant.getModelLocation().equals(new ResourceLocation("builtin/missing"))) { + IModel subModel = ModelLoaderRegistry.getModelOrLogError(variant.getModelLocation(), "Unable to load subModel's Model: " + variant.getModelLocation()); + subModels.add(variant.process(new StateOverrideIModel(subModel, variant.getState()))); + } + } + + return new CCMultiModel(hasBase ? base : null, baseProperties, subModels); + } + + @Override + public IModelState getState() { + return state; + } + + private static Variant makeFinalVariant(CCVariant variant, String textureDomain) { + boolean uvLock = variant.uvLock.or(false); + boolean smooth = variant.smooth.or(true); + boolean gui3d = variant.gui3d.or(true); + int weight = variant.weight.or(1); + if (variant.model != null && variant.textures.size() == 0 && variant.customData.size() == 0 && variant.state.orNull() instanceof ModelRotation) { + return new Variant(variant.model, ((ModelRotation) variant.state.get()), uvLock, weight); + } else { + return new CCFinalVariant(variant.model, variant.state.or(TRSRTransformation.identity()), uvLock, smooth, gui3d, weight, variant.textures, textureDomain, variant.customData); + } + } +} diff --git a/dependencies/main/java/codechicken/lib/model/blockstate/CCFinalVariant.java b/dependencies/main/java/codechicken/lib/model/blockstate/CCFinalVariant.java new file mode 100644 index 0000000000..d97de65685 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockstate/CCFinalVariant.java @@ -0,0 +1,72 @@ +package codechicken.lib.model.blockstate; + +import com.google.common.collect.ImmutableMap; +import net.minecraft.client.renderer.block.model.ModelRotation; +import net.minecraft.client.renderer.block.model.Variant; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.IModel; +import net.minecraftforge.client.model.ModelLoaderRegistry; +import net.minecraftforge.client.model.ModelProcessingHelper; +import net.minecraftforge.common.model.IModelState; + +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +/** + * Created by covers1624 on 19/11/2016. + * Here because ForgeVariant is yet again private.. + * Credits to fry. + */ +public class CCFinalVariant extends Variant { + + private final IModelState state; + private final boolean smooth; + private final boolean gui3d; + private final ImmutableMap customData; + private final ImmutableMap textures; + + public CCFinalVariant(ResourceLocation model, IModelState state, boolean uvLock, boolean smooth, boolean gui3d, int weight, Map textures, String textureDomain, Map customData) { + super(model == null ? new ResourceLocation("builtin/missing") : model, state instanceof ModelRotation ? ((ModelRotation) state) : ModelRotation.X0_Y0, uvLock, weight); + this.state = state; + this.smooth = smooth; + this.gui3d = gui3d; + + Map newTextures = new HashMap(); + for (Entry entry : textures.entrySet()) { + String prefixedTexture = entry.getValue(); + if (!entry.getValue().contains(":")) { + prefixedTexture = textureDomain + ":" + prefixedTexture; + } + newTextures.put(entry.getKey(), prefixedTexture); + } + this.textures = ImmutableMap.copyOf(newTextures); + this.customData = ImmutableMap.copyOf(customData); + } + + public static IModel runModelHooks(IModel base, boolean smooth, boolean gui3d, boolean uvlock, ImmutableMap textureMap, ImmutableMap customData) { + base = ModelProcessingHelper.customData(base, customData); + base = ModelProcessingHelper.retexture(base, textureMap); + base = ModelProcessingHelper.smoothLighting(base, smooth); + base = ModelProcessingHelper.gui3d(base, gui3d); + base = ModelProcessingHelper.uvlock(base, uvlock); + return base; + } + + @Override + public IModel process(IModel base) { + + boolean hasBase = base != ModelLoaderRegistry.getMissingModel(); + + if (hasBase) { + base = runModelHooks(base, smooth, gui3d, isUvLock(), textures, customData); + } + + return base; + } + + @Override + public IModelState getState() { + return state; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/blockstate/CCVariant.java b/dependencies/main/java/codechicken/lib/model/blockstate/CCVariant.java new file mode 100644 index 0000000000..205416a2f3 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/blockstate/CCVariant.java @@ -0,0 +1,210 @@ +package codechicken.lib.model.blockstate; + +import codechicken.lib.util.Copyable; +import codechicken.lib.util.TransformUtils; +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; +import com.google.common.base.Optional; +import com.google.gson.*; +import net.minecraft.util.JsonUtils; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.common.model.IModelState; + +import java.lang.reflect.Type; +import java.util.*; +import java.util.Map.Entry; + +/** + * Created by covers1624 on 18/11/2016. + */ +public class CCVariant implements Copyable { + + protected ResourceLocation model; + protected Optional state = Optional.absent(); + protected Optional uvLock = Optional.absent(); + protected Optional smooth = Optional.absent(); + protected Optional gui3d = Optional.absent(); + protected Optional weight = Optional.absent(); + protected Map textures = new HashMap(); + protected Map customData = new HashMap(); + protected Map> subVariants = new LinkedHashMap>(); + + public CCVariant() { + } + + public CCVariant(CCVariant variant) { + this.model = variant.model; + this.state = variant.state; + this.uvLock = variant.uvLock; + this.smooth = variant.smooth; + this.gui3d = variant.gui3d; + this.weight = variant.weight; + this.textures = new HashMap(variant.textures); + this.customData = new HashMap(customData); + this.subVariants = new LinkedHashMap>(variant.subVariants); + } + + public CCVariant with(CCVariant other) { + if (this.model == null || other.model != null) { + this.model = other.model; + } + + if (other.state.isPresent()) { + this.state = other.state; + } + if (other.uvLock.isPresent()) { + this.uvLock = other.uvLock; + } + if (other.smooth.isPresent()) { + this.smooth = other.smooth; + } + if (other.gui3d.isPresent()) { + this.gui3d = other.gui3d; + } + if (other.weight.isPresent()) { + this.weight = other.weight; + } + HashMap newTextures = new HashMap(); + newTextures.putAll(textures); + newTextures.putAll(other.textures); + this.textures = new LinkedHashMap(newTextures); + HashMap newCustomData = new HashMap(); + newCustomData.putAll(customData); + newCustomData.putAll(other.customData); + this.customData = new LinkedHashMap(newCustomData); + return this; + } + + public List getPossibleVariantNames() { + List variantNames = new ArrayList(); + for (String variantName : subVariants.keySet()) { + variantNames.add(variantName); + for (CCVariant subVariant : subVariants.get(variantName).values()) { + variantNames.addAll(subVariant.getPossibleVariantNames()); + } + } + return variantNames; + } + + public List getPossibleVariantValues(String variant) { + List variantValues = new ArrayList(); + for (String variantName : subVariants.keySet()) { + if (variantName.equals(variant) && subVariants.containsKey(variant)) { + variantValues.addAll(subVariants.get(variant).keySet()); + } + + for (CCVariant subVariant : subVariants.get(variantName).values()) { + variantValues.addAll(subVariant.getPossibleVariantValues(variant)); + } + } + return variantValues; + } + + public CCVariant applySubOverrides(CCVariant parent, Map kvArray) { + CCVariant finalVariant = parent; + for (Entry entry : kvArray.entrySet()) { + for (Entry> variantsEntry : subVariants.entrySet()) { + if (entry.getKey().equals(variantsEntry.getKey())) { + Map variantMap = variantsEntry.getValue(); + if (variantMap.containsKey(entry.getValue())) { + finalVariant = finalVariant.with(variantMap.get(entry.getValue())); + } + } + } + } + + for (Entry entry : kvArray.entrySet()) { + for (Entry> variantsEntry : subVariants.entrySet()) { + if (entry.getKey().equals(variantsEntry.getKey())) { + Map variantMap = variantsEntry.getValue(); + if (variantMap.containsKey(entry.getValue())) { + finalVariant = variantMap.get(entry.getValue()).applySubOverrides(finalVariant, kvArray); + } + } + } + } + return finalVariant; + } + + @Override + public CCVariant copy() { + return new CCVariant(this); + } + + public static class Deserializer implements JsonDeserializer { + + public static ResourceLocation getBlockLocation(String location) { + ResourceLocation tmp = new ResourceLocation(location); + return new ResourceLocation(tmp.getResourceDomain(), "block/" + tmp.getResourcePath()); + } + + @Override + public CCVariant deserialize(JsonElement element, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { + CCVariant variant = new CCVariant(); + JsonObject json = element.getAsJsonObject(); + + if (json.has("model")) { + JsonElement modelElement = json.get("model"); + if (modelElement.isJsonNull()) { + variant.model = null; + } else { + variant.model = getBlockLocation(modelElement.getAsString()); + } + } + + if (json.has("textures")) { + for (Entry entry : json.get("textures").getAsJsonObject().entrySet()) { + if (entry.getValue().isJsonNull()) { + variant.textures.put(entry.getKey(), ""); + } else { + variant.textures.put(entry.getKey(), entry.getValue().getAsString()); + } + } + } + + variant.state = TransformUtils.parseFromJson(json); + + if (json.has("uvlock")) { + variant.uvLock = Optional.of(JsonUtils.getBoolean(json, "uvlock")); + } + + if (json.has("smooth_lighting")) { + variant.smooth = Optional.of(JsonUtils.getBoolean(json, "smooth_lighting")); + } + + if (json.has("gui3d")) { + variant.gui3d = Optional.of(JsonUtils.getBoolean(json, "gui3d")); + } + + if (json.has("weight")) { + variant.weight = Optional.of(JsonUtils.getInt(json, "weight")); + } + + if (json.has("variants")) { + variant.subVariants.putAll(CCBlockStateLoader.parseVariants(json.getAsJsonObject("variants"))); + } + + if (json.has("custom")) { + for (Entry e : json.get("custom").getAsJsonObject().entrySet()) { + if (e.getValue().isJsonNull()) { + variant.customData.put(e.getKey(), null); + } else { + variant.customData.put(e.getKey(), e.getValue().toString()); + } + } + } + + return variant; + } + } + + @Override + public String toString() { + ToStringHelper helper = Objects.toStringHelper("CCVariant"); + helper.add("Model", model); + helper.add("IModelState", state); + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + helper.add("Textures:", gson.toJson(textures, Map.class)); + return helper.toString(); + } +} diff --git a/dependencies/main/java/codechicken/lib/model/cube/CCCubeLoader.java b/dependencies/main/java/codechicken/lib/model/cube/CCCubeLoader.java new file mode 100644 index 0000000000..e8456d2f59 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/cube/CCCubeLoader.java @@ -0,0 +1,29 @@ +package codechicken.lib.model.cube; + +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.ICustomModelLoader; +import net.minecraftforge.client.model.IModel; + +/** + * Created by covers1624 on 19/11/2016. + */ +public class CCCubeLoader implements ICustomModelLoader { + + public static final CCCubeLoader INSTANCE = new CCCubeLoader(); + + @Override + public void onResourceManagerReload(IResourceManager resourceManager) { + } + + @Override + public boolean accepts(ResourceLocation modelLocation) { + String path = modelLocation.getResourcePath(); + return modelLocation.getResourceDomain().equals("ccl") && (path.equals("cube") || path.equals("models/block/cube") || path.equals("models/item/cube")); + } + + @Override + public IModel loadModel(ResourceLocation modelLocation) throws Exception { + return CCModelCube.INSTANCE; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/cube/CCModelCube.java b/dependencies/main/java/codechicken/lib/model/cube/CCModelCube.java new file mode 100644 index 0000000000..47802541dd --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/cube/CCModelCube.java @@ -0,0 +1,158 @@ +package codechicken.lib.model.cube; + +import codechicken.lib.model.BakedModelProperties; +import codechicken.lib.model.bakedmodels.PerspectiveAwareLayeredModelWrapper; +import codechicken.lib.texture.TextureUtils; +import com.google.common.base.Function; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.*; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; + +import java.util.*; +import java.util.Map.Entry; + +/** + * Created by covers1624 on 19/11/2016. + * TODO Document that this exists and what it does to jsons. + */ +public class CCModelCube implements IModel, IRetexturableModel, IModelSimpleProperties { + + public static String[] layerNames = { "solid", "cutout_mipped", "cutout", "translucent" }; + public static Map nameToLayer = new HashMap() { + { + put("solid", BlockRenderLayer.SOLID); + put("cutout_mipped", BlockRenderLayer.CUTOUT_MIPPED); + put("cutout", BlockRenderLayer.CUTOUT); + put("translucent", BlockRenderLayer.TRANSLUCENT); + } + }; + + public static CCModelCube INSTANCE = new CCModelCube(); + + private final ImmutableMap> layerFaceSpriteMap; + private boolean isAO; + private boolean gui3d; + + public CCModelCube() { + this(new HashMap>()); + } + + public CCModelCube(Map> layerFaceSpriteMap) { + this.layerFaceSpriteMap = ImmutableMap.copyOf(layerFaceSpriteMap); + } + + @Override + public Collection getDependencies() { + return Collections.singletonList(new ResourceLocation("minecraft:block/cube")); + } + + @Override + public Collection getTextures() { + List textures = new ArrayList(); + for (Entry> layerEnrty : layerFaceSpriteMap.entrySet()) { + for (Entry faceEntry : layerEnrty.getValue().entrySet()) { + textures.add(new ResourceLocation(faceEntry.getValue())); + } + } + return ImmutableList.copyOf(textures); + } + + @Override + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { + + Map layerModelMap = new HashMap(); + TextureAtlasSprite particle = TextureUtils.getMissingSprite(); + for (Entry> layerEntry : layerFaceSpriteMap.entrySet()) { + Map kvTextures = new HashMap(); + for (Entry faceEntry : layerEntry.getValue().entrySet()) { + if (faceEntry.getKey() == null) { + kvTextures.put("particle", faceEntry.getValue()); + } else { + kvTextures.put(faceEntry.getKey().getName(), faceEntry.getValue()); + } + } + IModel vanillaModel = ModelLoaderRegistry.getModelOrLogError(new ResourceLocation("minecraft:block/cube"), "Unable to get vanilla model wrapper.."); + vanillaModel = ModelProcessingHelper.retexture(vanillaModel, ImmutableMap.copyOf(addMissing(kvTextures))); + IBakedModel model = vanillaModel.bake(state, format, bakedTextureGetter); + + if (layerEntry.getKey() == BlockRenderLayer.SOLID) { + particle = model.getParticleTexture(); + } + + layerModelMap.put(layerEntry.getKey(), model); + } + + return new PerspectiveAwareLayeredModelWrapper(layerModelMap, state, new BakedModelProperties(isAO, gui3d, particle)); + } + + private static Map addMissing(Map textures) { + Map newTextures = new HashMap(textures); + for (EnumFacing face : EnumFacing.VALUES) { + if (!textures.containsKey(face.getName())) { + newTextures.put("#" + face.getName(), ""); + } + } + return newTextures; + } + + @Override + public IModelState getDefaultState() { + return TRSRTransformation.identity(); + } + + @Override + public IModel retexture(ImmutableMap textures) { + Map> layerFaceSpriteMap = new HashMap>(); + + for (Entry entry : textures.entrySet()) { + EnumFacing face = getFaceForKey(entry.getKey()); + BlockRenderLayer layer = getLayerForTexKey(entry.getKey()); + Map faceMap = layerFaceSpriteMap.get(layer); + if (faceMap == null) { + faceMap = new HashMap(); + layerFaceSpriteMap.put(layer, faceMap); + } + faceMap.put(face, entry.getValue()); + } + + return new CCModelCube(layerFaceSpriteMap); + } + + private static BlockRenderLayer getLayerForTexKey(String key) { + String layerName = "solid"; + for (String l : layerNames) { + if (key.endsWith(l)) { + layerName = l; + } + } + return nameToLayer.get(layerName); + } + + public static EnumFacing getFaceForKey(String key) { + String faceName = key; + if (key.contains("_")) { + faceName = key.substring(0, key.indexOf("_")); + } + return EnumFacing.byName(faceName); + } + + @Override + public IModel smoothLighting(boolean value) { + this.isAO = value; + return this; + } + + @Override + public IModel gui3d(boolean value) { + this.gui3d = value; + return this; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/loader/CCBakedModelLoader.java b/dependencies/main/java/codechicken/lib/model/loader/CCBakedModelLoader.java new file mode 100644 index 0000000000..525a0fa553 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/loader/CCBakedModelLoader.java @@ -0,0 +1,215 @@ +package codechicken.lib.model.loader; + +import codechicken.lib.model.loader.IBakedModelLoader.IModKeyProvider; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import codechicken.lib.thread.RestartableTask; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import com.google.common.collect.ImmutableList; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.LoaderState; +import org.apache.logging.log4j.Level; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; +import java.util.concurrent.Callable; +import java.util.concurrent.TimeUnit; + +/** + * Created by covers1624 on 7/25/2016. + * This is a flexible IBakedModel loader, It runs off IBakedModelLoaders and IModKeyProviders. + * When getModel(ItemStack) is called it will first try and obtain a IModKeyProvider, If no KeyProvider is found then it returns a null model. + * It then calls IModKeyProvider.createKey(ItemStack) if this returns null a null model is returned. + * It will then check the cache for a key -> IBakedModel reference, if the cache contains a model it is returned otherwise it bakes a model using IBakedModelLoader. + *

+ * To use this call registerLoader(IBakedModelLoader) from PRE INIT! + * //TODO This system needs to be scrapped for the new BlockBakery system that was newly implemented. + */ +@Deprecated +public class CCBakedModelLoader implements IIconRegister, IResourceManagerReloadListener { + + public static final CCBakedModelLoader INSTANCE = new CCBakedModelLoader(); + + //TODO use cache factories. + private static final Cache modelCache = CacheBuilder.newBuilder().expireAfterAccess(30, TimeUnit.MINUTES).build(); + private static final Map modelBakeQue = new HashMap(); + + private static final ModelBakeTask bakingTask = new ModelBakeTask(); + + private static final Map modKeyProviders = new HashMap(); + private static final Map modelLoaders = new HashMap(); + + static { + TextureUtils.addIconRegister(INSTANCE); + TextureUtils.registerReloadListener(INSTANCE); + } + + /** + * Registers a IModKeyProvider and IBakedModelLoader. + * + * @param loader Registers a loader. + */ + public static void registerLoader(IBakedModelLoader loader) { + if (Loader.instance().hasReachedState(LoaderState.INITIALIZATION)) { + throw new RuntimeException("Unable to register IBakedModelLoader after Pre Initialization! Please register as the first thing you do in Pre Init!"); + } + if (modelLoaders.containsValue(loader)) { + throw new RuntimeException("Unable to register IBakedModelLoader as it has already been registered!"); + } + + IModKeyProvider provider = loader.createKeyProvider(); + FMLLog.log("CodeChicken Lib", Level.INFO, "Registered loader for mod: %s", provider.getMod()); + modelLoaders.put(provider, loader); + modKeyProviders.put(provider.getMod(), provider); + } + + @Override + public void registerIcons(TextureMap textureMap) { + for (ResourceLocation location : getTextures()) { + textureMap.registerSprite(location); + } + } + + @Override + public void onResourceManagerReload(IResourceManager resourceManager) { + modelCache.invalidateAll(); + } + + public static void clearCache() { + synchronized (modelCache) { + modelCache.invalidateAll(); + } + } + + private static Collection getTextures() { + ImmutableList.Builder builder = ImmutableList.builder(); + for (IBakedModelLoader loader : modelLoaders.values()) { + loader.addTextures(builder); + } + return builder.build(); + } + + public static synchronized IBakedModel getModel(IBlockState state) { + if (state.getBlock() == null || state.getBlock().getRegistryName() == null) { + return null; + } + ResourceLocation location = state.getBlock().getRegistryName(); + final IModKeyProvider provider = modKeyProviders.get(location.getResourceDomain()); + if (provider == null) { + FMLLog.bigWarning("Unable to find IModKeyProvider for domain %s!", location.getResourceDomain()); + return null; + } + final String key = provider.createKey(state); + if (key == null) { + return null; + } + String mapKey = location.toString() + "|" + key; + synchronized (modelCache) { + try { + return modelCache.get(mapKey, new Callable() { + @Override + public IBakedModel call() throws Exception { + return modelLoaders.get(provider).bakeModel(key); + } + }); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + } + + /** + * Call this from ItemOverrideList.handleItemState() + * + * @param stack The ItemStack to attempt to obtain a model for. + * @return The baked model if it can be found/generated, else null. + */ + public static synchronized IBakedModel getModel(ItemStack stack) { + if (stack.getItem() == null || stack.getItem().getRegistryName() == null) { + return null; + } + ResourceLocation location = stack.getItem().getRegistryName(); + IModKeyProvider provider = modKeyProviders.get(location.getResourceDomain()); + if (provider == null) { + FMLLog.bigWarning("Unable to find IModKeyProvider for domain %s!", location.getResourceDomain()); + return null; + } + String key = provider.createKey(stack); + if (key == null) { + return null; + } + String mapKey = location.toString() + "|" + key; + synchronized (modelCache) { + if (modelCache.getIfPresent(mapKey) == null) { + if (modelBakeQue.containsKey(mapKey)) { + return null; + } else { + bakingTask.stop(); + synchronized (modelBakeQue) { + modelBakeQue.put(mapKey, provider); + } + bakingTask.restart(); + } + } + return modelCache.getIfPresent(mapKey); + } + } + + public static class ModelBakeTask extends RestartableTask { + + public ModelBakeTask() { + super("CodeChicken Lib Dynamic model baking"); + } + + @Override + public void execute() { + Map localQue; + synchronized (modelBakeQue) { + localQue = new HashMap(modelBakeQue); + } + Iterator> queIterator = localQue.entrySet().iterator(); + while (queIterator.hasNext()) { + if (interrupted()) { + return; + } + Entry entry = queIterator.next(); + try { + IBakedModelLoader loader = modelLoaders.get(entry.getValue()); + String key = stripMapHeader(entry.getKey()); + IBakedModel model = loader.bakeModel(key); + queIterator.remove(); + + if (model != null) { + synchronized (modelCache) { + modelCache.put(entry.getKey(), model); + } + } + } catch (Exception e) { + FMLLog.log("CodeChickenLib Dyn Model baking", Level.FATAL, e, "A fatal exception has occurred whilst baking a model with key: %s", entry.getKey()); + } finally { + synchronized (modelBakeQue) { + modelBakeQue.remove(entry.getKey()); + } + } + } + } + + private static String stripMapHeader(String mapKey) { + int firstPipe = mapKey.indexOf('|'); + return mapKey.substring(firstPipe + 1); + } + } +} diff --git a/dependencies/main/java/codechicken/lib/model/loader/IBakedModelLoader.java b/dependencies/main/java/codechicken/lib/model/loader/IBakedModelLoader.java new file mode 100644 index 0000000000..4a6a3ebab7 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/loader/IBakedModelLoader.java @@ -0,0 +1,77 @@ +package codechicken.lib.model.loader; + +import com.google.common.collect.ImmutableList; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; + +/** + * Created by covers1624 on 7/25/2016. + *

+ * This defines a sub bakery of CCBakedModelLoader + * See EnderStorage's EnderStorageBakedModelProvider for a "Default" implementation. + */ +@Deprecated +public interface IBakedModelLoader { + + /** + * This defines a Mod Key provider. + */ + @Deprecated + interface IModKeyProvider { + + /** + * Gets the mod to operate for. + * + * @return The mod id used in your Item.setRegistryName() CAPS SENSITIVE. + */ + String getMod(); + + /** + * Creates a unique key for your item that you can use to create models for. + * Return something like "key1=value1,key2=value2,key3=value3" but can realistically be what ever you want. + * + * @param stack Stack to create a key for. + * @return The key created, null if the item is not supported. + */ + String createKey(ItemStack stack); + + /** + * Creates a unique key for your BlockState that you can use to create models for. + * Return something like "key1=value1,key2=value2,key3=value3" but can realistically be what ever you want. + *

+ * This should be used to create a key for the BlockState, handle the face culling in the model you return! + * + * @param state IBlockState to create a key for. + * @return The key created, null if IBlockState is not supported. + */ + String createKey(IBlockState state); + } + + /** + * Used to associate a IModKeyProvider with a IBakedModelLoader. + * + * @return Your key provider. + */ + IModKeyProvider createKeyProvider(); + + /** + * Any textures you want added to the texture map. + * + * @param builder The Builder to add textures to. + */ + void addTextures(ImmutableList.Builder builder); + + /** + * Uses the key provided from the IModKeyProvider to bake a model from your unique key. + * Form your key you should have some sort of indication of what exactly you are baking. + *

+ * If it is a "In World" model then it can just be a simple wrapper as the override model just calls getQuads. + * + * @param key Your Unique key. + * @return The baked model created, null if it cannot for some reason. + */ + IBakedModel bakeModel(String key); + +} diff --git a/dependencies/main/java/codechicken/lib/model/modelbase/CCModelBase.java b/dependencies/main/java/codechicken/lib/model/modelbase/CCModelBase.java new file mode 100644 index 0000000000..9417a8f710 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/modelbase/CCModelBase.java @@ -0,0 +1,74 @@ +package codechicken.lib.model.modelbase; + +import codechicken.lib.render.CCModel; +import codechicken.lib.vec.uv.UV; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; + +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Random; + +/** + * Created by covers1624 on 8/24/2016. + * TODO, instead of just copying how vanillas works, create a wrapper that pulls data from existing ModelBases and allows some sort of Animation callback. + */ +public abstract class CCModelBase { + + public float swingProgress; + public boolean isRiding; + public boolean isChild = true; + public List boxList = Lists.newArrayList(); + private final Map modelTextureMap = Maps.newHashMap(); + public int textureWidth = 64; + public int textureHeight = 32; + + public CCModelRenderer getRandomModelBox(Random rand) { + return this.boxList.get(rand.nextInt(this.boxList.size())); + } + + protected void setTextureOffset(String partName, int x, int y) { + this.modelTextureMap.put(partName, new UV(x, y)); + } + + public UV getTextureOffset(String partName) { + return this.modelTextureMap.get(partName); + } + + public static void copyModelAngles(CCModelRenderer source, CCModelRenderer dest) { + dest.rotateAngleX = source.rotateAngleX; + dest.rotateAngleY = source.rotateAngleY; + dest.rotateAngleZ = source.rotateAngleZ; + dest.rotationPointX = source.rotationPointX; + dest.rotationPointY = source.rotationPointY; + dest.rotationPointZ = source.rotationPointZ; + } + + public void setModelAttributes(CCModelBase model) { + this.swingProgress = model.swingProgress; + this.isRiding = model.isRiding; + this.isChild = model.isChild; + } + + public static void renderModels(float scale, VertexBuffer buffer, TextureAtlasSprite sprite, CCModelRenderer... modelRenders) { + LinkedList models = new LinkedList(); + for (CCModelRenderer modelRenderer : modelRenders) { + models.add(modelRenderer.bake(scale)); + } + CCModel model = CCModel.combine(models); + + //TODO + //CCRenderState.bind(buffer); + //boolean startDrawing = !CCRenderState.isDrawing(); + //if (startDrawing) { + // CCRenderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); + //} + //model.render(); + //if (startDrawing) { + // CCRenderState.draw(); + //} + } +} diff --git a/dependencies/main/java/codechicken/lib/model/modelbase/CCModelBox.java b/dependencies/main/java/codechicken/lib/model/modelbase/CCModelBox.java new file mode 100644 index 0000000000..5b0ffde5e1 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/modelbase/CCModelBox.java @@ -0,0 +1,130 @@ +package codechicken.lib.model.modelbase; + +import codechicken.lib.colour.Colour; +import codechicken.lib.colour.ColourRGBA; +import codechicken.lib.model.bakery.CCQuad; +import codechicken.lib.vec.Vertex5; + +/** + * Created by covers1624 on 8/24/2016. + * TODO CCModel. + */ +public class CCModelBox { + + private final CCQuad[] quads; + public final float posX1; + public final float posY1; + public final float posZ1; + public final float posX2; + public final float posY2; + public final float posZ2; + public String boxName; + + public CCModelBox(CCModelRenderer renderer, int textureX, int textureY, float xOffset, float yOffset, float zOffset, int width, int height, int depth, float scaleFactor) { + this(renderer, textureX, textureY, xOffset, yOffset, zOffset, width, height, depth, scaleFactor, renderer.mirror); + } + + public CCModelBox(CCModelRenderer renderer, int textureX, int textureY, float xOffset, float yOffset, float zOffset, int width, int height, int depth, float scaleFactor, boolean mirrored) { + + this.posX1 = xOffset; + this.posY1 = yOffset; + this.posZ1 = zOffset; + this.posX2 = xOffset + (float) width; + this.posY2 = yOffset + (float) height; + this.posZ2 = zOffset + (float) depth; + this.quads = new CCQuad[6]; + float f = xOffset + (float) width; + float f1 = yOffset + (float) height; + float f2 = zOffset + (float) depth; + xOffset = xOffset - scaleFactor; + yOffset = yOffset - scaleFactor; + zOffset = zOffset - scaleFactor; + f = f + scaleFactor; + f1 = f1 + scaleFactor; + f2 = f2 + scaleFactor; + + if (mirrored) { + float f3 = f; + f = xOffset; + xOffset = f3; + } + Vertex5[] verts = new Vertex5[8]; + verts[0] = new Vertex5(xOffset, yOffset, zOffset, 0.0F, 0.0F); + verts[1] = new Vertex5(f, yOffset, zOffset, 0.0F, 8.0F); + verts[2] = new Vertex5(f, f1, zOffset, 8.0F, 8.0F); + verts[3] = new Vertex5(xOffset, f1, zOffset, 8.0F, 0.0F); + verts[4] = new Vertex5(xOffset, yOffset, f2, 0.0F, 0.0F); + verts[5] = new Vertex5(f, yOffset, f2, 0.0F, 8.0F); + verts[6] = new Vertex5(f, f1, f2, 8.0F, 8.0F); + verts[7] = new Vertex5(xOffset, f1, f2, 8.0F, 0.0F); + quads[0] = setTextureCoords(new CCQuad(verts[5], verts[1], verts[2], verts[6]), textureX + depth + width, textureY + depth, textureX + depth + width + depth, textureY + depth + height, renderer.textureWidth, renderer.textureHeight); + quads[1] = setTextureCoords(new CCQuad(verts[0], verts[4], verts[7], verts[3]), textureX, textureY + depth, textureX + depth, textureY + depth + height, renderer.textureWidth, renderer.textureHeight); + quads[2] = setTextureCoords(new CCQuad(verts[5], verts[4], verts[0], verts[1]), textureX + depth, textureY, textureX + depth + width, textureY + depth, renderer.textureWidth, renderer.textureHeight); + quads[3] = setTextureCoords(new CCQuad(verts[2], verts[3], verts[7], verts[6]), textureX + depth + width, textureY + depth, textureX + depth + width + width, textureY, renderer.textureWidth, renderer.textureHeight); + quads[4] = setTextureCoords(new CCQuad(verts[1], verts[0], verts[3], verts[2]), textureX + depth, textureY + depth, textureX + depth + width, textureY + depth + height, renderer.textureWidth, renderer.textureHeight); + quads[5] = setTextureCoords(new CCQuad(verts[4], verts[5], verts[6], verts[7]), textureX + depth + width + depth, textureY + depth, textureX + depth + width + depth + width, textureY + depth + height, renderer.textureWidth, renderer.textureHeight); + for (CCQuad quad : quads) { + quad.computeNormals(); + fillQuadData(quad); + if (mirrored) { + flipQuad(quad); + } + } + } + + private CCQuad setTextureCoords(CCQuad quad, int texCoordU1, int texCoordV1, int texCoordU2, int texCoordV2, double textureWidth, double textureHeight) { + double f = 0.0D / textureWidth; + double f1 = 0.0D / textureHeight; + quad.vertices[0].uv.set(texCoordU2 / textureWidth - f, texCoordV1 / textureHeight + f1); + quad.vertices[1].uv.set(texCoordU1 / textureWidth + f, texCoordV1 / textureHeight + f1); + quad.vertices[2].uv.set(texCoordU1 / textureWidth + f, texCoordV2 / textureHeight - f1); + quad.vertices[2].uv.set(texCoordU2 / textureWidth - f, texCoordV2 / textureHeight - f1); + return quad; + } + + private CCQuad fillQuadData(CCQuad quad) { + Colour[] colours = new Colour[quad.colours.length]; + for (int i = 0; i < quad.colours.length; i++) { + Colour colour = quad.colours[i]; + if (colour == null) { + colour = new ColourRGBA(0xFFFFFFFF); + } + colours[i] = colour; + } + quad.colours = colours; + + Integer[] lightMaps = new Integer[quad.lightMaps.length]; + for (int i = 0; i < quad.lightMaps.length; i++) { + Integer lightMap = quad.lightMaps[i]; + if (lightMap == null) { + lightMap = 0; + } + lightMaps[i] = lightMap; + } + quad.lightMaps = lightMaps; + return quad; + } + + public CCQuad flipQuad(CCQuad quad) { + Vertex5[] verts = new Vertex5[4]; + verts[0] = quad.vertices[3]; + verts[1] = quad.vertices[2]; + verts[2] = quad.vertices[1]; + verts[3] = quad.vertices[0]; + quad.vertices = verts; + return quad; + } + + public CCQuad[] getQuads() { + CCQuad[] quads = new CCQuad[this.quads.length]; + for (int i = 0; i < quads.length; i++) { + quads[i] = this.quads[i].copy(); + } + return quads; + } + + public CCModelBox setBoxName(String name) { + this.boxName = name; + return this; + } +} diff --git a/dependencies/main/java/codechicken/lib/model/modelbase/CCModelRenderer.java b/dependencies/main/java/codechicken/lib/model/modelbase/CCModelRenderer.java new file mode 100644 index 0000000000..b2cdf5af7e --- /dev/null +++ b/dependencies/main/java/codechicken/lib/model/modelbase/CCModelRenderer.java @@ -0,0 +1,279 @@ +package codechicken.lib.model.modelbase; + +import codechicken.lib.model.bakery.CCQuad; +import codechicken.lib.render.CCModel; +import codechicken.lib.vec.*; +import codechicken.lib.vec.uv.UV; +import com.google.common.collect.Lists; +import net.minecraft.client.renderer.VertexBuffer; +import org.lwjgl.opengl.GL11; + +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; + +/** + * Created by covers1624 on 8/24/2016. + * A ModelRenderer that is compatible with FastTESR's. + * TODO See CCModelBase's comment, + */ +public class CCModelRenderer { + + public float textureWidth; + public float textureHeight; + private int textureOffsetX; + private int textureOffsetY; + public float rotationPointX; + public float rotationPointY; + public float rotationPointZ; + public float rotateAngleX; + public float rotateAngleY; + public float rotateAngleZ; + public boolean mirror; + public boolean showModel; + public boolean isHidden; + + private CCModel compiledModel; + public boolean compiled; + + public List cubeList; + public List childModels; + public final String boxName; + private final CCModelBase baseModel; + public float offsetX; + public float offsetY; + public float offsetZ; + + public CCModelRenderer(CCModelBase model, String boxNameIn) { + this.textureWidth = 64.0F; + this.textureHeight = 32.0F; + this.showModel = true; + this.cubeList = Lists.newArrayList(); + this.baseModel = model; + model.boxList.add(this); + this.boxName = boxNameIn; + this.setTextureSize(model.textureWidth, model.textureHeight); + } + + public CCModelRenderer(CCModelBase model) { + this(model, null); + } + + public CCModelRenderer(CCModelBase model, int texOffX, int texOffY) { + this(model); + this.setTextureOffset(texOffX, texOffY); + } + + public void addChild(CCModelRenderer renderer) { + if (this.childModels == null) { + this.childModels = Lists.newArrayList(); + } + + this.childModels.add(renderer); + } + + public CCModelRenderer setTextureOffset(int x, int y) { + this.textureOffsetX = x; + this.textureOffsetY = y; + return this; + } + + public CCModelRenderer addBox(String partName, float offX, float offY, float offZ, int width, int height, int depth) { + partName = this.boxName + "." + partName; + UV textureOffset = this.baseModel.getTextureOffset(partName); + this.setTextureOffset((int) textureOffset.u, (int) textureOffset.v); + this.cubeList.add((new CCModelBox(this, this.textureOffsetX, this.textureOffsetY, offX, offY, offZ, width, height, depth, 0.0F)).setBoxName(partName)); + return this; + } + + public CCModelRenderer addBox(float offX, float offY, float offZ, int width, int height, int depth) { + this.cubeList.add(new CCModelBox(this, this.textureOffsetX, this.textureOffsetY, offX, offY, offZ, width, height, depth, 0.0F)); + return this; + } + + public CCModelRenderer addBox(float offX, float offY, float offZ, int width, int height, int depth, boolean mirrored) { + this.cubeList.add(new CCModelBox(this, this.textureOffsetX, this.textureOffsetY, offX, offY, offZ, width, height, depth, 0.0F, mirrored)); + return this; + } + + public void addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) { + this.cubeList.add(new CCModelBox(this, this.textureOffsetX, this.textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor)); + } + + public void setRotationPoint(float rotationPointXIn, float rotationPointYIn, float rotationPointZIn) { + this.rotationPointX = rotationPointXIn; + this.rotationPointY = rotationPointYIn; + this.rotationPointZ = rotationPointZIn; + } + + public void render(float scale, VertexBuffer buffer) { + //TODO + //CCRenderState.bind(buffer); + //boolean startDrawing = !CCRenderState.isDrawing(); + //if (startDrawing) { + // CCRenderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); + //} + //bake(scale).render(); + //if (startDrawing) { + // CCRenderState.draw(); + //} + } + + public CCModel bake(float scale) { + if (!this.isHidden) { + if (this.showModel) { + if (!this.compiled) { + this.compileModel(scale); + } + LinkedList transforms = new LinkedList(); + LinkedList finalModelElements = new LinkedList(); + transforms.add(new Translation(offsetX, offsetY, offsetZ)); + //GlStateManager.translate(this.offsetX, this.offsetY, this.offsetZ); + + if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { + if (this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F) { + //GlStateManager.callList(this.displayList); + finalModelElements.add(compiledModel.copy()); + if (this.childModels != null) { + for (CCModelRenderer modelRenderer : childModels) { + finalModelElements.add(modelRenderer.bake(scale).copy()); + } + } + } else { + transforms.add(new Translation(rotationPointX * scale, rotationPointY * scale, rotationPointZ * scale)); + //GlStateManager.translate(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + //GlStateManager.callList(this.displayList); + finalModelElements.add(compiledModel.copy()); + + if (this.childModels != null) { + for (CCModelRenderer modelRenderer : childModels) { + finalModelElements.add(modelRenderer.bake(scale).copy()); + } + } + + //GlStateManager.translate(-this.rotationPointX * scale, -this.rotationPointY * scale, -this.rotationPointZ * scale); + } + } else { + //GlStateManager.pushMatrix(); + //GlStateManager.translate(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + transforms.add(new Translation(rotationPointX * scale, rotationPointY * scale, rotationPointZ * scale)); + + if (this.rotateAngleZ != 0.0F) { + transforms.add(new Rotation(rotateAngleZ, new Vector3(0, 0, 1).normalize())); + //GlStateManager.rotate(this.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F); + } + + if (this.rotateAngleY != 0.0F) { + transforms.add(new Rotation(rotateAngleY, new Vector3(0, 1, 0).normalize())); + //GlStateManager.rotate(this.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F); + } + + if (this.rotateAngleX != 0.0F) { + transforms.add(new Rotation(rotateAngleZ, new Vector3(1, 0, 0).normalize())); + //GlStateManager.rotate(this.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F); + } + finalModelElements.add(compiledModel.copy()); + //GlStateManager.callList(this.displayList); + + if (this.childModels != null) { + for (CCModelRenderer modelRenderer : childModels) { + finalModelElements.add(modelRenderer.bake(scale).copy()); + } + } + + //GlStateManager.popMatrix(); + } + + //GlStateManager.translate(-this.offsetX, -this.offsetY, -this.offsetZ); + return CCModel.combine(finalModelElements).apply(new TransformationList(transforms.toArray(new Transformation[transforms.size()]))); + } + } + return CCModel.newModel(GL11.GL_QUADS); + } + + /*public void renderWithRotation(float scale, VertexBuffer buffer) { + if (!this.isHidden) { + if (this.showModel) { + if (!this.compiled) { + this.compileModel(scale, buffer.getVertexFormat()); + } + + GlStateManager.pushMatrix(); + GlStateManager.translate(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + + if (this.rotateAngleY != 0.0F) { + GlStateManager.rotate(this.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F); + } + + if (this.rotateAngleX != 0.0F) { + GlStateManager.rotate(this.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F); + } + + if (this.rotateAngleZ != 0.0F) { + GlStateManager.rotate(this.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F); + } + + GlStateManager.callList(this.displayList); + GlStateManager.popMatrix(); + } + } + }*/ + + //@SideOnly(Side.CLIENT) + /*public void postRender(float scale, VertexBuffer buffer) { + if (!this.isHidden) { + if (this.showModel) { + if (!this.compiled) { + this.compileModel(scale, buffer.getVertexFormat()); + } + + if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { + if (this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F) { + GlStateManager.translate(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + } + } else { + GlStateManager.translate(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + + if (this.rotateAngleZ != 0.0F) { + GlStateManager.rotate(this.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F); + } + + if (this.rotateAngleY != 0.0F) { + GlStateManager.rotate(this.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F); + } + + if (this.rotateAngleX != 0.0F) { + GlStateManager.rotate(this.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F); + } + } + } + } + }*/ + + private CCModel compileModel(float scale) { + if (compiled) { + return compiledModel; + } + + CCModel model = CCModel.newModel(GL11.GL_QUADS); + LinkedList vertices = new LinkedList(); + for (CCModelBox box : cubeList) { + for (CCQuad quad : box.getQuads()) { + Collections.addAll(vertices, quad.vertices); + } + } + model.verts = vertices.toArray(new Vertex5[vertices.size()]); + model.computeNormals(); + + compiledModel = model.copy().apply(new Scale(scale)); + + this.compiled = true; + return compiledModel; + } + + public CCModelRenderer setTextureSize(int textureWidthIn, int textureHeightIn) { + this.textureWidth = (float) textureWidthIn; + this.textureHeight = (float) textureHeightIn; + return this; + } +} diff --git a/dependencies/main/java/codechicken/lib/packet/ICustomPacketTile.java b/dependencies/main/java/codechicken/lib/packet/ICustomPacketTile.java index 9bf9e033a2..a760696f20 100644 --- a/dependencies/main/java/codechicken/lib/packet/ICustomPacketTile.java +++ b/dependencies/main/java/codechicken/lib/packet/ICustomPacketTile.java @@ -1,5 +1,12 @@ package codechicken.lib.packet; +import codechicken.lib.data.MCDataInput; +import codechicken.lib.data.MCDataOutput; + public interface ICustomPacketTile { - public void handleDescriptionPacket(PacketCustom packet); + + void writeToPacket(MCDataOutput packet); + + void readFromPacket(MCDataInput packet); + } diff --git a/dependencies/main/java/codechicken/lib/packet/PacketCustom.java b/dependencies/main/java/codechicken/lib/packet/PacketCustom.java index 2357bc6f64..8301937e46 100644 --- a/dependencies/main/java/codechicken/lib/packet/PacketCustom.java +++ b/dependencies/main/java/codechicken/lib/packet/PacketCustom.java @@ -1,9 +1,7 @@ package codechicken.lib.packet; +import codechicken.lib.data.MCDataHandler; import codechicken.lib.data.MCDataIO; -import codechicken.lib.data.MCDataInput; -import codechicken.lib.data.MCDataOutput; -import codechicken.lib.vec.BlockCoord; import com.google.common.collect.Maps; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; @@ -24,8 +22,12 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.network.play.INetHandlerPlayClient; import net.minecraft.network.play.INetHandlerPlayServer; +import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.server.MinecraftServer; -import net.minecraft.server.management.PlayerManager.PlayerInstance; +import net.minecraft.server.management.PlayerChunkMapEntry; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.fluids.FluidStack; @@ -42,26 +44,30 @@ import java.io.IOException; import java.util.EnumMap; -import java.util.List; import java.util.zip.Deflater; import java.util.zip.Inflater; -public final class PacketCustom extends PacketBuffer implements MCDataInput, MCDataOutput { - public static interface ICustomPacketHandler { +public final class PacketCustom extends PacketBuffer implements MCDataHandler { + + public interface ICustomPacketHandler { + } public interface IClientPacketHandler extends ICustomPacketHandler { - public void handlePacket(PacketCustom packetCustom, Minecraft mc, INetHandlerPlayClient handler); + + void handlePacket(PacketCustom packetCustom, Minecraft mc, INetHandlerPlayClient handler); } public interface IServerPacketHandler extends ICustomPacketHandler { - public void handlePacket(PacketCustom packetCustom, EntityPlayerMP sender, INetHandlerPlayServer handler); + + void handlePacket(PacketCustom packetCustom, EntityPlayerMP sender, INetHandlerPlayServer handler); } public static AttributeKey cclHandler = new AttributeKey("ccl:handler"); @ChannelHandler.Sharable public static class CustomInboundHandler extends SimpleChannelInboundHandler { + public EnumMap handlers = Maps.newEnumMap(Side.class); @Override @@ -76,11 +82,13 @@ protected void channelRead0(ChannelHandlerContext ctx, FMLProxyPacket msg) throw } } - private static interface CustomHandler { - public void handle(INetHandler handler, String channel, PacketCustom packet); + private interface CustomHandler { + + void handle(INetHandler handler, String channel, PacketCustom packet); } public static class ClientInboundHandler implements CustomHandler { + private IClientPacketHandler handler; public ClientInboundHandler(ICustomPacketHandler handler) { @@ -107,6 +115,7 @@ public void run() { } public static class ServerInboundHandler implements CustomHandler { + private IServerPacketHandler handler; public ServerInboundHandler(ICustomPacketHandler handler) { @@ -116,7 +125,7 @@ public ServerInboundHandler(ICustomPacketHandler handler) { @Override public void handle(final INetHandler netHandler, final String channel, final PacketCustom packet) { if (netHandler instanceof NetHandlerPlayServer) { - MinecraftServer mc = MinecraftServer.getServer(); + MinecraftServer mc = FMLCommonHandler.instance().getMinecraftServerInstance(); if (!mc.isCallingFromMinecraftThread()) { mc.addScheduledTask(new Runnable() { public void run() { @@ -132,11 +141,13 @@ public void run() { } } - public static interface IHandshakeHandler { - public void handshakeRecieved(NetHandlerPlayServer netHandler); + public interface IHandshakeHandler { + + void handshakeReceived(NetHandlerPlayServer netHandler); } public static class HandshakeInboundHandler extends ChannelInboundHandlerAdapter { + public IHandshakeHandler handler; public HandshakeInboundHandler(IHandshakeHandler handler) { @@ -148,7 +159,7 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exc if (evt instanceof NetworkHandshakeEstablished) { INetHandler netHandler = ((NetworkDispatcher) ctx.channel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).get()).getNetHandler(); if (netHandler instanceof NetHandlerPlayServer) { - handler.handshakeRecieved((NetHandlerPlayServer) netHandler); + handler.handshakeReceived((NetHandlerPlayServer) netHandler); } } else { ctx.fireUserEventTriggered(evt); @@ -225,12 +236,13 @@ public PacketCustom(Object channelKey, int type) { private void decompress() { Inflater inflater = new Inflater(); try { - int len = readInt(); + int len = readVarInt(); byte[] out = new byte[len]; inflater.setInput(array(), readerIndex(), readableBytes()); inflater.inflate(out); clear(); - writeByteArray(out); + writeArray(out); + } catch (Exception e) { throw new EncoderException(e); } finally { @@ -257,7 +269,7 @@ private void do_compress() { clear(); writeByte(type | 0x80); writeVarInt(len); - writeByteArray(out); + writeArray(out); } catch (Exception e) { throw new EncoderException(e); } finally { @@ -285,36 +297,43 @@ public PacketCustom compress() { return this; } + @Override public PacketCustom writeBoolean(boolean b) { super.writeBoolean(b); return this; } + @Override public PacketCustom writeByte(int b) { super.writeByte(b); return this; } + @Override public PacketCustom writeShort(int s) { super.writeShort(s); return this; } + @Override public PacketCustom writeInt(int i) { super.writeInt(i); return this; } + @Override public PacketCustom writeFloat(float f) { super.writeFloat(f); return this; } + @Override public PacketCustom writeDouble(double d) { super.writeDouble(d); return this; } + @Override public PacketCustom writeLong(long l) { super.writeLong(l); return this; @@ -326,50 +345,62 @@ public PacketCustom writeChar(char c) { return this; } + @Override + public PacketCustom writeVarInt(int i) { writeVarIntToBuffer(i); return this; } + @Override public PacketCustom writeVarShort(int s) { MCDataIO.writeVarShort(this, s); return this; } + @Override public PacketCustom writeArray(byte[] barray) { writeBytes(barray); return this; } + @Override public PacketCustom writeString(String s) { super.writeString(s); return this; } - public PacketCustom writeCoord(int x, int y, int z) { - writeInt(x); - writeInt(y); - writeInt(z); + public PacketCustom writeLocation(ResourceLocation loc) { + writeString(loc.toString()); return this; } - public PacketCustom writeCoord(BlockCoord coord) { - writeInt(coord.x); - writeInt(coord.y); - writeInt(coord.z); + @Override + public PacketCustom writePos(BlockPos pos) { + writeInt(pos.getX()); + writeInt(pos.getY()); + writeInt(pos.getZ()); return this; } + @Override + public PacketCustom writeBlockPos(BlockPos pos) { + return writePos(pos); + } + + @Override public PacketCustom writeItemStack(ItemStack stack) { MCDataIO.writeItemStack(this, stack); return this; } + @Override public PacketCustom writeNBTTagCompound(NBTTagCompound tag) { writeNBTTagCompoundToBuffer(tag); return this; } + @Override public PacketCustom writeFluidStack(FluidStack fluid) { MCDataIO.writeFluidStack(this, fluid); return this; @@ -393,22 +424,37 @@ public int readVarInt() { return readVarIntFromBuffer(); } - public BlockCoord readCoord() { - return new BlockCoord(readInt(), readInt(), readInt()); + @Override + public BlockPos readPos() { + return new BlockPos(readInt(), readInt(), readInt()); } + @Override + public BlockPos readBlockPos() { + return readPos(); + } + + @Override public byte[] readArray(int length) { return readBytes(length).array(); } + @Override public String readString() { return readStringFromBuffer(32767); } + //TODO 1.11 pull to MC data in / out. + public ResourceLocation readLocation() { + return new ResourceLocation(readString()); + } + + @Override public ItemStack readItemStack() { return MCDataIO.readItemStack(this); } + @Override public NBTTagCompound readNBTTagCompound() { try { return readNBTTagCompoundFromBuffer(); @@ -417,6 +463,7 @@ public NBTTagCompound readNBTTagCompound() { } } + @Override public FluidStack readFluidStack() { return MCDataIO.readFluidStack(this); } @@ -433,6 +480,30 @@ public FMLProxyPacket toPacket() { return new FMLProxyPacket(new PacketBuffer(copy()), channel); } + public NBTTagCompound toNBTTag(NBTTagCompound tagCompound) { + tagCompound.setByteArray("CCL:data", array()); + return tagCompound; + } + + public NBTTagCompound toNBTTag() { + NBTTagCompound tagCompound = new NBTTagCompound(); + tagCompound.setByteArray("CCL:data", array()); + return tagCompound; + } + + public static PacketCustom fromNBTTag(NBTTagCompound tagCompound) { + return new PacketCustom(Unpooled.copiedBuffer(tagCompound.getByteArray("CCL:data"))); + } + + public SPacketUpdateTileEntity toTilePacket(BlockPos pos) { + return new SPacketUpdateTileEntity(pos, 0, toNBTTag()); + } + + @SideOnly (Side.CLIENT) + public static PacketCustom fromTilePacket(SPacketUpdateTileEntity tilePacket) { + return fromNBTTag(tilePacket.getNbtCompound()); + } + public void sendToPlayer(EntityPlayer player) { sendToPlayer(toPacket(), player); } @@ -441,7 +512,7 @@ public static void sendToPlayer(Packet packet, EntityPlayer player) { if (player == null) { sendToClients(packet); } else { - ((EntityPlayerMP) player).playerNetServerHandler.sendPacket(packet); + ((EntityPlayerMP) player).connection.sendPacket(packet); } } @@ -450,7 +521,11 @@ public void sendToClients() { } public static void sendToClients(Packet packet) { - MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(packet); + FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().sendPacketToAllPlayers(packet); + } + + public void sendPacketToAllAround(BlockPos pos, double range, int dim) { + sendPacketToAllAround(pos.getX(), pos.getY(), pos.getZ(), range, dim); } public void sendPacketToAllAround(double x, double y, double z, double range, int dim) { @@ -458,7 +533,7 @@ public void sendPacketToAllAround(double x, double y, double z, double range, in } public static void sendToAllAround(Packet packet, double x, double y, double z, double range, int dim) { - MinecraftServer.getServer().getConfigurationManager().sendToAllNear(x, y, z, range, dim, packet); + FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().sendToAllNearExcept(null, x, y, z, range, dim, packet); } public void sendToDimension(int dim) { @@ -466,7 +541,11 @@ public void sendToDimension(int dim) { } public static void sendToDimension(Packet packet, int dim) { - MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayersInDimension(packet, dim); + FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().sendPacketToAllPlayersInDimension(packet, dim); + } + + public void sendToChunk(TileEntity tile) { + sendToChunk(tile.getWorld(), tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4); } public void sendToChunk(World world, int chunkX, int chunkZ) { @@ -474,9 +553,9 @@ public void sendToChunk(World world, int chunkX, int chunkZ) { } public static void sendToChunk(Packet packet, World world, int chunkX, int chunkZ) { - PlayerInstance p = ((WorldServer) world).getPlayerChunkMap().getPlayerInstance(chunkX, chunkZ, false); - if (p != null) { - p.sendToAllPlayersWatchingChunk(packet); + PlayerChunkMapEntry playerInstance = ((WorldServer) world).getPlayerChunkMap().getEntry(chunkX, chunkZ); + if (playerInstance != null) { + playerInstance.sendPacket(packet); } } @@ -485,20 +564,20 @@ public void sendToOps() { } public static void sendToOps(Packet packet) { - for (EntityPlayerMP player : (List) MinecraftServer.getServer().getConfigurationManager().playerEntityList) { - if (MinecraftServer.getServer().getConfigurationManager().canSendCommands(player.getGameProfile())) { + for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList()) { + if (FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().canSendCommands(player.getGameProfile())) { sendToPlayer(packet, player); } } } - @SideOnly(Side.CLIENT) + @SideOnly (Side.CLIENT) public void sendToServer() { sendToServer(toPacket()); } - @SideOnly(Side.CLIENT) + @SideOnly (Side.CLIENT) public static void sendToServer(Packet packet) { - Minecraft.getMinecraft().getNetHandler().addToSendQueue(packet); + Minecraft.getMinecraft().getConnection().sendPacket(packet); } } diff --git a/dependencies/main/java/codechicken/lib/raytracer/CuboidRayTraceResult.java b/dependencies/main/java/codechicken/lib/raytracer/CuboidRayTraceResult.java new file mode 100644 index 0000000000..5261c0ff3e --- /dev/null +++ b/dependencies/main/java/codechicken/lib/raytracer/CuboidRayTraceResult.java @@ -0,0 +1,54 @@ +package codechicken.lib.raytracer; + +import codechicken.lib.vec.Vector3; +import net.minecraft.entity.Entity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; + +/** + * Created by covers1624 on 8/9/2016. + * This class is kind of special as if you return this in Block.collisionRayTrace, when the blocks HitBox is rendered it will cancel and use the cuboid provided here. + * This is to get around the fact that it is currently impossible to determine from Block.getSelectedBoundingBox what sub box to render as you have absolutely no player context to do a trace. + */ +public class CuboidRayTraceResult extends DistanceRayTraceResult { + + public IndexedCuboid6 cuboid6; + + /** + * Optional flag that disables auto rendering of this trace result. Useful when + * you wish to use this class to retain the Cuboid6 box but would like to render + * it yourself. + */ + public boolean disableAutoHitboxRender = false; + + public CuboidRayTraceResult(Entity entity, Vector3 hit, IndexedCuboid6 cuboid, double dist) { + super(entity, hit, cuboid.data, dist); + this.cuboid6 = cuboid; + } + + public CuboidRayTraceResult(Vector3 hit, BlockPos pos, EnumFacing side, IndexedCuboid6 cuboid, double dist) { + super(hit, pos, side, cuboid.data, dist); + this.cuboid6 = cuboid; + } + + public CuboidRayTraceResult(Vector3 hit, EnumFacing side, IndexedCuboid6 cuboid6, double dist) { + super(hit, side, cuboid6.data, dist); + this.cuboid6 = cuboid6; + } + + /** + * This will create a new instance of a DistanceRayTraceResult. + * You will not be able to TypeCast this back to a CuboidRayTraceResult. + * This can be used to avoid CCL's HitBox render taking over down the line. + * + * @return + */ + public DistanceRayTraceResult getAsTraceResult() { + return new DistanceRayTraceResult(new Vector3(hitVec), sideHit, hitInfo, dist); + } + + @Override + public String toString() { + return super.toString().replace("}", "") + ", cuboid=" + cuboid6.toString() + "}"; + } +} diff --git a/dependencies/main/java/codechicken/lib/raytracer/DistanceRayTraceResult.java b/dependencies/main/java/codechicken/lib/raytracer/DistanceRayTraceResult.java new file mode 100644 index 0000000000..d1d6113702 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/raytracer/DistanceRayTraceResult.java @@ -0,0 +1,60 @@ +package codechicken.lib.raytracer; + +import codechicken.lib.vec.Vector3; +import net.minecraft.entity.Entity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; + +//TODO Copyable. +public class DistanceRayTraceResult extends RayTraceResult implements Comparable { + + /** + * The square distance from the start of the raytrace. + */ + public double dist; + + public DistanceRayTraceResult(Entity entity, Vector3 hit, Object data, double dist) { + super(entity, hit.vec3()); + setData(data); + this.dist = dist; + } + + public DistanceRayTraceResult(Vector3 hit, EnumFacing side, Object data, double dist) { + super(hit.vec3(), side); + this.dist = dist; + setData(data); + } + + public DistanceRayTraceResult(Vector3 hit, BlockPos pos, EnumFacing side, Object data, double dist) { + super(hit.vec3(), side, pos); + setData(data); + this.dist = dist; + } + + public void setData(Object data) { + if (data instanceof Integer) { + subHit = (Integer) data; + } + hitInfo = data; + } + + @Deprecated//TODO Is this actually needed.. Can remove an AT line if not needed. + public void setPos(BlockPos pos) { + this.blockPos = pos; + } + + public void offsetHit(BlockPos pos) { + hitVec = hitVec.addVector(pos.getX(), pos.getY(), pos.getZ()); + } + + @Override + public int compareTo(DistanceRayTraceResult o) { + return dist == o.dist ? 0 : dist < o.dist ? -1 : 1; + } + + @Override + public String toString() { + return super.toString().replace("}", "") + ", subHit=" + subHit + ", sqDist: " + dist + "}"; + } +} diff --git a/dependencies/main/java/codechicken/lib/raytracer/ExtendedMOP.java b/dependencies/main/java/codechicken/lib/raytracer/ExtendedMOP.java deleted file mode 100644 index 786cd368e3..0000000000 --- a/dependencies/main/java/codechicken/lib/raytracer/ExtendedMOP.java +++ /dev/null @@ -1,38 +0,0 @@ -package codechicken.lib.raytracer; - -import codechicken.lib.vec.BlockCoord; -import codechicken.lib.vec.Vector3; -import net.minecraft.entity.Entity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; - -public class ExtendedMOP extends MovingObjectPosition implements Comparable { - /** - * The square distance from the start of the raytrace. - */ - public double dist; - - public ExtendedMOP(Entity entity, Vector3 hit, Object data, double dist) { - super(entity, hit.vec3()); - setData(data); - this.dist = dist; - } - - public ExtendedMOP(Vector3 hit, int side, BlockCoord pos, Object data, double dist) { - super(hit.vec3(), EnumFacing.values()[side], pos.pos()); - setData(data); - this.dist = dist; - } - - public void setData(Object data) { - if (data instanceof Integer) { - subHit = ((Integer) data).intValue(); - } - hitInfo = data; - } - - @Override - public int compareTo(ExtendedMOP o) { - return dist == o.dist ? 0 : dist < o.dist ? -1 : 1; - } -} diff --git a/dependencies/main/java/codechicken/lib/raytracer/ICuboidProvider.java b/dependencies/main/java/codechicken/lib/raytracer/ICuboidProvider.java new file mode 100644 index 0000000000..d62223ca0e --- /dev/null +++ b/dependencies/main/java/codechicken/lib/raytracer/ICuboidProvider.java @@ -0,0 +1,19 @@ +package codechicken.lib.raytracer; + +import java.util.List; + +/** + * Created by covers1624 on 8/10/2016. + * This is a completely random interface, mainly used to have a standard method to get cuboids from a tile. + * For a somewhat standard impl, use the first index in the array to indicate the blocks bounds, and anything else for other clickable's or boxes. + */ +public interface ICuboidProvider { + + /** + * Everything must return pure bounds not offset by the tiles position. + * + * @return A list of cuboids for a tile. + */ + List getIndexedCuboids(); + +} diff --git a/dependencies/main/java/codechicken/lib/raytracer/IndexedCuboid6.java b/dependencies/main/java/codechicken/lib/raytracer/IndexedCuboid6.java index 63e2ed778f..66738a9c29 100644 --- a/dependencies/main/java/codechicken/lib/raytracer/IndexedCuboid6.java +++ b/dependencies/main/java/codechicken/lib/raytracer/IndexedCuboid6.java @@ -1,12 +1,94 @@ package codechicken.lib.raytracer; +import codechicken.lib.math.MathHelper; import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Vector3; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; public class IndexedCuboid6 extends Cuboid6 { + public Object data; public IndexedCuboid6(Object data, Cuboid6 cuboid) { super(cuboid); this.data = data; } -} \ No newline at end of file + + public IndexedCuboid6(Object data, AxisAlignedBB box) { + super(box); + this.data = data; + } + + public CuboidRayTraceResult calculateIntercept(Vector3 start, Vector3 end) { + Vector3 hit = null; + EnumFacing sideHit = null; + double dist = Double.MAX_VALUE; + + for (EnumFacing face : EnumFacing.values()) { + Vector3 suspectHit = null; + switch (face) { + case DOWN: + suspectHit = start.copy().XZintercept(end, min.y); + break; + case UP: + suspectHit = start.copy().XZintercept(end, max.y); + break; + case NORTH: + suspectHit = start.copy().XYintercept(end, min.z); + break; + case SOUTH: + suspectHit = start.copy().XYintercept(end, max.z); + break; + case WEST: + suspectHit = start.copy().YZintercept(end, min.x); + break; + case EAST: + suspectHit = start.copy().YZintercept(end, max.x); + break; + } + + if (suspectHit == null) { + continue; + } + + switch (face) { + + case DOWN: + case UP: + if (!MathHelper.between(min.x, suspectHit.x, max.x) || !MathHelper.between(min.z, suspectHit.z, max.z)) { + continue; + } + break; + case NORTH: + case SOUTH: + if (!MathHelper.between(min.x, suspectHit.x, max.x) || !MathHelper.between(min.y, suspectHit.y, max.y)) { + continue; + } + break; + case WEST: + case EAST: + if (!MathHelper.between(min.y, suspectHit.y, max.y) || !MathHelper.between(min.z, suspectHit.z, max.z)) { + continue; + } + break; + } + double suspectDist = suspectHit.copy().subtract(start).magSquared(); + if (suspectDist < dist) { + sideHit = face; + dist = suspectDist; + hit = suspectHit; + } + } + + if (sideHit != null && hit != null) { + return new CuboidRayTraceResult(hit, sideHit, this, dist); + } + return null; + } + + @Override + public IndexedCuboid6 copy() { + return new IndexedCuboid6(data, this); + } +} diff --git a/dependencies/main/java/codechicken/lib/raytracer/RayTracer.java b/dependencies/main/java/codechicken/lib/raytracer/RayTracer.java index 4d73c362ee..864d8e1640 100644 --- a/dependencies/main/java/codechicken/lib/raytracer/RayTracer.java +++ b/dependencies/main/java/codechicken/lib/raytracer/RayTracer.java @@ -1,170 +1,239 @@ package codechicken.lib.raytracer; -import codechicken.lib.math.MathHelper; -import codechicken.lib.vec.BlockCoord; import codechicken.lib.vec.Cuboid6; import codechicken.lib.vec.Vector3; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedList; import java.util.List; public class RayTracer { - private Vector3 vec = new Vector3(); - private Vector3 vec2 = new Vector3(); - private Vector3 s_vec = new Vector3(); - private double s_dist; - private int s_side; - private IndexedCuboid6 c_cuboid; - - private static ThreadLocal t_inst = new ThreadLocal(); + /** + * @param start The vector to start RayTracing from. + * @param end The Vector to stop RayTracing at. + * @param cuboids The cuboids to check for a hit. + * @param pos The position offset for the start and end vector. + * @return The closest hit to the start vector. + * //TODO 1.11, Re arrange args to (start, end, pos, cuboids) + */ + public static CuboidRayTraceResult rayTraceCuboidsClosest(Vec3d start, Vec3d end, List cuboids, BlockPos pos) { + return rayTraceCuboidsClosest(new Vector3(start), new Vector3(end), cuboids, pos); + } - public static RayTracer instance() { - RayTracer inst = t_inst.get(); - if (inst == null) { - t_inst.set(inst = new RayTracer()); + /** + * @param start The vector to start RayTracing from. + * @param end The Vector to stop RayTracing at. + * @param cuboids The cuboids to check for a hit. + * @param pos The position offset for the start and end vector. + * @return The closest hit to the start vector. + * //TODO 1.11, Re arrange args to (start, end, pos, cuboids) + */ + public static CuboidRayTraceResult rayTraceCuboidsClosest(Vector3 start, Vector3 end, List cuboids, BlockPos pos) { + List results = new ArrayList(); + for (IndexedCuboid6 cuboid6 : cuboids) { + CuboidRayTraceResult hit = rayTrace(pos, start, end, cuboid6); + results.add(hit); } - return inst; - } - - private void traceSide(int side, Vector3 start, Vector3 end, Cuboid6 cuboid) { - vec.set(start); - Vector3 hit = null; - switch (side) { - case 0: - hit = vec.XZintercept(end, cuboid.min.y); - break; - case 1: - hit = vec.XZintercept(end, cuboid.max.y); - break; - case 2: - hit = vec.XYintercept(end, cuboid.min.z); - break; - case 3: - hit = vec.XYintercept(end, cuboid.max.z); - break; - case 4: - hit = vec.YZintercept(end, cuboid.min.x); - break; - case 5: - hit = vec.YZintercept(end, cuboid.max.x); - break; - } - if (hit == null) { - return; + CuboidRayTraceResult closestHit = null; + double curClosest = Double.MAX_VALUE; + for (CuboidRayTraceResult hit : results) { + if (hit != null) { + if (curClosest > hit.dist) { + closestHit = hit; + curClosest = hit.dist; + } + } } + return closestHit; + } - switch (side) { - case 0: - case 1: - if (!MathHelper.between(cuboid.min.x, hit.x, cuboid.max.x) || !MathHelper.between(cuboid.min.z, hit.z, cuboid.max.z)) { - return; - } - break; - case 2: - case 3: - if (!MathHelper.between(cuboid.min.x, hit.x, cuboid.max.x) || !MathHelper.between(cuboid.min.y, hit.y, cuboid.max.y)) { - return; - } - break; - case 4: - case 5: - if (!MathHelper.between(cuboid.min.y, hit.y, cuboid.max.y) || !MathHelper.between(cuboid.min.z, hit.z, cuboid.max.z)) { - return; + /** + * This method goes by the assumption you don't care about IndexedCuboids and their extra data. + * Useful for adding hitboxes to blocks that don't actually do anything but visuals. + * + * @param start The vector to start RayTracing from. + * @param end The vector to stop RayTracing at. + * @param pos The position offset for the start and enc vector. + * @param boxes The cuboids to trace. + * @return The closest hit to the start vector. + */ + public static CuboidRayTraceResult rayTraceCuboidsClosest(Vector3 start, Vector3 end, BlockPos pos, AxisAlignedBB... boxes) { + List cuboidList = new LinkedList(); + if (boxes != null) { + for (AxisAlignedBB box : boxes) { + cuboidList.add(new IndexedCuboid6(0, box)); } - break; } + return rayTraceCuboidsClosest(start, end, cuboidList, pos); + } - double dist = vec2.set(hit).subtract(start).magSquared(); - if (dist < s_dist) { - s_side = side; - s_dist = dist; - s_vec.set(vec); + /** + * This method goes by the assumption you don't care about IndexedCuboids and their extra data. + * Useful for adding hitboxes to blocks that don't actually do anything but visuals. + * + * @param start The vector to start RayTracing from. + * @param end The vector to stop RayTracing at. + * @param pos The position offset for the start and enc vector. + * @param boxes The cuboids to trace. + * @return The closest hit to the start vector. + */ + public static CuboidRayTraceResult rayTraceCuboidsClosest(Vec3d start, Vec3d end, BlockPos pos, AxisAlignedBB... boxes) { + List cuboidList = new LinkedList(); + if (boxes != null) { + for (AxisAlignedBB box : boxes) { + cuboidList.add(new IndexedCuboid6(0, box)); + } } + return rayTraceCuboidsClosest(start, end, cuboidList, pos); } - private boolean rayTraceCuboid(Vector3 start, Vector3 end, Cuboid6 cuboid) { - s_dist = Double.MAX_VALUE; - s_side = -1; - - for (int i = 0; i < 6; i++) { - traceSide(i, start, end, cuboid); + /** + * This method goes by the assumption you don't care about IndexedCuboids and their extra data. + * Useful for adding hitboxes to blocks that don't actually do anything but visuals. + * + * @param start The vector to start RayTracing from. + * @param end The vector to stop RayTracing at. + * @param pos The position offset for the start and enc vector. + * @param cuboids The cuboids to trace. + * @return The closest hit to the start vector. + */ + public static CuboidRayTraceResult rayTraceCuboidsClosest(Vector3 start, Vector3 end, BlockPos pos, Cuboid6... cuboids) { + List cuboidList = new LinkedList(); + if (cuboids != null) { + for (Cuboid6 cuboid : cuboids) { + cuboidList.add(new IndexedCuboid6(0, cuboid)); + } } + return rayTraceCuboidsClosest(start, end, cuboidList, pos); + } - return s_side >= 0; + /** + * This method goes by the assumption you don't care about IndexedCuboids and their extra data. + * Useful for adding hitboxes to blocks that don't actually do anything but visuals. + * + * @param start The vector to start RayTracing from. + * @param end The vector to stop RayTracing at. + * @param pos The position offset for the start and enc vector. + * @param cuboids The cuboids to trace. + * @return The closest hit to the start vector. + */ + public static CuboidRayTraceResult rayTraceCuboidsClosest(Vec3d start, Vec3d end, BlockPos pos, Cuboid6... cuboids) { + List cuboidList = new LinkedList(); + if (cuboids != null) { + for (Cuboid6 cuboid : cuboids) { + cuboidList.add(new IndexedCuboid6(0, cuboid)); + } + } + return rayTraceCuboidsClosest(start, end, cuboidList, pos); } - public ExtendedMOP rayTraceCuboid(Vector3 start, Vector3 end, Cuboid6 cuboid, BlockCoord pos, Object data) { - return rayTraceCuboid(start, end, cuboid) ? new ExtendedMOP(s_vec, s_side, pos, data, s_dist) : null; + /** + * @param start The vector to start RayTracing from. + * @param end The Vector to stop RayTracing at. + * @param pos The position offset for the start and end vector. + * @param cuboids The cuboids to check for a hit. + * @return The closest hit to the start vector. + */ + public static CuboidRayTraceResult rayTraceCuboidsClosest(Vector3 start, Vector3 end, BlockPos pos, IndexedCuboid6... cuboids) { + List cuboidList = new LinkedList(); + if (cuboids != null) { + Collections.addAll(cuboidList, cuboids); + } + return rayTraceCuboidsClosest(start, end, cuboidList, pos); } - public ExtendedMOP rayTraceCuboid(Vector3 start, Vector3 end, Cuboid6 cuboid, Entity entity, Object data) { - return rayTraceCuboid(start, end, cuboid) ? new ExtendedMOP(entity, s_vec, data, s_dist) : null; + /** + * @param start The vector to start RayTracing from. + * @param end The Vector to stop RayTracing at. + * @param pos The position offset for the start and end vector. + * @param cuboids The cuboids to check for a hit. + * @return The closest hit to the start vector. + */ + public static CuboidRayTraceResult rayTraceCuboidsClosest(Vec3d start, Vec3d end, BlockPos pos, IndexedCuboid6... cuboids) { + List cuboidList = new LinkedList(); + if (cuboids != null) { + Collections.addAll(cuboidList, cuboids); + } + return rayTraceCuboidsClosest(start, end, cuboidList, pos); } - public void rayTraceCuboids(Vector3 start, Vector3 end, List cuboids, BlockCoord pos, Block block, List hitList) { - for (IndexedCuboid6 cuboid : cuboids) { - ExtendedMOP mop = rayTraceCuboid(start, end, cuboid, pos, cuboid.data); - if (mop != null) { - hitList.add(mop); - } + /** + * Ray traces from start to end, if the ray intercepts the cuboid it returns a new CuboidRayTraceResult. + * + * @param pos The BlockPosition to subtract from the start and end vector. + * @param start The vector to start RayTracing from. + * @param end The vector to end RayTracing at. + * @param cuboid The cuboid to check for an intercept. + * @return A new CuboidRayTraceResult if successful, null if fail. + */ + public static CuboidRayTraceResult rayTrace(BlockPos pos, Vector3 start, Vector3 end, IndexedCuboid6 cuboid) { + Vector3 startRay = start.copy().subtract(pos); + Vector3 endRay = end.copy().subtract(pos); + RayTraceResult bbResult = cuboid.aabb().calculateIntercept(startRay.vec3(), endRay.vec3()); + + if (bbResult != null) { + Vector3 hitVec = new Vector3(bbResult.hitVec).add(pos); + EnumFacing sideHit = bbResult.sideHit; + double dist = hitVec.copy().subtract(start).magSquared(); + return new CuboidRayTraceResult(hitVec, pos, sideHit, cuboid, dist); } + return null; } - public static MovingObjectPosition retraceBlock(World world, EntityPlayer player, BlockPos pos) { - IBlockState b = world.getBlockState(pos); - Vec3 headVec = getCorrectedHeadVec(player); - Vec3 lookVec = player.getLook(1.0F); - double reach = getBlockReachDistance(player); - Vec3 endVec = headVec.addVector(lookVec.xCoord * reach, lookVec.yCoord * reach, lookVec.zCoord * reach); - return b.getBlock().collisionRayTrace(world, pos, headVec, endVec); + public static RayTraceResult retraceBlock(World world, EntityPlayer player, BlockPos pos) { + Vec3d startVec = getStartVec(player); + Vec3d endVec = getEndVec(player); + return world.getBlockState(pos).collisionRayTrace(world, pos, startVec, endVec); } private static double getBlockReachDistance_server(EntityPlayerMP player) { - return player.theItemInWorldManager.getBlockReachDistance(); + return player.interactionManager.getBlockReachDistance(); } - @SideOnly(Side.CLIENT) + @SideOnly (Side.CLIENT) private static double getBlockReachDistance_client() { return Minecraft.getMinecraft().playerController.getBlockReachDistance(); } - public static MovingObjectPosition retrace(EntityPlayer player) { + public static RayTraceResult retrace(EntityPlayer player) { return retrace(player, getBlockReachDistance(player)); } - public static MovingObjectPosition retrace(EntityPlayer player, double reach) { - Vec3 headVec = getCorrectedHeadVec(player); - Vec3 lookVec = player.getLook(1); - Vec3 endVec = headVec.addVector(lookVec.xCoord * reach, lookVec.yCoord * reach, lookVec.zCoord * reach); - return player.worldObj.rayTraceBlocks(headVec, endVec, true, false, true); + public static RayTraceResult retrace(EntityPlayer player, boolean stopOnFluid) { + Vec3d startVec = getStartVec(player); + Vec3d endVec = getEndVec(player); + return player.worldObj.rayTraceBlocks(startVec, endVec, stopOnFluid, false, true); } - public static Vec3 getCorrectedHeadVec(EntityPlayer player) { - Vector3 v = Vector3.fromEntity(player); - if (player.worldObj.isRemote) { - v.y += player.getEyeHeight() - player.getDefaultEyeHeight();//compatibility with eye height changing mods - } else { - v.y += player.getEyeHeight(); - if (player instanceof EntityPlayerMP && player.isSneaking()) { - v.y -= 0.08; - } - } + public static RayTraceResult retrace(EntityPlayer player, double reach, boolean stopOnFluids) { + Vec3d startVec = getStartVec(player); + Vec3d endVec = getEndVec(player, reach); + return player.worldObj.rayTraceBlocks(startVec, endVec, stopOnFluids, false, true); + } + + public static RayTraceResult retrace(EntityPlayer player, double reach) { + return retrace(player, reach, true); + } + + public static Vec3d getCorrectedHeadVec(EntityPlayer player) { + Vector3 v = Vector3.fromEntity(player).add(0, player.getEyeHeight(), 0); return v.vec3(); } - public static Vec3 getStartVec(EntityPlayer player) { + public static Vec3d getStartVec(EntityPlayer player) { return getCorrectedHeadVec(player); } @@ -172,10 +241,16 @@ public static double getBlockReachDistance(EntityPlayer player) { return player.worldObj.isRemote ? getBlockReachDistance_client() : player instanceof EntityPlayerMP ? getBlockReachDistance_server((EntityPlayerMP) player) : 5D; } - public static Vec3 getEndVec(EntityPlayer player) { - Vec3 headVec = getCorrectedHeadVec(player); - Vec3 lookVec = player.getLook(1.0F); + public static Vec3d getEndVec(EntityPlayer player) { + Vec3d headVec = getCorrectedHeadVec(player); + Vec3d lookVec = player.getLook(1.0F); double reach = getBlockReachDistance(player); return headVec.addVector(lookVec.xCoord * reach, lookVec.yCoord * reach, lookVec.zCoord * reach); } + + public static Vec3d getEndVec(EntityPlayer player, double reach) { + Vec3d headVec = getCorrectedHeadVec(player); + Vec3d lookVec = player.getLook(1.0F); + return headVec.addVector(lookVec.xCoord * reach, lookVec.yCoord * reach, lookVec.zCoord * reach); + } } diff --git a/dependencies/main/java/codechicken/lib/render/BlockRenderer.java b/dependencies/main/java/codechicken/lib/render/BlockRenderer.java index d9a28d8e32..ea5c7eba26 100644 --- a/dependencies/main/java/codechicken/lib/render/BlockRenderer.java +++ b/dependencies/main/java/codechicken/lib/render/BlockRenderer.java @@ -1,14 +1,18 @@ package codechicken.lib.render; import codechicken.lib.lighting.LC; -import codechicken.lib.render.CCRenderState.VertexAttribute; +import codechicken.lib.render.pipeline.IVertexSource; +import codechicken.lib.render.pipeline.attribute.AttributeKey; +import codechicken.lib.render.pipeline.attribute.LightCoordAttribute; +import codechicken.lib.render.pipeline.attribute.SideAttribute; import codechicken.lib.vec.Cuboid6; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemTransformVec3f; -import org.lwjgl.util.vector.Vector3f; +import codechicken.lib.vec.Vertex5; +//TODO Ability to use this without lighting. public class BlockRenderer { - public static class BlockFace implements CCRenderState.IVertexSource { + + public static class BlockFace implements IVertexSource { + public Vertex5[] verts = new Vertex5[] { new Vertex5(), new Vertex5(), new Vertex5(), new Vertex5() }; public LC[] lightCoords = new LC[] { new LC(), new LC(), new LC(), new LC() }; public boolean lcComputed = false; @@ -20,18 +24,18 @@ public Vertex5[] getVertices() { } @Override - public T getAttributes(CCRenderState.VertexAttribute attr) { - return attr == CCRenderState.lightCoordAttrib && lcComputed ? (T) lightCoords : null; + public T getAttributes(AttributeKey attr) { + return LightCoordAttribute.attributeKey.equals(attr) && lcComputed ? (T) lightCoords : null; } @Override - public boolean hasAttribute(CCRenderState.VertexAttribute attr) { - return attr == CCRenderState.sideAttrib || attr == CCRenderState.lightCoordAttrib && lcComputed; + public boolean hasAttribute(AttributeKey attr) { + return SideAttribute.attributeKey.equals(attr) || LightCoordAttribute.attributeKey.equals(attr) && lcComputed; } @Override - public void prepareVertex() { - CCRenderState.side = side; + public void prepareVertex(CCRenderState state) { + state.side = side; } public BlockFace computeLightCoords() { @@ -59,71 +63,72 @@ public BlockFace loadCuboidFace(Cuboid6 c, int side) { lcComputed = false; switch (side) { - case 0: - u1 = x1; - v1 = z1; - u2 = x2; - v2 = z2; - verts[0].set(x1, y1, z2, u1, v2, 0); - verts[1].set(x1, y1, z1, u1, v1, 0); - verts[2].set(x2, y1, z1, u2, v1, 0); - verts[3].set(x2, y1, z2, u2, v2, 0); - break; - case 1: - u1 = x1; - v1 = z1; - u2 = x2; - v2 = z2; - verts[0].set(x2, y2, z2, u2, v2, 1); - verts[1].set(x2, y2, z1, u2, v1, 1); - verts[2].set(x1, y2, z1, u1, v1, 1); - verts[3].set(x1, y2, z2, u1, v2, 1); - break; - case 2: - u1 = 1 - x1; - v1 = 1 - y2; - u2 = 1 - x2; - v2 = 1 - y1; - verts[0].set(x1, y1, z1, u1, v2, 2); - verts[1].set(x1, y2, z1, u1, v1, 2); - verts[2].set(x2, y2, z1, u2, v1, 2); - verts[3].set(x2, y1, z1, u2, v2, 2); - break; - case 3: - u1 = x1; - v1 = 1 - y2; - u2 = x2; - v2 = 1 - y1; - verts[0].set(x2, y1, z2, u2, v2, 3); - verts[1].set(x2, y2, z2, u2, v1, 3); - verts[2].set(x1, y2, z2, u1, v1, 3); - verts[3].set(x1, y1, z2, u1, v2, 3); - break; - case 4: - u1 = z1; - v1 = 1 - y2; - u2 = z2; - v2 = 1 - y1; - verts[0].set(x1, y1, z2, u2, v2, 4); - verts[1].set(x1, y2, z2, u2, v1, 4); - verts[2].set(x1, y2, z1, u1, v1, 4); - verts[3].set(x1, y1, z1, u1, v2, 4); - break; - case 5: - u1 = 1 - z1; - v1 = 1 - y2; - u2 = 1 - z2; - v2 = 1 - y1; - verts[0].set(x2, y1, z1, u1, v2, 5); - verts[1].set(x2, y2, z1, u1, v1, 5); - verts[2].set(x2, y2, z2, u2, v1, 5); - verts[3].set(x2, y1, z2, u2, v2, 5); + case 0: + u1 = x1; + v1 = z1; + u2 = x2; + v2 = z2; + verts[0].set(x1, y1, z2, u1, v2, 0); + verts[1].set(x1, y1, z1, u1, v1, 0); + verts[2].set(x2, y1, z1, u2, v1, 0); + verts[3].set(x2, y1, z2, u2, v2, 0); + break; + case 1: + u1 = x1; + v1 = z1; + u2 = x2; + v2 = z2; + verts[0].set(x2, y2, z2, u2, v2, 1); + verts[1].set(x2, y2, z1, u2, v1, 1); + verts[2].set(x1, y2, z1, u1, v1, 1); + verts[3].set(x1, y2, z2, u1, v2, 1); + break; + case 2: + u1 = 1 - x1; + v1 = 1 - y2; + u2 = 1 - x2; + v2 = 1 - y1; + verts[0].set(x1, y1, z1, u1, v2, 2); + verts[1].set(x1, y2, z1, u1, v1, 2); + verts[2].set(x2, y2, z1, u2, v1, 2); + verts[3].set(x2, y1, z1, u2, v2, 2); + break; + case 3: + u1 = x1; + v1 = 1 - y2; + u2 = x2; + v2 = 1 - y1; + verts[0].set(x2, y1, z2, u2, v2, 3); + verts[1].set(x2, y2, z2, u2, v1, 3); + verts[2].set(x1, y2, z2, u1, v1, 3); + verts[3].set(x1, y1, z2, u1, v2, 3); + break; + case 4: + u1 = z1; + v1 = 1 - y2; + u2 = z2; + v2 = 1 - y1; + verts[0].set(x1, y1, z2, u2, v2, 4); + verts[1].set(x1, y2, z2, u2, v1, 4); + verts[2].set(x1, y2, z1, u1, v1, 4); + verts[3].set(x1, y1, z1, u1, v2, 4); + break; + case 5: + u1 = 1 - z1; + v1 = 1 - y2; + u2 = 1 - z2; + v2 = 1 - y1; + verts[0].set(x2, y1, z1, u1, v2, 5); + verts[1].set(x2, y2, z1, u1, v1, 5); + verts[2].set(x2, y2, z2, u2, v1, 5); + verts[3].set(x2, y1, z2, u2, v2, 5); } return this; } } - public static class FullBlock implements CCRenderState.IVertexSource { + public static class FullBlock implements IVertexSource { + public Vertex5[] verts = CCModel.quadModel(24).generateBlock(0, Cuboid6.full).verts; public LC[] lightCoords = new LC[24]; @@ -139,29 +144,26 @@ public Vertex5[] getVertices() { } @Override - public T getAttributes(VertexAttribute attr) { - return attr == CCRenderState.lightCoordAttrib ? (T) lightCoords : null; + public T getAttributes(AttributeKey attr) { + return LightCoordAttribute.attributeKey.equals(attr) ? (T) lightCoords : null; } @Override - public boolean hasAttribute(VertexAttribute attr) { - return attr == CCRenderState.sideAttrib || attr == CCRenderState.lightCoordAttrib; + public boolean hasAttribute(AttributeKey attr) { + return SideAttribute.attributeKey.equals(attr) || LightCoordAttribute.attributeKey.equals(attr); } @Override - public void prepareVertex() { - CCRenderState.side = CCRenderState.vertexIndex >> 2; + public void prepareVertex(CCRenderState state) { + state.side = state.vertexIndex >> 2; } } - public static ItemTransformVec3f thirdPersonTransform = new ItemTransformVec3f(new Vector3f(10, -45, 170), new Vector3f(0, 1.5F / 16F, -2.75F / 16F), new Vector3f(0.375F, 0.375F, 0.375F)); - public static ItemCameraTransforms blockCameraTransform = new ItemCameraTransforms(thirdPersonTransform, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT, ItemTransformVec3f.DEFAULT); - public static FullBlock fullBlock = new FullBlock(); - public static void renderFullBlock(int sideMask) { - CCRenderState.setModel(fullBlock); - renderFaces(sideMask); + public static void renderFullBlock(CCRenderState state, int sideMask) { + state.setModel(fullBlock); + renderFaces(state, sideMask); } /** @@ -169,14 +171,14 @@ public static void renderFullBlock(int sideMask) { * * @param sideMask A mask of faces not to render */ - public static void renderFaces(int sideMask) { + public static void renderFaces(CCRenderState state, int sideMask) { if (sideMask == 0x3F) { return; } for (int s = 0; s < 6; s++) { if ((sideMask & 1 << s) == 0) { - CCRenderState.setVertexRange(s * 4, (s + 1) * 4); - CCRenderState.render(); + state.setVertexRange(s * 4, (s + 1) * 4); + state.render(); } } } @@ -189,16 +191,16 @@ public static void renderFaces(int sideMask) { * @param bounds The bounding cuboid to render * @param sideMask A mask of faces not to render */ - public static void renderCuboid(Cuboid6 bounds, int sideMask) { + public static void renderCuboid(CCRenderState state, Cuboid6 bounds, int sideMask) { if (sideMask == 0x3F) { return; } - CCRenderState.setModel(face); + state.setModel(face); for (int s = 0; s < 6; s++) { if ((sideMask & 1 << s) == 0) { face.loadCuboidFace(bounds, s); - CCRenderState.render(); + state.render(); } } } diff --git a/dependencies/main/java/codechicken/lib/render/CCIconRegister.java b/dependencies/main/java/codechicken/lib/render/CCIconRegister.java new file mode 100644 index 0000000000..fb67fa327f --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/CCIconRegister.java @@ -0,0 +1,52 @@ +package codechicken.lib.render; + +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.texture.TextureUtils.IIconRegister; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.ResourceLocation; + +import java.util.ArrayList; + +/** + * Created by covers1624 on 5/22/2016. + */ +public class CCIconRegister implements IIconRegister { + + public static ArrayList locations = new ArrayList(); + + static { + TextureUtils.addIconRegister(new CCIconRegister()); + } + + @Override + public void registerIcons(TextureMap textureMap) { + for (ResourceLocation texture : locations) { + textureMap.registerSprite(texture); + } + } + + public static void registerTexture(String texture) { + registerTexture(new ResourceLocation(texture)); + } + + public static void registerTexture(ResourceLocation location) { + locations.add(location); + } + + public static void registerBlockTexture(String string) { + registerBlockTexture(new ResourceLocation(string)); + } + + public static void registerBlockTexture(ResourceLocation location) { + registerTexture(new ResourceLocation(location.getResourceDomain(), "blocks/" + location.getResourcePath())); + } + + public static void registerItemTexture(String string) { + registerItemTexture(new ResourceLocation(string)); + } + + public static void registerItemTexture(ResourceLocation location) { + registerTexture(new ResourceLocation(location.getResourceDomain(), "items/" + location.getResourcePath())); + } + +} diff --git a/dependencies/main/java/codechicken/lib/render/CCModel.java b/dependencies/main/java/codechicken/lib/render/CCModel.java index bd9445e561..13c4b5695e 100644 --- a/dependencies/main/java/codechicken/lib/render/CCModel.java +++ b/dependencies/main/java/codechicken/lib/render/CCModel.java @@ -2,23 +2,27 @@ import codechicken.lib.lighting.LC; import codechicken.lib.lighting.LightModel; -import codechicken.lib.render.uv.UV; -import codechicken.lib.render.uv.UVTransformation; -import codechicken.lib.render.uv.UVTranslation; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.render.pipeline.IVertexSource; +import codechicken.lib.render.pipeline.VertexAttribute; +import codechicken.lib.render.pipeline.attribute.*; +import codechicken.lib.render.pipeline.attribute.AttributeKey.AttributeKeyRegistry; +import codechicken.lib.util.ArrayUtils; import codechicken.lib.util.Copyable; +import codechicken.lib.util.VectorUtils; import codechicken.lib.vec.*; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ResourceLocation; +import codechicken.lib.vec.uv.UV; +import codechicken.lib.vec.uv.UVTransformation; +import codechicken.lib.vec.uv.UVTranslation; -import java.io.*; import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import static codechicken.lib.vec.Rotation.sideRotations; -public class CCModel implements CCRenderState.IVertexSource, Copyable { +public class CCModel implements IVertexSource, Copyable { + private static class PositionNormalEntry { + public Vector3 pos; public LinkedList normals = new LinkedList(); @@ -51,7 +55,7 @@ protected CCModel(int vertexMode) { } public Vector3[] normals() { - return getAttributes(CCRenderState.normalAttrib); + return getAttributes(NormalAttribute.attributeKey); } @Override @@ -60,30 +64,29 @@ public Vertex5[] getVertices() { } @Override - public T getAttributes(CCRenderState.VertexAttribute attr) { - if (attr.attributeIndex < attributes.size()) { - return (T) attributes.get(attr.attributeIndex); + public T getAttributes(AttributeKey attr) { + if (attr.attributeKeyIndex < attributes.size()) { + return (T) attributes.get(attr.attributeKeyIndex); } - return null; } @Override - public boolean hasAttribute(CCRenderState.VertexAttribute attrib) { - return attrib.attributeIndex < attributes.size() && attributes.get(attrib.attributeIndex) != null; + public boolean hasAttribute(AttributeKey attr) { + return attr.attributeKeyIndex < attributes.size() && attributes.get(attr.attributeKeyIndex) != null; } @Override - public void prepareVertex() { + public void prepareVertex(CCRenderState state) { } - public T getOrAllocate(CCRenderState.VertexAttribute attrib) { - T array = getAttributes(attrib); + public T getOrAllocate(AttributeKey attr) { + T array = getAttributes(attr); if (array == null) { - while (attributes.size() <= attrib.attributeIndex) { + while (attributes.size() <= attr.attributeKeyIndex) { attributes.add(null); } - attributes.set(attrib.attributeIndex, array = attrib.newArray(verts.length)); + attributes.set(attr.attributeKeyIndex, array = attr.newArray(verts.length)); } return array; } @@ -284,6 +287,123 @@ public CCModel generateBlock(int i, double x1, double y1, double z1, double x2, return this; } + /** + * Generates a model using 2 Cuboids. + * c1 defines the size of the top face. + * c2 defines the size of the bottom face. + * the sides are generated on an angle between c1 and c2. + * + * @param i The vertex index to start generating at + * @param c1 The top face cuboid. + * @param c2 The bottom face cuboid. + * @return + */ + @Deprecated + public CCModel generateDualCuboidBlock(int i, Cuboid6 c1, Cuboid6 c2) { + double x11 = c1.min.x; + double y11 = c1.min.y; + double z11 = c1.min.z; + double x12 = c1.max.x; + double y12 = c1.max.y; + double z12 = c1.max.z; + + double x21 = c2.min.x; + double y21 = c2.min.y; + double z21 = c2.min.z; + double x22 = c2.max.x; + double y22 = c2.max.y; + double z22 = c2.max.z; + + double u11, v11, u12, v12; + double u21, v21, u22, v22; + + //bottom face + u11 = x11; + v11 = z11; + u12 = x12; + v12 = z12; + verts[i++] = new Vertex5(x11, y11, z12, u11, v12, 0); + verts[i++] = new Vertex5(x11, y11, z11, u11, v11, 0); + verts[i++] = new Vertex5(x12, y11, z11, u12, v11, 0); + verts[i++] = new Vertex5(x12, y11, z12, u12, v12, 0); + + //top face + u21 = x21; + v21 = z21; + u22 = x22; + v22 = z22; + verts[i++] = new Vertex5(x22, y22, z22, u22, v22, 1); + verts[i++] = new Vertex5(x22, y22, z21, u22, v21, 1); + verts[i++] = new Vertex5(x21, y22, z21, u21, v21, 1); + verts[i++] = new Vertex5(x21, y22, z22, u21, v22, 1); + + //east face + u11 = 1 - x11; + v11 = 1 - y12; + u12 = 1 - x12; + v12 = 1 - y11; + + u21 = 1 - x21; + v21 = 1 - y22; + u22 = 1 - x22; + v22 = 1 - y21; + + verts[i++] = new Vertex5(x11, y11, z11, u11, v12, 2); + verts[i++] = new Vertex5(x21, y22, z21, u21, v21, 2); + verts[i++] = new Vertex5(x22, y22, z21, u22, v21, 2); + verts[i++] = new Vertex5(x12, y11, z11, u12, v12, 2); + + //west face + u11 = x11; + v11 = 1 - y12; + u12 = x12; + v12 = 1 - y11; + + u21 = x21; + v21 = 1 - y22; + u22 = x22; + v22 = 1 - y21; + + verts[i++] = new Vertex5(x12, y11, z12, u12, v12, 3); + verts[i++] = new Vertex5(x22, y22, z22, u22, v21, 3); + verts[i++] = new Vertex5(x21, y22, z22, u21, v21, 3); + verts[i++] = new Vertex5(x11, y11, z12, u11, v12, 3); + + //north face + u11 = z11; + v11 = 1 - y12; + u12 = z12; + v12 = 1 - y11; + + u21 = z21; + v21 = 1 - y22; + u22 = z22; + v22 = 1 - y21; + + verts[i++] = new Vertex5(x11, y11, z12, u12, v12, 4); + verts[i++] = new Vertex5(x21, y22, z22, u22, v21, 4); + verts[i++] = new Vertex5(x21, y22, z21, u21, v21, 4); + verts[i++] = new Vertex5(x11, y11, z11, u11, v12, 4); + + //south face + u11 = 1 - z11; + v11 = 1 - y12; + u12 = 1 - z12; + v12 = 1 - y11; + + u21 = 1 - z21; + v21 = 1 - y22; + u22 = 1 - z22; + v22 = 1 - y21; + + verts[i++] = new Vertex5(x12, y11, z11, u11, v12, 5); + verts[i++] = new Vertex5(x22, y22, z21, u21, v21, 5); + verts[i++] = new Vertex5(x22, y22, z22, u22, v21, 5); + verts[i++] = new Vertex5(x12, y11, z12, u12, v12, 5); + + return this; + } + public CCModel computeNormals() { return computeNormals(0, verts.length); } @@ -301,7 +421,7 @@ public CCModel computeNormals(int start, int length) { throw new IllegalArgumentException("Cannot generate normals across polygons"); } - Vector3[] normals = getOrAllocate(CCRenderState.normalAttrib); + Vector3[] normals = getOrAllocate(NormalAttribute.attributeKey); for (int k = 0; k < length; k += vp) { int i = k + start; Vector3 diff1 = verts[i + 1].vec.copy().subtract(verts[i].vec); @@ -323,9 +443,9 @@ public CCModel computeNormals(int start, int length) { */ public CCModel computeLighting(LightModel light) { Vector3[] normals = normals(); - int[] colours = getAttributes(CCRenderState.lightingAttrib); + int[] colours = getAttributes(LightingAttribute.attributeKey); if (colours == null) { - colours = getOrAllocate(CCRenderState.lightingAttrib); + colours = getOrAllocate(LightingAttribute.attributeKey); Arrays.fill(colours, -1); } for (int k = 0; k < verts.length; k++) { @@ -335,7 +455,7 @@ public CCModel computeLighting(LightModel light) { } public CCModel setColour(int c) { - int[] colours = getOrAllocate(CCRenderState.colourAttrib); + int[] colours = getOrAllocate(ColourAttribute.attributeKey); Arrays.fill(colours, c); return this; } @@ -346,7 +466,7 @@ public CCModel setColour(int c) { * @return The model */ public CCModel computeLightCoords() { - LC[] lcs = getOrAllocate(CCRenderState.lightCoordAttrib); + LC[] lcs = getOrAllocate(LightCoordAttribute.attributeKey); Vector3[] normals = normals(); for (int i = 0; i < verts.length; i++) { lcs[i] = new LC().compute(verts[i].vec, normals[i]); @@ -422,27 +542,27 @@ public CCModel expand(int extraVerts) { verts = Arrays.copyOf(verts, newLen); for (int i = 0; i < attributes.size(); i++) { if (attributes.get(i) != null) { - attributes.set(i, CCRenderState.copyOf((CCRenderState.VertexAttribute) CCRenderState.getAttribute(i), attributes.get(i), newLen)); + attributes.set(i, VertexAttribute.copyOf((AttributeKey) AttributeKeyRegistry.getAttributeKey(i), attributes.get(i), newLen)); } } return this; } - public void render(double x, double y, double z, double u, double v) { - render(new Vector3(x, y, z).translation(), new UVTranslation(u, v)); + public void render(CCRenderState state, double x, double y, double z, double u, double v) { + render(state, new Vector3(x, y, z).translation(), new UVTranslation(u, v)); } - public void render(double x, double y, double z, UVTransformation u) { - render(new Vector3(x, y, z).translation(), u); + public void render(CCRenderState state, double x, double y, double z, UVTransformation u) { + render(state, new Vector3(x, y, z).translation(), u); } - public void render(Transformation t, double u, double v) { - render(t, new UVTranslation(u, v)); + public void render(CCRenderState state, Transformation t, double u, double v) { + render(state, t, new UVTranslation(u, v)); } - public void render(CCRenderState.IVertexOperation... ops) { - render(0, verts.length, ops); + public void render(CCRenderState state, IVertexOperation... ops) { + render(state, 0, verts.length, ops); } /** @@ -452,9 +572,9 @@ public void render(CCRenderState.IVertexOperation... ops) { * @param end The vertex index to render until * @param ops Operations to apply */ - public void render(int start, int end, CCRenderState.IVertexOperation... ops) { - CCRenderState.setPipeline(this, start, end, ops); - CCRenderState.render(); + public void render(CCRenderState state, int start, int end, IVertexOperation... ops) { + state.setPipeline(this, start, end, ops); + state.render(); } public static CCModel quadModel(int numVerts) { @@ -475,191 +595,6 @@ public static CCModel newModel(int vertexMode) { return new CCModel(vertexMode); } - public static double[] parseDoubles(String s, String token) { - String[] as = s.split(token); - double[] values = new double[as.length]; - for (int i = 0; i < as.length; i++) { - values[i] = Double.parseDouble(as[i]); - } - return values; - } - - public static void illegalAssert(boolean b, String err) { - if (!b) { - throw new IllegalArgumentException(err); - } - } - - public static void assertMatch(Matcher m, String s) { - m.reset(s); - illegalAssert(m.matches(), "Malformed line: " + s); - } - - private static final Pattern vertPattern = Pattern.compile("v(?: ([\\d\\.+-]+))+"); - private static final Pattern uvwPattern = Pattern.compile("vt(?: ([\\d\\.+-]+))+"); - private static final Pattern normalPattern = Pattern.compile("vn(?: ([\\d\\.+-]+))+"); - private static final Pattern polyPattern = Pattern.compile("f(?: ((?:\\d*)(?:/\\d*)?(?:/\\d*)?))+"); - public static final Matcher vertMatcher = vertPattern.matcher(""); - public static final Matcher uvwMatcher = uvwPattern.matcher(""); - public static final Matcher normalMatcher = normalPattern.matcher(""); - public static final Matcher polyMatcher = polyPattern.matcher(""); - - /** - * Parses vertices, texture coords, normals and polygons from a WaveFront Obj file - * - * @param input An input stream to a obj file - * @param vertexMode The vertex mode to create the model for (GL_TRIANGLES or GL_QUADS) - * @param coordSystem The cooridnate system transformation to apply - * @return A map of group names to models - * @throws IOException - */ - public static Map parseObjModels(InputStream input, int vertexMode, Transformation coordSystem) throws IOException { - if (coordSystem == null) { - coordSystem = new RedundantTransformation(); - } - int vp = vertexMode == 7 ? 4 : 3; - - HashMap modelMap = new HashMap(); - ArrayList verts = new ArrayList(); - ArrayList uvs = new ArrayList(); - ArrayList normals = new ArrayList(); - ArrayList polys = new ArrayList(); - String modelName = "unnamed"; - - BufferedReader reader = new BufferedReader(new InputStreamReader(input)); - - String line; - while ((line = reader.readLine()) != null) { - line = line.replaceAll("\\s+", " ").trim(); - if (line.startsWith("#") || line.length() == 0) { - continue; - } - - if (line.startsWith("v ")) { - assertMatch(vertMatcher, line); - double[] values = parseDoubles(line.substring(2), " "); - illegalAssert(values.length >= 3, "Vertices must have x, y and z components"); - Vector3 vert = new Vector3(values[0], values[1], values[2]); - coordSystem.apply(vert); - verts.add(vert); - continue; - } - if (line.startsWith("vt ")) { - assertMatch(uvwMatcher, line); - double[] values = parseDoubles(line.substring(3), " "); - illegalAssert(values.length >= 2, "Tex Coords must have u, and v components"); - uvs.add(new Vector3(values[0], 1 - values[1], 0)); - continue; - } - if (line.startsWith("vn ")) { - assertMatch(normalMatcher, line); - double[] values = parseDoubles(line.substring(3), " "); - illegalAssert(values.length >= 3, "Normals must have x, y and z components"); - Vector3 norm = new Vector3(values[0], values[1], values[2]).normalize(); - coordSystem.applyN(norm); - normals.add(norm); - continue; - } - if (line.startsWith("f ")) { - assertMatch(polyMatcher, line); - String[] av = line.substring(2).split(" "); - illegalAssert(av.length >= 3, "Polygons must have at least 3 vertices"); - int[][] polyVerts = new int[av.length][3]; - for (int i = 0; i < av.length; i++) { - String[] as = av[i].split("/"); - for (int p = 0; p < as.length; p++) { - if (as[p].length() > 0) { - polyVerts[i][p] = Integer.parseInt(as[p]); - } - } - } - if (vp == 3) { - triangulate(polys, polyVerts); - } else { - quadulate(polys, polyVerts); - } - } - if (line.startsWith("g ")) { - if (!polys.isEmpty()) { - modelMap.put(modelName, createModel(verts, uvs, normals, vertexMode, polys)); - polys.clear(); - } - modelName = line.substring(2); - } - } - - if (!polys.isEmpty()) { - modelMap.put(modelName, createModel(verts, uvs, normals, vertexMode, polys)); - } - - return modelMap; - } - - public static void triangulate(List polys, int[][] polyVerts) { - for (int i = 2; i < polyVerts.length; i++) { - polys.add(polyVerts[0]); - polys.add(polyVerts[i]); - polys.add(polyVerts[i - 1]); - } - } - - public static void quadulate(List polys, int[][] polyVerts) { - if (polyVerts.length == 4) { - polys.add(polyVerts[0]); - polys.add(polyVerts[3]); - polys.add(polyVerts[2]); - polys.add(polyVerts[1]); - } else { - for (int i = 2; i < polyVerts.length; i++) { - polys.add(polyVerts[0]); - polys.add(polyVerts[i]); - polys.add(polyVerts[i - 1]); - polys.add(polyVerts[i - 1]); - } - } - } - - /** - * Parses vertices, texture coords, normals and polygons from a WaveFront Obj file - * - * @param res The resource for the obj file - * @return A map of group names to models - */ - public static Map parseObjModels(ResourceLocation res) { - return parseObjModels(res, 4, null); - } - - /** - * Parses vertices, texture coords, normals and polygons from a WaveFront Obj file - * - * @param res The resource for the obj file - * @param coordSystem The cooridnate system transformation to apply - * @return A map of group names to models - */ - public static Map parseObjModels(ResourceLocation res, Transformation coordSystem) { - try { - return parseObjModels(Minecraft.getMinecraft().getResourceManager().getResource(res).getInputStream(), 4, coordSystem); - } catch (IOException e) { - throw new RuntimeException("failed to load model: " + res, e); - } - } - - /** - * Parses vertices, texture coords, normals and polygons from a WaveFront Obj file - * - * @param res The resource for the obj file - * @param vertexMode The vertex mode to create the model for (GL_TRIANGLES or GL_QUADS) - * @param coordSystem The cooridnate system transformation to apply - * @return A map of group names to models - */ - public static Map parseObjModels(ResourceLocation res, int vertexMode, Transformation coordSystem) { - try { - return parseObjModels(Minecraft.getMinecraft().getResourceManager().getResource(res).getInputStream(), vertexMode, coordSystem); - } catch (Exception e) { - throw new RuntimeException("failed to load model: " + res, e); - } - } - public static CCModel createModel(List verts, List uvs, List normals, int vertexMode, List polys) { int vp = vertexMode == 7 ? 4 : 3; if (polys.size() < vp || polys.size() % vp != 0) { @@ -669,7 +604,7 @@ public static CCModel createModel(List verts, List uvs, List 0; CCModel model = CCModel.newModel(vertexMode, polys.size()); if (hasNormals) { - model.getOrAllocate(CCRenderState.normalAttrib); + model.getOrAllocate(NormalAttribute.attributeKey); } for (int i = 0; i < polys.size(); i++) { @@ -689,84 +624,6 @@ public static CCModel createModel(List verts, List uvs, List int addIndex(List list, T elem) { - int i = list.indexOf(elem) + 1; - if (i == 0) { - list.add(elem); - i = list.size(); - } - return i; - } - - private static String clean(double d) { - return d == (int) d ? Integer.toString((int) d) : Double.toString(d); - } - - public static void exportObj(Map models, PrintWriter p) { - List verts = new ArrayList(); - List uvs = new ArrayList(); - List normals = new ArrayList(); - List polys = new ArrayList(); - for (Map.Entry e : models.entrySet()) { - p.println("g " + e.getKey()); - CCModel m = e.getValue(); - - int vStart = verts.size(); - int uStart = uvs.size(); - int nStart = normals.size(); - boolean hasNormals = m.normals() != null; - polys.clear(); - - for (int i = 0; i < m.verts.length; i++) { - int[] ia = new int[hasNormals ? 3 : 2]; - ia[0] = addIndex(verts, m.verts[i].vec); - ia[1] = addIndex(uvs, m.verts[i].uv); - if (hasNormals) { - ia[2] = addIndex(normals, m.normals()[i]); - } - polys.add(ia); - } - - if (vStart < verts.size()) { - p.println(); - for (int i = vStart; i < verts.size(); i++) { - Vector3 v = verts.get(i); - p.format("v %s %s %s\n", clean(v.x), clean(v.y), clean(v.z)); - } - } - if (uStart < uvs.size()) { - p.println(); - for (int i = uStart; i < uvs.size(); i++) { - UV uv = uvs.get(i); - p.format("vt %s %s\n", clean(uv.u), clean(uv.v)); - } - } - if (nStart < normals.size()) { - p.println(); - for (int i = nStart; i < normals.size(); i++) { - Vector3 n = normals.get(i); - p.format("vn %s %s %s\n", clean(n.x), clean(n.y), clean(n.z)); - } - } - - p.println(); - for (int i = 0; i < polys.size(); i++) { - if (i % m.vp == 0) { - p.format("f"); - } - int[] ia = polys.get(i); - if (hasNormals) { - p.format(" %d/%d/%d", ia[0], ia[1], ia[2]); - } else { - p.format(" %d/%d", ia[0], ia[1]); - } - if (i % m.vp == m.vp - 1) { - p.println(); - } - } - } - } - /** * Brings the UV coordinates of each face closer to the center UV by d. * Useful for fixing texture seams @@ -807,7 +664,7 @@ public static void copy(CCModel src, int srcpos, CCModel dst, int destpos, int l for (int i = 0; i < src.attributes.size(); i++) { if (src.attributes.get(i) != null) { - CCRenderState.arrayCopy(src.attributes.get(i), srcpos, dst.getOrAllocate(CCRenderState.getAttribute(i)), destpos, length); + ArrayUtils.arrayCopy(src.attributes.get(i), srcpos, dst.getOrAllocate(AttributeKeyRegistry.getAttributeKey(i)), destpos, length); } } } @@ -870,7 +727,7 @@ public static CCModel generateBackface(CCModel src, int srcpos, CCModel dst, int dst.verts[di] = src.verts[si].copy(); for (int a = 0; a < src.attributes.size(); a++) { if (src.attributes.get(a) != null) { - CCRenderState.arrayCopy(src.attributes.get(a), si, dst.getOrAllocate(CCRenderState.getAttribute(a)), di, 1); + ArrayUtils.arrayCopy(src.attributes.get(a), si, dst.getOrAllocate(AttributeKeyRegistry.getAttributeKey(a)), di, 1); } } @@ -1006,52 +863,30 @@ public CCModel zOffset(Cuboid6 offsets) { for (int k = 0; k < verts.length; k++) { Vertex5 vert = verts[k]; Vector3 normal = normals()[k]; - switch (findSide(normal)) { - case 0: - vert.vec.y += offsets.min.y; - break; - case 1: - vert.vec.y += offsets.max.y; - break; - case 2: - vert.vec.z += offsets.min.z; - break; - case 3: - vert.vec.z += offsets.max.z; - break; - case 4: - vert.vec.x += offsets.min.x; - break; - case 5: - vert.vec.x += offsets.max.x; - break; + switch (VectorUtils.findSide(normal)) { + case 0: + vert.vec.y += offsets.min.y; + break; + case 1: + vert.vec.y += offsets.max.y; + break; + case 2: + vert.vec.z += offsets.min.z; + break; + case 3: + vert.vec.z += offsets.max.z; + break; + case 4: + vert.vec.x += offsets.min.x; + break; + case 5: + vert.vec.x += offsets.max.x; + break; } } return this; } - public static int findSide(Vector3 normal) { - if (normal.y <= -0.99) { - return 0; - } - if (normal.y >= 0.99) { - return 1; - } - if (normal.z <= -0.99) { - return 2; - } - if (normal.z >= 0.99) { - return 3; - } - if (normal.x <= -0.99) { - return 4; - } - if (normal.x >= 0.99) { - return 5; - } - return -1; - } - /** * @return A Cuboid6 containing all the verts in this model */ diff --git a/dependencies/main/java/codechicken/lib/render/CCModelLibrary.java b/dependencies/main/java/codechicken/lib/render/CCModelLibrary.java index 958e48c184..1a662055cc 100644 --- a/dependencies/main/java/codechicken/lib/render/CCModelLibrary.java +++ b/dependencies/main/java/codechicken/lib/render/CCModelLibrary.java @@ -1,10 +1,14 @@ package codechicken.lib.render; -import codechicken.lib.vec.*; +import codechicken.lib.vec.Quat; +import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.Vertex5; import static codechicken.lib.math.MathHelper.phi; +//TODO Maybe expand to some more platonic solids at some point. public class CCModelLibrary { + public static CCModel icosahedron4; public static CCModel icosahedron7; @@ -76,8 +80,4 @@ private static void addIcosahedronTriangle(Vector3 vec1, double u1, double v1, V icosahedron4.verts[i * 3 + 2] = icosahedron7.verts[i * 4 + 2] = icosahedron7.verts[i * 4 + 3] = new Vertex5(vec3, u3, v3); i++; } - - public static Matrix4 getRenderMatrix(Vector3 position, Rotation rotation, double scale) { - return new Matrix4().translate(position).apply(new Scale(scale)).apply(rotation); - } } diff --git a/dependencies/main/java/codechicken/lib/render/CCModelState.java b/dependencies/main/java/codechicken/lib/render/CCModelState.java new file mode 100644 index 0000000000..a6352b8597 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/CCModelState.java @@ -0,0 +1,79 @@ +package codechicken.lib.render; + +import com.google.common.base.Optional; +import com.google.common.collect.ImmutableMap; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ItemTransformVec3f; +import net.minecraftforge.client.model.IPerspectiveAwareModel.MapWrapper; +import net.minecraftforge.common.model.IModelPart; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; + +/** + * Created by covers1624 on 5/16/2016. + * Same as a SimpleModelState except has a getter for the Transform map. + * TODO Fix toVanillaTransform. + */ +public class CCModelState implements IModelState { + + private final ImmutableMap map; + private final Optional defaultTransform; + + public CCModelState(ImmutableMap map) { + this(map, Optional.absent()); + } + + public CCModelState(ImmutableMap map, Optional defaultTransform) { + this.map = map; + this.defaultTransform = defaultTransform; + } + + public Optional apply(Optional part) { + if (!part.isPresent() || !(part.get() instanceof TransformType) || !map.containsKey(part.get())) { + return defaultTransform; + } + return Optional.fromNullable(map.get(part.get())); + } + + public ImmutableMap getTransforms() { + return MapWrapper.getTransforms(this); + } + + @SuppressWarnings ("deprecation")//TODO, This seems to create invalid transforms. + public ItemCameraTransforms toVanillaTransform() { + ItemTransformVec3f thirdPLeft = ItemTransformVec3f.DEFAULT; + ItemTransformVec3f thirdPRight = ItemTransformVec3f.DEFAULT; + ItemTransformVec3f firstPLeft = ItemTransformVec3f.DEFAULT; + ItemTransformVec3f firstPRight = ItemTransformVec3f.DEFAULT; + ItemTransformVec3f head = ItemTransformVec3f.DEFAULT; + ItemTransformVec3f gui = ItemTransformVec3f.DEFAULT; + ItemTransformVec3f ground = ItemTransformVec3f.DEFAULT; + ItemTransformVec3f fixed = ItemTransformVec3f.DEFAULT; + if (map.containsKey(TransformType.THIRD_PERSON_LEFT_HAND)) { + thirdPLeft = map.get(TransformType.THIRD_PERSON_LEFT_HAND).toItemTransform(); + } + if (map.containsKey(TransformType.THIRD_PERSON_RIGHT_HAND)) { + thirdPRight = map.get(TransformType.THIRD_PERSON_RIGHT_HAND).toItemTransform(); + } + if (map.containsKey(TransformType.FIRST_PERSON_LEFT_HAND)) { + firstPLeft = map.get(TransformType.FIRST_PERSON_LEFT_HAND).toItemTransform(); + } + if (map.containsKey(TransformType.FIRST_PERSON_RIGHT_HAND)) { + firstPRight = map.get(TransformType.FIRST_PERSON_RIGHT_HAND).toItemTransform(); + } + if (map.containsKey(TransformType.HEAD)) { + head = map.get(TransformType.HEAD).toItemTransform(); + } + if (map.containsKey(TransformType.GUI)) { + gui = map.get(TransformType.GUI).toItemTransform(); + } + if (map.containsKey(TransformType.GROUND)) { + ground = map.get(TransformType.GROUND).toItemTransform(); + } + if (map.containsKey(TransformType.FIXED)) { + fixed = map.get(TransformType.FIXED).toItemTransform(); + } + return new ItemCameraTransforms(thirdPLeft, thirdPRight, firstPLeft, firstPRight, head, gui, ground, fixed); + } +} diff --git a/dependencies/main/java/codechicken/lib/render/CCOBJParser.java b/dependencies/main/java/codechicken/lib/render/CCOBJParser.java new file mode 100644 index 0000000000..d987b0924b --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/CCOBJParser.java @@ -0,0 +1,289 @@ +package codechicken.lib.render; + +import codechicken.lib.vec.RedundantTransformation; +import codechicken.lib.vec.Transformation; +import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.uv.UV; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; + +import java.io.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Created by covers1624 on 6/21/2016. + * TODO Support MatLib files. + * TODO Custom Mat file for loading LightModels, calculating normals and applying the lighting and rotations. + */ +public class CCOBJParser { + + private static final Pattern vertPattern = Pattern.compile("v(?: ([\\d\\.+-]+))+"); + private static final Pattern uvwPattern = Pattern.compile("vt(?: ([\\d\\.+-]+))+"); + private static final Pattern normalPattern = Pattern.compile("vn(?: ([\\d\\.+-]+))+"); + private static final Pattern polyPattern = Pattern.compile("f(?: ((?:\\d*)(?:/\\d*)?(?:/\\d*)?))+"); + public static final Matcher vertMatcher = vertPattern.matcher(""); + public static final Matcher uvwMatcher = uvwPattern.matcher(""); + public static final Matcher normalMatcher = normalPattern.matcher(""); + public static final Matcher polyMatcher = polyPattern.matcher(""); + + /** + * Parses vertices, texture coords, normals and polygons from a WaveFront Obj file + * + * @param res The resource for the obj file + * @return A map of group names to models + */ + public static Map parseObjModels(ResourceLocation res) { + return parseObjModels(res, null); + } + + /** + * Parses vertices, texture coords, normals and polygons from a WaveFront Obj file + * + * @param res The resource for the obj file + * @param coordSystem The cooridnate system transformation to apply + * @return A map of group names to models + */ + public static Map parseObjModels(ResourceLocation res, Transformation coordSystem) { + return parseObjModels(res, 4, coordSystem); + } + + /** + * Parses vertices, texture coords, normals and polygons from a WaveFront Obj file + * + * @param res The resource for the obj file + * @param vertexMode The vertex mode to create the model for (GL_TRIANGLES or GL_QUADS) + * @param coordSystem The cooridnate system transformation to apply + * @return A map of group names to models + */ + public static Map parseObjModels(ResourceLocation res, int vertexMode, Transformation coordSystem) { + try { + return parseObjModels(Minecraft.getMinecraft().getResourceManager().getResource(res).getInputStream(), vertexMode, coordSystem); + } catch (Exception e) { + throw new RuntimeException("failed to load model: " + res, e); + } + } + + /** + * Parses vertices, texture coords, normals and polygons from a WaveFront Obj file + * + * @param input An input stream to a obj file + * @param vertexMode The vertex mode to create the model for (GL_TRIANGLES or GL_QUADS) + * @param coordSystem The cooridnate system transformation to apply + * @return A map of group names to models + * @throws IOException + */ + public static Map parseObjModels(InputStream input, int vertexMode, Transformation coordSystem) throws IOException { + if (coordSystem == null) { + coordSystem = new RedundantTransformation(); + } + int vp = vertexMode == 7 ? 4 : 3; + + HashMap modelMap = new HashMap(); + ArrayList verts = new ArrayList(); + ArrayList uvs = new ArrayList(); + ArrayList normals = new ArrayList(); + ArrayList polys = new ArrayList(); + String modelName = "unnamed"; + + BufferedReader reader = new BufferedReader(new InputStreamReader(input)); + + String line; + while ((line = reader.readLine()) != null) { + line = line.replaceAll("\\s+", " ").trim(); + if (line.startsWith("#") || line.length() == 0) { + continue; + } + + if (line.startsWith("v ")) { + assertMatch(vertMatcher, line); + double[] values = parseDoubles(line.substring(2), " "); + illegalAssert(values.length >= 3, "Vertices must have x, y and z components"); + Vector3 vert = new Vector3(values[0], values[1], values[2]); + coordSystem.apply(vert); + verts.add(vert); + continue; + } + if (line.startsWith("vt ")) { + assertMatch(uvwMatcher, line); + double[] values = parseDoubles(line.substring(3), " "); + illegalAssert(values.length >= 2, "Tex Coords must have u, and v components"); + uvs.add(new Vector3(values[0], 1 - values[1], 0)); + continue; + } + if (line.startsWith("vn ")) { + assertMatch(normalMatcher, line); + double[] values = parseDoubles(line.substring(3), " "); + illegalAssert(values.length >= 3, "Normals must have x, y and z components"); + Vector3 norm = new Vector3(values[0], values[1], values[2]).normalize(); + coordSystem.applyN(norm); + normals.add(norm); + continue; + } + if (line.startsWith("f ")) { + assertMatch(polyMatcher, line); + String[] av = line.substring(2).split(" "); + illegalAssert(av.length >= 3, "Polygons must have at least 3 vertices"); + int[][] polyVerts = new int[av.length][3]; + for (int i = 0; i < av.length; i++) { + String[] as = av[i].split("/"); + for (int p = 0; p < as.length; p++) { + if (as[p].length() > 0) { + polyVerts[i][p] = Integer.parseInt(as[p]); + } + } + } + if (vp == 3) { + triangulate(polys, polyVerts); + } else { + quadulate(polys, polyVerts); + } + } + if (line.startsWith("g ")) { + if (!polys.isEmpty()) { + modelMap.put(modelName, CCModel.createModel(verts, uvs, normals, vertexMode, polys)); + polys.clear(); + } + modelName = line.substring(2); + } + } + + if (!polys.isEmpty()) { + modelMap.put(modelName, CCModel.createModel(verts, uvs, normals, vertexMode, polys)); + } + + return modelMap; + } + + /** + * Exports an Map of CCModels to a File. + * + * @param models Map of models to export. + * @param p PrintWriter to write the model to. + */ + public static void exportObj(Map models, PrintWriter p) { + List verts = new ArrayList(); + List uvs = new ArrayList(); + List normals = new ArrayList(); + List polys = new ArrayList(); + for (Map.Entry e : models.entrySet()) { + p.println("g " + e.getKey()); + CCModel m = e.getValue(); + + int vStart = verts.size(); + int uStart = uvs.size(); + int nStart = normals.size(); + boolean hasNormals = m.normals() != null; + polys.clear(); + + for (int i = 0; i < m.verts.length; i++) { + int[] ia = new int[hasNormals ? 3 : 2]; + ia[0] = addIndex(verts, m.verts[i].vec); + ia[1] = addIndex(uvs, m.verts[i].uv); + if (hasNormals) { + ia[2] = addIndex(normals, m.normals()[i]); + } + polys.add(ia); + } + + if (vStart < verts.size()) { + p.println(); + for (int i = vStart; i < verts.size(); i++) { + Vector3 v = verts.get(i); + p.format("v %s %s %s\n", clean(v.x), clean(v.y), clean(v.z)); + } + } + if (uStart < uvs.size()) { + p.println(); + for (int i = uStart; i < uvs.size(); i++) { + UV uv = uvs.get(i); + p.format("vt %s %s\n", clean(uv.u), clean(uv.v)); + } + } + if (nStart < normals.size()) { + p.println(); + for (int i = nStart; i < normals.size(); i++) { + Vector3 n = normals.get(i); + p.format("vn %s %s %s\n", clean(n.x), clean(n.y), clean(n.z)); + } + } + + p.println(); + for (int i = 0; i < polys.size(); i++) { + if (i % m.vp == 0) { + p.format("f"); + } + int[] ia = polys.get(i); + if (hasNormals) { + p.format(" %d/%d/%d", ia[0], ia[1], ia[2]); + } else { + p.format(" %d/%d", ia[0], ia[1]); + } + if (i % m.vp == m.vp - 1) { + p.println(); + } + } + } + } + + private static int addIndex(List list, T elem) { + int i = list.indexOf(elem) + 1; + if (i == 0) { + list.add(elem); + i = list.size(); + } + return i; + } + + private static String clean(double d) { + return d == (int) d ? Integer.toString((int) d) : Double.toString(d); + } + + private static void assertMatch(Matcher m, String s) { + m.reset(s); + illegalAssert(m.matches(), "Malformed line: " + s); + } + + private static void illegalAssert(boolean b, String err) { + if (!b) { + throw new IllegalArgumentException(err); + } + } + + private static double[] parseDoubles(String s, String token) { + String[] as = s.split(token); + double[] values = new double[as.length]; + for (int i = 0; i < as.length; i++) { + values[i] = Double.parseDouble(as[i]); + } + return values; + } + + private static void triangulate(List polys, int[][] polyVerts) { + for (int i = 2; i < polyVerts.length; i++) { + polys.add(polyVerts[0]); + polys.add(polyVerts[i]); + polys.add(polyVerts[i - 1]); + } + } + + private static void quadulate(List polys, int[][] polyVerts) { + if (polyVerts.length == 4) { + polys.add(polyVerts[0]); + polys.add(polyVerts[3]); + polys.add(polyVerts[2]); + polys.add(polyVerts[1]); + } else { + for (int i = 2; i < polyVerts.length; i++) { + polys.add(polyVerts[0]); + polys.add(polyVerts[i]); + polys.add(polyVerts[i - 1]); + polys.add(polyVerts[i - 1]); + } + } + } +} diff --git a/dependencies/main/java/codechicken/lib/render/CCRSConsumer.java b/dependencies/main/java/codechicken/lib/render/CCRSConsumer.java new file mode 100644 index 0000000000..1459fee901 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/CCRSConsumer.java @@ -0,0 +1,86 @@ +package codechicken.lib.render; + +import codechicken.lib.colour.Colour; +import codechicken.lib.vec.Vector3; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.renderer.vertex.VertexFormatElement; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.client.model.pipeline.IVertexConsumer; + +/** + * Created by covers1624 on 15/01/2017. + * TODO, Maybe merge with CCRS?? + */ +public class CCRSConsumer implements IVertexConsumer { + + private final CCRenderState ccrs; + private Vector3 offset = Vector3.zero; + + public CCRSConsumer(CCRenderState ccrs) { + this.ccrs = ccrs; + } + + @Override + public VertexFormat getVertexFormat() { + return ccrs.getVertexFormat(); + } + + @Override + public void setTexture(TextureAtlasSprite texture) { + ccrs.sprite = texture; + } + + @Override + public void put(int e, float... data) { + VertexFormat format = getVertexFormat(); + + VertexFormatElement fmte = format.getElement(e); + switch (fmte.getUsage()) { + case POSITION: + ccrs.vert.vec.set(data).add(offset); + break; + case UV: + if (fmte.getIndex() == 0) { + ccrs.vert.uv.set(data[0], data[1]); + } else { + ccrs.brightness = (int) (data[1] * 65535 / 32) << 20 | (int) (data[0] * 65535 / 32) << 4; + } + break; + case COLOR: + ccrs.colour = Colour.packRGBA(data); + break; + case NORMAL: + ccrs.normal.set(data); + break; + case PADDING: + break; + default: + throw new UnsupportedOperationException("Generic vertex format element"); + } + if (e == format.getElementCount() - 1) { + ccrs.writeVert(); + } + } + + public void setOffset(Vector3 offset) { + this.offset = offset; + } + + public void setOffset(BlockPos offset) { + this.offset = Vector3.fromBlockPos(offset); + } + + @Override + public void setQuadTint(int tint) { + } + + @Override + public void setQuadOrientation(EnumFacing orientation) { + } + + @Override + public void setApplyDiffuseLighting(boolean diffuse) { + } +} diff --git a/dependencies/main/java/codechicken/lib/render/CCRenderEventHandler.java b/dependencies/main/java/codechicken/lib/render/CCRenderEventHandler.java new file mode 100644 index 0000000000..0135f0ae99 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/CCRenderEventHandler.java @@ -0,0 +1,56 @@ +package codechicken.lib.render; + +import codechicken.lib.raytracer.CuboidRayTraceResult; +import codechicken.lib.vec.Vector3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.RayTraceResult.Type; +import net.minecraftforge.client.event.DrawBlockHighlightEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public class CCRenderEventHandler { + + public static int renderTime; + public static float renderFrame; + + private static boolean hasInit = false; + + public static void init() { + if (!hasInit) { + MinecraftForge.EVENT_BUS.register(new CCRenderEventHandler()); + hasInit = true; + } + } + + @SubscribeEvent + public void clientTick(TickEvent.ClientTickEvent event) { + if (event.phase == Phase.END) { + renderTime++; + } + } + + @SubscribeEvent + public void renderTick(TickEvent.RenderTickEvent event) { + if (event.phase == Phase.START) { + renderFrame = event.renderTickTime; + } + } + + @SideOnly (Side.CLIENT) + @SubscribeEvent//TODO Change event priority. + public void onBlockHighlight(DrawBlockHighlightEvent event) { + BlockPos pos = event.getTarget().getBlockPos(); + + //We have found a CuboidRayTraceResult, Lets render it properly.. + RayTraceResult hit = event.getTarget(); + if (hit.typeOfHit == Type.BLOCK && hit instanceof CuboidRayTraceResult && !((CuboidRayTraceResult) hit).disableAutoHitboxRender) { + event.setCanceled(true); + RenderUtils.renderHitBox(event.getPlayer(), ((CuboidRayTraceResult) event.getTarget()).cuboid6.copy().add(new Vector3(pos)), event.getPartialTicks()); + } + } +} diff --git a/dependencies/main/java/codechicken/lib/render/CCRenderState.java b/dependencies/main/java/codechicken/lib/render/CCRenderState.java index a61e92664f..5fefa35b2f 100644 --- a/dependencies/main/java/codechicken/lib/render/CCRenderState.java +++ b/dependencies/main/java/codechicken/lib/render/CCRenderState.java @@ -1,29 +1,42 @@ package codechicken.lib.render; +import codechicken.lib.colour.Colour; import codechicken.lib.colour.ColourRGBA; import codechicken.lib.lighting.LC; import codechicken.lib.lighting.LightMatrix; -import codechicken.lib.util.Copyable; -import codechicken.lib.vec.Rotation; -import codechicken.lib.vec.Transformation; +import codechicken.lib.render.buffer.BakingVertexBuffer; +import codechicken.lib.render.pipeline.CCRenderPipeline; +import codechicken.lib.render.pipeline.IVertexOperation; +import codechicken.lib.render.pipeline.IVertexSource; +import codechicken.lib.render.pipeline.VertexAttribute; +import codechicken.lib.render.pipeline.attribute.*; import codechicken.lib.vec.Vector3; -import net.minecraft.client.Minecraft; +import codechicken.lib.vec.Vertex5; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ResourceLocation; +import net.minecraft.client.renderer.vertex.VertexFormatElement; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.lwjgl.opengl.GL11; -import java.util.ArrayList; +import java.util.List; /** * The core of the CodeChickenLib render system. - * Rendering operations are written to avoid object allocations by reusing static variables. + * Where possible assign a local var of CCRenderState to avoid millions of calls to instance(); + * Uses a ThreadLocal system to assign each thread their own CCRenderState so we can use it in Multithreaded chunk batching. + * TODO, proper piping of BakedQuads and CCBakedQuads. */ public class CCRenderState { + private static int nextOperationIndex; public static int registerOperation() { @@ -34,420 +47,251 @@ public static int operationCount() { return nextOperationIndex; } - /** - * Represents an operation to be run for each vertex that operates on and modifies the current state - */ - public static interface IVertexOperation { - /** - * Load any required references and add dependencies to the pipeline based on the current model (may be null) - * Return false if this operation is redundant in the pipeline with the given model - */ - public boolean load(); - - /** - * Perform the operation on the current render state - */ - public void operate(); - - /** - * Get the unique id representing this type of operation. Duplicate operation IDs within the pipeline may have unexpected results. - * ID shoulld be obtained from CCRenderState.registerOperation() and stored in a static variable - */ - public int operationID(); - } - - private static ArrayList> vertexAttributes = new ArrayList>(); - - private static int registerVertexAttribute(VertexAttribute attr) { - vertexAttributes.add(attr); - return vertexAttributes.size() - 1; - } - - public static VertexAttribute getAttribute(int index) { - return vertexAttributes.get(index); - } - - /** - * Management class for a vertex attrute such as colour, normal etc - * This class should handle the loading of the attrute from an array provided by IVertexSource.getAttributes or the computation of this attrute from others - * - * @param The array type for this attrute eg. int[], Vector3[] - */ - public static abstract class VertexAttribute implements IVertexOperation { - public final int attributeIndex = registerVertexAttribute(this); - private final int operationIndex = registerOperation(); - /** - * Set to true when the attrute is part of the pipeline. Should only be managed by CCRenderState when constructing the pipeline - */ - public boolean active = false; - - /** - * Construct a new array for storage of vertex attrutes in a model - */ - public abstract T newArray(int length); - - @Override - public int operationID() { - return operationIndex; - } - } - - public static void arrayCopy(Object src, int srcPos, Object dst, int destPos, int length) { - System.arraycopy(src, srcPos, dst, destPos, length); - if (dst instanceof Copyable[]) { - Object[] oa = (Object[]) dst; - Copyable[] c = (Copyable[]) dst; - for (int i = destPos; i < destPos + length; i++) { - if (c[i] != null) { - oa[i] = c[i].copy(); - } - } - } - } - - public static T copyOf(VertexAttribute attr, T src, int length) { - T dst = attr.newArray(length); - arrayCopy(src, 0, dst, 0, ((Object[]) src).length); - return dst; - } - - public static interface IVertexSource { - public Vertex5[] getVertices(); - - /** - * Gets an array of vertex attrutes - * - * @param attr The vertex attrute to get - * @param The attrute array type - * @return An array, or null if not computed - */ - public T getAttributes(VertexAttribute attr); - - /** - * @return True if the specified attrute is provided by this model, either by returning an array from getAttributes or by setting the state in prepareVertex - */ - public boolean hasAttribute(VertexAttribute attr); - - /** - * Callback to set CCRenderState for a vertex before the pipeline runs - */ - public void prepareVertex(); - } - - public static VertexAttribute normalAttrib = new VertexAttribute() { - private Vector3[] normalRef; + //Each attrib needs to be assigned in this order to have a valid operation index. + public final VertexAttribute normalAttrib = new NormalAttribute(); + public final VertexAttribute colourAttrib = new ColourAttribute(); + public final VertexAttribute lightingAttrib = new LightingAttribute(); + public final VertexAttribute sideAttrib = new SideAttribute(); + public final VertexAttribute lightCoordAttrib = new LightCoordAttribute(); + private static final ThreadLocal instances = new ThreadLocal() { @Override - public Vector3[] newArray(int length) { - return new Vector3[length]; - } - - @Override - public boolean load() { - normalRef = model.getAttributes(this); - if (model.hasAttribute(this)) { - return normalRef != null; - } - - if (model.hasAttribute(sideAttrib)) { - pipeline.addDependency(sideAttrib); - return true; - } - throw new IllegalStateException("Normals requested but neither normal or side attrutes are provided by the model"); - } - - @Override - public void operate() { - if (normalRef != null) { - setNormal(normalRef[vertexIndex]); - } else { - setNormal(Rotation.axes[side]); - } - } - }; - public static VertexAttribute colourAttrib = new VertexAttribute() { - private int[] colourRef; - - @Override - public int[] newArray(int length) { - return new int[length]; - } - - @Override - public boolean load() { - colourRef = model.getAttributes(this); - return colourRef != null || !model.hasAttribute(this); - } - - @Override - public void operate() { - if (colourRef != null) { - setColour(ColourRGBA.multiply(baseColour, colourRef[vertexIndex])); - } else { - setColour(baseColour); - } + protected CCRenderState initialValue() { + return new CCRenderState(); } }; - public static VertexAttribute lightingAttrib = new VertexAttribute() { - private int[] colourRef; - - @Override - public int[] newArray(int length) { - return new int[length]; - } - - @Override - public boolean load() { - if (!computeLighting || !useColour || !model.hasAttribute(this)) { - return false; - } - - colourRef = model.getAttributes(this); - if (colourRef != null) { - pipeline.addDependency(colourAttrib); - return true; - } - return false; - } + private static final CCRenderState bakingRenderState = new CCRenderState(); - @Override - public void operate() { - setColour(ColourRGBA.multiply(colour, colourRef[vertexIndex])); - } - }; - public static VertexAttribute sideAttrib = new VertexAttribute() { - private int[] sideRef; - - @Override - public int[] newArray(int length) { - return new int[length]; - } - - @Override - public boolean load() { - sideRef = model.getAttributes(this); - if (model.hasAttribute(this)) { - return sideRef != null; - } - - pipeline.addDependency(normalAttrib); - return true; - } + //pipeline state + public IVertexSource model; + public int firstVertexIndex; + public int lastVertexIndex; + public int vertexIndex; + public CCRenderPipeline pipeline; + @SideOnly (Side.CLIENT) + public VertexBuffer r; + @SideOnly (Side.CLIENT) + public VertexFormat fmt; - @Override - public void operate() { - if (sideRef != null) { - side = sideRef[vertexIndex]; - } else { - side = CCModel.findSide(normal); - } - } - }; - /** - * Uses the position of the lightmatrix to compute LC if not provided - */ - public static VertexAttribute lightCoordAttrib = new VertexAttribute() { - private LC[] lcRef; - private Vector3 vec = new Vector3();//for computation - private Vector3 pos = new Vector3(); + //context + public int baseColour; + public int alphaOverride; + public boolean computeLighting; + public LightMatrix lightMatrix = new LightMatrix(); - @Override - public LC[] newArray(int length) { - return new LC[length]; - } + //vertex outputs + public final Vertex5 vert = new Vertex5(); + public final Vector3 normal = new Vector3(); + public int colour; + public int brightness; - @Override - public boolean load() { - lcRef = model.getAttributes(this); - if (model.hasAttribute(this)) { - return lcRef != null; - } + //attribute storage + public int side; + public LC lc = new LC(); + @SideOnly (Side.CLIENT) + public TextureAtlasSprite sprite; - pos.set(lightMatrix.pos.x, lightMatrix.pos.y, lightMatrix.pos.z); - pipeline.addDependency(sideAttrib); - pipeline.addRequirement(Transformation.operationIndex); - return true; - } + private CCRenderState() { + pipeline = new CCRenderPipeline(this); - @Override - public void operate() { - if (lcRef != null) { - lc.set(lcRef[vertexIndex]); - } else { - lc.compute(vec.set(vert.vec).sub(pos), side); - } - } - }; + } - //pipeline state - public static IVertexSource model; - public static int firstVertexIndex; - public static int lastVertexIndex; - public static int vertexIndex; - public static CCRenderPipeline pipeline = new CCRenderPipeline(); + public static CCRenderState instance() { + return instances.get(); + } - //context - public static int baseColour; - public static int alphaOverride; - public static boolean useNormals; - public static boolean computeLighting; - public static boolean useColour; - public static LightMatrix lightMatrix = new LightMatrix(); + public static CCRenderState getBakingRenderState() { + return bakingRenderState; + } - //vertex outputs - public static Vertex5 vert = new Vertex5(); - public static boolean hasNormal; - public static Vector3 normal = new Vector3(); - public static boolean hasColour; - public static int colour; - public static boolean hasBrightness; - public static int brightness; - - //attrute storage - public static int side; - public static LC lc = new LC(); - - public static void reset() { + public void reset() { model = null; pipeline.reset(); - useNormals = hasNormal = hasBrightness = hasColour = false; - useColour = computeLighting = true; + computeLighting = true; baseColour = alphaOverride = -1; } - public static void setPipeline(IVertexOperation... ops) { + public void preRenderWorld(IBlockAccess world, BlockPos pos) { + this.reset(); + this.colour = 0xFFFFFFFF; + this.setBrightness(world, pos); + } + + public void setPipeline(IVertexOperation... ops) { pipeline.setPipeline(ops); } - public static void setPipeline(IVertexSource model, int start, int end, IVertexOperation... ops) { + public void setPipeline(IVertexSource model, int start, int end, IVertexOperation... ops) { pipeline.reset(); + pipeline.forceFormatAttributes = false; setModel(model, start, end); + pipeline.forceFormatAttributes = true; pipeline.setPipeline(ops); } - public static void bindModel(IVertexSource model) { - if (CCRenderState.model != model) { - CCRenderState.model = model; + public void bindModel(IVertexSource model) { + if (this.model != model) { + this.model = model; pipeline.rebuild(); } } - public static void setModel(IVertexSource source) { + public void setModel(IVertexSource source) { setModel(source, 0, source.getVertices().length); } - public static void setModel(IVertexSource source, int start, int end) { + public void setModel(IVertexSource source, int start, int end) { bindModel(source); setVertexRange(start, end); } - public static void setVertexRange(int start, int end) { + public void setVertexRange(int start, int end) { firstVertexIndex = start; lastVertexIndex = end; } - public static void render(IVertexOperation... ops) { + public void renderQuads(List quads) { + VertexBuffer buffer = startDrawing(GL11.GL_QUADS, quads.get(0).getFormat()); + for (BakedQuad quad : quads) { + buffer.addVertexData(quad.getVertexData()); + } + draw(); + } + + public void render(IVertexOperation... ops) { setPipeline(ops); render(); } - public static void render() { + public void render() { Vertex5[] verts = model.getVertices(); for (vertexIndex = firstVertexIndex; vertexIndex < lastVertexIndex; vertexIndex++) { - model.prepareVertex(); + model.prepareVertex(this); vert.set(verts[vertexIndex]); runPipeline(); writeVert(); } } - public static void runPipeline() { + public void runPipeline() { pipeline.operate(); } - public static void writeVert() { - WorldRenderer r = Tessellator.getInstance().getWorldRenderer(); - - if (hasNormal) { - r.normal((float) normal.x, (float) normal.y, (float) normal.z); - } - if (hasColour) { - r.color(colour >>> 24, colour >> 16 & 0xFF, colour >> 8 & 0xFF, alphaOverride >= 0 ? alphaOverride : colour & 0xFF); + public void writeVert() { + if (r instanceof BakingVertexBuffer) { + ((BakingVertexBuffer) r).setSprite(sprite); } - if (hasBrightness) { - r.lightmap(brightness >> 16 & 65535, brightness & 65535); + for (int e = 0; e < fmt.getElementCount(); e++) { + VertexFormatElement fmte = fmt.getElement(e); + switch (fmte.getUsage()) { + case POSITION: + r.pos(vert.vec.x, vert.vec.y, vert.vec.z); + break; + case UV: + if (fmte.getIndex() == 0) { + r.tex(vert.uv.u, vert.uv.v); + } else { + r.lightmap(brightness >> 16 & 65535, brightness & 65535); + } + break; + case COLOR: + if (r.isColorDisabled()) { + //-_- Fucking mojang.. + r.nextVertexFormatIndex(); + } else { + r.color(colour >>> 24, colour >> 16 & 0xFF, colour >> 8 & 0xFF, alphaOverride >= 0 ? alphaOverride : colour & 0xFF); + } + break; + case NORMAL: + r.normal((float) normal.x, (float) normal.y, (float) normal.z); + break; + case PADDING: + break; + default: + throw new UnsupportedOperationException("Generic vertex format element"); + } } + r.endVertex(); } - public static void setNormal(double x, double y, double z) { - hasNormal = true; - normal.set(x, y, z); + public void pushColour() { + GlStateManager.color((colour >>> 24) / 255F, (colour >> 16 & 0xFF) / 255F, (colour >> 8 & 0xFF) / 255F, (alphaOverride >= 0 ? alphaOverride : colour & 0xFF) / 255F); } - public static void setNormal(Vector3 n) { - hasNormal = true; - normal.set(n); + public void setBrightness(IBlockAccess world, BlockPos pos) { + brightness = world.getBlockState(pos).getBlock().getPackedLightmapCoords(world.getBlockState(pos), world, pos); } - public static void setColour(int c) { - hasColour = true; - colour = c; + public void pullLightmap() { + brightness = (int) OpenGlHelper.lastBrightnessY << 16 | (int) OpenGlHelper.lastBrightnessX; } - public static void setBrightness(int b) { - hasBrightness = true; - brightness = b; + public void pushLightmap() { + OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightness & 0xFFFF, brightness >>> 16); } - public static void setBrightness(IBlockAccess world, BlockPos pos) { - setBrightness(world.getBlockState(pos).getBlock().getMixedBrightnessForBlock(world, pos)); + public void setFluidColour(FluidStack fluidStack) { + setFluidColour(fluidStack, 0xFF); } - public static void pullLightmap() { - setBrightness((int) OpenGlHelper.lastBrightnessY << 16 | (int) OpenGlHelper.lastBrightnessX); + public void setFluidColour(FluidStack fluidStack, int alpha) { + this.colour = fluidStack.getFluid().getColor(fluidStack) << 8 | alpha; } - public static void pushLightmap() { - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightness & 0xFFFF, brightness >>> 16); + public void setColour(Colour colour) { + this.colour = colour.rgba(); } - /** - * Compact helper for setting dynamic rendering context. Uses normals and doesn't compute lighting - */ - public static void setDynamic() { - useNormals = true; - computeLighting = false; + public ColourRGBA getColour() { + return new ColourRGBA(colour); } - public static void changeTexture(String texture) { - changeTexture(new ResourceLocation(texture)); + @SideOnly (Side.CLIENT) + public VertexBuffer startDrawing(int mode, VertexFormat format) { + VertexBuffer r = Tessellator.getInstance().getBuffer(); + r.begin(mode, format); + bind(r); + return r; } - public static void changeTexture(ResourceLocation texture) { - Minecraft.getMinecraft().renderEngine.bindTexture(texture); + @SideOnly (Side.CLIENT) + public VertexBuffer startDrawing(int mode, VertexFormat format, VertexBuffer buffer) { + buffer.begin(mode, format); + bind(buffer); + return buffer; } - public static WorldRenderer startDrawing() { - return startDrawing(7, DefaultVertexFormats.POSITION_TEX); + @SideOnly (Side.CLIENT) + public void bind(VertexBuffer r) { + this.r = r; + fmt = r.getVertexFormat(); } - public static WorldRenderer startDrawing(VertexFormat format) { - return startDrawing(7, format); + @SideOnly (Side.CLIENT) + public VertexBuffer getBuffer() { + return r; } - public static WorldRenderer startDrawing(int mode, VertexFormat format) { - WorldRenderer r = Tessellator.getInstance().getWorldRenderer(); - r.begin(mode, format); - if (hasColour) { - r.color(colour >>> 24, colour >> 16 & 0xFF, colour >> 8 & 0xFF, alphaOverride >= 0 ? alphaOverride : colour & 0xFF); - } - if (hasBrightness) { - r.lightmap(brightness >> 16 & 65535, brightness & 65535); - } - return r; + @SideOnly (Side.CLIENT) + public VertexFormat getVertexFormat() { + return fmt; } - public static void draw() { + public void draw() { Tessellator.getInstance().draw(); } + + /** + * Polls the currently bound VertexBuffer to see if it is drawing. + * If no buffer is bound it checks Tessellator.getInstance.getBuffer. + * + * @return If the buffer is drawing. + */ + public boolean isDrawing() { + if (r != null) { + return r.isDrawing; + } else { + return Tessellator.getInstance().getBuffer().isDrawing; + } + } } diff --git a/dependencies/main/java/codechicken/lib/render/DigIconParticle.java b/dependencies/main/java/codechicken/lib/render/DigIconParticle.java new file mode 100644 index 0000000000..cc43d54bf3 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/DigIconParticle.java @@ -0,0 +1,92 @@ +package codechicken.lib.render; + +import codechicken.lib.render.particle.CustomParticleHandler; +import codechicken.lib.vec.Cuboid6; +import net.minecraft.client.particle.Particle; +import net.minecraft.client.particle.ParticleManager; +import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.entity.Entity; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class DigIconParticle extends Particle { + + public DigIconParticle(World world, double x, double y, double z, double dx, double dy, double dz, TextureAtlasSprite icon) { + super(world, x, y, z, dx, dy, dz); + particleTexture = icon; + particleGravity = 1; + particleRed = particleGreen = particleBlue = 0.6F; + particleScale /= 2.0F; + } + + public static DigIconParticle newLandingParticle(World world, double x, double y, double z, double dx, double dy, double dz, TextureAtlasSprite icon) { + DigIconParticle particle = new DigIconParticle(world, x, y, z, dx, dy, dz, icon); + particle.motionX = dx; + particle.motionY = dy; + particle.motionZ = dz; + return particle; + } + + @Override + public int getFXLayer() { + return 1; + } + + public void setScale(float scale) { + particleScale = scale; + } + + public float getScale() { + return particleScale; + } + + public void setMaxAge(int age) { + particleMaxAge = age; + } + + public int getMaxAge() { + return particleMaxAge; + } + + /** + * copy pasted from ParticleBreaking + * //TODO Doc. + */ + @Override + public void renderParticle(VertexBuffer vertexBuffer, Entity entity, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { + float f = ((float) this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F; + float f1 = f + 0.015609375F; + float f2 = ((float) this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F; + float f3 = f2 + 0.015609375F; + float f4 = 0.1F * this.particleScale; + + if (this.particleTexture != null) { + f = this.particleTexture.getInterpolatedU((double) (this.particleTextureJitterX / 4.0F * 16.0F)); + f1 = this.particleTexture.getInterpolatedU((double) ((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F)); + f2 = this.particleTexture.getInterpolatedV((double) (this.particleTextureJitterY / 4.0F * 16.0F)); + f3 = this.particleTexture.getInterpolatedV((double) ((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F)); + } + + float f5 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) partialTicks - interpPosX); + float f6 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) partialTicks - interpPosY); + float f7 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTicks - interpPosZ); + int i = this.getBrightnessForRender(partialTicks); + int j = i >> 16 & 65535; + int k = i & 65535; + vertexBuffer.pos((double) (f5 - rotationX * f4 - rotationXY * f4), (double) (f6 - rotationZ * f4), (double) (f7 - rotationYZ * f4 - rotationXZ * f4)).tex((double) f, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + vertexBuffer.pos((double) (f5 - rotationX * f4 + rotationXY * f4), (double) (f6 + rotationZ * f4), (double) (f7 - rotationYZ * f4 + rotationXZ * f4)).tex((double) f, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + vertexBuffer.pos((double) (f5 + rotationX * f4 + rotationXY * f4), (double) (f6 + rotationZ * f4), (double) (f7 + rotationYZ * f4 + rotationXZ * f4)).tex((double) f1, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + vertexBuffer.pos((double) (f5 + rotationX * f4 - rotationXY * f4), (double) (f6 - rotationZ * f4), (double) (f7 + rotationYZ * f4 - rotationXZ * f4)).tex((double) f1, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); + } + + @Deprecated//Use CustomParticleHandler.addBlockHitEffects This will be removed in 1.11 + public static void addBlockHitEffects(World world, Cuboid6 bounds, int side, TextureAtlasSprite icon, ParticleManager effectRenderer) { + CustomParticleHandler.addBlockHitEffects(world, bounds, EnumFacing.VALUES[side], icon, effectRenderer); + } + + @Deprecated//Use CustomParticleHandler.addBlockDestroyEffects This will be removed in 1.11 + public static void addBlockDestroyEffects(World world, Cuboid6 bounds, TextureAtlasSprite[] icons, ParticleManager effectRenderer) { + CustomParticleHandler.addBlockDestroyEffects(world, bounds, icons, effectRenderer); + } +} diff --git a/dependencies/main/java/codechicken/lib/render/EntityDigIconFX.java b/dependencies/main/java/codechicken/lib/render/EntityDigIconFX.java deleted file mode 100644 index c3aeb431ed..0000000000 --- a/dependencies/main/java/codechicken/lib/render/EntityDigIconFX.java +++ /dev/null @@ -1,120 +0,0 @@ -package codechicken.lib.render; - -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Vector3; -import net.minecraft.client.particle.EffectRenderer; -import net.minecraft.client.particle.EntityFX; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.entity.Entity; -import net.minecraft.world.World; - -public class EntityDigIconFX extends EntityFX { - public EntityDigIconFX(World world, double x, double y, double z, double dx, double dy, double dz, TextureAtlasSprite icon) { - super(world, x, y, z, dx, dy, dz); - particleIcon = icon; - particleGravity = 1; - particleRed = particleGreen = particleBlue = 0.6F; - particleScale /= 2.0F; - } - - @Override - public int getFXLayer() { - return 1; - } - - public void setScale(float scale) { - particleScale = scale; - } - - public float getScale() { - return particleScale; - } - - public void setMaxAge(int age) { - particleMaxAge = age; - } - - public int getMaxAge() { - return particleMaxAge; - } - - /** - * copy pasted from EntityDiggingFX - */ - @Override - public void renderParticle(WorldRenderer par1Tessellator, Entity entity, float par2, float par3, float par4, float par5, float par6, float par7) { - float f6 = (particleTextureIndexX + particleTextureJitterX / 4.0F) / 16.0F; - float f7 = f6 + 0.015609375F; - float f8 = (particleTextureIndexY + particleTextureJitterY / 4.0F) / 16.0F; - float f9 = f8 + 0.015609375F; - float f10 = 0.1F * particleScale; - - if (particleIcon != null) { - f6 = particleIcon.getInterpolatedU(particleTextureJitterX / 4.0F * 16.0F); - f7 = particleIcon.getInterpolatedU((particleTextureJitterX + 1.0F) / 4.0F * 16.0F); - f8 = particleIcon.getInterpolatedV(particleTextureJitterY / 4.0F * 16.0F); - f9 = particleIcon.getInterpolatedV((particleTextureJitterY + 1.0F) / 4.0F * 16.0F); - } - - float f11 = (float) (prevPosX + (posX - prevPosX) * par2 - interpPosX); - float f12 = (float) (prevPosY + (posY - prevPosY) * par2 - interpPosY); - float f13 = (float) (prevPosZ + (posZ - prevPosZ) * par2 - interpPosZ); - float f14 = 1.0F; - - par1Tessellator.pos(f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10).tex(f6, f9).color(f14 * particleRed, f14 * particleGreen, f14 * particleBlue, 255F).endVertex(); - par1Tessellator.pos(f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10).tex(f6, f8).color(f14 * particleRed, f14 * particleGreen, f14 * particleBlue, 255F).endVertex(); - par1Tessellator.pos(f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10).tex(f7, f8).color(f14 * particleRed, f14 * particleGreen, f14 * particleBlue, 255F).endVertex(); - par1Tessellator.pos(f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10).tex(f7, f9).color(f14 * particleRed, f14 * particleGreen, f14 * particleBlue, 255F).endVertex(); - } - - public static void addBlockHitEffects(World world, Cuboid6 bounds, int side, TextureAtlasSprite icon, EffectRenderer effectRenderer) { - float border = 0.1F; - Vector3 diff = bounds.max.copy().subtract(bounds.min).add(-2 * border); - diff.x *= world.rand.nextDouble(); - diff.y *= world.rand.nextDouble(); - diff.z *= world.rand.nextDouble(); - Vector3 pos = diff.add(bounds.min).add(border); - - if (side == 0) { - diff.y = bounds.min.y - border; - } - if (side == 1) { - diff.y = bounds.max.y + border; - } - if (side == 2) { - diff.z = bounds.min.z - border; - } - if (side == 3) { - diff.z = bounds.max.z + border; - } - if (side == 4) { - diff.x = bounds.min.x - border; - } - if (side == 5) { - diff.x = bounds.max.x + border; - } - - effectRenderer.addEffect(new EntityDigIconFX(world, pos.x, pos.y, pos.z, 0, 0, 0, icon).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); - } - - public static void addBlockDestroyEffects(World world, Cuboid6 bounds, TextureAtlasSprite[] icons, EffectRenderer effectRenderer) { - Vector3 diff = bounds.max.copy().subtract(bounds.min); - Vector3 center = bounds.min.copy().add(bounds.max).multiply(0.5); - Vector3 density = diff.copy().multiply(4); - density.x = Math.ceil(density.x); - density.y = Math.ceil(density.y); - density.z = Math.ceil(density.z); - - for (int i = 0; i < density.x; ++i) { - for (int j = 0; j < density.y; ++j) { - for (int k = 0; k < density.z; ++k) { - double x = bounds.min.x + (i + 0.5) * diff.x / density.x; - double y = bounds.min.y + (j + 0.5) * diff.y / density.y; - double z = bounds.min.z + (k + 0.5) * diff.z / density.z; - effectRenderer.addEffect(new EntityDigIconFX(world, x, y, z, x - center.x, y - center.y, z - center.z, icons[world.rand.nextInt(icons.length)])); - } - } - } - } -} diff --git a/dependencies/main/java/codechicken/lib/render/IFaceRenderer.java b/dependencies/main/java/codechicken/lib/render/IFaceRenderer.java deleted file mode 100644 index 891b8f9bdd..0000000000 --- a/dependencies/main/java/codechicken/lib/render/IFaceRenderer.java +++ /dev/null @@ -1,5 +0,0 @@ -package codechicken.lib.render; - -public interface IFaceRenderer { - public void renderFace(Vertex5[] face, int side); -} diff --git a/dependencies/main/java/codechicken/lib/render/IItemRenderer.java b/dependencies/main/java/codechicken/lib/render/IItemRenderer.java deleted file mode 100644 index d9935d4c4a..0000000000 --- a/dependencies/main/java/codechicken/lib/render/IItemRenderer.java +++ /dev/null @@ -1,12 +0,0 @@ -package codechicken.lib.render; - -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.item.ItemStack; - -/** - * Hooks the location in RenderItem where TileEntityItemStackRenderer.renderByItem is called. - * Be sure to override isBuiltInRenderer true - */ -public interface IItemRenderer extends IBakedModel { - public void renderItem(ItemStack item); -} diff --git a/dependencies/main/java/codechicken/lib/render/ModelRegistryHelper.java b/dependencies/main/java/codechicken/lib/render/ModelRegistryHelper.java deleted file mode 100644 index 98916680b4..0000000000 --- a/dependencies/main/java/codechicken/lib/render/ModelRegistryHelper.java +++ /dev/null @@ -1,59 +0,0 @@ -package codechicken.lib.render; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelResourceLocation; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.event.ModelBakeEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.LinkedList; -import java.util.List; - -public class ModelRegistryHelper { - private static List> registerModels = new LinkedList>(); - - static { - MinecraftForge.EVENT_BUS.register(new ModelRegistryHelper()); - } - - public static void register(ModelResourceLocation location, IBakedModel model) { - registerModels.add(new ImmutablePair(location, model)); - } - - public static void registerItemModel(Item item, ResourceLocation location) { - registerItemModel(item, 0, location); - } - - public static void registerItemModel(Item item, int meta, ResourceLocation location) { - Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(location, "inventory")); - } - - public static void registerItemMesher(Item item, ItemMeshDefinition mesher) { - Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, mesher); - } - - public static void registerItemRenderer(Item item, IItemRenderer renderer, ResourceLocation location) { - final ModelResourceLocation modelLoc = new ModelResourceLocation(location, "inventory"); - register(modelLoc, renderer); - registerItemMesher(item, new ItemMeshDefinition() { - @Override - public ModelResourceLocation getModelLocation(ItemStack stack) { - return modelLoc; - } - }); - } - - @SubscribeEvent - public void onModelBake(ModelBakeEvent event) { - for (Pair pair : registerModels) { - event.modelRegistry.putObject(pair.getKey(), pair.getValue()); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/render/QBImporter.java b/dependencies/main/java/codechicken/lib/render/QBImporter.java index f83d25753d..2990847591 100644 --- a/dependencies/main/java/codechicken/lib/render/QBImporter.java +++ b/dependencies/main/java/codechicken/lib/render/QBImporter.java @@ -1,8 +1,10 @@ package codechicken.lib.render; -import codechicken.lib.render.uv.UV; -import codechicken.lib.render.uv.UVScale; +import codechicken.lib.texture.TextureDataHolder; +import codechicken.lib.texture.TextureUtils; import codechicken.lib.vec.*; +import codechicken.lib.vec.uv.UV; +import codechicken.lib.vec.uv.UVScale; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import net.minecraft.client.Minecraft; @@ -15,8 +17,11 @@ import java.io.*; import java.util.*; +//TODO, Is this needed anymore? public class QBImporter { + private static class ImagePackNode { + Rectangle4i rect; ImagePackNode child1; ImagePackNode child2; @@ -144,6 +149,7 @@ private void write(BufferedImage img) { } private static class ImageTransform { + int transform; public ImageTransform(int i) { @@ -200,6 +206,7 @@ public UV transform(UV uv) { } public static class QBImage implements Comparable { + int[][] data; ImageTransform packT; Rectangle4i packSlot; @@ -268,6 +275,7 @@ public void transform(UV uv) { { 3, 0 }, { 1, 0 }, { 1, 2 }, { 3, 2 } }; public static class QBQuad { + public Vertex5[] verts = new Vertex5[4]; public QBImage image = new QBImage(); public ImageTransform t = new ImageTransform(); @@ -309,6 +317,7 @@ public Rectangle4i flatten() { } public static class QBCuboid { + public QBMatrix mat; public CuboidCoord c; public int sides; @@ -322,12 +331,7 @@ public QBCuboid(QBMatrix mat, CuboidCoord c) { public static boolean intersects(QBCuboid a, QBCuboid b) { CuboidCoord c = a.c; CuboidCoord d = b.c; - return c.min.x <= d.max.x && - d.min.x <= c.max.x && - c.min.y <= d.max.y && - d.min.y <= c.max.y && - c.min.z <= d.max.z && - d.min.z <= c.max.z; + return c.min.x <= d.max.x && d.min.x <= c.max.x && c.min.y <= d.max.y && d.min.y <= c.max.y && c.min.z <= d.max.z && d.min.z <= c.max.z; } public static void clip(QBCuboid a, QBCuboid b) { @@ -342,10 +346,7 @@ public void clip(QBCuboid o) { for (int a = 0; a < 6; a += 2) { int a1 = (a + 2) % 6; int a2 = (a + 4) % 6; - if (c.getSide(a1 + 1) <= d.getSide(a1 + 1) && - c.getSide(a1) >= d.getSide(a1) && - c.getSide(a2 + 1) <= d.getSide(a2 + 1) && - c.getSide(a2) >= d.getSide(a2)) { + if (c.getSide(a1 + 1) <= d.getSide(a1 + 1) && c.getSide(a1) >= d.getSide(a1) && c.getSide(a2 + 1) <= d.getSide(a2 + 1) && c.getSide(a2) >= d.getSide(a2)) { if (c.getSide(a) <= d.getSide(a + 1) && c.getSide(a) >= d.getSide(a)) { c.setSide(a, d.getSide(a + 1) + 1); @@ -406,6 +407,7 @@ private QBQuad extractQuad(int side, Cuboid6 box) { } public static class QBMatrix { + public String name; public BlockCoord pos; public BlockCoord size; @@ -623,6 +625,7 @@ private static void addImages(List quads, List images) { public static final int SCALEMC = 8; public static class QBModel { + public QBMatrix[] matrices; public boolean rightHanded; @@ -661,7 +664,9 @@ public RasterisedModel toRasterisedModel(int flags) { } public static class RasterisedModel { + private class Holder { + CCModel m; int img; @@ -719,7 +724,7 @@ public void export(File objFile, File imgDir) { } PrintWriter p = new PrintWriter(objFile); - CCModel.exportObj(modelMap, p); + CCOBJParser.exportObj(modelMap, p); p.close(); if (images.size() < map.size()) { diff --git a/dependencies/main/java/codechicken/lib/render/RenderUtils.java b/dependencies/main/java/codechicken/lib/render/RenderUtils.java index 996fb1aca2..935c88f315 100644 --- a/dependencies/main/java/codechicken/lib/render/RenderUtils.java +++ b/dependencies/main/java/codechicken/lib/render/RenderUtils.java @@ -1,46 +1,60 @@ package codechicken.lib.render; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Rectangle4i; -import codechicken.lib.vec.Vector3; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.vec.*; +import codechicken.lib.vec.uv.IconTransformation; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderGlobal; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.entity.RenderEntityItem; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.shader.Framebuffer; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import org.lwjgl.opengl.GL11; +//TODO Document and reorder things in here. public class RenderUtils { - static Vector3[] vectors = new Vector3[8]; - /*static RenderItem uniformRenderItem = new RenderItem() - { - public boolean shouldBob() - { - return false; + private static Vector3[] vectors = new Vector3[8]; + private static RenderEntityItem uniformRenderItem; + private static boolean hasInitRenderItem; + + private static ThreadLocal iconTransformCache = new ThreadLocal() { + @Override + protected IconTransformation initialValue() { + return new IconTransformation(TextureUtils.getBlockTexture("stone")); } - };*/ - static EntityItem entityItem; + }; + + private static EntityItem entityItem; static { for (int i = 0; i < vectors.length; i++) { vectors[i] = new Vector3(); } - //uniformRenderItem.setRenderManager(RenderManager.instance); - entityItem = new EntityItem(null); entityItem.hoverStart = 0; } + private static void loadItemRenderer() { + if (!hasInitRenderItem) { + Minecraft minecraft = Minecraft.getMinecraft(); + uniformRenderItem = new RenderEntityItem(minecraft.getRenderManager(), minecraft.getRenderItem()); + hasInitRenderItem = true; + } + } + public static void renderFluidQuad(Vector3 point1, Vector3 point2, Vector3 point3, Vector3 point4, TextureAtlasSprite icon, double res) { renderFluidQuad(point2, vectors[0].set(point4).subtract(point1), vectors[1].set(point1).subtract(point2), icon, res); } @@ -54,8 +68,7 @@ public static void renderFluidQuad(Vector3 point1, Vector3 point2, Vector3 point * @param res Units per icon */ public static void renderFluidQuad(Vector3 base, Vector3 wide, Vector3 high, TextureAtlasSprite icon, double res) { - WorldRenderer r = Tessellator.getInstance().getWorldRenderer(); - + VertexBuffer r = CCRenderState.instance().getBuffer(); double u1 = icon.getMinU(); double du = icon.getMaxU() - icon.getMinU(); double v2 = icon.getMaxV(); @@ -104,21 +117,22 @@ public static void translateToWorldCoords(Entity entity, float frame) { } public static void drawCuboidOutline(Cuboid6 c) { - WorldRenderer r = CCRenderState.startDrawing(3, DefaultVertexFormats.POSITION); + CCRenderState state = CCRenderState.instance(); + VertexBuffer r = state.startDrawing(3, DefaultVertexFormats.POSITION); r.pos(c.min.x, c.min.y, c.min.z).endVertex(); r.pos(c.max.x, c.min.y, c.min.z).endVertex(); r.pos(c.max.x, c.min.y, c.max.z).endVertex(); r.pos(c.min.x, c.min.y, c.max.z).endVertex(); r.pos(c.min.x, c.min.y, c.min.z).endVertex(); - CCRenderState.draw(); - CCRenderState.startDrawing(3, DefaultVertexFormats.POSITION); + state.draw(); + state.startDrawing(3, DefaultVertexFormats.POSITION); r.pos(c.min.x, c.max.y, c.min.z).endVertex(); r.pos(c.max.x, c.max.y, c.min.z).endVertex(); r.pos(c.max.x, c.max.y, c.max.z).endVertex(); r.pos(c.min.x, c.max.y, c.max.z).endVertex(); r.pos(c.min.x, c.max.y, c.min.z).endVertex(); - CCRenderState.draw(); - CCRenderState.startDrawing(1, DefaultVertexFormats.POSITION); + state.draw(); + state.startDrawing(1, DefaultVertexFormats.POSITION); r.pos(c.min.x, c.min.y, c.min.z).endVertex(); r.pos(c.min.x, c.max.y, c.min.z).endVertex(); r.pos(c.max.x, c.min.y, c.min.z).endVertex(); @@ -127,7 +141,7 @@ public static void drawCuboidOutline(Cuboid6 c) { r.pos(c.max.x, c.max.y, c.max.z).endVertex(); r.pos(c.min.x, c.min.y, c.max.z).endVertex(); r.pos(c.min.x, c.max.y, c.max.z).endVertex(); - CCRenderState.draw(); + state.draw(); } public static void renderFluidCuboid(Cuboid6 bound, TextureAtlasSprite tex, double res) { @@ -148,71 +162,123 @@ public static void renderFluidCuboid(Cuboid6 bound, TextureAtlasSprite tex, doub public static void renderBlockOverlaySide(int x, int y, int z, int side, double tx1, double tx2, double ty1, double ty2) { double[] points = new double[] { x - 0.009, x + 1.009, y - 0.009, y + 1.009, z - 0.009, z + 1.009 }; - WorldRenderer r = Tessellator.getInstance().getWorldRenderer(); + VertexBuffer r = Tessellator.getInstance().getBuffer(); + //TODO switch (side) { - case 0: - r.pos(points[0], points[2], points[4]).tex(tx1, ty1).endVertex(); - r.pos(points[1], points[2], points[4]).tex(tx2, ty1).endVertex(); - r.pos(points[1], points[2], points[5]).tex(tx2, ty2).endVertex(); - r.pos(points[0], points[2], points[5]).tex(tx1, ty2).endVertex(); - break; - case 1: - r.pos(points[1], points[3], points[4]).tex(tx2, ty1).endVertex(); - r.pos(points[0], points[3], points[4]).tex(tx1, ty1).endVertex(); - r.pos(points[0], points[3], points[5]).tex(tx1, ty2).endVertex(); - r.pos(points[1], points[3], points[5]).tex(tx2, ty2).endVertex(); - break; - case 2: - r.pos(points[0], points[3], points[4]).tex(tx2, ty1).endVertex(); - r.pos(points[1], points[3], points[4]).tex(tx1, ty1).endVertex(); - r.pos(points[1], points[2], points[4]).tex(tx1, ty2).endVertex(); - r.pos(points[0], points[2], points[4]).tex(tx2, ty2).endVertex(); - break; - case 3: - r.pos(points[1], points[3], points[5]).tex(tx2, ty1).endVertex(); - r.pos(points[0], points[3], points[5]).tex(tx1, ty1).endVertex(); - r.pos(points[0], points[2], points[5]).tex(tx1, ty2).endVertex(); - r.pos(points[1], points[2], points[5]).tex(tx2, ty2).endVertex(); - break; - case 4: - r.pos(points[0], points[3], points[5]).tex(tx2, ty1).endVertex(); - r.pos(points[0], points[3], points[4]).tex(tx1, ty1).endVertex(); - r.pos(points[0], points[2], points[4]).tex(tx1, ty2).endVertex(); - r.pos(points[0], points[2], points[5]).tex(tx2, ty2).endVertex(); - break; - case 5: - r.pos(points[1], points[3], points[4]).tex(tx2, ty1).endVertex(); - r.pos(points[1], points[3], points[5]).tex(tx1, ty1).endVertex(); - r.pos(points[1], points[2], points[5]).tex(tx1, ty2).endVertex(); - r.pos(points[1], points[2], points[4]).tex(tx2, ty2).endVertex(); - break; + case 0: + r.pos(points[0], points[2], points[4]).tex(tx1, ty1).endVertex(); + r.pos(points[1], points[2], points[4]).tex(tx2, ty1).endVertex(); + r.pos(points[1], points[2], points[5]).tex(tx2, ty2).endVertex(); + r.pos(points[0], points[2], points[5]).tex(tx1, ty2).endVertex(); + break; + case 1: + r.pos(points[1], points[3], points[4]).tex(tx2, ty1).endVertex(); + r.pos(points[0], points[3], points[4]).tex(tx1, ty1).endVertex(); + r.pos(points[0], points[3], points[5]).tex(tx1, ty2).endVertex(); + r.pos(points[1], points[3], points[5]).tex(tx2, ty2).endVertex(); + break; + case 2: + r.pos(points[0], points[3], points[4]).tex(tx2, ty1).endVertex(); + r.pos(points[1], points[3], points[4]).tex(tx1, ty1).endVertex(); + r.pos(points[1], points[2], points[4]).tex(tx1, ty2).endVertex(); + r.pos(points[0], points[2], points[4]).tex(tx2, ty2).endVertex(); + break; + case 3: + r.pos(points[1], points[3], points[5]).tex(tx2, ty1).endVertex(); + r.pos(points[0], points[3], points[5]).tex(tx1, ty1).endVertex(); + r.pos(points[0], points[2], points[5]).tex(tx1, ty2).endVertex(); + r.pos(points[1], points[2], points[5]).tex(tx2, ty2).endVertex(); + break; + case 4: + r.pos(points[0], points[3], points[5]).tex(tx2, ty1).endVertex(); + r.pos(points[0], points[3], points[4]).tex(tx1, ty1).endVertex(); + r.pos(points[0], points[2], points[4]).tex(tx1, ty2).endVertex(); + r.pos(points[0], points[2], points[5]).tex(tx2, ty2).endVertex(); + break; + case 5: + r.pos(points[1], points[3], points[4]).tex(tx2, ty1).endVertex(); + r.pos(points[1], points[3], points[5]).tex(tx1, ty1).endVertex(); + r.pos(points[1], points[2], points[5]).tex(tx1, ty2).endVertex(); + r.pos(points[1], points[2], points[4]).tex(tx2, ty2).endVertex(); + break; } } + public static void renderHitBox(EntityPlayer player, Cuboid6 cuboid, float partialTicks) { + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.glLineWidth(2.0F); + GlStateManager.disableTexture2D(); + GlStateManager.depthMask(false); + double xPos = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks; + double yPos = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks; + double zPos = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks; + RenderGlobal.drawSelectionBoundingBox(cuboid.aabb().expandXyz(0.0020000000949949026D).offset(-xPos, -yPos, -zPos), 0.0F, 0.0F, 0.0F, 0.4F); + GlStateManager.depthMask(true); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); + } + + public static void drawSelectionBoundingBox(AxisAlignedBB boundingBox) { + + Tessellator tessellator = Tessellator.getInstance(); + VertexBuffer vertexbuffer = tessellator.getBuffer(); + vertexbuffer.begin(3, DefaultVertexFormats.POSITION); + vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); + vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); + vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex(); + vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex(); + vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); + tessellator.draw(); + vertexbuffer.begin(3, DefaultVertexFormats.POSITION); + vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); + vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex(); + vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex(); + vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex(); + vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); + tessellator.draw(); + vertexbuffer.begin(1, DefaultVertexFormats.POSITION); + vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); + vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); + vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); + vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex(); + vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex(); + vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex(); + vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex(); + vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex(); + tessellator.draw(); + } + + /** + * Checks to see if the FluidStack should be rendered. + * + * @param stack FluidStack to render. + * @return Weather to render or not. + */ public static boolean shouldRenderFluid(FluidStack stack) { return stack.amount > 0 && stack.getFluid() != null; } /** + * Sets the colour of the fluid and returns the texture + * * @param stack The fluid stack to render * @return The icon of the fluid */ public static TextureAtlasSprite prepareFluidRender(FluidStack stack, int alpha) { + Fluid fluid = stack.getFluid(); + CCRenderState.instance().colour = fluid.getColor(stack) << 8 | alpha; + return TextureUtils.getTexture(fluid.getStill()); + } + + /** + * Disables lighting, enables blending and changes to the blocks texture + */ + public static void preFluidRender() { GlStateManager.disableLighting(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - - Fluid fluid = stack.getFluid(); - CCRenderState.setColour(fluid.getColor(stack) << 8 | alpha); - CCRenderState.changeTexture(TextureMap.locationBlocksTexture); - - String iconName = null; - if (fluid == FluidRegistry.LAVA) { - iconName = "minecraft:blocks/lava_still"; - } else if (fluid == FluidRegistry.WATER) { - iconName = "minecraft:blocks/water_still"; - } - return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(iconName); + TextureUtils.bindBlockTexture(); } /** @@ -229,6 +295,7 @@ public static double fluidDensityToAlpha(double density) { /** * Renders a fluid within a bounding box. + * Assumes that CCRenderstate is already drawing with appropriate gl state. For a separate draw call see renderFluidCuboidGL * If the fluid is a liquid it will render as a normal tank with height equal to density/bound.height. * If the fluid is a gas, it will render the full box with an alpha equal to density. * Warning, bound will be mutated if the fluid is a liquid @@ -250,13 +317,26 @@ public static void renderFluidCuboid(FluidStack stack, Cuboid6 bound, double den bound.max.y = bound.min.y + (bound.max.y - bound.min.y) * density; } - TextureAtlasSprite tex = prepareFluidRender(stack, alpha); - CCRenderState.startDrawing(); - renderFluidCuboid(bound, tex, res); - CCRenderState.draw(); + renderFluidCuboid(bound, prepareFluidRender(stack, alpha), res); + } + + public static void renderFluidCuboidGL(FluidStack stack, Cuboid6 bound, double density, double res) { + if (!shouldRenderFluid(stack)) { + return; + } + + preFluidRender(); + CCRenderState state = CCRenderState.instance(); + state.startDrawing(7, DefaultVertexFormats.POSITION_TEX); + renderFluidCuboid(stack, bound, density, res); + state.pushColour(); + state.draw(); postFluidRender(); } + /** + * Assumes that CCRenderstate is already drawing with appropriate gl state. For a separate draw call see renderFluidGaugeGL + */ public static void renderFluidGauge(FluidStack stack, Rectangle4i rect, double density, double res) { if (!shouldRenderFluid(stack)) { return; @@ -270,55 +350,70 @@ public static void renderFluidGauge(FluidStack stack, Rectangle4i rect, double d rect.y += rect.h - height; rect.h = height; } - - TextureAtlasSprite tex = prepareFluidRender(stack, alpha); - CCRenderState.startDrawing(); - renderFluidQuad(new Vector3(rect.x, rect.y + rect.h, 0), new Vector3(rect.w, 0, 0), new Vector3(0, -rect.h, 0), tex, res); - CCRenderState.draw(); + CCRenderState state = CCRenderState.instance(); + state.startDrawing(7, DefaultVertexFormats.POSITION_TEX); + renderFluidQuad(new Vector3(rect.x, rect.y + rect.h, 0), new Vector3(rect.w, 0, 0), new Vector3(0, -rect.h, 0), prepareFluidRender(stack, alpha), res); + state.draw(); postFluidRender(); } + public static void renderFluidGaugeGL(FluidStack stack, Rectangle4i rect, double density, double res) { + if (!shouldRenderFluid(stack)) { + return; + } + + preFluidRender(); + CCRenderState state = CCRenderState.instance(); + state.startDrawing(7, DefaultVertexFormats.POSITION_TEX); + renderFluidGauge(stack, rect, density, res); + state.pushColour(); + state.draw(); + } + + public static Matrix4 getMatrix(Vector3 position, Rotation rotation, double scale) { + return new Matrix4().translate(position).apply(new Scale(scale)).apply(rotation); + } + /** * Renders items and blocks in the world at 0,0,0 with transformations that size them appropriately */ - /*public static void renderItemUniform(ItemStack item) { + public static void renderItemUniform(ItemStack item) { renderItemUniform(item, 0); - }*/ + } - /** + /* * Renders items and blocks in the world at 0,0,0 with transformations that size them appropriately * * @param spin The spin angle of the item around the y axis in degrees */ - /*public static void renderItemUniform(ItemStack item, double spin) - { - IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY); - boolean is3D = customRenderer != null && customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D); - - boolean larger = false; - if (item.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item.getItem()).getRenderType())) - { - int renderType = Block.getBlockFromItem(item.getItem()).getRenderType(); - larger = !(renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2); - } - else if(is3D) - { - larger = true; - } - - double d = 2; - double d1 = 1/d; - if(larger) - GLStateManager.scale(d, d, d); - - GLStateManager.color(1, 1, 1, 1); - + public static void renderItemUniform(ItemStack item, double spin) { + loadItemRenderer(); + //IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY); + //boolean is3D = customRenderer != null && customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D); + + //boolean larger = false; + //if (item.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item.getItem()).getRenderType())) { + // int renderType = Block.getBlockFromItem(item.getItem()).getRenderType(); + // larger = !(renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2); + //} else if (is3D) { + // larger = true; + //} + + //double d = 2; + //double d1 = 1 / d; + //if (larger) { + // GLStateManager.scale(d, d, d); + //} + + GlStateManager.color(1, 1, 1, 1); + entityItem.setEntityItemStack(item); - uniformRenderItem.doRender(entityItem, 0, larger ? 0.09 : 0.06, 0, 0, (float)(spin*9/Math.PI)); - - if(larger) - GLStateManager.scale(d1, d1, d1); - }/* + uniformRenderItem.doRender(entityItem, 0, 0.06, 0, 0, (float) (spin * 9 / Math.PI)); + + //if (larger) { + // GLStateManager.scale(d1, d1, d1); + //}*/ + } /** * Checks if stencil buffer is supported and attempts to enable it if so. @@ -327,4 +422,23 @@ public static boolean checkEnableStencil() { Framebuffer fb = Minecraft.getMinecraft().getFramebuffer(); return fb.isStencilEnabled() || fb.enableStencil(); } + + public static float getPearlBob(double time) { + return (float) Math.sin(time / 25 * 3.141593) * 0.1F; + } + + public static int getTimeOffset(BlockPos pos) { + return getTimeOffset(pos.getX(), pos.getY(), pos.getZ()); + } + + public static int getTimeOffset(int x, int y, int z) { + return x * 3 + y * 5 + z * 9; + } + + public static IconTransformation getIconTransformation(TextureAtlasSprite sprite) { + IconTransformation transformation = iconTransformCache.get(); + transformation.icon = sprite; + return transformation; + } + } diff --git a/dependencies/main/java/codechicken/lib/render/TextureUtils.java b/dependencies/main/java/codechicken/lib/render/TextureUtils.java deleted file mode 100644 index de0362fe2c..0000000000 --- a/dependencies/main/java/codechicken/lib/render/TextureUtils.java +++ /dev/null @@ -1,155 +0,0 @@ -package codechicken.lib.render; - -import codechicken.lib.colour.Colour; -import codechicken.lib.colour.ColourARGB; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.event.TextureStitchEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; - -public class TextureUtils { - public static interface IIconRegister { - public void registerIcons(TextureMap textureMap); - } - - static { - MinecraftForge.EVENT_BUS.register(new TextureUtils()); - } - - private static ArrayList iconRegisters = new ArrayList(); - - public static void addIconRegister(IIconRegister registrar) { - iconRegisters.add(registrar); - } - - @SubscribeEvent - public void textureLoad(TextureStitchEvent.Pre event) { - for (IIconRegister reg : iconRegisters) { - reg.registerIcons(event.map); - } - } - - /** - * @return an array of ARGB pixel data - */ - public static int[] loadTextureData(ResourceLocation resource) { - return loadTexture(resource).data; - } - - public static Colour[] loadTextureColours(ResourceLocation resource) { - int[] idata = loadTextureData(resource); - Colour[] data = new Colour[idata.length]; - for (int i = 0; i < data.length; i++) { - data[i] = new ColourARGB(idata[i]); - } - return data; - } - - public static InputStream getTextureResource(ResourceLocation textureFile) throws IOException { - return Minecraft.getMinecraft().getResourceManager().getResource(textureFile).getInputStream(); - } - - public static BufferedImage loadBufferedImage(ResourceLocation textureFile) { - try { - return loadBufferedImage(getTextureResource(textureFile)); - } catch (Exception e) { - System.err.println("Failed to load texture file: " + textureFile); - e.printStackTrace(); - } - return null; - } - - public static BufferedImage loadBufferedImage(InputStream in) throws IOException { - BufferedImage img = ImageIO.read(in); - in.close(); - return img; - } - - public static void copySubImg(int[] fromTex, int fromWidth, int fromX, int fromY, int width, int height, int[] toTex, int toWidth, int toX, int toY) { - for (int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) { - int fp = (y + fromY) * fromWidth + x + fromX; - int tp = (y + toX) * toWidth + x + toX; - - toTex[tp] = fromTex[fp]; - } - } - } - - public static TextureAtlasSprite getBlankIcon(int size, TextureMap textureMap) { - String s = "blank_" + size; - TextureAtlasSprite icon = textureMap.getTextureExtry(s); - if (icon == null) { - textureMap.setTextureEntry(s, icon = new TextureSpecial(s).blank(size)); - } - - return icon; - } - - public static TextureSpecial getTextureSpecial(TextureMap textureMap, String name) { - if (textureMap.getTextureExtry(name) != null) { - throw new IllegalStateException("Texture: " + name + " is already registered"); - } - - TextureSpecial icon = new TextureSpecial(name); - textureMap.setTextureEntry(name, icon); - return icon; - } - - public static void prepareTexture(int target, int texture, int min_mag_filter, int wrap) { - GL11.glTexParameteri(target, GL11.GL_TEXTURE_MIN_FILTER, min_mag_filter); - GL11.glTexParameteri(target, GL11.GL_TEXTURE_MAG_FILTER, min_mag_filter); - if (target == GL11.GL_TEXTURE_2D) { - GlStateManager.bindTexture(target); - } else { - GL11.glBindTexture(target, texture); - } - - switch (target) { - case GL12.GL_TEXTURE_3D: - GL11.glTexParameteri(target, GL12.GL_TEXTURE_WRAP_R, wrap); - case GL11.GL_TEXTURE_2D: - GL11.glTexParameteri(target, GL11.GL_TEXTURE_WRAP_T, wrap); - case GL11.GL_TEXTURE_1D: - GL11.glTexParameteri(target, GL11.GL_TEXTURE_WRAP_S, wrap); - } - } - - public static TextureDataHolder loadTexture(ResourceLocation resource) { - BufferedImage img = loadBufferedImage(resource); - if (img == null) { - throw new RuntimeException("Texture not found: " + resource); - } - return new TextureDataHolder(img); - } - - /** - * Uses an empty placeholder texture to tell if the map has been reloaded since the last call to refresh texture and the texture with name needs to be reacquired to be valid - */ - public static boolean refreshTexture(TextureMap map, String name) { - if (map.getTextureExtry(name) == null) { - map.setTextureEntry(name, new PlaceholderTexture(name)); - return true; - } - return false; - } - - /*public static IIcon safeIcon(IIcon icon) { - if (icon == null) - icon = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno"); - - return icon; - }*/ -} diff --git a/dependencies/main/java/codechicken/lib/render/block/BlockRenderingRegistry.java b/dependencies/main/java/codechicken/lib/render/block/BlockRenderingRegistry.java new file mode 100644 index 0000000000..b0c64e131b --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/block/BlockRenderingRegistry.java @@ -0,0 +1,110 @@ +package codechicken.lib.render.block; + +import codechicken.lib.model.SimpleBakedBlockModel; +import codechicken.lib.render.buffer.BakingVertexBuffer; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.util.ReflectionManager; +import com.google.common.collect.ImmutableList; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BlockModelRenderer; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.common.util.EnumHelper; +import net.minecraftforge.fml.relauncher.ReflectionHelper; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.Map; + +/** + * Created by covers1624 on 8/09/2016. + * TODO Start phase out of this system. + */ +public class BlockRenderingRegistry { + + private static final Map blockRendererList = new HashMap(); + private static final ImmutableList vanillaRenderTypes = ImmutableList.copyOf(EnumBlockRenderType.values()); + + private static boolean initialized = false; + + static { + init(); + } + + public static void init() { + if (!initialized) { + Minecraft mc = Minecraft.getMinecraft(); + BlockRendererDispatcher parentDispatcher = mc.getBlockRendererDispatcher(); + CCBlockRendererDispatcher newDispatcher = new CCBlockRendererDispatcher(parentDispatcher, mc.getBlockColors()); + + Field field = ReflectionHelper.findField(Minecraft.class, "blockRenderDispatcher", "field_175618_aM", "aR"); + ReflectionManager.set(field, mc, newDispatcher); + + TextureUtils.addIconRegister(newDispatcher); + + initialized = true; + } + } + + public static EnumBlockRenderType createRenderType(String name) { + return EnumHelper.addEnum(EnumBlockRenderType.class, name, new Class[0]); + } + + public static boolean canHandle(EnumBlockRenderType type) { + return blockRendererList.containsKey(type); + } + + public static void registerRenderer(EnumBlockRenderType type, ICCBlockRenderer renderer) { + if (vanillaRenderTypes.contains(type)) { + throw new IllegalArgumentException("Invalid EnumBlockRenderType! " + type.name()); + } + if (blockRendererList.containsKey(type)) { + throw new IllegalArgumentException("Unable to register duplicate render type!" + type.name()); + } + blockRendererList.put(type, renderer); + } + + static void renderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite) { + ICCBlockRenderer renderer = blockRendererList.get(state.getRenderType()); + if (renderer != null) { + state = state.getActualState(world, pos); + //TODO This needs to be optimized, probably not the most efficient thing in the world.. + VertexBuffer parent = Tessellator.getInstance().getBuffer(); + BakingVertexBuffer buffer = BakingVertexBuffer.create(); + buffer.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ()); + buffer.begin(7, parent.getVertexFormat()); + renderer.handleRenderBlockDamage(world, pos, state, sprite, buffer); + buffer.finishDrawing(); + BlockModelRenderer modelRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer(); + modelRenderer.renderModel(world, new SimpleBakedBlockModel(buffer.bake()), state, pos, parent, true); + } + } + + static boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, VertexBuffer buffer) { + ICCBlockRenderer renderer = blockRendererList.get(state.getRenderType()); + if (renderer != null) { + return renderer.renderBlock(world, pos, state, buffer); + } + return false; + } + + static void renderBlockBrightness(IBlockState state, float brightness) { + ICCBlockRenderer renderer = blockRendererList.get(state.getRenderType()); + if (renderer != null) { + renderer.renderBrightness(state, brightness); + } + } + + static void registerTextures(TextureMap map) { + for (ICCBlockRenderer renderer : blockRendererList.values()) { + renderer.registerTextures(map); + } + } +} diff --git a/dependencies/main/java/codechicken/lib/render/block/CCBlockRendererDispatcher.java b/dependencies/main/java/codechicken/lib/render/block/CCBlockRendererDispatcher.java new file mode 100644 index 0000000000..6a57fbeddd --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/block/CCBlockRendererDispatcher.java @@ -0,0 +1,91 @@ +package codechicken.lib.render.block; + +import codechicken.lib.texture.TextureUtils; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.BlockModelRenderer; +import net.minecraft.client.renderer.BlockModelShapes; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.color.BlockColors; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.util.ReportedException; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.WorldType; + +/** + * Created by covers1624 on 8/09/2016. + * TODO Move back end of this to CCExtendedBlockRenderDispatcher + */ +public class CCBlockRendererDispatcher extends BlockRendererDispatcher implements TextureUtils.IIconRegister { + + public final BlockRendererDispatcher parentDispatcher; + + public CCBlockRendererDispatcher(BlockRendererDispatcher dispatcher, BlockColors blockColours) { + super(dispatcher.getBlockModelShapes(), blockColours); + parentDispatcher = dispatcher; + } + + @Override + public void renderBlockDamage(IBlockState state, BlockPos pos, TextureAtlasSprite texture, IBlockAccess blockAccess) { + if (BlockRenderingRegistry.canHandle(state.getRenderType())) { + BlockRenderingRegistry.renderBlockDamage(blockAccess, pos, state, texture); + } else { + parentDispatcher.renderBlockDamage(state, pos, texture, blockAccess); + } + } + + @Override + public boolean renderBlock(IBlockState state, BlockPos pos, IBlockAccess blockAccess, VertexBuffer worldRendererIn) { + try { + if (BlockRenderingRegistry.canHandle(state.getRenderType())) { + if (blockAccess.getWorldType() != WorldType.DEBUG_WORLD) { + try { + state = state.getActualState(blockAccess, pos); + } catch (Exception ignored) { + //Noise.. + } + } + return BlockRenderingRegistry.renderBlock(blockAccess, pos, state, worldRendererIn); + } + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tessellating CCL block in world"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being tessellated"); + CrashReportCategory.addBlockInfo(crashreportcategory, pos, state.getBlock(), state.getBlock().getMetaFromState(state)); + throw new ReportedException(crashreport); + } + return parentDispatcher.renderBlock(state, pos, blockAccess, worldRendererIn); + } + + @Override + public void renderBlockBrightness(IBlockState state, float brightness) { + if (BlockRenderingRegistry.canHandle(state.getRenderType())) { + BlockRenderingRegistry.renderBlockBrightness(state, brightness); + } + super.renderBlockBrightness(state, brightness); + } + + @Override + public void registerIcons(TextureMap textureMap) { + BlockRenderingRegistry.registerTextures(textureMap); + } + + @Override + public BlockModelRenderer getBlockModelRenderer() { + return parentDispatcher.getBlockModelRenderer(); + } + + @Override + public IBakedModel getModelForState(IBlockState state) { + return parentDispatcher.getModelForState(state); + } + + @Override + public BlockModelShapes getBlockModelShapes() { + return parentDispatcher.getBlockModelShapes(); + } +} diff --git a/dependencies/main/java/codechicken/lib/render/block/CCExtendedBlockRendererDispatcher.java b/dependencies/main/java/codechicken/lib/render/block/CCExtendedBlockRendererDispatcher.java new file mode 100644 index 0000000000..eb718efbc9 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/block/CCExtendedBlockRendererDispatcher.java @@ -0,0 +1,94 @@ +package codechicken.lib.render.block; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.BlockModelRenderer; +import net.minecraft.client.renderer.BlockModelShapes; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.color.BlockColors; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.ReportedException; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.WorldType; + +/** + * Created by covers1624 on 26/10/2016. + * TODO remove IExtendedModel. + */ +public class CCExtendedBlockRendererDispatcher extends BlockRendererDispatcher { + + private final BlockRendererDispatcher parentDispatcher; + + private static boolean initialized = false; + + public CCExtendedBlockRendererDispatcher(BlockRendererDispatcher parentDispatcher, BlockColors blockColors) { + super(parentDispatcher.getBlockModelShapes(), blockColors); + this.parentDispatcher = parentDispatcher; + } + + public static void init() { + if (!initialized) { + Minecraft mc = Minecraft.getMinecraft(); + BlockRendererDispatcher parentDispatcher = mc.getBlockRendererDispatcher(); + CCExtendedBlockRendererDispatcher newDispatcher = new CCExtendedBlockRendererDispatcher(parentDispatcher, mc.getBlockColors()); + + mc.blockRenderDispatcher = newDispatcher; + initialized = true; + } + } + + @Override + public boolean renderBlock(IBlockState state, BlockPos pos, IBlockAccess blockAccess, VertexBuffer worldRendererIn) { + try { + EnumBlockRenderType enumblockrendertype = state.getRenderType(); + + if (enumblockrendertype == EnumBlockRenderType.MODEL && blockAccess.getWorldType() != WorldType.DEBUG_WORLD) { + IBakedModel model = this.getModelForState(state); + if (!(model instanceof IExtendedModel)) { + return parentDispatcher.renderBlock(state, pos, blockAccess, worldRendererIn); + } + state = state.getBlock().getExtendedState(state, blockAccess, pos); + model = ((IExtendedModel) model).handleExtendedModel(model, state); + return parentDispatcher.getBlockModelRenderer().renderModel(blockAccess, model, state, pos, worldRendererIn, true); + } else { + return parentDispatcher.renderBlock(state, pos, blockAccess, worldRendererIn); + } + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block in world"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being tesselated"); + CrashReportCategory.addBlockInfo(crashreportcategory, pos, state.getBlock(), state.getBlock().getMetaFromState(state)); + throw new ReportedException(crashreport); + } + } + + @Override + public void renderBlockDamage(IBlockState state, BlockPos pos, TextureAtlasSprite texture, IBlockAccess blockAccess) { + parentDispatcher.renderBlockDamage(state, pos, texture, blockAccess); + } + + @Override + public void renderBlockBrightness(IBlockState state, float brightness) { + parentDispatcher.renderBlockBrightness(state, brightness); + } + + @Override + public BlockModelRenderer getBlockModelRenderer() { + return parentDispatcher.getBlockModelRenderer(); + } + + @Override + public IBakedModel getModelForState(IBlockState state) { + return parentDispatcher.getModelForState(state); + } + + @Override + public BlockModelShapes getBlockModelShapes() { + return parentDispatcher.getBlockModelShapes(); + } +} diff --git a/dependencies/main/java/codechicken/lib/render/block/ICCBlockRenderer.java b/dependencies/main/java/codechicken/lib/render/block/ICCBlockRenderer.java new file mode 100644 index 0000000000..46d54cf585 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/block/ICCBlockRenderer.java @@ -0,0 +1,23 @@ +package codechicken.lib.render.block; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; + +/** + * Created by covers1624 on 8/09/2016. + * TODO, Some sort of automatic block breaking texture stuff. + */ +public interface ICCBlockRenderer { + + void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, VertexBuffer buffer); + + boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, VertexBuffer buffer); + + void renderBrightness(IBlockState state, float brightness); + + void registerTextures(TextureMap map); +} diff --git a/dependencies/main/java/codechicken/lib/render/block/IExtendedModel.java b/dependencies/main/java/codechicken/lib/render/block/IExtendedModel.java new file mode 100644 index 0000000000..6875887fcd --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/block/IExtendedModel.java @@ -0,0 +1,26 @@ +package codechicken.lib.render.block; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.model.IBakedModel; + +/** + * Created by covers1624 on 26/10/2016. + * Implementing this on a IBakedModel will allow you to have interaction similar to Block#getExtendedState. + * You can return an entirely different model for this or just set some flags. What ever you want. + * Useful for on-the-fly model baking, where you need to generate from an IExtendedBlockState. + */ +@Deprecated +public interface IExtendedModel extends IBakedModel { + + /** + * You can return what ever model you like. + * This is fired from BlockRendererDispatcher#renderBlock before blockModelRenderer#renderModel, + * but after getExtendedState. + * + * @param prevModel The model that was going to be rendered. + * @param state The IBlockState returned from getExtendedState. + * @return Another IBakedModel, can be different, same, whatever. + */ + IBakedModel handleExtendedModel(IBakedModel prevModel, IBlockState state); + +} diff --git a/dependencies/main/java/codechicken/lib/render/buffer/BakingVertexBuffer.java b/dependencies/main/java/codechicken/lib/render/buffer/BakingVertexBuffer.java new file mode 100644 index 0000000000..2a780a0a16 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/buffer/BakingVertexBuffer.java @@ -0,0 +1,176 @@ +package codechicken.lib.render.buffer; + +import codechicken.lib.math.MathHelper; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.util.VectorUtils; +import codechicken.lib.util.VertexDataUtils; +import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.uv.UV; +import com.google.common.collect.ImmutableList; +import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.client.model.pipeline.LightUtil; +import net.minecraftforge.fml.common.FMLLog; +import org.apache.logging.log4j.Level; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + +/** + * Created by covers1624 on 4/10/2016. + * Creates a List of BakedQuads from a VertexBuffer. That's it really.. + * //TODO, support triangles & quadulate. + */ +public class BakingVertexBuffer extends VertexBuffer { + + private HashMap spriteMap; + private boolean useSprites = true; + private boolean useDiffuseLighting = true; + + private static ThreadLocal threadBuffers = new ThreadLocal() { + @Override + protected BakingVertexBuffer initialValue() { + return new BakingVertexBuffer(0x200000); + } + }; + + public static BakingVertexBuffer create() { + return threadBuffers.get(); + } + + private BakingVertexBuffer(int bufferSizeIn) { + super(bufferSizeIn); + } + + @Override + public void begin(int glMode, VertexFormat format) { + if (glMode != 7) { + throw new IllegalArgumentException("Unable to bake GL Mode, only Quads supported! To bake triangles pipe through CCQuad then quadulate."); + } + super.begin(glMode, format); + } + + @Override + public void reset() { + spriteMap = new HashMap(); + useSprites = true; + useDiffuseLighting = true; + super.reset(); + } + + /** + * Sets the sprite for a specific vertex. + * + * @param sprite The sprite to set. + */ + public BakingVertexBuffer setSprite(TextureAtlasSprite sprite) { + spriteMap.put(MathHelper.floor(getVertexCount() / 4D), sprite); + return this; + } + + /** + * Sets the baker to ignore all sprite calculations and just use the missing icon. + * This should only be used in cases where you know the quads are not going to be transformed by another mod at any point. + */ + public BakingVertexBuffer ignoreSprites() { + useSprites = false; + return this; + } + + /** + * Sets the baker to use any set vertex range sprite, or calculate sprites for a given UV mapping. + * This is enabled by default. + */ + public BakingVertexBuffer useSprites() { + useSprites = true; + return this; + } + + /** + * Disables DiffuseLighting on quads. + */ + public BakingVertexBuffer dissableDiffuseLighting() { + useDiffuseLighting = false; + return this; + } + + /** + * Enables DiffuseLighting on quads. + * This is enabled by default. + */ + public BakingVertexBuffer enableDiffuseLighting() { + useDiffuseLighting = true; + return this; + } + + /** + * Bakes the data inside the VertexBuffer to a baked quad. + * + * @return The list of quads baked. + */ + public List bake() { + if (isDrawing) { + FMLLog.log("CodeChickenLib", Level.WARN, new IllegalStateException("Bake called before finishDrawing!"), "Someone is calling bake before finishDrawing!"); + finishDrawing(); + } + State state = getVertexState(); + VertexFormat format = state.getVertexFormat(); + if (!format.hasUvOffset(0)) { + throw new IllegalStateException("Unable to bake format that does not have UV mappings!"); + } + int[] rawBuffer = Arrays.copyOf(state.getRawBuffer(), state.getRawBuffer().length); + + List quads = new LinkedList(); + TextureAtlasSprite sprite = TextureUtils.getMissingSprite(); + + int curr = 0; + int next = format.getNextOffset(); + int i = 0; + while (rawBuffer.length >= next) { + int[] quadData = Arrays.copyOfRange(rawBuffer, curr, next); + Vector3 normal = new Vector3(); + if (format.hasNormal()) { + //Grab first normal. + float[] normalData = new float[4]; + LightUtil.unpack(quadData, normalData, format, 0, VertexDataUtils.getNormalElement(format)); + normal = Vector3.fromArray(normalData); + } else { + //No normal provided in format, so we calculate. + float[][] posData = new float[4][4]; + for (int v = 0; v < 4; v++) { + LightUtil.unpack(quadData, posData[v], format, v, VertexDataUtils.getPositionElement(format)); + } + normal.set(VectorUtils.calculateNormal(Vector3.fromArray(posData[0]), Vector3.fromArray(posData[1]), Vector3.fromArray(posData[3]))); + } + if (useSprites) { + //Attempt to get sprite for vertex. + if (spriteMap.containsKey(i)) { + //Use provided sprite for vertex. + sprite = spriteMap.get(i); + } else { + //Sprite not found for vertex, so we attempt to calculate the sprite. + float[] uvData = new float[4]; + LightUtil.unpack(quadData, uvData, format, 0, VertexDataUtils.getUVElement(format)); + UV uv = new UV(uvData[0], uvData[1]); + sprite = VertexDataUtils.getSpriteForUV(TextureUtils.getTextureMap(), uv); + } + } + //Use normal to calculate facing. + EnumFacing facing = VectorUtils.calcNormalSide(normal); + if (facing == null) { + facing = EnumFacing.UP; + } + BakedQuad quad = new BakedQuad(quadData, -1, facing, sprite, useDiffuseLighting, format); + quads.add(quad); + curr = next; + next += format.getNextOffset(); + i++; + } + return ImmutableList.copyOf(quads); + } +} diff --git a/dependencies/main/java/codechicken/lib/render/item/CCRenderItem.java b/dependencies/main/java/codechicken/lib/render/item/CCRenderItem.java new file mode 100644 index 0000000000..ffc7d72c41 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/item/CCRenderItem.java @@ -0,0 +1,306 @@ +package codechicken.lib.render.item; + +import codechicken.lib.asm.ObfMapping; +import codechicken.lib.render.state.GlStateManagerHelper; +import codechicken.lib.util.ReflectionManager; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.ItemModelMesher; +import net.minecraft.client.renderer.RenderItem; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.crash.ICrashReportDetail; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ReportedException; +import net.minecraft.world.World; +import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.model.IPerspectiveAwareModel; +import org.apache.commons.lang3.tuple.Pair; + +import javax.annotation.Nullable; +import javax.vecmath.Matrix4f; + +/** + * Created by covers1624 on 17/10/2016. + * TODO, Generify how this works. might be different from vanilla in the end but we should probably try and sniff off if the model is ours at an earlier date. + * TODO, Some sort of registry over IMC for mods to add their own hooks to this. + */ +public class CCRenderItem extends RenderItem { + + private final RenderItem parent; + private static CCRenderItem instance; + private static boolean hasInit; + + //Because forge has this private. + private static final Matrix4f flipX; + + static { + flipX = new Matrix4f(); + flipX.setIdentity(); + flipX.m00 = -1; + } + + public CCRenderItem(RenderItem renderItem) { + super(renderItem.textureManager, renderItem.itemModelMesher.getModelManager(), renderItem.itemColors); + ReflectionManager.setField(new ObfMapping("net/minecraft/client/renderer/RenderItem", "field_175059_m", ""), renderItem, renderItem.itemModelMesher); + this.parent = renderItem; + } + + public static void init() { + if (!hasInit) { + instance = new CCRenderItem(Minecraft.getMinecraft().getRenderItem()); + ObfMapping mapping = new ObfMapping("net/minecraft/client/Minecraft", "field_175621_X", ""); + ReflectionManager.setField(mapping, Minecraft.getMinecraft(), instance); + hasInit = true; + } + } + + public static CCRenderItem instance() { + init(); + return instance; + } + + @Override + public void renderItem(ItemStack stack, IBakedModel model) { + if (stack != null && model instanceof IItemRenderer) { + IItemRenderer renderer = (IItemRenderer) model; + boolean shouldHandleRender = true; + try {//Catch AME's from new method. + shouldHandleRender = true;//renderer.shouldHandleRender(stack); + } catch (AbstractMethodError ignored) { + } + if (shouldHandleRender) { + GlStateManager.pushMatrix(); + GlStateManager.translate(-0.5F, -0.5F, -0.5F); + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableRescaleNormal(); + GlStateManagerHelper.pushState(); + renderer.renderItem(stack); + GlStateManagerHelper.popState(); + GlStateManager.popMatrix(); + return; + } + } + parent.renderItem(stack, model); + } + + private IBakedModel handleTransforms(ItemStack stack, IBakedModel model, TransformType transformType, boolean isLeftHand) { + if (model instanceof IMatrixTransform) { + ((IMatrixTransform) model).getTransform(transformType, isLeftHand).glApply(); + } else if (model instanceof IGLTransform) { + ((IGLTransform) model).applyTransforms(transformType, isLeftHand); + } else if (model instanceof IPerspectiveAwareModel) { + model = ForgeHooksClient.handleCameraTransforms(model, transformType, isLeftHand); + } else if (model instanceof IStackPerspectiveAwareModel) { + Pair pair = ((IStackPerspectiveAwareModel) model).handlePerspective(stack, transformType); + + if (pair.getRight() != null) { + Matrix4f matrix = new Matrix4f(pair.getRight()); + if (isLeftHand) { + matrix.mul(flipX, matrix); + matrix.mul(matrix, flipX); + } + ForgeHooksClient.multiplyCurrentGlMatrix(matrix); + } + return pair.getLeft(); + } + return model; + } + + private boolean isValidModel(IBakedModel model) { + return model instanceof IItemRenderer || model instanceof IGLTransform || model instanceof IMatrixTransform || model instanceof IStackPerspectiveAwareModel; + } + + @Override + public void renderItemModel(ItemStack stack, IBakedModel bakedModel, TransformType transform, boolean leftHanded) { + if (stack.getItem() != null) { + if (isValidModel(bakedModel)) { + this.textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + this.textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableRescaleNormal(); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.pushMatrix(); + + bakedModel = handleTransforms(stack, bakedModel, transform, leftHanded); + + this.renderItem(stack, bakedModel); + GlStateManager.cullFace(GlStateManager.CullFace.BACK); + GlStateManager.popMatrix(); + GlStateManager.disableRescaleNormal(); + GlStateManager.disableBlend(); + this.textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + this.textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); + } else { + parent.zLevel = this.zLevel; + parent.renderItemModel(stack, bakedModel, transform, leftHanded); + } + } + } + + @Override + public void renderItemModelIntoGUI(ItemStack stack, int x, int y, IBakedModel bakedModel) { + if (isValidModel(bakedModel)) { + GlStateManager.pushMatrix(); + this.textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + this.textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); + GlStateManager.enableRescaleNormal(); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.setupGuiTransform(x, y, bakedModel.isGui3d()); + + bakedModel = handleTransforms(stack, bakedModel, ItemCameraTransforms.TransformType.GUI, false); + + this.renderItem(stack, bakedModel); + GlStateManager.disableAlpha(); + GlStateManager.disableRescaleNormal(); + GlStateManager.disableLighting(); + GlStateManager.popMatrix(); + this.textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + this.textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); + } else { + parent.zLevel = this.zLevel; + parent.renderItemModelIntoGUI(stack, x, y, bakedModel); + } + } + + // region Other Overrides + + @Override + public void renderItem(ItemStack stack, TransformType cameraTransformType) { + if (stack != null) { + IBakedModel bakedModel = this.getItemModelWithOverrides(stack, (World) null, (EntityLivingBase) null); + if (isValidModel(bakedModel)) { + this.renderItemModel(stack, bakedModel, cameraTransformType, false); + } + parent.zLevel = this.zLevel; + parent.renderItem(stack, cameraTransformType); + } + } + + @Override + public void renderItem(ItemStack stack, EntityLivingBase livingBase, TransformType transform, boolean leftHanded) { + if (stack != null && livingBase != null && stack.getItem() != null) { + IBakedModel bakedModel = this.getItemModelWithOverrides(stack, livingBase.worldObj, livingBase); + if (isValidModel(bakedModel)) { + this.renderItemModel(stack, bakedModel, transform, leftHanded); + } else { + parent.zLevel = this.zLevel; + parent.renderItem(stack, livingBase, transform, leftHanded); + } + } + } + + @Override + public void renderItemIntoGUI(ItemStack stack, int x, int y) { + IBakedModel bakedModel = this.getItemModelWithOverrides(stack, (World) null, (EntityLivingBase) null); + if (isValidModel(bakedModel)) { + this.renderItemModelIntoGUI(stack, x, y, bakedModel); + } else { + parent.zLevel = this.zLevel; + parent.renderItemIntoGUI(stack, x, y); + } + } + + @Override + public void renderItemAndEffectIntoGUI(ItemStack stack, int xPosition, int yPosition) { + this.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().thePlayer, stack, xPosition, yPosition); + } + + @Override + public void renderItemAndEffectIntoGUI(@Nullable EntityLivingBase livingBase, final ItemStack stack, int x, int y) { + if (stack != null && stack.getItem() != null) { + try { + + IBakedModel model = this.getItemModelWithOverrides(stack, (World) null, livingBase); + if (isValidModel(model)) { + this.zLevel += 50.0F; + this.renderItemModelIntoGUI(stack, x, y, model); + this.zLevel -= 50.0F; + } else { + parent.zLevel = this.zLevel; + parent.renderItemAndEffectIntoGUI(livingBase, stack, x, y); + } + + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering item"); + CrashReportCategory crashreportcategory = crashreport.makeCategory("Item being rendered"); + crashreportcategory.setDetail("Item Type", new ICrashReportDetail() { + public String call() throws Exception { + return String.valueOf((Object) stack.getItem()); + } + }); + crashreportcategory.setDetail("Item Aux", new ICrashReportDetail() { + public String call() throws Exception { + return String.valueOf(stack.getMetadata()); + } + }); + crashreportcategory.setDetail("Item NBT", new ICrashReportDetail() { + public String call() throws Exception { + return String.valueOf((Object) stack.getTagCompound()); + } + }); + crashreportcategory.setDetail("Item Foil", new ICrashReportDetail() { + public String call() throws Exception { + return String.valueOf(stack.hasEffect()); + } + }); + throw new ReportedException(crashreport); + } + } + } + + // endregion + + // region parentOverrides + @Override + public void registerItems() { + //We don't want to register any more items as we are just a wrapper. + } + + @Override + public void registerItem(Item item, int subType, String identifier) { + //Pass this through because why not. + parent.registerItem(item, subType, identifier); + } + + @Override + public void isNotRenderingEffectsInGUI(boolean isNot) { + parent.isNotRenderingEffectsInGUI(isNot); + } + + @Override + public ItemModelMesher getItemModelMesher() { + return parent.getItemModelMesher(); + } + + @Override + public boolean shouldRenderItemIn3D(ItemStack stack) { + return parent.shouldRenderItemIn3D(stack); + } + + @Override + public IBakedModel getItemModelWithOverrides(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entitylivingbaseIn) { + return parent.getItemModelWithOverrides(stack, worldIn, entitylivingbaseIn); + } + + @Override + public void onResourceManagerReload(IResourceManager resourceManager) { + parent.onResourceManagerReload(resourceManager); + } + + //endregion +} diff --git a/dependencies/main/java/codechicken/lib/render/item/EntityRendererHooks.java b/dependencies/main/java/codechicken/lib/render/item/EntityRendererHooks.java new file mode 100644 index 0000000000..073a4970d8 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/item/EntityRendererHooks.java @@ -0,0 +1,129 @@ +package codechicken.lib.render.item; + +import codechicken.lib.asm.ObfMapping; +import codechicken.lib.util.ReflectionManager; +import net.minecraft.client.renderer.RenderItem; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.entity.Entity; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraftforge.client.event.GuiOpenEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.client.GuiModList; +import net.minecraftforge.fml.client.registry.IRenderFactory; +import net.minecraftforge.fml.client.registry.RenderingRegistry; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.ModContainer; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import java.lang.reflect.Field; +import java.util.ArrayList; + +/** + * Created by covers1624 on 31/10/2016. + */ +//Used to make sure all references to RenderItem are of CCL's overridden renderer. +@Mod (modid = "ccl-entityhook") +//TODO Find another way to do this, Maybe an ASM hook to load the CCRenderItem. +public class EntityRendererHooks { + + private static boolean hasSanitized; + + public static EntityRendererHooks instance; + + public EntityRendererHooks() { + instance = this; + } + + @EventHandler + @SideOnly (Side.CLIENT) + public void preInt(FMLPreInitializationEvent event) { + MinecraftForge.EVENT_BUS.register(instance); + RenderingRegistry.registerEntityRenderingHandler(DummyEntity.class, new IRenderFactory() { + @Override + public Render createRenderFor(RenderManager manager) { + sanitizeEntityRenderers(manager); + return new Render(manager) { + @Override + protected ResourceLocation getEntityTexture(DummyEntity entity) { + return null; + } + }; + } + }); + } + + @SuppressWarnings ("unchecked") + @SubscribeEvent + @SideOnly (Side.CLIENT) + public void onGuiInit(GuiOpenEvent event) { + try { + if (event.getGui() instanceof GuiModList) { + ModContainer container = FMLCommonHandler.instance().findContainerFor(instance); + Field field = ReflectionManager.getField(new ObfMapping("net/minecraftforge/fml/client/GuiModList", "mods", "")); + ArrayList mods = (ArrayList) field.get(event.getGui()); + if (mods.contains(container)) { + mods.remove(container); + } else { + FMLLog.warning("CCL's Dummy mod was not found inside the mod gui list!"); + } + + } + } catch (Exception e) { + throw new RuntimeException("Unable to hide CCL Dummy mod from the mods gui!.", e); + } + } + + @SideOnly (Side.CLIENT) + public static void sanitizeEntityRenderers(RenderManager renderManager) { + if (!hasSanitized) { + try { + for (Render render : renderManager.entityRenderMap.values()) { + if (render != null) { + for (Field field : render.getClass().getDeclaredFields()) { + if (field.getType().equals(RenderItem.class)) { + field.setAccessible(true); + field.set(render, CCRenderItem.instance()); + } + } + } + } + } catch (Exception e) { + throw new RuntimeException("Unable to reflect an EntityRenderer!", e); + } + hasSanitized = true; + } + } + + @SideOnly (Side.CLIENT) + public class DummyEntity extends Entity { + + public DummyEntity(World worldIn) { + super(worldIn); + } + + @Override + protected void entityInit() { + + } + + @Override + protected void readEntityFromNBT(NBTTagCompound compound) { + + } + + @Override + protected void writeEntityToNBT(NBTTagCompound compound) { + + } + } + +} diff --git a/dependencies/main/java/codechicken/lib/render/item/IGLTransform.java b/dependencies/main/java/codechicken/lib/render/item/IGLTransform.java new file mode 100644 index 0000000000..bdb4de5c0f --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/item/IGLTransform.java @@ -0,0 +1,13 @@ +package codechicken.lib.render.item; + +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; + +/** + * Created by covers1624 on 18/10/2016. + * Used to manually apply OpenGL transforms based on the TransformType. + */ +public interface IGLTransform extends IBakedModel { + + void applyTransforms(TransformType transformType, boolean isLeftHand); +} diff --git a/dependencies/main/java/codechicken/lib/render/item/IItemRenderer.java b/dependencies/main/java/codechicken/lib/render/item/IItemRenderer.java new file mode 100644 index 0000000000..3748beb941 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/item/IItemRenderer.java @@ -0,0 +1,20 @@ +package codechicken.lib.render.item; + +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.item.ItemStack; + +/** + * Hooks to the location of RenderItem#renderItem(ItemStack, IBakedModel) + */ +//TODO, We need a perspective aware IItemRenderer +public interface IItemRenderer extends IBakedModel { + + /** + * Used as a CallBack to render a TileEntity / Item after Transforms have been applied. + * + * @param item Stack to render. + */ + void renderItem(ItemStack item); + + //boolean shouldHandleRender(ItemStack stack); +} diff --git a/dependencies/main/java/codechicken/lib/render/item/IMatrixTransform.java b/dependencies/main/java/codechicken/lib/render/item/IMatrixTransform.java new file mode 100644 index 0000000000..a9ccb759e6 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/item/IMatrixTransform.java @@ -0,0 +1,14 @@ +package codechicken.lib.render.item; + +import codechicken.lib.vec.Matrix4; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; + +/** + * Created by covers1624 on 18/10/2016. + * Used to define IITemRenderer to apply transforms using a Matrix4 + */ +public interface IMatrixTransform extends IBakedModel { + + Matrix4 getTransform(TransformType transformType, boolean isLeftHand); +} diff --git a/dependencies/main/java/codechicken/lib/render/item/IStackPerspectiveAwareModel.java b/dependencies/main/java/codechicken/lib/render/item/IStackPerspectiveAwareModel.java new file mode 100644 index 0000000000..b937a5eda9 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/item/IStackPerspectiveAwareModel.java @@ -0,0 +1,17 @@ +package codechicken.lib.render.item; + +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.item.ItemStack; +import org.apache.commons.lang3.tuple.Pair; + +import javax.vecmath.Matrix4f; + +/** + * Created by covers1624 on 5/11/2016. + * Basically the same as IPerspectiveAwareModel. Except you have reference to the ItemStack you are rendering for. + */ +public interface IStackPerspectiveAwareModel extends IBakedModel { + + Pair handlePerspective(ItemStack stack, TransformType cameraTransformType); +} diff --git a/dependencies/main/java/codechicken/lib/render/item/map/IMapRenderer.java b/dependencies/main/java/codechicken/lib/render/item/map/IMapRenderer.java new file mode 100644 index 0000000000..2c419b2310 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/item/map/IMapRenderer.java @@ -0,0 +1,34 @@ +package codechicken.lib.render.item.map; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.storage.MapData; + +import javax.annotation.Nullable; + +/** + * Created by covers1624 on 15/02/2017. + * Used to handle the rendering of map data for your custom maps. + */ +public interface IMapRenderer { + + /** + * If the IMapRenderer should handle rendering the data from this map. + * + * @param stack The ItemStack to render map data from. + * @param data The Map data contained inside this Map. + * @param inFrame If the ItemStack is inside an ItemFrame. + * @return Should this IMapRenderer handle with this context. + */ + boolean shouldHandle(ItemStack stack, @Nullable MapData data, boolean inFrame); + + /** + * If this is called you are expected to do something. + * This is ONLY called if shouldHandle returns true. + * + * @param stack The ItemStack to render the map data from. + * @param data The MapData contained in the ItemStack. + * @param inFrame If the ItemStack is inside an ItemFrame. + */ + void renderMap(ItemStack stack, @Nullable MapData data, boolean inFrame); + +} diff --git a/dependencies/main/java/codechicken/lib/render/item/map/MapRenderRegistry.java b/dependencies/main/java/codechicken/lib/render/item/map/MapRenderRegistry.java new file mode 100644 index 0000000000..a3f82db491 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/item/map/MapRenderRegistry.java @@ -0,0 +1,50 @@ +package codechicken.lib.render.item.map; + +import net.minecraft.client.Minecraft; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.storage.MapData; +import net.minecraftforge.client.event.RenderItemInFrameEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +import java.util.IdentityHashMap; + +/** + * Created by covers1624 on 15/02/2017. + * TODO PR for 1.11 to add this as an event. + */ +public class MapRenderRegistry { + + private static IdentityHashMap mapRenderers = new IdentityHashMap(); + + public static boolean shouldHandle(ItemStack stack, boolean inFrame) { + IMapRenderer mapRenderer = mapRenderers.get(stack.getItem()); + if (mapRenderer != null) { + MapData data = Items.FILLED_MAP.getMapData(stack, Minecraft.getMinecraft().theWorld); + return mapRenderer.shouldHandle(stack, data, inFrame); + } + return false; + } + + public static void handleRender(ItemStack stack, boolean inFrame) { + IMapRenderer mapRenderer = mapRenderers.get(stack.getItem()); + if (mapRenderer != null) { + MapData data = Items.FILLED_MAP.getMapData(stack, Minecraft.getMinecraft().theWorld); + mapRenderer.renderMap(stack, data, inFrame); + } + } + + public static void registerMapRenderer(Item item, IMapRenderer mapRenderer) { + mapRenderers.put(item, mapRenderer); + } + + @SubscribeEvent + public void onItemFrameRender(RenderItemInFrameEvent event) { + if (shouldHandle(event.getItem(), true)) { + event.setCanceled(true); + handleRender(event.getItem(), true); + } + } + +} diff --git a/dependencies/main/java/codechicken/lib/render/particle/CustomParticleHandler.java b/dependencies/main/java/codechicken/lib/render/particle/CustomParticleHandler.java new file mode 100644 index 0000000000..6183ae0429 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/particle/CustomParticleHandler.java @@ -0,0 +1,85 @@ +package codechicken.lib.render.particle; + +import codechicken.lib.render.DigIconParticle; +import codechicken.lib.texture.IWorldBlockTextureProvider; +import codechicken.lib.vec.Cuboid6; +import codechicken.lib.vec.Vector3; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.particle.ParticleManager; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.world.World; + +/** + * Created by covers1624 on 21/11/2016. + * TODO, we need to support landing particles and Maybe some ASM to add this to all blocks that CCL supports. + */ +public class CustomParticleHandler { + + public static void addHitEffects(IBlockState state, World world, RayTraceResult trace, ParticleManager particleManager, IWorldBlockTextureProvider provider) { + TextureAtlasSprite sprite = provider.getTexture(trace.sideHit, state, BlockRenderLayer.SOLID, world, trace.getBlockPos()); + Cuboid6 cuboid = new Cuboid6(state.getBoundingBox(world, trace.getBlockPos())).add(trace.getBlockPos()); + addBlockHitEffects(world, cuboid, trace.sideHit, sprite, particleManager); + } + + public static void addDestroyEffects(World world, BlockPos pos, ParticleManager particleManager, IWorldBlockTextureProvider provider) { + TextureAtlasSprite[] sprites = new TextureAtlasSprite[6]; + IBlockState state = world.getBlockState(pos); + for (EnumFacing face : EnumFacing.VALUES) { + sprites[face.ordinal()] = provider.getTexture(face, state, BlockRenderLayer.SOLID, world, pos); + } + Cuboid6 cuboid = new Cuboid6(state.getBoundingBox(world, pos)).add(pos); + addBlockDestroyEffects(world, cuboid, sprites, particleManager); + } + + public static void addBlockHitEffects(World world, Cuboid6 bounds, EnumFacing side, TextureAtlasSprite icon, ParticleManager particleManager) { + float border = 0.1F; + Vector3 diff = bounds.max.copy().subtract(bounds.min).add(-2 * border); + diff.x *= world.rand.nextDouble(); + diff.y *= world.rand.nextDouble(); + diff.z *= world.rand.nextDouble(); + Vector3 pos = diff.add(bounds.min).add(border); + + if (side == EnumFacing.DOWN) { + diff.y = bounds.min.y - border; + } + if (side == EnumFacing.UP) { + diff.y = bounds.max.y + border; + } + if (side == EnumFacing.NORTH) { + diff.z = bounds.min.z - border; + } + if (side == EnumFacing.SOUTH) { + diff.z = bounds.max.z + border; + } + if (side == EnumFacing.WEST) { + diff.x = bounds.min.x - border; + } + if (side == EnumFacing.EAST) { + diff.x = bounds.max.x + border; + } + + particleManager.addEffect(new DigIconParticle(world, pos.x, pos.y, pos.z, 0, 0, 0, icon).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); + } + + public static void addBlockDestroyEffects(World world, Cuboid6 bounds, TextureAtlasSprite[] icons, ParticleManager particleManager) { + Vector3 diff = bounds.max.copy().subtract(bounds.min); + Vector3 center = bounds.min.copy().add(bounds.max).multiply(0.5); + Vector3 density = diff.copy().multiply(4).celi(); + + for (int i = 0; i < density.x; ++i) { + for (int j = 0; j < density.y; ++j) { + for (int k = 0; k < density.z; ++k) { + double x = bounds.min.x + (i + 0.5) * diff.x / density.x; + double y = bounds.min.y + (j + 0.5) * diff.y / density.y; + double z = bounds.min.z + (k + 0.5) * diff.z / density.z; + particleManager.addEffect(new DigIconParticle(world, x, y, z, x - center.x, y - center.y, z - center.z, icons[world.rand.nextInt(icons.length)])); + } + } + } + } + +} diff --git a/dependencies/main/java/codechicken/lib/render/CCRenderPipeline.java b/dependencies/main/java/codechicken/lib/render/pipeline/CCRenderPipeline.java similarity index 73% rename from dependencies/main/java/codechicken/lib/render/CCRenderPipeline.java rename to dependencies/main/java/codechicken/lib/render/pipeline/CCRenderPipeline.java index a5b3759e52..2e84dd8295 100644 --- a/dependencies/main/java/codechicken/lib/render/CCRenderPipeline.java +++ b/dependencies/main/java/codechicken/lib/render/pipeline/CCRenderPipeline.java @@ -1,12 +1,19 @@ -package codechicken.lib.render; +package codechicken.lib.render.pipeline; -import codechicken.lib.render.CCRenderState.IVertexOperation; -import codechicken.lib.render.CCRenderState.VertexAttribute; +import codechicken.lib.render.CCRenderState; import java.util.ArrayList; public class CCRenderPipeline { + public class PipelineBuilder { + + CCRenderState renderState; + + public PipelineBuilder(CCRenderState renderState) { + this.renderState = renderState; + } + public PipelineBuilder add(IVertexOperation op) { ops.add(op); return this; @@ -25,11 +32,12 @@ public void build() { public void render() { rebuild(); - CCRenderState.render(); + renderState.render(); } } private class PipelineNode { + public ArrayList deps = new ArrayList(); public IVertexOperation op; @@ -47,12 +55,22 @@ public void add() { } } + private CCRenderState renderState; + + //By default we want to force format attributes. + public boolean forceFormatAttributes = true; + private ArrayList attribs = new ArrayList(); private ArrayList ops = new ArrayList(); private ArrayList nodes = new ArrayList(); private ArrayList sorted = new ArrayList(); private PipelineNode loading; - private PipelineBuilder builder = new PipelineBuilder(); + private PipelineBuilder builder; + + public CCRenderPipeline(CCRenderState renderState) { + this.renderState = renderState; + builder = new PipelineBuilder(renderState); + } public void setPipeline(IVertexOperation... ops) { this.ops.clear(); @@ -76,7 +94,20 @@ private void unbuild() { } public void rebuild() { - if (ops.isEmpty() || CCRenderState.model == null) { + + if (forceFormatAttributes) { + if (renderState.fmt.hasNormal()) { + addAttribute(renderState.normalAttrib); + } + if (renderState.fmt.hasColor()) { + addAttribute(renderState.colourAttrib); + } + if (renderState.computeLighting) { + addAttribute(renderState.lightingAttrib); + } + } + + if (ops.isEmpty() || renderState.model == null) { return; } @@ -86,20 +117,10 @@ public void rebuild() { } unbuild(); - if (CCRenderState.useNormals) { - addAttribute(CCRenderState.normalAttrib); - } - if (CCRenderState.useColour) { - addAttribute(CCRenderState.colourAttrib); - } - if (CCRenderState.computeLighting) { - addAttribute(CCRenderState.lightingAttrib); - } - for (int i = 0; i < ops.size(); i++) { IVertexOperation op = ops.get(i); loading = nodes.get(op.operationID()); - boolean loaded = op.load(); + boolean loaded = op.load(renderState); if (loaded) { loading.op = op; } @@ -136,7 +157,7 @@ public void addAttribute(VertexAttribute attrib) { public void operate() { for (int i = 0; i < sorted.size(); i++) { - sorted.get(i).operate(); + sorted.get(i).operate(renderState); } } diff --git a/dependencies/main/java/codechicken/lib/render/ColourMultiplier.java b/dependencies/main/java/codechicken/lib/render/pipeline/ColourMultiplier.java similarity index 63% rename from dependencies/main/java/codechicken/lib/render/ColourMultiplier.java rename to dependencies/main/java/codechicken/lib/render/pipeline/ColourMultiplier.java index 80b613e885..2b7721ff55 100644 --- a/dependencies/main/java/codechicken/lib/render/ColourMultiplier.java +++ b/dependencies/main/java/codechicken/lib/render/pipeline/ColourMultiplier.java @@ -1,8 +1,10 @@ -package codechicken.lib.render; +package codechicken.lib.render.pipeline; import codechicken.lib.colour.ColourRGBA; +import codechicken.lib.render.CCRenderState; + +public class ColourMultiplier implements IVertexOperation { -public class ColourMultiplier implements CCRenderState.IVertexOperation { private static ColourMultiplier instance = new ColourMultiplier(-1); public static ColourMultiplier instance(int colour) { @@ -18,18 +20,18 @@ public ColourMultiplier(int colour) { } @Override - public boolean load() { + public boolean load(CCRenderState state) { if (colour == -1) { return false; } - CCRenderState.pipeline.addDependency(CCRenderState.colourAttrib); + state.pipeline.addDependency(state.colourAttrib); return true; } @Override - public void operate() { - CCRenderState.setColour(ColourRGBA.multiply(CCRenderState.colour, colour)); + public void operate(CCRenderState state) { + state.colour = ColourRGBA.multiply(state.colour, colour); } @Override diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/IVertexOperation.java b/dependencies/main/java/codechicken/lib/render/pipeline/IVertexOperation.java new file mode 100644 index 0000000000..57a14ffdcc --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/pipeline/IVertexOperation.java @@ -0,0 +1,26 @@ +package codechicken.lib.render.pipeline; + +import codechicken.lib.render.CCRenderState; + +/** + * Represents an operation to be run for each vertex that operates on and modifies the current state + */ +public interface IVertexOperation { + + /** + * Load any required references and add dependencies to the pipeline based on the current model (may be null) + * Return false if this operation is redundant in the pipeline with the given model + */ + boolean load(CCRenderState state); + + /** + * Perform the operation on the current render state + */ + void operate(CCRenderState state); + + /** + * Get the unique id representing this type of operation. Duplicate operation IDs within the pipeline may have unexpected results. + * ID shoulld be obtained from CCRenderState.registerOperation() and stored in a static variable + */ + int operationID(); +} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/IVertexSource.java b/dependencies/main/java/codechicken/lib/render/pipeline/IVertexSource.java new file mode 100644 index 0000000000..e09aef18d8 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/pipeline/IVertexSource.java @@ -0,0 +1,32 @@ +package codechicken.lib.render.pipeline; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.attribute.AttributeKey; +import codechicken.lib.vec.Vertex5; + +/** + * Created by covers1624 on 10/10/2016. + */ +public interface IVertexSource { + + Vertex5[] getVertices(); + + /** + * Gets an array of vertex attributes + * + * @param attr The vertex attribute to get + * @param The attribute array type + * @return An array, or null if not computed + */ + T getAttributes(AttributeKey attr); + + /** + * @return True if the specified attribute is provided by this model, either by returning an array from getAttributes or by setting the state in prepareVertex + */ + boolean hasAttribute(AttributeKey attr); + + /** + * Callback to set CCRenderState for a vertex before the pipeline runs + */ + void prepareVertex(CCRenderState state); +} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/VertexAttribute.java b/dependencies/main/java/codechicken/lib/render/pipeline/VertexAttribute.java new file mode 100644 index 0000000000..a3225f425d --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/pipeline/VertexAttribute.java @@ -0,0 +1,39 @@ +package codechicken.lib.render.pipeline; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.attribute.AttributeKey; +import codechicken.lib.util.ArrayUtils; + +/** + * Management class for a vertex attribute such as colour, normal etc + * This class should handle the loading of the attribute from an array provided by IVertexSource.getAttributes or the computation of this attribute from others + * + * @param The array type for this attribute eg. int[], Vector3[] + */ +public abstract class VertexAttribute implements IVertexOperation { + + private final int operationIndex = CCRenderState.registerOperation(); + + /** + * Set to true when the attribute is part of the pipeline. Should only be managed by CCRenderState when constructing the pipeline + */ + public boolean active = false; + + /** + * Construct a new array for storage of vertex attributes in a model + */ + public abstract T newArray(int length); + + public abstract String getAttribName(); + + @Override + public int operationID() { + return operationIndex; + } + + public static R copyOf(AttributeKey attr, R src, int length) { + R dst = attr.newArray(length); + ArrayUtils.arrayCopy(src, 0, dst, 0, ((Object[]) src).length); + return dst; + } +} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/AttributeKey.java b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/AttributeKey.java new file mode 100644 index 0000000000..743281a039 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/AttributeKey.java @@ -0,0 +1,40 @@ +package codechicken.lib.render.pipeline.attribute; + +import com.google.common.collect.ImmutableList; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by covers1624 on 10/10/2016. + * Used to lookup and create new arrays for an attribute without a hard dep on an attribute instance. + */ +public abstract class AttributeKey { + + public final int attributeKeyIndex; + + public AttributeKey() { + attributeKeyIndex = AttributeKeyRegistry.registerAttributeKey(this); + } + + public abstract T newArray(int length); + + public static class AttributeKeyRegistry { + + private static ArrayList> attributeKeys = new ArrayList>(); + + private static int registerAttributeKey(AttributeKey attr) { + attributeKeys.add(attr); + return attributeKeys.size() - 1; + } + + public static AttributeKey getAttributeKey(int index) { + return attributeKeys.get(index); + } + + public static List> getRegisteredAttributeKeys() { + return ImmutableList.copyOf(attributeKeys); + } + } + +} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/ColourAttribute.java b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/ColourAttribute.java new file mode 100644 index 0000000000..9c02f2cdac --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/ColourAttribute.java @@ -0,0 +1,45 @@ +package codechicken.lib.render.pipeline.attribute; + +import codechicken.lib.colour.ColourRGBA; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.VertexAttribute; + +/** + * Sets colour in CCRS to the specified colour in the model. + */ +public class ColourAttribute extends VertexAttribute { + + public static final AttributeKey attributeKey = new AttributeKey() { + @Override + public int[] newArray(int length) { + return new int[length]; + } + }; + + private int[] colourRef; + + @Override + public int[] newArray(int length) { + return new int[length]; + } + + @Override + public String getAttribName() { + return "colourAttrib"; + } + + @Override + public boolean load(CCRenderState state) { + colourRef = state.model.getAttributes(ColourAttribute.attributeKey); + return colourRef != null || !state.model.hasAttribute(ColourAttribute.attributeKey); + } + + @Override + public void operate(CCRenderState state) { + if (colourRef != null) { + state.colour = ColourRGBA.multiply(state.baseColour, colourRef[state.vertexIndex]); + } else { + state.colour = state.baseColour; + } + } +} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightCoordAttribute.java b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightCoordAttribute.java new file mode 100644 index 0000000000..cd9f3edafe --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightCoordAttribute.java @@ -0,0 +1,56 @@ +package codechicken.lib.render.pipeline.attribute; + +import codechicken.lib.lighting.LC; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.VertexAttribute; +import codechicken.lib.vec.Transformation; +import codechicken.lib.vec.Vector3; + +/** + * Uses the position of the lightmatrix to compute LC if not provided + */ +public class LightCoordAttribute extends VertexAttribute { + + public static final AttributeKey attributeKey = new AttributeKey() { + @Override + public LC[] newArray(int length) { + return new LC[length]; + } + }; + + private LC[] lcRef; + private Vector3 vec = new Vector3();//for computation + private Vector3 pos = new Vector3(); + + @Override + public LC[] newArray(int length) { + return new LC[length]; + } + + @Override + public String getAttribName() { + return "lightCoordAttrib"; + } + + @Override + public boolean load(CCRenderState state) { + lcRef = state.model.getAttributes(LightCoordAttribute.attributeKey); + if (state.model.hasAttribute(LightCoordAttribute.attributeKey)) { + return lcRef != null; + } + + pos.set(new Vector3(state.lightMatrix.pos)); + state.pipeline.addDependency(state.sideAttrib); + state.pipeline.addRequirement(Transformation.operationIndex); + return true; + } + + @Override + public void operate(CCRenderState state) { + if (lcRef != null) { + state.lc.set(lcRef[state.vertexIndex]); + } else { + state.lc.compute(vec.set(state.vert.vec).subtract(pos), state.side); + } + } +} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightingAttribute.java b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightingAttribute.java new file mode 100644 index 0000000000..9d1c4175d5 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightingAttribute.java @@ -0,0 +1,49 @@ +package codechicken.lib.render.pipeline.attribute; + +import codechicken.lib.colour.ColourRGBA; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.VertexAttribute; + +/** + * Created by covers1624 on 10/10/2016. + */ +public class LightingAttribute extends VertexAttribute { + + public static final AttributeKey attributeKey = new AttributeKey() { + @Override + public int[] newArray(int length) { + return new int[length]; + } + }; + + private int[] colourRef; + + @Override + public int[] newArray(int length) { + return new int[length]; + } + + @Override + public String getAttribName() { + return "lightingAttrib"; + } + + @Override + public boolean load(CCRenderState state) { + if (!state.computeLighting || !state.fmt.hasColor() || !state.model.hasAttribute(LightingAttribute.attributeKey)) { + return false; + } + + colourRef = state.model.getAttributes(LightingAttribute.attributeKey); + if (colourRef != null) { + state.pipeline.addDependency(state.colourAttrib); + return true; + } + return false; + } + + @Override + public void operate(CCRenderState state) { + state.colour = ColourRGBA.multiply(state.colour, colourRef[state.vertexIndex]); + } +} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/NormalAttribute.java b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/NormalAttribute.java new file mode 100644 index 0000000000..f8649e9afd --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/NormalAttribute.java @@ -0,0 +1,54 @@ +package codechicken.lib.render.pipeline.attribute; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.VertexAttribute; +import codechicken.lib.vec.Rotation; +import codechicken.lib.vec.Vector3; + +/** + * Apples normals to the render operation. If the model is a planar model it uses known normals. + */ +public class NormalAttribute extends VertexAttribute { + + public static final AttributeKey attributeKey = new AttributeKey() { + @Override + public Vector3[] newArray(int length) { + return new Vector3[length]; + } + }; + + private Vector3[] normalRef; + + @Override + public Vector3[] newArray(int length) { + return new Vector3[length]; + } + + @Override + public String getAttribName() { + return "normalAttrib"; + } + + @Override + public boolean load(CCRenderState state) { + normalRef = state.model.getAttributes(NormalAttribute.attributeKey); + if (state.model.hasAttribute(NormalAttribute.attributeKey)) { + return normalRef != null; + } + + if (state.model.hasAttribute(SideAttribute.attributeKey)) { + state.pipeline.addDependency(state.sideAttrib); + return true; + } + throw new IllegalStateException("Normals requested but neither normal or side attrutes are provided by the model"); + } + + @Override + public void operate(CCRenderState state) { + if (normalRef != null) { + state.normal.set(normalRef[state.vertexIndex]); + } else { + state.normal.set(Rotation.axes[state.side]); + } + } +} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/SideAttribute.java b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/SideAttribute.java new file mode 100644 index 0000000000..042cede201 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/SideAttribute.java @@ -0,0 +1,50 @@ +package codechicken.lib.render.pipeline.attribute; + +import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.VertexAttribute; +import codechicken.lib.util.VectorUtils; + +/** + * Sets the side state in CCRS based on the provided model. If the model does not have side data it requires normals. + */ +public class SideAttribute extends VertexAttribute { + + public static final AttributeKey attributeKey = new AttributeKey() { + @Override + public int[] newArray(int length) { + return new int[length]; + } + }; + + private int[] sideRef; + + @Override + public int[] newArray(int length) { + return new int[length]; + } + + @Override + public String getAttribName() { + return "sideAttrib"; + } + + @Override + public boolean load(CCRenderState state) { + sideRef = state.model.getAttributes(SideAttribute.attributeKey); + if (state.model.hasAttribute(SideAttribute.attributeKey)) { + return sideRef != null; + } + + state.pipeline.addDependency(state.normalAttrib); + return true; + } + + @Override + public void operate(CCRenderState state) { + if (sideRef != null) { + state.side = sideRef[state.vertexIndex]; + } else { + state.side = VectorUtils.findSide(state.normal); + } + } +} diff --git a/dependencies/main/java/codechicken/lib/render/ShaderProgram.java b/dependencies/main/java/codechicken/lib/render/shader/ShaderProgram.java similarity index 64% rename from dependencies/main/java/codechicken/lib/render/ShaderProgram.java rename to dependencies/main/java/codechicken/lib/render/shader/ShaderProgram.java index d70bf23401..b5a480b4d7 100644 --- a/dependencies/main/java/codechicken/lib/render/ShaderProgram.java +++ b/dependencies/main/java/codechicken/lib/render/shader/ShaderProgram.java @@ -1,5 +1,8 @@ -package codechicken.lib.render; +package codechicken.lib.render.shader; +import codechicken.lib.render.shader.pipeline.CCShaderPipeline; +import codechicken.lib.render.shader.pipeline.attribute.IShaderOperation; +import org.lwjgl.opengl.ARBFragmentShader; import org.lwjgl.opengl.ARBShaderObjects; import org.lwjgl.opengl.ARBVertexShader; import org.lwjgl.opengl.GL11; @@ -9,11 +12,15 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.util.ArrayList; import static org.lwjgl.opengl.ARBShaderObjects.*; public class ShaderProgram { - int programID; + + private int programID; + public CCShaderPipeline pipeline = new CCShaderPipeline(this); + private ArrayList ops = new ArrayList(); public ShaderProgram() { programID = glCreateProgramObjectARB(); @@ -22,40 +29,60 @@ public ShaderProgram() { } } - public void attach(int shaderType, String resource) { - InputStream stream = ShaderProgram.class.getResourceAsStream(resource); - if (stream == null) { - throw new RuntimeException("Unable to locate resource: " + resource); - } + public void attachShaderOperation(IShaderOperation operation) { + ops.add(operation); + } - attach(shaderType, stream); + public void bindShader() { + glUseProgramObjectARB(programID); } - public void use() { + /** + * Allows you to bind the shader for use outside an IShaderOperation. + * You can still pass variables to the shader using an IShaderOperation. + * + * Call this before you do your rendering. + * Then call ShaderProgram.unbindShader() when you have finished rendering. + */ + public void freeBindShader() { + pipeline.reset(); + pipeline.setPipeline(ops); + glUseProgramObjectARB(programID); + pipeline.operate(); } - public static void restore() { + public static void unbindShader() { glUseProgramObjectARB(0); } - public void link() { - glLinkProgramARB(programID); - if (glGetObjectParameteriARB(programID, GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) { - throw new RuntimeException("Error linking program: " + getInfoLog(programID)); - } + public void runShader() { + pipeline.reset(); + pipeline.setPipeline(ops); - glValidateProgramARB(programID); - if (glGetObjectParameteriARB(programID, GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) { - throw new RuntimeException("Error validating program: " + getInfoLog(programID)); + bindShader(); + pipeline.operate(); + unbindShader(); + } + + public ShaderProgram attachVert(String resource) { + return attach(ARBVertexShader.GL_VERTEX_SHADER_ARB, resource); + } + + public ShaderProgram attachFrag(String resource) { + return attach(ARBFragmentShader.GL_FRAGMENT_SHADER_ARB, resource); + } + + public ShaderProgram attach(int shaderType, String resource) { + InputStream stream = ShaderProgram.class.getResourceAsStream(resource); + if (stream == null) { + throw new RuntimeException("Unable to locate resource: " + resource); } - use(); - onLink(); - restore(); + return attach(shaderType, stream); } - public void attach(int shaderType, InputStream stream) { + public ShaderProgram attach(int shaderType, InputStream stream) { if (stream == null) { throw new RuntimeException("Invalid shader inputstream"); } @@ -83,6 +110,23 @@ public void attach(int shaderType, InputStream stream) { glDeleteObjectARB(shaderID); throw e; } + return this; + } + + /** + * Call this once you have bound your frag and vert shader. + */ + public ShaderProgram validate() { + glLinkProgramARB(programID); + if (glGetObjectParameteriARB(programID, GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) { + throw new RuntimeException("Error linking program: " + getInfoLog(programID)); + } + + glValidateProgramARB(programID); + if (glGetObjectParameteriARB(programID, GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) { + throw new RuntimeException("Error validating program: " + getInfoLog(programID)); + } + return this; } public static String asString(InputStream stream) throws IOException { @@ -112,14 +156,18 @@ public void uniformTexture(String name, int textureIndex) { ARBShaderObjects.glUniform1iARB(getUniformLoc(name), textureIndex); } - public void onLink() { - - } - public void glVertexAttributeMat4(int loc, Matrix4f matrix) { ARBVertexShader.glVertexAttrib4fARB(loc, matrix.m00, matrix.m01, matrix.m02, matrix.m03); ARBVertexShader.glVertexAttrib4fARB(loc + 1, matrix.m10, matrix.m11, matrix.m12, matrix.m13); ARBVertexShader.glVertexAttrib4fARB(loc + 2, matrix.m20, matrix.m21, matrix.m22, matrix.m23); ARBVertexShader.glVertexAttrib4fARB(loc + 3, matrix.m30, matrix.m31, matrix.m32, matrix.m33); } + + /** + * This method will completely remove the shader. + */ + public void cleanup() { + ops.clear(); + ARBShaderObjects.glDeleteObjectARB(programID); + } } diff --git a/dependencies/main/java/codechicken/lib/render/shader/pipeline/CCShaderPipeline.java b/dependencies/main/java/codechicken/lib/render/shader/pipeline/CCShaderPipeline.java new file mode 100644 index 0000000000..b3b9152b86 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/shader/pipeline/CCShaderPipeline.java @@ -0,0 +1,135 @@ +package codechicken.lib.render.shader.pipeline; + +import codechicken.lib.render.shader.ShaderProgram; +import codechicken.lib.render.shader.pipeline.attribute.IShaderOperation; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Created by covers1624 on 18/10/2016. + */ +public class CCShaderPipeline { + + private static int nextOperationIndex; + + public static int registerOperation() { + return nextOperationIndex++; + } + + public static int operationCount() { + return nextOperationIndex; + } + + public class PipelineBuilder { + + public CCShaderPipeline.PipelineBuilder add(IShaderOperation op) { + ops.add(op); + return this; + } + + public CCShaderPipeline.PipelineBuilder add(IShaderOperation... ops) { + for (int i = 0; i < ops.length; i++) { + CCShaderPipeline.this.ops.add(ops[i]); + } + return this; + } + + public void build() { + rebuild(); + } + } + + private class PipelineNode { + + public ArrayList deps = new ArrayList(); + public IShaderOperation op; + + public void add() { + if (op == null) { + return; + } + + for (int i = 0; i < deps.size(); i++) { + deps.get(i).add(); + } + deps.clear(); + sorted.add(op); + op = null; + } + } + + private ShaderProgram program; + + private ArrayList ops = new ArrayList(); + private ArrayList nodes = new ArrayList(); + private ArrayList sorted = new ArrayList(); + private CCShaderPipeline.PipelineNode loading; + private CCShaderPipeline.PipelineBuilder builder = new CCShaderPipeline.PipelineBuilder(); + + public CCShaderPipeline(ShaderProgram program) { + this.program = program; + } + + public void setPipeline(IShaderOperation... ops) { + this.ops.clear(); + Collections.addAll(this.ops, ops); + rebuild(); + } + + public void setPipeline(List ops) { + this.ops.clear(); + this.ops.addAll(ops); + rebuild(); + } + + public void reset() { + ops.clear(); + unbuild(); + } + + private void unbuild() { + sorted.clear(); + } + + public void rebuild() { + + if (ops.isEmpty()) { + return; + } + + //ensure enough nodes for all ops + while (nodes.size() < operationCount()) { + nodes.add(new CCShaderPipeline.PipelineNode()); + } + unbuild(); + + for (IShaderOperation op : ops) { + loading = nodes.get(op.operationID()); + boolean loaded = op.load(program); + if (loaded) { + loading.op = op; + } + } + + for (PipelineNode node : nodes) { + node.add(); + } + } + + public void addRequirement(int opRef) { + loading.deps.add(nodes.get(opRef)); + } + + public void operate() { + for (IShaderOperation op : sorted) { + op.operate(program); + } + } + + public CCShaderPipeline.PipelineBuilder builder() { + ops.clear(); + return builder; + } +} diff --git a/dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/IShaderOperation.java b/dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/IShaderOperation.java new file mode 100644 index 0000000000..b5dcf2a674 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/IShaderOperation.java @@ -0,0 +1,15 @@ +package codechicken.lib.render.shader.pipeline.attribute; + +import codechicken.lib.render.shader.ShaderProgram; + +/** + * Created by covers1624 on 18/10/2016. + */ +public interface IShaderOperation { + + boolean load(ShaderProgram program); + + void operate(ShaderProgram program); + + int operationID(); +} diff --git a/dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/ShaderRenderTimeOperation.java b/dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/ShaderRenderTimeOperation.java new file mode 100644 index 0000000000..6239026375 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/ShaderRenderTimeOperation.java @@ -0,0 +1,37 @@ +package codechicken.lib.render.shader.pipeline.attribute; + +import codechicken.lib.render.shader.ShaderProgram; +import codechicken.lib.render.shader.pipeline.CCShaderPipeline; +import codechicken.lib.util.ClientUtils; +import org.lwjgl.opengl.ARBShaderObjects; + +import java.util.HashMap; + +/** + * Created by covers1624 on 18/10/2016. + */ +public class ShaderRenderTimeOperation implements IShaderOperation { + + public static final int operationID = CCShaderPipeline.registerOperation(); + private final HashMap shaderRenderTimeCache = new HashMap(); + + @Override + public boolean load(ShaderProgram program) { + return true; + } + + @Override + public void operate(ShaderProgram program) { + float renderTime = (float) ClientUtils.getRenderTime(); + if (renderTime != shaderRenderTimeCache.get(program)) { + int location = program.getAttribLoc("time"); + ARBShaderObjects.glUniform1fARB(location, renderTime); + shaderRenderTimeCache.put(program, renderTime); + } + } + + @Override + public int operationID() { + return operationID; + } +} diff --git a/dependencies/main/java/codechicken/lib/render/state/GlStateManagerHelper.java b/dependencies/main/java/codechicken/lib/render/state/GlStateManagerHelper.java new file mode 100644 index 0000000000..650cc45a5a --- /dev/null +++ b/dependencies/main/java/codechicken/lib/render/state/GlStateManagerHelper.java @@ -0,0 +1,356 @@ +package codechicken.lib.render.state; + +import com.google.common.base.Objects; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.GlStateManager.*; + +import java.util.ArrayList; +import java.util.LinkedList; + +/** + * Created by covers1624 on 10/10/2016. + * Dumps specific GL states from GlStateManager + * Ability to push and pop most of the GL state. + * TODO Ability to auto compare between different saved states. So basically a GlLeak analyser. + * TODO Support both Raw GL and GLStateManager, would be useful for detecting GLLeaks that occur due to raw GL calls. + * TODO Support all the things. + */ +public class GlStateManagerHelper { + + public static enum State { + GL_ALPHA_TEST { + @Override + public String getState() { + AlphaState alphaState = GlStateManager.alphaState; + return Objects.toStringHelper(name()).add("Func", alphaState.func).add("Ref", alphaState.ref).add("Enabled", String.valueOf(alphaState.alphaTest.currentState).toUpperCase()).toString(); + } + + @Override + public void pushState(SavedState state) { + state.alphaTest = GlStateManager.alphaState.alphaTest.currentState; + state.alphaFunc = GlStateManager.alphaState.func; + state.alphaRef = GlStateManager.alphaState.ref; + } + + @Override + public void popState(SavedState pre, SavedState post) { + if (pre.alphaTest) { + GlStateManager.enableAlpha(); + } else { + GlStateManager.disableAlpha(); + } + GlStateManager.alphaFunc(pre.alphaFunc, pre.alphaRef); + } + }, + GL_LIGHTING { + @Override + public String getState() { + return Objects.toStringHelper(name()).add("Enabled", parseBoolState(GlStateManager.lightingState)).toString(); + } + + @Override + public void pushState(SavedState state) { + state.lighting = GlStateManager.lightingState.currentState; + } + + @Override + public void popState(SavedState pre, SavedState post) { + if (pre.lighting) { + GlStateManager.enableLighting(); + } else { + GlStateManager.disableLighting(); + } + } + }, + GL_BLEND { + @Override + public String getState() { + BlendState blendState = GlStateManager.blendState; + //@formatter:off + return Objects.toStringHelper(name()) + .add("SrcFactor", parseFactor(blendState.srcFactor)) .add("DstFactor", parseFactor(blendState.dstFactor)) + .add("SrcFactorAlpha", parseFactor(blendState.srcFactorAlpha)).add("DstFactorAlpha", parseFactor(blendState.dstFactorAlpha)) + .add("Enabled", parseBoolState(blendState.blend)).toString(); + //@formatter:on + } + + @Override + public void pushState(SavedState state) { + state.blend = GlStateManager.blendState.blend.currentState; + state.blendSrcFactor = GlStateManager.blendState.srcFactor; + state.blendDstFactor = GlStateManager.blendState.dstFactor; + state.blendSrcFactorAlpha = GlStateManager.blendState.srcFactorAlpha; + state.blendDstFactorAlpha = GlStateManager.blendState.dstFactorAlpha; + } + + @Override + public void popState(SavedState pre, SavedState post) { + if (pre.blend) { + GlStateManager.enableBlend(); + } else { + GlStateManager.disableBlend(); + } + if (pre.blendSrcFactorAlpha != post.blendSrcFactorAlpha || pre.blendDstFactorAlpha != post.blendDstFactorAlpha) { + GlStateManager.tryBlendFuncSeparate(pre.blendSrcFactor, pre.blendDstFactor, pre.blendSrcFactorAlpha, pre.blendDstFactorAlpha); + } else { + GlStateManager.blendFunc(pre.blendSrcFactor, post.blendDstFactor); + } + } + + private String parseFactor(int factor) { + switch (factor) { + case 32771: + return "CONSTANT_ALPHA"; + case 32769: + return "CONSTANT_COLOR"; + case 772: + return "DST_ALPHA"; + case 774: + return "DST_COLOR"; + case 1: + return "ONE"; + case 32772: + return "ONE_MINUS_CONSTANT_ALPHA"; + case 32770: + return "ONE_MINUS_CONSTANT_COLOR"; + case 773: + return "ONE_MINUS_DST_ALPHA"; + case 775: + return "ONE_MINUS_DST_COLOR"; + case 771: + return "ONE_MINUS_SRC_ALPHA"; + case 769: + return "ONE_MINUS_SRC_COLOR"; + case 770: + return "SRC_ALPHA"; + case 776: + return "SRC_ALPHA_SATURATE"; + case 768: + return "SRC_COLOR"; + case 0: + return "ZERO"; + default: + return "UNKNOWN:" + factor; + + } + } + + }, + GL_DEPTH_TEST { + @Override + public String getState() { + DepthState depthState = GlStateManager.depthState; + return Objects.toStringHelper(name()).add("Func", parseFunc(depthState.depthFunc)).add("Mask", String.valueOf(depthState.maskEnabled).toUpperCase()).add("Enabled", parseBoolState(depthState.depthTest)).toString(); + } + + @Override + public void pushState(SavedState state) { + state.depthTest = GlStateManager.depthState.depthTest.currentState; + state.depthMaskEnabled = GlStateManager.depthState.maskEnabled; + state.depthFunc = GlStateManager.depthState.depthFunc; + } + + @Override + public void popState(SavedState pre, SavedState post) { + if (pre.depthTest) { + GlStateManager.enableDepth(); + } else { + GlStateManager.disableDepth(); + } + GlStateManager.depthMask(pre.depthMaskEnabled); + GlStateManager.depthFunc(pre.depthFunc); + } + + private String parseFunc(int func) { + switch (func) { + case 0x200: + return "GL_NEVER"; + case 0x201: + return "GL_LESS"; + case 0x202: + return "GL_EQUAL"; + case 0x203: + return "GL_LEQUAL"; + case 0x204: + return "GL_GREATER"; + case 0x205: + return "GL_NOTEQUAL"; + case 0x206: + return "GL_GEQUAL"; + case 0x207: + return "GL_ALWAYS"; + default: + return "UNKNOWN:" + func; + + } + } + }, + GL_CULL_FACE { + @Override + public String getState() { + CullState cullState = GlStateManager.cullState; + return Objects.toStringHelper(name()).add("Mode", parseMode(cullState.mode)).add("Enabled", parseBoolState(cullState.cullFace)).toString(); + } + + @Override + public void pushState(SavedState state) { + state.cull = GlStateManager.cullState.cullFace.currentState; + state.cullMode = GlStateManager.cullState.mode; + } + + @Override + public void popState(SavedState pre, SavedState post) { + + if (pre.cull) { + GlStateManager.enableCull(); + } else { + GlStateManager.disableCull(); + } + GlStateManager.cullFace(pre.cullMode); + } + + private String parseMode(int mode) { + switch (mode) { + case 1028: + return "FRONT"; + case 1029: + return "BACK"; + case 1032: + return "FRONT_AND_BACK"; + default: + return "UNKNOWN:" + mode; + + } + } + + }, + GL_RESCALE_NORMAL { + @Override + public String getState() { + return Objects.toStringHelper(name()).add("Enabled", parseBoolState(GlStateManager.rescaleNormalState)).toString(); + } + + @Override + public void pushState(SavedState state) { + state.rescaleNormal = GlStateManager.rescaleNormalState.currentState; + } + + @Override + public void popState(SavedState pre, SavedState post) { + if (pre.rescaleNormal) { + GlStateManager.enableRescaleNormal(); + } else { + GlStateManager.disableRescaleNormal(); + } + } + + }; + + public abstract String getState(); + + public abstract void pushState(SavedState state); + + public abstract void popState(SavedState pre, SavedState post); + } + + public static class SavedState { + + private ArrayList savedStates = new ArrayList(); + + boolean alphaTest; + int alphaFunc; + float alphaRef; + + boolean lighting; + + boolean blend; + int blendSrcFactor; + int blendDstFactor; + int blendSrcFactorAlpha; + int blendDstFactorAlpha; + + boolean depthTest; + boolean depthMaskEnabled; + int depthFunc; + + boolean cull; + int cullMode; + + boolean rescaleNormal; + + private SavedState() { + } + + private static SavedState createSavedState(SavedState state) { + return createSavedState(state.savedStates.toArray(new State[state.savedStates.size()])); + } + + private static SavedState createSavedState(State... states) { + SavedState saveState = new SavedState(); + for (State state : states) { + state.pushState(saveState); + saveState.savedStates.add(state); + } + return saveState; + } + + private static void applyState(SavedState pre, SavedState post) { + for (State state : pre.savedStates) { + state.popState(pre, post); + } + } + + } + + private static final LinkedList savedStates = new LinkedList(); + + private static String parseBoolState(BooleanState boolState) { + return String.valueOf(boolState.currentState).toUpperCase(); + } + + public static String dumpGLState(State... states) { + StringBuilder builder = new StringBuilder(); + builder.append("GlStateManager { "); + for (int i = 0; i < states.length; i++) { + State state = states[i]; + builder.append(state.getState()); + if (i != states.length - 1) { + builder.append(", "); + } + } + + builder.append(" }"); + return builder.toString(); + } + + public static void pushState() { + SavedState state = SavedState.createSavedState(State.values()); + savedStates.addLast(state); + } + + public static void pushStates(State... states) { + if (states == null || states.length == 0) { + states = State.values(); + } + SavedState state = SavedState.createSavedState(states); + savedStates.addLast(state); + } + + public static void pushState(State[] states) { + if (states == null || states.length == 0) { + states = State.values(); + } + SavedState state = SavedState.createSavedState(states); + savedStates.addLast(state); + } + + public static void popState() { + if (savedStates.isEmpty()) { + throw new IllegalStateException("Unable to pop the GL state as there is no saved state!"); + } + SavedState pre = savedStates.removeLast(); + SavedState post = SavedState.createSavedState(pre); + SavedState.applyState(pre, post); + } + +} diff --git a/dependencies/main/java/codechicken/lib/texture/CustomIResource.java b/dependencies/main/java/codechicken/lib/texture/CustomIResource.java new file mode 100644 index 0000000000..fc715d0f7b --- /dev/null +++ b/dependencies/main/java/codechicken/lib/texture/CustomIResource.java @@ -0,0 +1,69 @@ +package codechicken.lib.texture; + +import net.minecraft.client.resources.IResource; +import net.minecraft.client.resources.data.IMetadataSection; +import net.minecraft.util.ResourceLocation; + +import javax.annotation.Nullable; +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; + +/** + * Created by covers1624 on 2/11/2016. + * TODO Document. + */ +public class CustomIResource implements IResource { + + private ResourceLocation location; + private InputStream stream; + private IResource wrapped; + + public CustomIResource(ResourceLocation location, BufferedImage image, IResource wrapped) { + try { + this.location = location; + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ImageIO.write(image, "png", baos); + stream = new ByteArrayInputStream(baos.toByteArray()); + this.wrapped = wrapped; + + } catch (Exception e) { + throw new RuntimeException("Unable to create CustomIResource", e); + } + } + + @Override + public ResourceLocation getResourceLocation() { + return location; + } + + @Override + public InputStream getInputStream() { + return stream; + } + + @Override + public boolean hasMetadata() { + return wrapped.hasMetadata(); + } + + @Nullable + @Override + public T getMetadata(String sectionName) { + return wrapped.getMetadata(sectionName); + } + + @Override + public String getResourcePackName() { + return wrapped.getResourcePackName(); + } + + @Override + public void close() throws IOException { + wrapped.close(); + stream.close(); + } +} diff --git a/dependencies/main/java/codechicken/lib/texture/IItemBlockTextureProvider.java b/dependencies/main/java/codechicken/lib/texture/IItemBlockTextureProvider.java new file mode 100644 index 0000000000..1cc0f075ab --- /dev/null +++ b/dependencies/main/java/codechicken/lib/texture/IItemBlockTextureProvider.java @@ -0,0 +1,15 @@ +package codechicken.lib.texture; + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; + +/** + * Created by covers1624 on 30/10/2016. + * TODO Document. + */ +public interface IItemBlockTextureProvider { + + TextureAtlasSprite getTexture(EnumFacing side, ItemStack stack); + +} diff --git a/dependencies/main/java/codechicken/lib/texture/IWorldBlockTextureProvider.java b/dependencies/main/java/codechicken/lib/texture/IWorldBlockTextureProvider.java new file mode 100644 index 0000000000..913b12141d --- /dev/null +++ b/dependencies/main/java/codechicken/lib/texture/IWorldBlockTextureProvider.java @@ -0,0 +1,27 @@ +package codechicken.lib.texture; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; + +/** + * Created by covers1624 on 25/11/2016. + */ +public interface IWorldBlockTextureProvider extends IItemBlockTextureProvider { + + /** + * Gets the texture for the given face of an in world block. + * + * @param side The side to get the texture for. + * @param state The state of the block. + * @param layer The layer needed. + * @param world The world the block is in. + * @param pos The position of the block. + * @return The texture, null if there is no texture for the arguments, {@link TextureUtils#getMissingSprite()} if the arguments are invalid. + */ + TextureAtlasSprite getTexture(EnumFacing side, IBlockState state, BlockRenderLayer layer, IBlockAccess world, BlockPos pos); + +} diff --git a/dependencies/main/java/codechicken/lib/render/ManagedTextureFX.java b/dependencies/main/java/codechicken/lib/texture/ManagedTextureFX.java similarity index 93% rename from dependencies/main/java/codechicken/lib/render/ManagedTextureFX.java rename to dependencies/main/java/codechicken/lib/texture/ManagedTextureFX.java index 69dfcb7f25..19ecc73440 100644 --- a/dependencies/main/java/codechicken/lib/render/ManagedTextureFX.java +++ b/dependencies/main/java/codechicken/lib/texture/ManagedTextureFX.java @@ -1,6 +1,7 @@ -package codechicken.lib.render; +package codechicken.lib.texture; public class ManagedTextureFX extends TextureFX { + public boolean changed; public ManagedTextureFX(int size, String name) { diff --git a/dependencies/main/java/codechicken/lib/render/PlaceholderTexture.java b/dependencies/main/java/codechicken/lib/texture/PlaceholderTexture.java similarity index 94% rename from dependencies/main/java/codechicken/lib/render/PlaceholderTexture.java rename to dependencies/main/java/codechicken/lib/texture/PlaceholderTexture.java index 96aef9aaa8..84afd5ab75 100644 --- a/dependencies/main/java/codechicken/lib/render/PlaceholderTexture.java +++ b/dependencies/main/java/codechicken/lib/texture/PlaceholderTexture.java @@ -1,10 +1,11 @@ -package codechicken.lib.render; +package codechicken.lib.texture; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.IResourceManager; import net.minecraft.util.ResourceLocation; public class PlaceholderTexture extends TextureAtlasSprite { + protected PlaceholderTexture(String par1) { super(par1); } diff --git a/dependencies/main/java/codechicken/lib/render/SpriteSheetManager.java b/dependencies/main/java/codechicken/lib/texture/SpriteSheetManager.java similarity index 97% rename from dependencies/main/java/codechicken/lib/render/SpriteSheetManager.java rename to dependencies/main/java/codechicken/lib/texture/SpriteSheetManager.java index a6593694d4..49839fcd95 100644 --- a/dependencies/main/java/codechicken/lib/render/SpriteSheetManager.java +++ b/dependencies/main/java/codechicken/lib/texture/SpriteSheetManager.java @@ -1,6 +1,6 @@ -package codechicken.lib.render; +package codechicken.lib.texture; -import codechicken.lib.render.TextureUtils.IIconRegister; +import codechicken.lib.texture.TextureUtils.IIconRegister; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.ResourceLocation; @@ -11,8 +11,10 @@ import java.util.HashMap; public class SpriteSheetManager { - @SideOnly(Side.CLIENT) + + @SideOnly (Side.CLIENT) public static class SpriteSheet implements IIconRegister { + private int tilesX; private int tilesY; private ArrayList newSprites = new ArrayList(); diff --git a/dependencies/main/java/codechicken/lib/render/TextureDataHolder.java b/dependencies/main/java/codechicken/lib/texture/TextureDataHolder.java similarity index 95% rename from dependencies/main/java/codechicken/lib/render/TextureDataHolder.java rename to dependencies/main/java/codechicken/lib/texture/TextureDataHolder.java index 3632787b72..e411308440 100644 --- a/dependencies/main/java/codechicken/lib/render/TextureDataHolder.java +++ b/dependencies/main/java/codechicken/lib/texture/TextureDataHolder.java @@ -1,8 +1,9 @@ -package codechicken.lib.render; +package codechicken.lib.texture; import java.awt.image.BufferedImage; public class TextureDataHolder { + public int width; public int height; public int[] data; diff --git a/dependencies/main/java/codechicken/lib/render/TextureFX.java b/dependencies/main/java/codechicken/lib/texture/TextureFX.java similarity index 92% rename from dependencies/main/java/codechicken/lib/render/TextureFX.java rename to dependencies/main/java/codechicken/lib/texture/TextureFX.java index b37f93e39e..4ca8147509 100644 --- a/dependencies/main/java/codechicken/lib/render/TextureFX.java +++ b/dependencies/main/java/codechicken/lib/texture/TextureFX.java @@ -1,12 +1,13 @@ -package codechicken.lib.render; +package codechicken.lib.texture; -import codechicken.lib.render.SpriteSheetManager.SpriteSheet; +import codechicken.lib.texture.SpriteSheetManager.SpriteSheet; import net.minecraft.client.Minecraft; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -@SideOnly(Side.CLIENT) +@SideOnly (Side.CLIENT) public class TextureFX { + public int[] imageData; public int tileSizeBase = 16; public int tileSizeSquare = 256; diff --git a/dependencies/main/java/codechicken/lib/render/TextureSpecial.java b/dependencies/main/java/codechicken/lib/texture/TextureSpecial.java similarity index 74% rename from dependencies/main/java/codechicken/lib/render/TextureSpecial.java rename to dependencies/main/java/codechicken/lib/texture/TextureSpecial.java index 707fc6361f..c0b8781209 100644 --- a/dependencies/main/java/codechicken/lib/render/TextureSpecial.java +++ b/dependencies/main/java/codechicken/lib/texture/TextureSpecial.java @@ -1,13 +1,13 @@ -package codechicken.lib.render; +package codechicken.lib.texture; -import codechicken.lib.render.SpriteSheetManager.SpriteSheet; -import codechicken.lib.render.TextureUtils.IIconRegister; +import codechicken.lib.texture.SpriteSheetManager.SpriteSheet; +import codechicken.lib.texture.TextureUtils.IIconRegister; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.PngSizeInfo; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.texture.TextureUtil; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.data.AnimationMetadataSection; import net.minecraft.client.settings.GameSettings; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; @@ -17,8 +17,9 @@ import java.io.IOException; import java.util.ArrayList; -@SideOnly(Side.CLIENT) +@SideOnly (Side.CLIENT) public class TextureSpecial extends TextureAtlasSprite implements IIconRegister { + //sprite sheet fields private int spriteIndex; private SpriteSheet spriteSheet; @@ -62,7 +63,7 @@ public TextureSpecial addTextureFX(TextureFX fx) { public void initSprite(int sheetWidth, int sheetHeight, int originX, int originY, boolean rotated) { super.initSprite(sheetWidth, sheetHeight, originX, originY, rotated); if (textureFX != null) { - textureFX.onTextureDimensionsUpdate(rawWidth, rawHeight); + textureFX.onTextureDimensionsUpdate(width, height); } } @@ -73,46 +74,18 @@ public void updateAnimation() { if (textureFX.changed()) { int[][] mipmaps = new int[mipmapLevels + 1][]; mipmaps[0] = textureFX.imageData; - //TODO mipmaps = prepareAnisotropicFiltering(mipmaps); mipmaps = TextureUtil.generateMipmapData(mipmapLevels, width, mipmaps); TextureUtil.uploadTextureMipmap(mipmaps, width, height, originX, originY, false, false); } } } - /** - * Copy paste mojang code because it's private, and CCL can't have access transformers or reflection - */ - /*public int[][] prepareAnisotropicFiltering(int[][] mipmaps) { - if (Minecraft.getMinecraft().gameSettings.anisotropicFiltering <= 1) - { - return mipmaps; - } - else - { - int[][] aint1 = new int[mipmaps.length][]; - - for (int k = 0; k < mipmaps.length; ++k) - { - int[] aint2 = mipmaps[k]; - - if (aint2 != null) - { - int[] aint3 = new int[(rawWidth + 16 >> k) * (rawHeight + 16 >> k)]; - System.arraycopy(aint2, 0, aint3, 0, aint2.length); - aint1[k] = TextureUtil.prepareAnisotropicData(aint3, rawWidth >> k, rawHeight >> k, 8 >> k); - } - } - - return aint1; - } - }*/ @Override - public void loadSprite(BufferedImage[] images, AnimationMetadataSection animationMeta) { - rawWidth = images[0].getWidth(); - rawHeight = images[0].getHeight(); + public void loadSprite(PngSizeInfo sizeInfo, boolean animationMeta) { + rawWidth = sizeInfo.pngWidth; + rawHeight = sizeInfo.pngHeight; try { - super.loadSprite(images, null); + super.loadSprite(sizeInfo, false); } catch (IOException e) { throw new RuntimeException(e); } @@ -135,7 +108,14 @@ public void addFrame(int[] data, int width, int height) { images[0] = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); images[0].setRGB(0, 0, width, height, data, 0, width); - loadSprite(images, null); + //Workaround for mojang's change to TextureAtlasSprite loading. + resetSprite(); + this.width = images[0].getWidth(); + this.height = images[0].getHeight(); + int[][] aInt = new int[settings.mipmapLevels + 1][]; + aInt[0] = new int[images[0].getWidth() * images[0].getHeight()]; + images[0].getRGB(0, 0, images[0].getWidth(), images[0].getHeight(), aInt[0], 0, images[0].getWidth()); + framesTextureData.add(aInt); } @Override diff --git a/dependencies/main/java/codechicken/lib/texture/TextureUtils.java b/dependencies/main/java/codechicken/lib/texture/TextureUtils.java new file mode 100644 index 0000000000..ac62db079a --- /dev/null +++ b/dependencies/main/java/codechicken/lib/texture/TextureUtils.java @@ -0,0 +1,311 @@ +package codechicken.lib.texture; + +import codechicken.lib.colour.Colour; +import codechicken.lib.colour.ColourARGB; +import com.google.common.base.Function; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.resources.IReloadableResourceManager; +import net.minecraft.client.resources.IResource; +import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.event.TextureStitchEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +public class TextureUtils { + + //TODO, Move this somewhere else. + public interface IIconRegister { + + @SideOnly (Side.CLIENT) + void registerIcons(TextureMap textureMap); + } + + static { + MinecraftForge.EVENT_BUS.register(new TextureUtils()); + } + + private static ArrayList iconRegisters = new ArrayList(); + + public static Function bakedTextureGetter = new Function() { + @Override + public TextureAtlasSprite apply(ResourceLocation input) { + return getTexture(input); + } + }; + + //TODO Rename this. + public static void addIconRegister(IIconRegister registrar) { + iconRegisters.add(registrar); + } + + public static void registerReloadListener(IResourceManagerReloadListener reloadListener) { + //If this crashes people need to stop using reflection.. + getResourceManager().registerReloadListener(reloadListener); + } + + @SubscribeEvent + public void textureLoad(TextureStitchEvent.Pre event) { + for (IIconRegister reg : iconRegisters) { + reg.registerIcons(event.getMap()); + } + } + + /** + * @return an array of ARGB pixel data + */ + public static int[] loadTextureData(ResourceLocation resource) { + return loadTexture(resource).data; + } + + public static Colour[] loadTextureColours(ResourceLocation resource) { + int[] idata = loadTextureData(resource); + Colour[] data = new Colour[idata.length]; + for (int i = 0; i < data.length; i++) { + data[i] = new ColourARGB(idata[i]); + } + return data; + } + + //TODO Move to some sort of IO Utils. + public static InputStream getTextureResource(ResourceLocation textureFile) throws IOException { + return Minecraft.getMinecraft().getResourceManager().getResource(textureFile).getInputStream(); + } + + public static BufferedImage loadBufferedImage(ResourceLocation textureFile) { + try { + return loadBufferedImage(getTextureResource(textureFile)); + } catch (Exception e) { + System.err.println("Failed to load texture file: " + textureFile); + e.printStackTrace(); + } + return null; + } + + public static BufferedImage loadBufferedImage(InputStream in) throws IOException { + BufferedImage img = ImageIO.read(in); + in.close(); + return img; + } + + public static void copySubImg(int[] fromTex, int fromWidth, int fromX, int fromY, int width, int height, int[] toTex, int toWidth, int toX, int toY) { + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + int fp = (y + fromY) * fromWidth + x + fromX; + int tp = (y + toX) * toWidth + x + toX; + + toTex[tp] = fromTex[fp]; + } + } + } + + public static TextureAtlasSprite getBlankIcon(int size, TextureMap textureMap) { + String s = "blank_" + size; + TextureAtlasSprite icon = textureMap.getTextureExtry(s); + if (icon == null) { + textureMap.setTextureEntry(s, icon = new TextureSpecial(s).blank(size)); + } + + return icon; + } + + public static TextureSpecial getTextureSpecial(TextureMap textureMap, String name) { + if (textureMap.getTextureExtry(name) != null) { + throw new IllegalStateException("Texture: " + name + " is already registered"); + } + + TextureSpecial icon = new TextureSpecial(name); + textureMap.setTextureEntry(name, icon); + return icon; + } + + public static void prepareTexture(int target, int texture, int min_mag_filter, int wrap) { + GlStateManager.glTexParameteri(target, GL11.GL_TEXTURE_MIN_FILTER, min_mag_filter); + GlStateManager.glTexParameteri(target, GL11.GL_TEXTURE_MAG_FILTER, min_mag_filter); + if (target == GL11.GL_TEXTURE_2D) { + GlStateManager.bindTexture(target); + } else { + GL11.glBindTexture(target, texture); + } + + switch (target) { + case GL12.GL_TEXTURE_3D: + GlStateManager.glTexParameteri(target, GL12.GL_TEXTURE_WRAP_R, wrap); + case GL11.GL_TEXTURE_2D: + GlStateManager.glTexParameteri(target, GL11.GL_TEXTURE_WRAP_T, wrap); + case GL11.GL_TEXTURE_1D: + GlStateManager.glTexParameteri(target, GL11.GL_TEXTURE_WRAP_S, wrap); + } + } + + public static TextureDataHolder loadTexture(ResourceLocation resource) { + BufferedImage img = loadBufferedImage(resource); + if (img == null) { + throw new RuntimeException("Texture not found: " + resource); + } + return new TextureDataHolder(img); + } + + /** + * Uses an empty placeholder texture to tell if the map has been reloaded since the last call to refresh texture and the texture with name needs to be reacquired to be valid + */ + public static boolean refreshTexture(TextureMap map, String name) { + if (map.getTextureExtry(name) == null) { + map.setTextureEntry(name, new PlaceholderTexture(name)); + return true; + } + return false; + } + + /*public static IIcon safeIcon(IIcon icon) { + if (icon == null) + icon = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno"); + + return icon; + }*/ + + public static TextureManager getTextureManager() { + return Minecraft.getMinecraft().renderEngine; + } + + public static TextureMap getTextureMap() { + return Minecraft.getMinecraft().getTextureMapBlocks(); + } + + public static IReloadableResourceManager getResourceManager() { + return (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager(); + } + + public static TextureAtlasSprite getMissingSprite() { + return getTextureMap().getMissingSprite(); + } + + public static TextureAtlasSprite getTexture(String location) { + return getTextureMap().getAtlasSprite(location); + } + + public static TextureAtlasSprite getTexture(ResourceLocation location) { + return getTexture(location.toString()); + } + + public static TextureAtlasSprite getBlockTexture(String string) { + return getBlockTexture(new ResourceLocation(string)); + } + + public static TextureAtlasSprite getBlockTexture(ResourceLocation location) { + return getTexture(new ResourceLocation(location.getResourceDomain(), "blocks/" + location.getResourcePath())); + } + + public static TextureAtlasSprite getItemTexture(String string) { + return getItemTexture(new ResourceLocation(string)); + } + + public static TextureAtlasSprite getItemTexture(ResourceLocation location) { + return getTexture(new ResourceLocation(location.getResourceDomain(), "items/" + location.getResourcePath())); + } + + public static IResource getResource(String location) throws IOException { + return getResource(new ResourceLocation(location)); + } + + public static IResource getResource(ResourceLocation location) throws IOException { + return getResourceManager().getResource(location); + } + + public static void changeTexture(String texture) { + changeTexture(new ResourceLocation(texture)); + } + + public static void changeTexture(ResourceLocation texture) { + getTextureManager().bindTexture(texture); + } + + public static void disableMipmap(String texture) { + disableMipmap(new ResourceLocation(texture)); + } + + public static void disableMipmap(ResourceLocation texture) { + getTextureManager().getTexture(texture).setBlurMipmap(false, false); + } + + public static void restoreLastMipmap(String texture) { + restoreLastMipmap(new ResourceLocation(texture)); + } + + public static void restoreLastMipmap(ResourceLocation location) { + getTextureManager().getTexture(location).restoreLastBlurMipmap(); + } + + public static void bindBlockTexture() { + changeTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + } + + public static void dissableBlockMipmap() { + disableMipmap(TextureMap.LOCATION_BLOCKS_TEXTURE); + } + + public static void restoreBlockMipmap() { + restoreLastMipmap(TextureMap.LOCATION_BLOCKS_TEXTURE); + } + + public static TextureAtlasSprite[] getSideIconsForBlock(IBlockState state) { + TextureAtlasSprite[] sideSprites = new TextureAtlasSprite[6]; + TextureAtlasSprite missingSprite = getMissingSprite(); + for (int i = 0; i < 6; i++) { + TextureAtlasSprite[] sprites = getIconsForBlock(state, i); + TextureAtlasSprite sideSprite = missingSprite; + if (sprites.length != 0) { + sideSprite = sprites[0]; + } + sideSprites[i] = sideSprite; + } + return sideSprites; + } + + public static TextureAtlasSprite[] getIconsForBlock(IBlockState state, int side) { + return getIconsForBlock(state, EnumFacing.values()[side]); + } + + public static TextureAtlasSprite[] getIconsForBlock(IBlockState state, EnumFacing side) { + IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state); + if (model != null) { + List quads = model.getQuads(state, side, 0); + if (quads != null && quads.size() > 0) { + TextureAtlasSprite[] sprites = new TextureAtlasSprite[quads.size()]; + for (int i = 0; i < quads.size(); i++) { + sprites[i] = quads.get(i).getSprite(); + } + return sprites; + } + } + return new TextureAtlasSprite[0]; + } + + public static TextureAtlasSprite getParticleIconForBlock(IBlockState state) { + IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state); + if (model != null) { + return model.getParticleTexture(); + } + return null; + } + +} diff --git a/dependencies/main/java/codechicken/core/ProfileTimer.java b/dependencies/main/java/codechicken/lib/thread/ProfileTimer.java similarity index 96% rename from dependencies/main/java/codechicken/core/ProfileTimer.java rename to dependencies/main/java/codechicken/lib/thread/ProfileTimer.java index 22312abb8f..50990198df 100644 --- a/dependencies/main/java/codechicken/core/ProfileTimer.java +++ b/dependencies/main/java/codechicken/lib/thread/ProfileTimer.java @@ -1,6 +1,7 @@ -package codechicken.core; +package codechicken.lib.thread; public class ProfileTimer { + public double decay; public long startTime; public long nanoTime; diff --git a/dependencies/main/java/codechicken/core/ReentrantCheck.java b/dependencies/main/java/codechicken/lib/thread/ReentrantCheck.java similarity index 94% rename from dependencies/main/java/codechicken/core/ReentrantCheck.java rename to dependencies/main/java/codechicken/lib/thread/ReentrantCheck.java index 2f8b80862a..d23e4cd0b2 100644 --- a/dependencies/main/java/codechicken/core/ReentrantCheck.java +++ b/dependencies/main/java/codechicken/lib/thread/ReentrantCheck.java @@ -1,6 +1,7 @@ -package codechicken.core; +package codechicken.lib.thread; public class ReentrantCheck { + private boolean entered; public ReentrantCheck() { diff --git a/dependencies/main/java/codechicken/nei/RestartableTask.java b/dependencies/main/java/codechicken/lib/thread/RestartableTask.java similarity index 70% rename from dependencies/main/java/codechicken/nei/RestartableTask.java rename to dependencies/main/java/codechicken/lib/thread/RestartableTask.java index d175a690aa..54562b890a 100644 --- a/dependencies/main/java/codechicken/nei/RestartableTask.java +++ b/dependencies/main/java/codechicken/lib/thread/RestartableTask.java @@ -1,6 +1,11 @@ -package codechicken.nei; +package codechicken.lib.thread; +/** + * Provides an abstract way to have a task run and restart if needed whilst still operating. + * It is recommended to implement + */ public abstract class RestartableTask { + public final String name; private Thread thread; private volatile boolean restart; @@ -42,11 +47,19 @@ private synchronized boolean finish() { } } + /** + * Clears the current task. + * Not recommended to be called directly. + */ public void clearTasks() { thread = null; timer = null; } + /** + * Marks the Task to be restarted. + * You may call this to start the process too. + */ public synchronized void restart() { if (thread != null) { stopped = false; @@ -66,6 +79,11 @@ public synchronized void stop() { } } + /** + * This must be implemented in your execute method, if this returns true it means you need to get your operation in to a restartable state and prepare for a restart. + * + * @return True if the process should end. + */ public boolean interrupted() { return restart; } @@ -77,5 +95,9 @@ public synchronized ThreadOperationTimer getTimer(int timeout) { return timer; } + /** + * Main call point for the RestartableTask, this is where you will put your logic to be called. + * Make sure you implement some sort of bail out system if interrupted() is true. + */ public abstract void execute(); } diff --git a/dependencies/main/java/codechicken/core/TaskProfiler.java b/dependencies/main/java/codechicken/lib/thread/TaskProfiler.java similarity index 80% rename from dependencies/main/java/codechicken/core/TaskProfiler.java rename to dependencies/main/java/codechicken/lib/thread/TaskProfiler.java index c133705b1b..42522e826f 100644 --- a/dependencies/main/java/codechicken/core/TaskProfiler.java +++ b/dependencies/main/java/codechicken/lib/thread/TaskProfiler.java @@ -1,4 +1,4 @@ -package codechicken.core; +package codechicken.lib.thread; import java.util.ArrayList; import java.util.HashMap; @@ -6,7 +6,9 @@ import java.util.Map.Entry; public class TaskProfiler { + public static class ProfilerResult { + public final String name; public final long time; public final double fraction; @@ -24,6 +26,9 @@ public ProfilerResult(String name, long time, long totalTime) { private long startTime; private long totalTime; + private long startTimeOnce; + private String currentOnceSection; + public void start(String section) { if (currentSection != null) { end(); @@ -45,6 +50,16 @@ public void end() { currentSection = null; } + public void startOnce(String name) { + currentOnceSection = name; + startTimeOnce = System.nanoTime(); + } + + public ProfilerResult endOnce() { + long end = System.nanoTime() - startTimeOnce; + return new ProfilerResult(currentOnceSection, end, end); + } + public List getResults() { ArrayList results = new ArrayList(times.size()); for (Entry e : times.entrySet()) { diff --git a/dependencies/main/java/codechicken/nei/ThreadOperationTimer.java b/dependencies/main/java/codechicken/lib/thread/ThreadOperationTimer.java similarity index 86% rename from dependencies/main/java/codechicken/nei/ThreadOperationTimer.java rename to dependencies/main/java/codechicken/lib/thread/ThreadOperationTimer.java index fab818895a..92a710fe7f 100644 --- a/dependencies/main/java/codechicken/nei/ThreadOperationTimer.java +++ b/dependencies/main/java/codechicken/lib/thread/ThreadOperationTimer.java @@ -1,11 +1,16 @@ -package codechicken.nei; +package codechicken.lib.thread; +import codechicken.lib.asm.ObfMapping; import com.google.common.base.Objects; -import net.minecraftforge.fml.common.FMLCommonHandler; +/** + * Used to control how long a thread can run for before a TimeoutException is thrown. + */ public class ThreadOperationTimer extends Thread { - @SuppressWarnings("serial") + + @SuppressWarnings ("serial") public static class TimeoutException extends RuntimeException { + public final Object operation; public TimeoutException(String msg, Object op) { @@ -45,10 +50,10 @@ public synchronized void update(Object op) { } } - @SuppressWarnings("deprecation") + @SuppressWarnings ("deprecation") @Override public void run() { - if (FMLCommonHandler.instance().findContainerFor("NotEnoughItems").getVersion().contains("$")) { + if (ObfMapping.obfuscated) { return;//don't run this thread in a source environment } @@ -70,4 +75,4 @@ public static ThreadOperationTimer start(Thread thread, int limit) { t.start(); return t; } -} \ No newline at end of file +} diff --git a/dependencies/main/java/codechicken/lib/tile/IActiveTile.java b/dependencies/main/java/codechicken/lib/tile/IActiveTile.java new file mode 100644 index 0000000000..1a054c9584 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/tile/IActiveTile.java @@ -0,0 +1,12 @@ +package codechicken.lib.tile; + +/** + * Created by covers1624 on 3/28/2016. + */ +public interface IActiveTile { + + boolean isActive(); + + void setActive(boolean active); + +} diff --git a/dependencies/main/java/codechicken/lib/tile/IDisplayTickTile.java b/dependencies/main/java/codechicken/lib/tile/IDisplayTickTile.java new file mode 100644 index 0000000000..2f2af84b09 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/tile/IDisplayTickTile.java @@ -0,0 +1,19 @@ +package codechicken.lib.tile; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import java.util.Random; + +/** + * Created by covers1624 on 3/28/2016. + */ +public interface IDisplayTickTile { + + @SideOnly (Side.CLIENT) + void randomDisplayTick(World world, BlockPos position, IBlockState state, Random random); + +} diff --git a/dependencies/main/java/codechicken/lib/tile/IGuiTile.java b/dependencies/main/java/codechicken/lib/tile/IGuiTile.java new file mode 100644 index 0000000000..705d92de1b --- /dev/null +++ b/dependencies/main/java/codechicken/lib/tile/IGuiTile.java @@ -0,0 +1,13 @@ +package codechicken.lib.tile; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +/** + * Created by covers1624 on 3/28/2016. + */ +public interface IGuiTile { + + void openGui(World world, BlockPos pos, EntityPlayer player); +} diff --git a/dependencies/main/java/codechicken/lib/tile/IHarvestTile.java b/dependencies/main/java/codechicken/lib/tile/IHarvestTile.java new file mode 100644 index 0000000000..1fe7119f00 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/tile/IHarvestTile.java @@ -0,0 +1,13 @@ +package codechicken.lib.tile; + +import net.minecraft.item.ItemStack; + +import java.util.List; + +/** + * Created by covers1624 on 3/28/2016. + */ +public interface IHarvestTile { + + List getHarvestItems(); +} diff --git a/dependencies/main/java/codechicken/lib/tile/IPlacingTypeTile.java b/dependencies/main/java/codechicken/lib/tile/IPlacingTypeTile.java new file mode 100644 index 0000000000..d14ad15d01 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/tile/IPlacingTypeTile.java @@ -0,0 +1,13 @@ +package codechicken.lib.tile; + +/** + * Created by covers1624 on 3/28/2016. + */ +//TODO Enum. +public interface IPlacingTypeTile { + + boolean getPlacing(); + + void setPlacing(boolean placing); + +} diff --git a/dependencies/main/java/codechicken/lib/tile/IRedstoneActiveTile.java b/dependencies/main/java/codechicken/lib/tile/IRedstoneActiveTile.java new file mode 100644 index 0000000000..cc3fb0865c --- /dev/null +++ b/dependencies/main/java/codechicken/lib/tile/IRedstoneActiveTile.java @@ -0,0 +1,12 @@ +package codechicken.lib.tile; + +/** + * Created by covers1624 on 7/3/2016. + */ +public interface IRedstoneActiveTile { + + void setTileActive(); + + void setTileInactive(); + +} diff --git a/dependencies/main/java/codechicken/lib/tile/IRotatableTile.java b/dependencies/main/java/codechicken/lib/tile/IRotatableTile.java new file mode 100644 index 0000000000..016c0ff4f8 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/tile/IRotatableTile.java @@ -0,0 +1,13 @@ +package codechicken.lib.tile; + +import net.minecraft.util.EnumFacing; + +public interface IRotatableTile extends IPlacingTypeTile { + + void doRotation(boolean shift); + + EnumFacing getRotation(); + + void setRotation(EnumFacing facing); + +} diff --git a/dependencies/main/java/codechicken/lib/tool/LibDownloader.java b/dependencies/main/java/codechicken/lib/tool/LibDownloader.java index b0c2d7f66b..0de10de9d3 100644 --- a/dependencies/main/java/codechicken/lib/tool/LibDownloader.java +++ b/dependencies/main/java/codechicken/lib/tool/LibDownloader.java @@ -12,6 +12,7 @@ import java.util.List; public class LibDownloader { + private static String[] libs = new String[] { "org/ow2/asm/asm-debug-all/5.0.3/asm-debug-all-5.0.3.jar", "com/google/guava/guava/14.0/guava-14.0.jar", "net/sf/jopt-simple/jopt-simple/4.5/jopt-simple-4.5.jar", "org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar", "org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar" }; private static File libDir = new File("lib"); @@ -35,7 +36,7 @@ public static void load() { private static void addPaths(String[] libs) { try { URLClassLoader cl = (URLClassLoader) ClassLoader.getSystemClassLoader(); - Method m_addURL = URLClassLoader.class.getDeclaredMethod("addURL", new Class[] { URL.class }); + Method m_addURL = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); m_addURL.setAccessible(true); for (String lib : libs) { m_addURL.invoke(cl, new File(libDir, fileName(lib)).toURI().toURL()); @@ -76,7 +77,7 @@ private static void download(InputStream is, int sizeGuess, File target) throws while ((bytesRead = is.read(smallBuffer)) >= 0) { downloadBuffer.put(smallBuffer, 0, bytesRead); fullLength += bytesRead; - System.out.format("\rDownloading lib %s %d%%", name, (int) (fullLength * 100 / sizeGuess)); + System.out.format("\rDownloading lib %s %d%%", name, fullLength * 100 / sizeGuess); } System.out.format("\rDownloaded lib %s \n", name); is.close(); diff --git a/dependencies/main/java/codechicken/lib/tool/MCStripTransformer.java b/dependencies/main/java/codechicken/lib/tool/MCStripTransformer.java index 9ad3f79178..d9ad82dfa0 100644 --- a/dependencies/main/java/codechicken/lib/tool/MCStripTransformer.java +++ b/dependencies/main/java/codechicken/lib/tool/MCStripTransformer.java @@ -12,7 +12,9 @@ import java.util.Iterator; public class MCStripTransformer { + public static class ReferenceDetector extends Remapper { + boolean found = false; @Override diff --git a/dependencies/main/java/codechicken/lib/tool/Main.java b/dependencies/main/java/codechicken/lib/tool/Main.java index e5d44ba6dc..039121ca0a 100644 --- a/dependencies/main/java/codechicken/lib/tool/Main.java +++ b/dependencies/main/java/codechicken/lib/tool/Main.java @@ -1,6 +1,7 @@ package codechicken.lib.tool; public class Main { + public static void main(String[] args) { LibDownloader.load(); try { diff --git a/dependencies/main/java/codechicken/lib/tool/StripClassLoader.java b/dependencies/main/java/codechicken/lib/tool/StripClassLoader.java index 631bb9e3ed..1a2f86db3c 100644 --- a/dependencies/main/java/codechicken/lib/tool/StripClassLoader.java +++ b/dependencies/main/java/codechicken/lib/tool/StripClassLoader.java @@ -7,6 +7,7 @@ import java.net.URLClassLoader; public class StripClassLoader extends URLClassLoader { + public StripClassLoader() { super(new URL[0], StripClassLoader.class.getClassLoader()); } diff --git a/dependencies/main/java/codechicken/lib/tool/ToolMain.java b/dependencies/main/java/codechicken/lib/tool/ToolMain.java index 81644989b5..46dd0353f3 100644 --- a/dependencies/main/java/codechicken/lib/tool/ToolMain.java +++ b/dependencies/main/java/codechicken/lib/tool/ToolMain.java @@ -3,12 +3,14 @@ import codechicken.lib.tool.module.ModuleQBConverter; public class ToolMain { - public static interface Module { - public void main(String[] args); - public String name(); + public interface Module { - public void printHelp(); + void main(String[] args); + + String name(); + + void printHelp(); } public static Module[] modules = new Module[] { new ModuleQBConverter() }; diff --git a/dependencies/main/java/codechicken/lib/tool/module/JOptModule.java b/dependencies/main/java/codechicken/lib/tool/module/JOptModule.java index 83e84d7815..5493399578 100644 --- a/dependencies/main/java/codechicken/lib/tool/module/JOptModule.java +++ b/dependencies/main/java/codechicken/lib/tool/module/JOptModule.java @@ -8,6 +8,7 @@ import java.io.IOException; public abstract class JOptModule implements ToolMain.Module { + OptionParser parser = new OptionParser(); @Override diff --git a/dependencies/main/java/codechicken/lib/tool/module/ModuleQBConverter.java b/dependencies/main/java/codechicken/lib/tool/module/ModuleQBConverter.java index 3abfc90f9f..1110edcede 100644 --- a/dependencies/main/java/codechicken/lib/tool/module/ModuleQBConverter.java +++ b/dependencies/main/java/codechicken/lib/tool/module/ModuleQBConverter.java @@ -9,6 +9,7 @@ import static java.util.Arrays.asList; public class ModuleQBConverter extends JOptModule { + public ModuleQBConverter() { parser.acceptsAll(asList("?", "h", "help"), "Show the help"); parser.acceptsAll(asList("i", "input"), "comma separated list of paths to models (.qb or directories)").withRequiredArg().ofType(File.class).withValuesSeparatedBy(',').required(); diff --git a/dependencies/main/java/codechicken/lib/util/ArrayUtils.java b/dependencies/main/java/codechicken/lib/util/ArrayUtils.java new file mode 100644 index 0000000000..30507cce7c --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/ArrayUtils.java @@ -0,0 +1,234 @@ +package codechicken.lib.util; + +import com.google.common.base.Function; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by covers1624 on 3/27/2016. + */ +public class ArrayUtils { + + /** + * Converts an String array to lowercase. + * + * @param array Array to convert. + * @return Converted array. + */ + public static String[] arrayToLowercase(String[] array) { + String[] copy = new String[array.length]; + for (int i = 0; i < array.length; i++) { + copy[i] = array[i].toLowerCase(); + } + return copy; + } + + /** + * Converts and array of "key=value" to a map. + * + * @param array Array to convert. + * @return Map of values. + */ + public static Map convertKeyValueArrayToMap(String[] array) { + HashMap map = new HashMap(); + for (String entry : array) { + String[] split = entry.split("="); + map.put(split[0], split[1]); + } + return map; + } + + /** + * Prefixes a string array with the desired value. + * + * @param prefix The prefix to apply. + * @param list The list to apply the prefix to. + * @return The list with the prefix applied. + */ + public static List prefixStringList(String prefix, List list) { + List finalList = new ArrayList(); + for (String string : list) { + finalList.add(prefix + string); + } + return finalList; + } + + /** + * Checks if a map contains all keys passed in. + * + * @param map Map to check. + * @param keys Keys that must exist. + * @param The type of data in the map key. + * @return False if fail. + */ + public static boolean containsKeys(Map map, T... keys) { + for (T object : keys) { + if (!map.containsKey(object)) { + return false; + } + } + return true; + } + + /** + * Adds the value at the first null index in the array. + * + * @param array Array to add to. + * @param value Value to add. + * @param Type of value. + */ + public static void addToArrayFirstNull(T[] array, T value) { + int nullIndex = -1; + for (int i = 0; i < array.length; i++) { + T v = array[i]; + if (v == null) { + nullIndex = i; + break; + } + } + if (nullIndex == -1) {//We aren't able to expand it as we are using generics. + throw new RuntimeException("Unable to add to array as it is full! Expand it before adding to it!"); + } + array[nullIndex] = value; + } + + /** + * Adds all elements from the array that are not null to the list. + * + * @param array Array to grab from. + * @param list List to add to. + * @param What we are dealing with. + * @return The modified list. + */ + public static List addAllNoNull(T[] array, List list) { + for (T value : array) { + if (value != null) { + list.add(value); + } + } + return list; + } + + /** + * Checks if the array is all null. + * + * @param array The array to check. + * @param What we are dealing with. + * @return True if the array only contains nulls. + */ + public static boolean isEmpty(T[] array) { + for (T value : array) { + if (value != null) { + return false; + } + } + return true; + } + + /** + * Counts the elements in the array that are not null. + * + * @param array The array to check. + * @param What we are dealing with. + * @return The count of non-null objects in the array. + */ + public static int countNoNull(T[] array) { + int counter = 0; + for (T value : array) { + if (value != null) { + counter++; + } + } + return counter; + } + + /** + * Fills the array with the specified value. + * If the value is an instance of Copyable it will call copy. + * + * @param array Array to fill. + * @param value Value to fill with. + * @param What we are dealing with. + */ + @SuppressWarnings ("unchecked") + public static void fillArray(T[] array, T value) { + for (int i = 0; i < array.length; i++) { + T newValue = value; + if (value instanceof Copyable) { + newValue = ((Copyable) value).copy(); + } + array[i] = newValue; + } + } + + /** + * Apples the Specified function to the entire array and returns a new List of the result. + * The input to the function may be null. + * + * @param function The function to apply. + * @param array The array to apply the function to. + * @param The Input generic. + * @param The Output generic. + * @return A list of the output of the specified function. + */ + public static List applyArray(Function function, I... array) { + List finalList = new ArrayList(); + for (I i : array) { + finalList.add(function.apply(i)); + } + + return finalList; + } + + /** + * Basically a wrapper for System.arraycopy with support for CCL Copyable's + * + * @param src The source array. + * @param srcPos Starting position in the source array. + * @param dst The destination array. + * @param destPos Starting position in the destination array. + * @param length The number of elements to copy. + */ + public static void arrayCopy(Object src, int srcPos, Object dst, int destPos, int length) { + System.arraycopy(src, srcPos, dst, destPos, length); + if (dst instanceof Copyable[]) { + Object[] oa = (Object[]) dst; + Copyable[] c = (Copyable[]) dst; + for (int i = destPos; i < destPos + length; i++) { + if (c[i] != null) { + oa[i] = c[i].copy(); + } + } + } + } + + /** + * Returns the index of the first occurrence of the specified element in the array. + * Will return -1 if the element is non existent in the array. + * + * @param array The array to search. + * @param object Element to find. + * @param What we are dealing with. + * @return The index in the array of the object. + */ + public static int indexOf(T[] array, T object) { + if (object == null) { + for (int i = 0; i < array.length; i++) { + if (array[i] == null) { + return i; + } + } + } else { + for (int i = 0; i < array.length; i++) { + if (object.equals(array[i])) { + return i; + } + } + } + return -1; + } + +} diff --git a/dependencies/main/java/codechicken/lib/util/BlockStateUtils.java b/dependencies/main/java/codechicken/lib/util/BlockStateUtils.java new file mode 100644 index 0000000000..e553ea9063 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/BlockStateUtils.java @@ -0,0 +1,41 @@ +package codechicken.lib.util; + +import com.google.common.base.Objects; +import com.google.common.base.Optional; +import net.minecraft.block.state.IBlockState; +import net.minecraftforge.common.property.IExtendedBlockState; +import net.minecraftforge.common.property.IUnlistedProperty; + +import java.util.LinkedList; +import java.util.List; +import java.util.Map.Entry; + +/** + * Created by covers1624 on 13/01/2017. + */ +public class BlockStateUtils { + + public static int hashBlockState(IBlockState state) { + if (state instanceof IExtendedBlockState) { + return hashBlockState((IExtendedBlockState) state); + } + return hashBlockState_(state); + } + + public static int hashBlockState_(IBlockState state) { + return Objects.hashCode(state.toString()); + } + + @SuppressWarnings ("unchecked") + private static int hashBlockState(IExtendedBlockState state) { + List toHash = new LinkedList(); + toHash.add(state.toString()); + toHash.add("meta=" + state.getBlock().getMetaFromState(state)); + for (Entry, Optional> entry : state.getUnlistedProperties().entrySet()) { + IUnlistedProperty property = entry.getKey(); + toHash.add(property.getName() + "=" + property.valueToString(state.getValue(property))); + } + return Objects.hashCode(toHash.toArray()); + } + +} diff --git a/dependencies/main/java/codechicken/lib/util/BlockUtils.java b/dependencies/main/java/codechicken/lib/util/BlockUtils.java new file mode 100644 index 0000000000..3b718b5bd9 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/BlockUtils.java @@ -0,0 +1,81 @@ +package codechicken.lib.util; + +import codechicken.lib.vec.Vector3; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +import java.util.LinkedList; +import java.util.List; + +/** + * Created by covers1624 on 6/30/2016. + * TODO Nuke things in here that aren't needed anymore. + */ +public class BlockUtils { + + /** + * Generates a bounding box. + * + * @param pos Position of block. + * @param dir Direction to create Box. + * @param vector3 Size of the box. + */ + public static AxisAlignedBB getBox(BlockPos pos, EnumFacing dir, Vector3 vector3) { + return new AxisAlignedBB(pos, pos.add(vector3.x, vector3.y, vector3.z)); + } + + /** + * Checks if an entity is in range of the position passed in. + * + * @param pos Position of block. + * @param entity Entity to check. + * @param range Range to check. + * @return True if entity in range. + */ + public static boolean isEntityInRange(BlockPos pos, Entity entity, int range) { + return entity.getDistanceSq(pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D) <= range; + } + + /** + * Simply fires a lighting update for a block. + * + * @param world World for the update. + * @param position Pos to update. + */ + public static void fireLightUpdate(World world, BlockPos position) { + world.notifyLightSet(position); + } + + /** + * Fires a block update. + * Assumes the BlockState has not changed but a update is still needed. + * + * @param world + * @param pos + *///TODO fireBlockUpdate(TileEntity). + public static void fireBlockUpdate(World world, BlockPos pos) { + IBlockState state = world.getBlockState(pos); + world.notifyBlockUpdate(pos, state, state, 3); + } + + /** + * Gets the adjacent blocks for a position. + * + * @param pos Main position. + * @param includeVertical Weather to include vertical facings. + * @return List of adjacent blocks. + */ + public static List getAdjacent(BlockPos pos, boolean includeVertical) { + LinkedList adjacentPositions = new LinkedList(); + for (EnumFacing step : (includeVertical ? EnumFacing.VALUES : EnumFacing.HORIZONTALS)) { + adjacentPositions.add(pos.offset(step)); + } + + return adjacentPositions; + } + +} diff --git a/dependencies/main/java/codechicken/lib/util/CCDirection.java b/dependencies/main/java/codechicken/lib/util/CCDirection.java new file mode 100644 index 0000000000..17b771e007 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/CCDirection.java @@ -0,0 +1,103 @@ +package codechicken.lib.util; + +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; + +/** + * Created by covers1624 on 5/17/2016. + */ +@Deprecated//Brandon this isn't needed anymore, use null and special case it instead of UNKNOWN +public enum CCDirection implements IStringSerializable { + + /** + * -Y + */ + DOWN(0, -1, 0), + + /** + * +Y + */ + UP(0, 1, 0), + + /** + * -Z + */ + NORTH(0, 0, -1), + + /** + * +Z + */ + SOUTH(0, 0, 1), + + /** + * -X + */ + WEST(-1, 0, 0), + + /** + * +X + */ + EAST(1, 0, 0), + + /** + * Used only by getOrientation, for invalid inputs + */ + UNKNOWN(0, 0, 0); + + public final int offsetX; + public final int offsetY; + public final int offsetZ; + public final int flag; + public static final CCDirection[] VALID_DIRECTIONS = { DOWN, UP, NORTH, SOUTH, WEST, EAST }; + public static final int[] OPPOSITES = { 1, 0, 3, 2, 5, 4, 6 }; + // Left hand rule rotation matrix for all possible axes of rotation + public static final int[][] ROTATION_MATRIX = {// + { 0, 1, 4, 5, 3, 2, 6 },// + { 0, 1, 5, 4, 2, 3, 6 },// + { 5, 4, 2, 3, 0, 1, 6 },// + { 4, 5, 2, 3, 1, 0, 6 },// + { 2, 3, 1, 0, 4, 5, 6 },// + { 3, 2, 0, 1, 4, 5, 6 },// + { 0, 1, 2, 3, 4, 5, 6 },// + }; + + CCDirection(int x, int y, int z) { + offsetX = x; + offsetY = y; + offsetZ = z; + flag = 1 << ordinal(); + } + + public static CCDirection getOrientation(int id) { + if (id >= 0 && id < VALID_DIRECTIONS.length) { + return VALID_DIRECTIONS[id]; + } + return UNKNOWN; + } + + public CCDirection getOpposite() { + return getOrientation(OPPOSITES[ordinal()]); + } + + public CCDirection getRotation(CCDirection axis) { + return getOrientation(ROTATION_MATRIX[axis.ordinal()][ordinal()]); + } + + public EnumFacing getFacing(CCDirection direction) { + if (direction != UNKNOWN) { + return EnumFacing.getFront(direction.ordinal()); + } else { + return null; + } + } + + public CCDirection getDirection(EnumFacing facing) { + return facing == null ? UNKNOWN : VALID_DIRECTIONS[facing.getIndex()]; + } + + @Override + public String getName() { + return name().toLowerCase(); + } + +} diff --git a/dependencies/main/java/codechicken/core/ClientUtils.java b/dependencies/main/java/codechicken/lib/util/ClientUtils.java similarity index 59% rename from dependencies/main/java/codechicken/core/ClientUtils.java rename to dependencies/main/java/codechicken/lib/util/ClientUtils.java index 4bc652638a..50e19608b9 100644 --- a/dependencies/main/java/codechicken/core/ClientUtils.java +++ b/dependencies/main/java/codechicken/lib/util/ClientUtils.java @@ -1,17 +1,16 @@ -package codechicken.core; +package codechicken.lib.util; -import codechicken.core.internal.CCCEventHandler; +import codechicken.lib.render.CCRenderEventHandler; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.network.NetworkManager; -import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class ClientUtils extends CommonUtils { + private static Minecraft mc() { return Minecraft.getMinecraft(); } @@ -20,10 +19,9 @@ public static World getWorld() { return mc().theWorld; } -// public static boolean inWorld()//TODO unused -// { -// return mc().getNetHandler() != null; -// } + public static boolean inWorld() { + return mc().getConnection() != null; + } public static void openSMPGui(int windowId, GuiScreen gui) { mc().displayGuiScreen(gui); @@ -33,11 +31,11 @@ public static void openSMPGui(int windowId, GuiScreen gui) { } public static float getRenderFrame() { - return CCCEventHandler.renderFrame; + return CCRenderEventHandler.renderFrame; } public static double getRenderTime() { - return CCCEventHandler.renderTime + getRenderFrame(); + return CCRenderEventHandler.renderTime + getRenderFrame(); } public static String getServerIP() { @@ -53,15 +51,8 @@ public static String getServerIP() { } } - @SideOnly(Side.CLIENT) - public static String getWorldSaveName() - { - return mc().isSingleplayer() ? getWorld().getMinecraftServer().getFolderName() : null; - } - - public static void enhanceSupportersList(Object mod) { - ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod); - mc.getMetadata().description = mc.getMetadata().description.replace("Supporters:", TextFormatting.AQUA + "Supporters:"); - GuiModListScroll.register(mod); + @SideOnly (Side.CLIENT) + public static String getWorldSaveName() { + return mc().isSingleplayer() ? FMLCommonHandler.instance().getMinecraftServerInstance().getFolderName() : null; } } diff --git a/dependencies/main/java/codechicken/core/CommonUtils.java b/dependencies/main/java/codechicken/lib/util/CommonUtils.java similarity index 74% rename from dependencies/main/java/codechicken/core/CommonUtils.java rename to dependencies/main/java/codechicken/lib/util/CommonUtils.java index 08ecd7f050..913e93a207 100644 --- a/dependencies/main/java/codechicken/core/CommonUtils.java +++ b/dependencies/main/java/codechicken/lib/util/CommonUtils.java @@ -1,4 +1,4 @@ -package codechicken.core; +package codechicken.lib.util; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; @@ -10,6 +10,15 @@ import java.io.File; public class CommonUtils { + + public static boolean isClientWorld(World world) { + return world.isRemote; + } + + public static boolean isServerWorld(World world) { + return !world.isRemote; + } + public static boolean isClient() { return FMLCommonHandler.instance().getSide().isClient(); } @@ -23,11 +32,11 @@ public static File getSaveLocation(int dim) { return getSaveLocation(DimensionManager.getWorld(dim)); } - public static String getWorldName(World world){ + public static String getWorldName(World world) { return world.getWorldInfo().getWorldName(); } - public static int getDimension(World world){ + public static int getDimension(World world) { return world.provider.getDimension(); } @@ -39,12 +48,12 @@ public static String getRelativePath(File parent, File child) { if (parent.isFile() || !child.getPath().startsWith(parent.getPath())) { return null; } - return child.getPath().substring(parent.getPath().length() + 1); } + @Deprecated public static void registerHandledEntity(Class entityClass, String identifier) { - EntityList.classToStringMapping.put(entityClass, identifier); - EntityList.stringToClassMapping.put(identifier, entityClass); + EntityList.CLASS_TO_NAME.put(entityClass, identifier); + EntityList.NAME_TO_CLASS.put(identifier, entityClass); } } diff --git a/dependencies/main/java/codechicken/lib/util/ContainerUtils.java b/dependencies/main/java/codechicken/lib/util/ContainerUtils.java new file mode 100644 index 0000000000..3ea10f77d0 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/ContainerUtils.java @@ -0,0 +1,37 @@ +package codechicken.lib.util; + +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; + +/** + * Created by covers1624 on 30/08/2016. + */ +@Deprecated +public class ContainerUtils { + + public static void bindPlayerInventory(Container container, InventoryPlayer inventoryPlayer, int xStart, int yStart) { + // Main inventory + for (int i = 0; i < 3; i++) {// Rows, 3 Rows + for (int j = 0; j < 9; j++) {// Columns, 9 Slots per row + int slot = j + i * 9 + 9; + int x = xStart + j * 18; + int y = yStart + i * 18; + addSlotToContainer(container, new Slot(inventoryPlayer, slot, x, y)); + } + } + + // Hotbar + for (int i = 0; i < 9; i++) { + addSlotToContainer(container, new Slot(inventoryPlayer, i, xStart + i * 18, yStart + 58)); + } + } + + public static Slot addSlotToContainer(Container container, Slot slot) { + slot.slotNumber = container.inventorySlots.size(); + //Covers1624Lib.logger.info(slot.slotNumber); + container.inventorySlots.add(slot); + container.inventoryItemStacks.add(null); + return slot; + } +} diff --git a/dependencies/main/java/codechicken/lib/util/Copyable.java b/dependencies/main/java/codechicken/lib/util/Copyable.java index 2f78c3929a..fff6f32e5e 100644 --- a/dependencies/main/java/codechicken/lib/util/Copyable.java +++ b/dependencies/main/java/codechicken/lib/util/Copyable.java @@ -1,5 +1,6 @@ package codechicken.lib.util; public interface Copyable { - public T copy(); + + T copy(); } diff --git a/dependencies/main/java/codechicken/lib/util/EntityUtils.java b/dependencies/main/java/codechicken/lib/util/EntityUtils.java new file mode 100644 index 0000000000..ec581bc7a4 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/EntityUtils.java @@ -0,0 +1,32 @@ +package codechicken.lib.util; + +import codechicken.lib.vec.Vector3; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.init.SoundEvents; +import net.minecraft.util.SoundCategory; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.living.EnderTeleportEvent; + +/** + * Created by covers1624 on 17/10/2016. + */ +//TODO Nuke. +public class EntityUtils { + + public static int entityId = 0; + + public static int nextEntityId() { + return entityId++; + } + + public static boolean teleportEntityTo(EntityLivingBase entity, Vector3 location) { + EnderTeleportEvent event = new EnderTeleportEvent(entity, location.x, location.y, location.z, 0); + if (MinecraftForge.EVENT_BUS.post(event)) { + return false; + } + entity.setPositionAndUpdate(event.getTargetX(), event.getTargetY(), event.getTargetZ()); + SoundUtils.playSoundAt(entity, SoundCategory.BLOCKS, SoundEvents.ENTITY_ENDERMEN_TELEPORT); + return true; + } + +} diff --git a/dependencies/main/java/codechicken/lib/render/FontUtils.java b/dependencies/main/java/codechicken/lib/util/FontUtils.java similarity index 65% rename from dependencies/main/java/codechicken/lib/render/FontUtils.java rename to dependencies/main/java/codechicken/lib/util/FontUtils.java index ff1ecaf7eb..7e4a18f75a 100644 --- a/dependencies/main/java/codechicken/lib/render/FontUtils.java +++ b/dependencies/main/java/codechicken/lib/util/FontUtils.java @@ -1,4 +1,4 @@ -package codechicken.lib.render; +package codechicken.lib.util; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -6,6 +6,7 @@ import net.minecraft.item.ItemStack; public class FontUtils { + public static FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; public static void drawCenteredString(String s, int xCenter, int y, int colour) { @@ -25,27 +26,27 @@ public static void drawItemQuantity(int x, int y, ItemStack item, String quantit if (quantity == null) { switch (mode) { - case 2: - int q = item.stackSize; - String postfix = ""; - for (int p = 0; p < 3 && q > 1000; p++) { - q /= 1000; - postfix = prefixes[p]; - } - quantity = Integer.toString(q) + postfix; - break; - case 1: - quantity = ""; - if (item.stackSize / 64 > 0) { - quantity += item.stackSize / 64 + "s"; - } - if (item.stackSize % 64 > 0) { - quantity += item.stackSize % 64; - } - break; - default: - quantity = Integer.toString(item.stackSize); - break; + case 2: + int q = item.stackSize; + String postfix = ""; + for (int p = 0; p < 3 && q > 1000; p++) { + q /= 1000; + postfix = prefixes[p]; + } + quantity = Integer.toString(q) + postfix; + break; + case 1: + quantity = ""; + if (item.stackSize / 64 > 0) { + quantity += item.stackSize / 64 + "s"; + } + if (item.stackSize % 64 > 0) { + quantity += item.stackSize % 64; + } + break; + default: + quantity = Integer.toString(item.stackSize); + break; } } diff --git a/dependencies/main/java/codechicken/lib/util/FuelUtils.java b/dependencies/main/java/codechicken/lib/util/FuelUtils.java new file mode 100644 index 0000000000..254715f8f7 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/FuelUtils.java @@ -0,0 +1,37 @@ +package codechicken.lib.util; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.common.IFuelHandler; + +import java.util.HashMap; + +/** + * Created by covers1624 on 17/10/2016. + */ +public class FuelUtils implements IFuelHandler { + + private static HashMap fuelBurnMap = new HashMap(); + + @Override + public int getBurnTime(ItemStack fuel) { + + if (fuelBurnMap.containsKey(fuel)) { + return fuelBurnMap.get(fuel); + } + return -1; + } + + public static void registerFuel(ItemStack stack, int burn) { + fuelBurnMap.put(stack, burn); + } + + public static void registerFuel(Block block, int burn) { + registerFuel(new ItemStack(block), burn); + } + + public static void registerFuel(Item item, int burn) { + registerFuel(new ItemStack(item), burn); + } +} diff --git a/dependencies/main/java/codechicken/lib/util/ItemNBTUtils.java b/dependencies/main/java/codechicken/lib/util/ItemNBTUtils.java new file mode 100644 index 0000000000..4d2d3217f5 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/ItemNBTUtils.java @@ -0,0 +1,389 @@ +package codechicken.lib.util; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +import java.util.UUID; + +/** + * Created by covers1624 on 6/30/2016. + */ +public class ItemNBTUtils { + + /** + * Checks if an ItemStack has an NBTTag. + * + * @param stack Stack to check. + * @return If tag is in existence. + */ + public static boolean hasTag(ItemStack stack) { + return stack.hasTagCompound(); + } + + /** + * Sets the tag on an ItemStack. + * + * @param stack Stack to set tag on. + * @param tagCompound Tag to set on item. + */ + public static void setTag(ItemStack stack, NBTTagCompound tagCompound) { + stack.setTagCompound(tagCompound); + } + + /** + * Gets the NBTTag associated with an ItemStack. + * + * @param stack Stack to get tag from. + * @return Tag from the ItemStack. + */ + public static NBTTagCompound getTag(ItemStack stack) { + return stack.getTagCompound(); + } + + /** + * Checks if an NBTTag exists on an item and if not it will create a new one. + * + * @param stack Stack to check. + * @return The Tag on the item. + */ + public static NBTTagCompound validateTagExists(ItemStack stack) { + if (!hasTag(stack)) { + setTag(stack, new NBTTagCompound()); + } + return getTag(stack); + } + + /** + * Checks if an ItemStack has an NBTTag on an ItemStack with the specified Key and Value. + * + * @param stack Stack to check. + * @param key Key to check for. + * @return False if key does not exist or if the tag does not exist. + */ + public static boolean hasKey(ItemStack stack, String key) { + return hasTag(stack) && getTag(stack).hasKey(key); + } + + /** + * Checks if an ItemStack has an NBTTag of a specific type and name. + * + * @param stack Stack to check. + * @param key Key to check for. + * @param nbtType Primitive NBT Type. + * @return False if key does not exist or if the tag does not exist. + */ + public static boolean hasKey(ItemStack stack, String key, int nbtType) { + return hasTag(stack) && getTag(stack).hasKey(key, nbtType); + } + + /** + * Removes a key from the ItemStacks NBTTag. + * + * @param stack Stack to edit. + * @param key Key to remove. + */ + public static void removeTag(ItemStack stack, String key) { + if (hasTag(stack)) { + getTag(stack).removeTag(key); + } + } + + //region Setters + + /** + * Sets a byte on an ItemStack with the specified Key and Value. + * + * @param stack Stack to set. + * @param key Key. + * @param b Value. + */ + public static void setByte(ItemStack stack, String key, byte b) { + validateTagExists(stack); + getTag(stack).setByte(key, b); + } + + /** + * Sets a short on an ItemStack with the specified Key and Value. + * + * @param stack Stack to set. + * @param key Key. + * @param s Value. + */ + public static void setShort(ItemStack stack, String key, short s) { + validateTagExists(stack); + getTag(stack).setShort(key, s); + } + + /** + * Sets a int on an ItemStack with the specified Key and Value. + * + * @param stack Stack to set. + * @param key Key. + * @param i Value. + */ + public static void setInteger(ItemStack stack, String key, int i) { + validateTagExists(stack); + getTag(stack).setInteger(key, i); + } + + /** + * Sets a long on an ItemStack with the specified Key and Value. + * + * @param stack Stack to set. + * @param key Key. + * @param l Value. + */ + public static void setLong(ItemStack stack, String key, long l) { + validateTagExists(stack); + getTag(stack).setLong(key, l); + } + + /** + * Sets a UUID on an ItemStack with the specified Key and Value. + * + * @param stack Stack to set. + * @param key Key. + * @param uuid Value. + */ + public static void setUUID(ItemStack stack, String key, UUID uuid) { + validateTagExists(stack); + getTag(stack).setUniqueId(key, uuid); + } + + /** + * Sets a float on an ItemStack with the specified Key and Value. + * + * @param stack Stack to set. + * @param key Key. + * @param f Value. + */ + public static void setFloat(ItemStack stack, String key, float f) { + validateTagExists(stack); + getTag(stack).setFloat(key, f); + } + + /** + * Sets a double on an ItemStack with the specified Key and Value. + * + * @param stack Stack to set. + * @param key Key. + * @param d Value. + */ + public static void setDouble(ItemStack stack, String key, double d) { + validateTagExists(stack); + getTag(stack).setDouble(key, d); + } + + /** + * Sets a String on an ItemStack with the specified Key and Value. + * + * @param stack Stack to set. + * @param key Key. + * @param s Value. + */ + public static void setString(ItemStack stack, String key, String s) { + validateTagExists(stack); + getTag(stack).setString(key, s); + } + + /** + * Sets a byte array on an ItemStack with the specified Key and Value. + * + * @param stack Stack to set. + * @param key Key. + * @param b Value. + */ + public static void setByteArray(ItemStack stack, String key, byte[] b) { + validateTagExists(stack); + getTag(stack).setByteArray(key, b); + } + + /** + * Sets a int array on an ItemStack with the specified Key and Value. + * + * @param stack Stack to set. + * @param key Key. + * @param i Value. + */ + public static void setIntArray(ItemStack stack, String key, int[] i) { + validateTagExists(stack); + getTag(stack).setIntArray(key, i); + } + + /** + * Sets a boolean on an ItemStack with the specified Key and Value. + * + * @param stack Stack to set. + * @param key Key. + * @param b Value. + */ + public static void setBoolean(ItemStack stack, String key, boolean b) { + validateTagExists(stack); + getTag(stack).setBoolean(key, b); + } + + //endregion + + //region Getters + + /** + * Gets a byte from an ItemStacks NBTTag. + * + * @param stack Stack key exists on. + * @param key Key for the value. + * @return Value. + */ + public static byte getByte(ItemStack stack, String key) { + validateTagExists(stack); + return getTag(stack).getByte(key); + } + + /** + * Gets a short from an ItemStacks NBTTag. + * + * @param stack Stack key exists on. + * @param key Key for the value. + * @return Value. + */ + public static short getShort(ItemStack stack, String key) { + validateTagExists(stack); + return getTag(stack).getShort(key); + } + + /** + * Gets a int from an ItemStacks NBTTag. + * + * @param stack Stack key exists on. + * @param key Key for the value. + * @return Value. + */ + public static int getInteger(ItemStack stack, String key) { + validateTagExists(stack); + return getTag(stack).getInteger(key); + } + + /** + * Gets a long from an ItemStacks NBTTag. + * + * @param stack Stack key exists on. + * @param key Key for the value. + * @return Value. + */ + public static long getLong(ItemStack stack, String key) { + validateTagExists(stack); + return getTag(stack).getLong(key); + } + + /** + * Gets a UUID from an ItemStacks NBTTag. + * + * @param stack Stack key exists on. + * @param key Key for the value. + * @return Value. + */ + public static UUID getUUID(ItemStack stack, String key) { + validateTagExists(stack); + return getTag(stack).getUniqueId(key); + } + + /** + * Gets a float from an ItemStacks NBTTag. + * + * @param stack Stack key exists on. + * @param key Key for the value. + * @return Value. + */ + public static float getFloat(ItemStack stack, String key) { + validateTagExists(stack); + return getTag(stack).getFloat(key); + } + + /** + * Gets a double from an ItemStacks NBTTag. + * + * @param stack Stack key exists on. + * @param key Key for the value. + * @return Value. + */ + public static double getDouble(ItemStack stack, String key) { + validateTagExists(stack); + return getTag(stack).getDouble(key); + } + + /** + * Gets a String from an ItemStacks NBTTag. + * + * @param stack Stack key exists on. + * @param key Key for the value. + * @return Value. + */ + public static String getString(ItemStack stack, String key) { + validateTagExists(stack); + return getTag(stack).getString(key); + } + + /** + * Gets a byte array from an ItemStacks NBTTag. + * + * @param stack Stack key exists on. + * @param key Key for the value. + * @return Value. + */ + public static byte[] getByteArray(ItemStack stack, String key) { + validateTagExists(stack); + return getTag(stack).getByteArray(key); + } + + /** + * Gets a int array from an ItemStacks NBTTag. + * + * @param stack Stack key exists on. + * @param key Key for the value. + * @return Value. + */ + public static int[] getIntArray(ItemStack stack, String key) { + validateTagExists(stack); + return getTag(stack).getIntArray(key); + } + + /** + * Gets a boolean from an ItemStacks NBTTag. + * + * @param stack Stack key exists on. + * @param key Key for the value. + * @return Value. + */ + public static boolean getBoolean(ItemStack stack, String key) { + validateTagExists(stack); + return getTag(stack).getBoolean(key); + } + + /** + * Gets a NBTTagCompound from an ItemStacks NBTTag. + * + * @param stack Stack key exists on. + * @param key Key for the value. + * @return Value. + */ + public static NBTTagCompound getCompoundTag(ItemStack stack, String key) { + validateTagExists(stack); + return getTag(stack).getCompoundTag(key); + } + + /** + * Gets a NBTTagList from an ItemStacks NBTTag. + * + * @param stack Stack key exists on. + * @param key Key for the value. + * @param type Primitive NBT Type the List should be made up of. + * @return Value. + */ + public static NBTTagList getTagList(ItemStack stack, String key, int type) { + validateTagExists(stack); + return getTag(stack).getTagList(key, type); + } + + //endregion + +} diff --git a/dependencies/main/java/codechicken/lib/util/ItemUtils.java b/dependencies/main/java/codechicken/lib/util/ItemUtils.java new file mode 100644 index 0000000000..05e91342e2 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/ItemUtils.java @@ -0,0 +1,188 @@ +package codechicken.lib.util; + +import codechicken.lib.inventory.InventoryUtils; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntityFurnace; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; + +import java.util.List; + +/** + * Created by covers1624 on 6/30/2016. + * TODO, InventoryUtils needs to have things merged to here and such. + */ +public class ItemUtils { + + public static boolean isPlayerHoldingSomething(EntityPlayer player) { + return player.getHeldItemMainhand() != null || player.getHeldItemOffhand() != null; + } + + public static ItemStack getHeldStack(EntityPlayer player) { + ItemStack stack = player.getHeldItemMainhand(); + if (stack == null) { + stack = player.getHeldItemOffhand(); + } + return stack; + } + + /** + * Drops an item in the world at the given BlockPos + * + * @param world World to drop the item. + * @param pos Location to drop item. + * @param stack ItemStack to drop. + * @param velocity The velocity to add. + */ + public static void dropItem(World world, BlockPos pos, ItemStack stack, double velocity) { + double xVelocity = world.rand.nextFloat() * velocity + (1.0D - velocity) * 0.5D; + double yVelocity = world.rand.nextFloat() * velocity + (1.0D - velocity) * 0.5D; + double zVelocity = world.rand.nextFloat() * velocity + (1.0D - velocity) * 0.5D; + EntityItem entityItem = new EntityItem(world, pos.getX() + xVelocity, pos.getY() + yVelocity, pos.getZ() + zVelocity, stack); + entityItem.setPickupDelay(10); + world.spawnEntityInWorld(entityItem); + } + + /** + * Drops an item in the world at the given BlockPos + * + * @param world World to drop the item. + * @param pos Location to drop item. + * @param stack ItemStack to drop. + */ + public static void dropItem(World world, BlockPos pos, ItemStack stack) { + dropItem(world, pos, stack, 0.7D); + } + + /** + * Drops all the items in an IInventory on the ground. + * + * @param world World to drop the item. + * @param pos Position to drop item. + * @param inventory IInventory to drop. + */ + public static void dropInventory(World world, BlockPos pos, IInventory inventory) { + for (int i = 0; i < inventory.getSizeInventory(); i++) { + ItemStack stack = inventory.getStackInSlot(i); + if (stack != null && stack.stackSize > 0) { + dropItem(world, pos, stack); + } + } + } + + /** + * Copy's an ItemStack. + * + * @param stack Stack to copy. + * @param stackSize Size of the new stack. + * @return The new stack. + */ + public static ItemStack copyStack(ItemStack stack, int stackSize) { + return InventoryUtils.copyStack(stack, stackSize); + } + + /** + * Ejects an item with .3 velocity in the given direction. + * + * @param world World to spawn the item. + * @param pos Location for item to spawn. + * @param stack Stack to spawn. + * @param dir Direction to shoot. + */ + public static void ejectItem(World world, BlockPos pos, ItemStack stack, EnumFacing dir) { + pos.offset(dir); + EntityItem entity = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack); + entity.motionX = 0.0; + entity.motionY = 0.0; + entity.motionZ = 0.0; + + switch (dir) { + case DOWN: + entity.motionY = -0.3; + break; + case UP: + entity.motionY = 0.3; + break; + case NORTH: + entity.motionZ = -0.3; + break; + case SOUTH: + entity.motionZ = 0.3; + break; + case WEST: + entity.motionX = -0.3; + break; + case EAST: + entity.motionX = 0.3; + break; + default: + } + + entity.setPickupDelay(10); + world.spawnEntityInWorld(entity); + } + + /** + * Ejects an list of items with .3 velocity in the given direction. + * + * @param world World to spawn the item. + * @param pos Location for item to spawn. + * @param stacks Stack to spawn. + * @param dir Direction to shoot. + */ + public static void ejectItems(World world, BlockPos pos, List stacks, EnumFacing dir) { + for (ItemStack stack : stacks) { + ejectItem(world, pos, stack, dir); + } + } + + /** + * Gets the burn time for a given ItemStack. + * Will return 0 if there is no burn time on the item. + * + * @param itemStack Stack to get Burn time on. + * @return Burn time for the Stack. + */ + public static int getBurnTime(ItemStack itemStack) { + return TileEntityFurnace.getItemBurnTime(itemStack); + } + + /** + * Compares an ItemStack, Useful for comparators. + * + * @param stack1 First Stack. + * @param stack2 Second Stack. + * @return Returns the difference. + */ + public static int compareItemStack(ItemStack stack1, ItemStack stack2) { + int itemStack1ID = Item.getIdFromItem(stack1.getItem()); + int itemStack2ID = Item.getIdFromItem(stack1.getItem()); + return itemStack1ID != itemStack2ID ? itemStack1ID - itemStack2ID : (stack1.getItemDamage() == stack2.getItemDamage() ? 0 : (stack1.getItem().getHasSubtypes() ? stack1.getItemDamage() - stack2.getItemDamage() : 0)); + } + + /** + * @param stack1 The {@link ItemStack} being compared. + * @param stack2 The {@link ItemStack} to compare to. + * @return whether the two items are the same in terms of damage and itemID. + */ + public static boolean areStacksSameType(ItemStack stack1, ItemStack stack2) { + return stack1 != null && stack2 != null && (stack1.getItem() == stack2.getItem() && (!stack2.getHasSubtypes() || stack2.getItemDamage() == stack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(stack2, stack1)); + } + + /** + * {@link ItemStack}s with damage 32767 are wildcards allowing all damages. Eg all colours of wool are allowed to create Beds. + * + * @param stack1 The {@link ItemStack} being compared. + * @param stack2 The {@link ItemStack} to compare to. + * @return whether the two items are the same from the perspective of a crafting inventory. + */ + public static boolean areStacksSameTypeCrafting(ItemStack stack1, ItemStack stack2) { + return stack1 != null && stack2 != null && stack1.getItem() == stack2.getItem() && (stack1.getItemDamage() == stack2.getItemDamage() || stack1.getItemDamage() == OreDictionary.WILDCARD_VALUE || stack2.getItemDamage() == OreDictionary.WILDCARD_VALUE || stack1.getItem().isDamageable()); + } +} diff --git a/dependencies/main/java/codechicken/lib/util/LangProxy.java b/dependencies/main/java/codechicken/lib/util/LangProxy.java index a29cf8cf53..d930e05fde 100644 --- a/dependencies/main/java/codechicken/lib/util/LangProxy.java +++ b/dependencies/main/java/codechicken/lib/util/LangProxy.java @@ -1,8 +1,9 @@ package codechicken.lib.util; -import net.minecraft.util.StatCollector; +import net.minecraft.util.text.translation.I18n; public class LangProxy { + public final String namespace; public LangProxy(String namespace) { @@ -10,10 +11,10 @@ public LangProxy(String namespace) { } public String translate(String key) { - return StatCollector.translateToLocal(namespace + key); + return I18n.translateToLocal(namespace + key); } public String format(String key, Object... params) { - return StatCollector.translateToLocalFormatted(namespace + key, params); + return I18n.translateToLocalFormatted(namespace + key, params); } } diff --git a/dependencies/main/java/codechicken/core/ReflectionManager.java b/dependencies/main/java/codechicken/lib/util/ReflectionManager.java similarity index 81% rename from dependencies/main/java/codechicken/core/ReflectionManager.java rename to dependencies/main/java/codechicken/lib/util/ReflectionManager.java index 0c5b9d3a09..66a3725954 100644 --- a/dependencies/main/java/codechicken/core/ReflectionManager.java +++ b/dependencies/main/java/codechicken/lib/util/ReflectionManager.java @@ -1,6 +1,7 @@ -package codechicken.core; +package codechicken.lib.util; import codechicken.lib.asm.ObfMapping; +import org.objectweb.asm.Type; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -8,7 +9,9 @@ import java.lang.reflect.Method; import java.util.HashMap; +//TODO Clean cruft and move basically everything to OBFMapping. public class ReflectionManager { + public static HashMap, Class> primitiveWrappers = new HashMap, Class>(); static { @@ -58,6 +61,18 @@ public static boolean classExists(String name) { return findClass(name, false) != null; } + public static Class findClass(ObfMapping mapping) { + return findClass(mapping, true); + } + + public static Class findClass(ObfMapping mapping, boolean init) { + try { + return Class.forName(mapping.javaClass(), init, ReflectionManager.class.getClassLoader()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + public static Class findClass(String name, boolean init) { try { return Class.forName(name, init, ReflectionManager.class.getClassLoader()); @@ -70,6 +85,16 @@ public static Class findClass(String name, boolean init) { } } + public static void setField(ObfMapping mapping, Object instance, Object value) { + try { + Field field = getField(mapping); + field.setAccessible(true); + field.set(instance, value); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + public static void setField(Class class1, Object instance, String name, Object value) throws IllegalArgumentException, IllegalAccessException { setField(class1, instance, new String[] { name }, value); } @@ -104,6 +129,7 @@ public static void setField(Class class1, Object instance, int fieldindex, Ob * void return type * single name */ + @Deprecated public static void callMethod(Class class1, String name, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { callMethod(class1, null, new String[] { name }, params); } @@ -113,6 +139,7 @@ public static void callMethod(Class class1, String name, Object... params) th * void return type * single name */ + @Deprecated public static void callMethod(Class class1, String[] names, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { callMethod(class1, null, names, params); } @@ -121,6 +148,7 @@ public static void callMethod(Class class1, String[] names, Object... params) * void return type * single name */ + @Deprecated public static void callMethod(Class class1, Object instance, String name, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { callMethod(class1, null, instance, new String[] { name }, params); } @@ -128,6 +156,7 @@ public static void callMethod(Class class1, Object instance, String name, Obj /** * void return type */ + @Deprecated public static void callMethod(Class class1, Object instance, String[] names, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { callMethod(class1, null, instance, names, params); } @@ -136,6 +165,7 @@ public static void callMethod(Class class1, Object instance, String[] names, * Static method * single name */ + @Deprecated public static R callMethod(Class class1, Class returntype, String name, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { return callMethod(class1, returntype, null, new String[] { name }, params); } @@ -143,6 +173,7 @@ public static R callMethod(Class class1, Class returntype, String name /** * Static method */ + @Deprecated public static R callMethod(Class class1, Class returntype, String[] names, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { return callMethod(class1, returntype, null, names, params); } @@ -150,10 +181,12 @@ public static R callMethod(Class class1, Class returntype, String[] na /** * sinlge name */ + @Deprecated public static R callMethod(Class class1, Class returntype, Object instance, String name, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { return callMethod(class1, returntype, instance, new String[] { name }, params); } + @Deprecated public static R callMethod(Class class1, Class returntype, Object instance, String[] names, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { nextMethod: for (Method method : class1.getDeclaredMethods()) { @@ -185,6 +218,31 @@ public static R callMethod(Class class1, Class returntype, Object inst return null; } + public static R callMethod(ObfMapping mapping, Class returnType, Object instance, Object... params) { + try { + return callMethod_Unsafe(mapping, returnType, instance, params); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public static R callMethod_Unsafe(ObfMapping mapping, Class returnType, Object instance, Object... params) throws InvocationTargetException, IllegalAccessException { + mapping.toRuntime(); + Class clazz = findClass(mapping); + Method method = null; + for (Method m : clazz.getDeclaredMethods()) { + if (m.getName().equals(mapping.s_name) && Type.getMethodDescriptor(m).equals(mapping.s_desc)) { + method = m; + break; + } + } + if (method != null) { + method.setAccessible(true); + return (R) method.invoke(instance, params); + } + return null; + } + public static T getField(Class class1, Class fieldType, Object instance, int fieldIndex) throws IllegalArgumentException, IllegalAccessException { Field field = class1.getDeclaredFields()[fieldIndex]; field.setAccessible(true); @@ -254,6 +312,15 @@ public static void set(Field field, Object instance, Object value) { } } + public static V getField(ObfMapping mapping, Object instance, Class clazz) { + try { + Field field = getField(mapping); + return (V) field.get(instance); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + public static Field getField(ObfMapping mapping) { mapping.toRuntime(); diff --git a/dependencies/main/java/codechicken/lib/util/RotationUtils.java b/dependencies/main/java/codechicken/lib/util/RotationUtils.java new file mode 100644 index 0000000000..e9836c240f --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/RotationUtils.java @@ -0,0 +1,177 @@ +package codechicken.lib.util; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; + +/** + * Contains a bunch of stuff to do with rotation. + * Created by covers1624 on 6/30/2016. + */ +public class RotationUtils { + + /** + * Gets the rotation for placing a block only on the horizon. + * + * @param entity Entity placing block. + * @return Direction placed. + */ + public static EnumFacing getPlacedRotationHorizontal(EntityLivingBase entity) { + int facing = MathHelper.floor_double((entity.rotationYaw * 4F) / 360F + 0.5D) & 3; + return entityRotationToSide(facing).getOpposite(); + } + + /** + * Gets rotation for placing a block, Will use Up and Down. + * + * @param pos Pos placement is happening. + * @param entity Entity placing block. + * @return Direction placed. + */ + public static EnumFacing getPlacedRotation(BlockPos pos, EntityLivingBase entity) { + int entityRotation = (int) Math.floor(entity.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + if (Math.abs(entity.posX - pos.getX()) < 2.0D && Math.abs(entity.posZ - pos.getZ()) < 2.0D) { + + double eyeDistance = entity.posY + 1.82D - pos.getY(); + + if (eyeDistance > 2.0D) { + return EnumFacing.DOWN; + } + + if (eyeDistance < 0.0D) { + return EnumFacing.UP; + } + } + + return entityRotationToSide(entityRotation); + } + + /** + * Short hand for getPlacedRotationHorizontal and getPlacedRotation. + * + * @param pos Pos placement is happening. + * @param entity Entity placing block. + * @param onlyHorizon True if should only obey the horizon. + * @return Direction placed. + */ + public static EnumFacing getPlacedRotation(BlockPos pos, EntityLivingBase entity, boolean onlyHorizon) { + if (onlyHorizon) { + return getPlacedRotationHorizontal(entity); + } + return getPlacedRotation(pos, entity); + } + + /** + * Rotate this Facing around the Y axis counter-clockwise (NORTH => WEST => SOUTH => EAST => NORTH) + * + * @param facing Current facing. + * @return Next facing. + */ + public static EnumFacing rotateCounterClockwise(EnumFacing facing) { + switch (facing) { + case NORTH: + return EnumFacing.WEST; + case EAST: + return EnumFacing.NORTH; + case SOUTH: + return EnumFacing.EAST; + case WEST: + return EnumFacing.SOUTH; + default: + throw new IllegalStateException("Unable to get CCW facing of " + facing); + } + } + + /** + * Rotate this Facing around the Y axis counter-clockwise (NORTH => EAST => SOUTH => WEST => NORTH) + * + * @param facing Current facing. + * @return Next facing. + */ + public static EnumFacing rotateClockwise(EnumFacing facing) { + switch (facing) { + case NORTH: + return EnumFacing.EAST; + case EAST: + return EnumFacing.SOUTH; + case SOUTH: + return EnumFacing.WEST; + case WEST: + return EnumFacing.NORTH; + default: + throw new IllegalStateException("Unable to get CW facing of " + facing); + } + } + + /** + * Rotate this Facing around all axises counter-clockwise (NORTH => SOUTH => EAST => WEST => UP => DOWN => NORTH) + * + * @param facing Current facing. + * @return Next facing. + */ + public static EnumFacing rotateForward(EnumFacing facing) { + switch (facing) { + case NORTH: + return EnumFacing.DOWN; + case DOWN: + return EnumFacing.UP; + case UP: + return EnumFacing.WEST; + case WEST: + return EnumFacing.EAST; + case EAST: + return EnumFacing.SOUTH; + case SOUTH: + return EnumFacing.NORTH; + } + return EnumFacing.NORTH; + } + + /** + * Rotate this Facing around all axises counter-clockwise (NORTH => DOWN => UP => WEST => EAST => SOUTH => NORTH) + * + * @param facing Current facing. + * @return Next facing. + */ + public static EnumFacing rotateBackwards(EnumFacing facing) { + switch (facing) { + case NORTH: + return EnumFacing.SOUTH; + case SOUTH: + return EnumFacing.EAST; + case EAST: + return EnumFacing.WEST; + case WEST: + return EnumFacing.UP; + case UP: + return EnumFacing.DOWN; + case DOWN: + return EnumFacing.NORTH; + } + return EnumFacing.NORTH; + } + + /** + * Turns Entity rotation in to EnumFacing. + * + * @param rotation The entity rotation, Generally MathHelper.floor_double((entity.rotationYaw * 4F) / 360F + 0.5D) & 3; + * @return The rotation in EnumFacing. + */ + public static EnumFacing entityRotationToSide(int rotation) { + switch (rotation) { + case 0: + return EnumFacing.SOUTH; + + case 1: + return EnumFacing.WEST; + + case 2: + return EnumFacing.NORTH; + + default: + return EnumFacing.EAST; + } + } + +} diff --git a/dependencies/main/java/codechicken/core/ServerUtils.java b/dependencies/main/java/codechicken/lib/util/ServerUtils.java similarity index 68% rename from dependencies/main/java/codechicken/core/ServerUtils.java rename to dependencies/main/java/codechicken/lib/util/ServerUtils.java index 44399253cb..4b5a2fcf97 100644 --- a/dependencies/main/java/codechicken/core/ServerUtils.java +++ b/dependencies/main/java/codechicken/lib/util/ServerUtils.java @@ -1,26 +1,35 @@ -package codechicken.core; +package codechicken.lib.util; +import codechicken.lib.gui.IGuiPacketSender; import com.mojang.authlib.GameProfile; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.Container; import net.minecraft.server.MinecraftServer; +import net.minecraft.server.management.PlayerProfileCache.ProfileEntry; +import net.minecraft.util.math.ChunkPos; +import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.common.FMLCommonHandler; import java.util.ArrayList; import java.util.List; import java.util.Locale; -public class ServerUtils extends CommonUtils { +/** + * Created by covers1624 on 22/10/2016. + */ +public class ServerUtils { + public static MinecraftServer mc() { - return MinecraftServer.getServer(); + return FMLCommonHandler.instance().getMinecraftServerInstance(); } public static EntityPlayerMP getPlayer(String playername) { - return mc().getConfigurationManager().getPlayerByUsername(playername); + return mc().getPlayerList().getPlayerByUsername(playername); } public static List getPlayers() { - return mc().getConfigurationManager().playerEntityList; + return mc().getPlayerList().getPlayerList(); } public static ArrayList getPlayersInDimension(int dimension) { @@ -34,13 +43,8 @@ public static ArrayList getPlayersInDimension(int dimension) { return players; } - public static void openSMPContainer(EntityPlayerMP player, Container container, IGuiPacketSender packetSender) { - player.getNextWindowId(); - player.closeContainer(); - packetSender.sendPacket(player, player.currentWindowId); - player.openContainer = container; - player.openContainer.windowId = player.currentWindowId; - player.openContainer.onCraftGuiOpened(player); + public static boolean isPlayerLoadingChunk(EntityPlayerMP player, ChunkPos chunk) { + return player.getServerWorld().getPlayerChunkMap().contains(chunk.chunkXPos, chunk.chunkZPos); } public static GameProfile getGameProfile(String username) { @@ -51,7 +55,7 @@ public static GameProfile getGameProfile(String username) { //try and access it in the cache without forcing a save username = username.toLowerCase(Locale.ROOT); - ProfileEntry cachedEntry = (ProfileEntry) mc().getPlayerProfileCache().usernameToProfileEntryMap.get(username); + ProfileEntry cachedEntry = mc().getPlayerProfileCache().usernameToProfileEntryMap.get(username); if (cachedEntry != null) { return cachedEntry.getGameProfile(); } @@ -62,7 +66,7 @@ public static GameProfile getGameProfile(String username) { public static boolean isPlayerOP(String username) { GameProfile prof = getGameProfile(username); - return prof != null && mc().getConfigurationManager().canSendCommands(prof); + return prof != null && mc().getPlayerList().canSendCommands(prof); } public static boolean isPlayerOwner(String username) { @@ -74,4 +78,13 @@ public static void sendChatToAll(ITextComponent msg) { p.addChatComponentMessage(msg); } } + + public static void openSMPContainer(EntityPlayerMP player, Container container, IGuiPacketSender packetSender) { + player.getNextWindowId(); + player.closeContainer(); + packetSender.sendPacket(player, player.currentWindowId); + player.openContainer = container; + player.openContainer.windowId = player.currentWindowId; + player.openContainer.addListener(player); + } } diff --git a/dependencies/main/java/codechicken/lib/util/SoundUtils.java b/dependencies/main/java/codechicken/lib/util/SoundUtils.java new file mode 100644 index 0000000000..a4b385a099 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/SoundUtils.java @@ -0,0 +1,42 @@ +package codechicken.lib.util; + +import codechicken.lib.vec.Vector3; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvent; +import net.minecraft.world.World; + +/** + * Created by covers1624 on 17/10/2016. + */ +public class SoundUtils { + + public static void playSoundAt(Entity entity, SoundCategory category, SoundEvent sound, float volume, float pitch, boolean distanceDelay) { + entity.worldObj.playSound(entity.posX, entity.posY, entity.posZ, sound, category, volume, pitch, distanceDelay); + } + + public static void playSoundAt(Entity entity, SoundCategory category, SoundEvent sound, float volume, float pitch) { + EntityPlayer player = null; + + //only assigning player on client as if triggered on server the player passed here would be omitted from hearing the sound + if (entity.worldObj.isRemote && entity instanceof EntityPlayer) { + player = (EntityPlayer) entity; + } + + entity.worldObj.playSound(player, entity.posX, entity.posY, entity.posZ, sound, category, volume, pitch); + } + + public static void playSoundAt(Entity entity, SoundCategory category, SoundEvent sound) { + playSoundAt(entity, category, sound, 1.0F, 1.0F); + } + + public static void playSoundAt(Vector3 pos, World world, SoundCategory category, SoundEvent sound, float volume, float pitch, boolean distanceDelay) { + world.playSound(pos.x, pos.y, pos.z, sound, category, volume, pitch, distanceDelay); + } + + public static void playSoundAt(Vector3 pos, World world, SoundCategory category, SoundEvent sound, float volume, float pitch) { + world.playSound(pos.x, pos.y, pos.z, sound, category, volume, pitch, false); + } + +} diff --git a/dependencies/main/java/codechicken/lib/util/TileEntityUtils.java b/dependencies/main/java/codechicken/lib/util/TileEntityUtils.java new file mode 100644 index 0000000000..d729ef2be2 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/TileEntityUtils.java @@ -0,0 +1,62 @@ +package codechicken.lib.util; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.InventoryLargeChest; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraftforge.items.CapabilityItemHandler; +import net.minecraftforge.items.IItemHandler; + +/** + * Created by covers1624 on 6/30/2016. + */ +public class TileEntityUtils { + + /** + * Retrieves an IInventory at the given location, Useful for receiving the entire inventory of a double chest. + */ + public static IInventory getInventory(World world, BlockPos pos) { + TileEntity tileEntity = world.getTileEntity(pos); + if (tileEntity instanceof IInventory) { + IInventory inventory = (IInventory) tileEntity; + if (inventory instanceof TileEntityChest) { + TileEntityChest first = (TileEntityChest) tileEntity; + TileEntityChest second = null; + for (BlockPos adjacentPos : BlockUtils.getAdjacent(pos, false)) { + TileEntity suspect = world.getTileEntity(adjacentPos); + if (suspect instanceof TileEntityChest) { + second = (TileEntityChest) suspect; + break; + } + } + if (second != null) { + return new InventoryLargeChest("large chest", first, second); + } + } + return inventory; + } + return null; + } + + /** + * Gets an IItemHandler at the given position. If the capability doesn't exist it returns null. + * + * @param world World the tile is in. + * @param pos Position the tile is at. + * @param facing The face of the tile to get the capability for. + * @return The IItemHandler existing on the tile. + */ + public static IItemHandler getIItemHandler(World world, BlockPos pos, EnumFacing facing) { + TileEntity tileEntity = world.getTileEntity(pos); + if (tileEntity != null) { + if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing)) { + return tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing); + } + } + return null; + } + +} diff --git a/dependencies/main/java/codechicken/lib/util/TransformUtils.java b/dependencies/main/java/codechicken/lib/util/TransformUtils.java new file mode 100644 index 0000000000..8b729ea762 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/TransformUtils.java @@ -0,0 +1,229 @@ +package codechicken.lib.util; + +import codechicken.lib.render.CCModelState; +import codechicken.lib.vec.Matrix4; +import com.google.common.base.Optional; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Maps; +import com.google.gson.*; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ModelRotation; +import net.minecraft.util.JsonUtils; +import net.minecraftforge.client.model.ForgeBlockStateV1.TRSRDeserializer; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; + +import javax.vecmath.Vector3f; +import java.util.EnumMap; + +/** + * Created by covers1624 on 5/16/2016. + * This is mostly just extracted from the ForgeBlockStateV1. + * Credits to Rain Warrior. + *

+ * If you have an idea for another transform just make a pull request. + */ +public class TransformUtils { + + private static final TRSRTransformation flipX = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null); + + public static final Gson GSON = new GsonBuilder().registerTypeAdapter(TRSRTransformation.class, TRSRDeserializer.INSTANCE).create(); + + public static final CCModelState DEFAULT_BLOCK; + public static final CCModelState DEFAULT_ITEM; + public static final CCModelState DEFAULT_TOOL; + public static final CCModelState DEFAULT_BOW; + public static final CCModelState DEFAULT_HANDHELD_ROD; + + static { + TRSRTransformation thirdPerson = get(0, 2.5f, 0, 75, 45, 0, 0.375f); + TRSRTransformation firstPerson; + + ImmutableMap.Builder defaultBlockBuilder = ImmutableMap.builder(); + defaultBlockBuilder.put(TransformType.GUI, get(0, 0, 0, 30, 225, 0, 0.625f)); + defaultBlockBuilder.put(TransformType.GROUND, get(0, 3, 0, 0, 0, 0, 0.25f)); + defaultBlockBuilder.put(TransformType.FIXED, get(0, 0, 0, 0, 0, 0, 0.5f)); + defaultBlockBuilder.put(TransformType.THIRD_PERSON_RIGHT_HAND, thirdPerson); + defaultBlockBuilder.put(TransformType.THIRD_PERSON_LEFT_HAND, leftify(thirdPerson)); + defaultBlockBuilder.put(TransformType.FIRST_PERSON_RIGHT_HAND, get(0, 0, 0, 0, 45, 0, 0.4f)); + defaultBlockBuilder.put(TransformType.FIRST_PERSON_LEFT_HAND, get(0, 0, 0, 0, 225, 0, 0.4f)); + DEFAULT_BLOCK = new CCModelState(defaultBlockBuilder.build()); + + thirdPerson = get(0, 3, 1, 0, 0, 0, 0.55f); + firstPerson = get(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f); + ImmutableMap.Builder defaultItemBuilder = ImmutableMap.builder(); + defaultItemBuilder.put(TransformType.GROUND, get(0, 2, 0, 0, 0, 0, 0.5f)); + defaultItemBuilder.put(TransformType.HEAD, get(0, 13, 7, 0, 180, 0, 1)); + defaultItemBuilder.put(TransformType.THIRD_PERSON_RIGHT_HAND, thirdPerson); + defaultItemBuilder.put(TransformType.THIRD_PERSON_LEFT_HAND, leftify(thirdPerson)); + defaultItemBuilder.put(TransformType.FIRST_PERSON_RIGHT_HAND, firstPerson); + defaultItemBuilder.put(TransformType.FIRST_PERSON_LEFT_HAND, leftify(firstPerson)); + DEFAULT_ITEM = new CCModelState(defaultItemBuilder.build()); + + ImmutableMap.Builder defaultToolBuilder = ImmutableMap.builder(); + defaultToolBuilder.put(TransformType.GROUND, get(0, 2, 0, 0, 0, 0, 0.5f)); + defaultToolBuilder.put(TransformType.THIRD_PERSON_RIGHT_HAND, get(0, 4, 0.5F, 0, -90, 55, 0.85F)); + defaultToolBuilder.put(TransformType.THIRD_PERSON_LEFT_HAND, get(0, 4, 0.5f, 0, 90, -55, 0.85f)); + defaultToolBuilder.put(TransformType.FIRST_PERSON_RIGHT_HAND, get(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f)); + defaultToolBuilder.put(TransformType.FIRST_PERSON_LEFT_HAND, get(1.13f, 3.2f, 1.13f, 0, 90, -25, 0.68f)); + DEFAULT_TOOL = new CCModelState(defaultToolBuilder.build()); + + ImmutableMap.Builder defaultBowBuilder = ImmutableMap.builder(); + defaultBowBuilder.put(TransformType.GROUND, get(0, 2, 0, 0, 0, 0, 0.5f)); + defaultBowBuilder.put(TransformType.THIRD_PERSON_RIGHT_HAND, get(-1F, -2F, 2.5F, -80, 260, -40, 0.9F)); + defaultBowBuilder.put(TransformType.THIRD_PERSON_LEFT_HAND, get(-1F, -2F, 2.5F, -80, -280, 40, 0.9f)); + defaultBowBuilder.put(TransformType.FIRST_PERSON_RIGHT_HAND, get(1.13F, 3.2F, 1.13F, 0, -90, 25, 0.68f)); + defaultBowBuilder.put(TransformType.FIRST_PERSON_LEFT_HAND, get(1.13f, 3.2f, 1.13f, 0, 90, -25, 0.68f)); + DEFAULT_BOW = new CCModelState(defaultBowBuilder.build()); + + ImmutableMap.Builder defaultRodBuilder = ImmutableMap.builder(); + defaultRodBuilder.put(TransformType.GROUND, get(0, 2, 0, 0, 0, 0, 0.5f)); + defaultRodBuilder.put(TransformType.THIRD_PERSON_RIGHT_HAND, get(0F, 4F, 2.5F, 0, 90, 55, 0.85F)); + defaultRodBuilder.put(TransformType.THIRD_PERSON_LEFT_HAND, get(0F, 4F, 2.5F, 0, -90, -55, 0.85f)); + defaultRodBuilder.put(TransformType.FIRST_PERSON_RIGHT_HAND, get(0F, 1.6F, 0.8F, 0, 90, 25, 0.68f)); + defaultRodBuilder.put(TransformType.FIRST_PERSON_LEFT_HAND, get(0F, 1.6F, 0.8F, 0, -90, -25, 0.68f)); + DEFAULT_HANDHELD_ROD = new CCModelState(defaultRodBuilder.build()); + } + + public static TRSRTransformation get(float tx, float ty, float tz, float rx, float ry, float rz, float s) { + return TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(tx / 16, ty / 16, tz / 16), TRSRTransformation.quatFromXYZDegrees(new Vector3f(rx, ry, rz)), new Vector3f(s, s, s), null)); + } + + public static TRSRTransformation leftify(TRSRTransformation transform) { + return TRSRTransformation.blockCenterToCorner(flipX.compose(TRSRTransformation.blockCornerToCenter(transform)).compose(flipX)); + } + + /** + * Reimplementation from ForgeBlockStateV1's variant Deserializer. + * + * @param json The Json that contains either ModelRotation x,y,TRSRTransforms or CCL defaults. + * @return A IModelState. + */ + public static Optional parseFromJson(JsonObject json) { + Optional ret = Optional.absent(); + if (json.has("x") || json.has("y")) { + int x = JsonUtils.getInt(json, "x", 0); + int y = JsonUtils.getInt(json, "y", 0); + ModelRotation rot = ModelRotation.getModelRotation(x, y); + ret = Optional.of(new TRSRTransformation(rot)); + if (!ret.isPresent()) { + throw new JsonParseException("Invalid BlockModelRotation x: " + x + " y: " + y); + } + } + if (json.has("transform")) { + JsonElement transformElement = json.get("transform"); + if (transformElement.isJsonPrimitive() && transformElement.getAsJsonPrimitive().isString()) { + String transform = transformElement.getAsString(); + if (transform.equals("identity")) { + ret = Optional.of(TRSRTransformation.identity()); + } else if (transform.equals("ccl:default-block")) { + ret = Optional.of(DEFAULT_BLOCK); + } else if (transform.equals("ccl:default-item")) { + ret = Optional.of(DEFAULT_ITEM); + } else if (transform.equals("ccl:default-tool")) { + ret = Optional.of(DEFAULT_TOOL); + } else if (transform.equals("ccl:default-bow")) { + ret = Optional.of(DEFAULT_BOW); + } else if (transform.equals("ccl:default-handheld-rod")) { + ret = Optional.of(DEFAULT_HANDHELD_ROD); + } + } else if (!transformElement.isJsonObject()) { + try { + TRSRTransformation base = GSON.fromJson(transformElement, TRSRTransformation.class); + ret = Optional.of(TRSRTransformation.blockCenterToCorner(base)); + } catch (JsonParseException e) { + throw new JsonParseException("transform: expected a string, object or valid base transformation, got: " + transformElement); + } + } else { + JsonObject transform = transformElement.getAsJsonObject(); + EnumMap transforms = Maps.newEnumMap(TransformType.class); + if (transform.has("thirdperson")) { + TRSRTransformation t = GSON.fromJson(transform.get("thirdperson"), TRSRTransformation.class); + transform.remove("thirdperson"); + transforms.put(TransformType.THIRD_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); + } + if (transform.has("thirdperson_righthand")) { + TRSRTransformation t = GSON.fromJson(transform.get("thirdperson_righthand"), TRSRTransformation.class); + transform.remove("thirdperson_righthand"); + transforms.put(TransformType.THIRD_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); + } + if (transform.has("thirdperson_lefthand")) { + TRSRTransformation t = GSON.fromJson(transform.get("thirdperson_lefthand"), TRSRTransformation.class); + transform.remove("thirdperson_lefthand"); + transforms.put(TransformType.THIRD_PERSON_LEFT_HAND, TRSRTransformation.blockCenterToCorner(t)); + } + if (transform.has("firstperson")) { + TRSRTransformation t = GSON.fromJson(transform.get("firstperson"), TRSRTransformation.class); + transform.remove("firstperson"); + transforms.put(TransformType.FIRST_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); + } + if (transform.has("firstperson_righthand")) { + TRSRTransformation t = GSON.fromJson(transform.get("firstperson_righthand"), TRSRTransformation.class); + transform.remove("firstperson_righthand"); + transforms.put(TransformType.FIRST_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); + } + if (transform.has("firstperson_lefthand")) { + TRSRTransformation t = GSON.fromJson(transform.get("firstperson_lefthand"), TRSRTransformation.class); + transform.remove("firstperson_lefthand"); + transforms.put(TransformType.FIRST_PERSON_LEFT_HAND, TRSRTransformation.blockCenterToCorner(t)); + } + if (transform.has("head")) { + TRSRTransformation t = GSON.fromJson(transform.get("head"), TRSRTransformation.class); + transform.remove("head"); + transforms.put(TransformType.HEAD, TRSRTransformation.blockCenterToCorner(t)); + } + if (transform.has("gui")) { + TRSRTransformation t = GSON.fromJson(transform.get("gui"), TRSRTransformation.class); + transform.remove("gui"); + transforms.put(TransformType.GUI, TRSRTransformation.blockCenterToCorner(t)); + } + if (transform.has("ground")) { + TRSRTransformation t = GSON.fromJson(transform.get("ground"), TRSRTransformation.class); + transform.remove("ground"); + transforms.put(TransformType.GROUND, TRSRTransformation.blockCenterToCorner(t)); + } + if (transform.has("fixed")) { + TRSRTransformation t = GSON.fromJson(transform.get("fixed"), TRSRTransformation.class); + transform.remove("fixed"); + transforms.put(TransformType.FIXED, TRSRTransformation.blockCenterToCorner(t)); + } + int k = transform.entrySet().size(); + if (transform.has("matrix")) { + k--; + } + if (transform.has("translation")) { + k--; + } + if (transform.has("rotation")) { + k--; + } + if (transform.has("scale")) { + k--; + } + if (transform.has("post-rotation")) { + k--; + } + if (k > 0) { + throw new JsonParseException("transform: allowed keys: 'thirdperson', 'firstperson', 'gui', 'head', 'matrix', 'translation', 'rotation', 'scale', 'post-rotation'"); + } + TRSRTransformation base = TRSRTransformation.identity(); + if (!transform.entrySet().isEmpty()) { + base = GSON.fromJson(transform, TRSRTransformation.class); + base = TRSRTransformation.blockCenterToCorner(base); + } + IModelState state; + if (transforms.isEmpty()) { + state = base; + } else { + state = new CCModelState(Maps.immutableEnumMap(transforms), Optional.of(base)); + } + ret = Optional.of(state); + } + } + return ret; + } + + public static TRSRTransformation fromMatrix4(Matrix4 matrix4) { + return new TRSRTransformation(matrix4.toMatrix4f()); + } +} diff --git a/dependencies/main/java/codechicken/lib/util/TripleABC.java b/dependencies/main/java/codechicken/lib/util/TripleABC.java new file mode 100644 index 0000000000..4f07f45fb5 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/TripleABC.java @@ -0,0 +1,30 @@ +package codechicken.lib.util; + +/** + * Created by covers1624 on 8/29/2016. + * TODO Copyable. + */ +public class TripleABC { + + private final A a; + private final B b; + private final C c; + + public TripleABC(A a, B b, C c) { + this.a = a; + this.b = b; + this.c = c; + } + + public A getA() { + return a; + } + + public B getB() { + return b; + } + + public C getC() { + return c; + } +} diff --git a/dependencies/main/java/codechicken/lib/util/VectorUtils.java b/dependencies/main/java/codechicken/lib/util/VectorUtils.java new file mode 100644 index 0000000000..787c0f47cf --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/VectorUtils.java @@ -0,0 +1,78 @@ +package codechicken.lib.util; + +import codechicken.lib.vec.Vector3; +import net.minecraft.util.EnumFacing; + +/** + * Created by covers1624 on 4/10/2016. + */ +public class VectorUtils { + + /** + * Calculates a normal for the given vertices. + * + * @param vertices The vertices to calculate a normal for, Expected to be a length of 3. + * @return The normal. + */ + public static Vector3 calculateNormal(Vector3... vertices) { + Vector3 diff1 = vertices[1].copy().subtract(vertices[0]); + Vector3 diff2 = vertices[2].copy().subtract(vertices[0]); + return diff1.crossProduct(diff2).normalize().copy(); + } + + /** + * Calculates the int direction a normal is facing. + * + * @param normal The normal to calculate from. + * @return The direction the normal is facing. + */ + public static int findSide(Vector3 normal) { + if (normal.y <= -0.99) { + return 0; + } + if (normal.y >= 0.99) { + return 1; + } + if (normal.z <= -0.99) { + return 2; + } + if (normal.z >= 0.99) { + return 3; + } + if (normal.x <= -0.99) { + return 4; + } + if (normal.x >= 0.99) { + return 5; + } + return -1; + } + + /** + * Calculates the EnumFacing for a given normal. + * + * @param normal The normal to calculate from. + * @return The direction the normal is facing. + */ + public static EnumFacing calcNormalSide(Vector3 normal) { + if (normal.y <= -0.99) { + return EnumFacing.DOWN; + } + if (normal.y >= 0.99) { + return EnumFacing.UP; + } + if (normal.z <= -0.99) { + return EnumFacing.NORTH; + } + if (normal.z >= 0.99) { + return EnumFacing.SOUTH; + } + if (normal.x <= -0.99) { + return EnumFacing.WEST; + } + if (normal.x >= 0.99) { + return EnumFacing.EAST; + } + return null; + } +} diff --git a/dependencies/main/java/codechicken/lib/util/VertexDataUtils.java b/dependencies/main/java/codechicken/lib/util/VertexDataUtils.java new file mode 100644 index 0000000000..d37e43c106 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/util/VertexDataUtils.java @@ -0,0 +1,145 @@ +package codechicken.lib.util; + +import codechicken.lib.math.MathHelper; +import codechicken.lib.vec.uv.UV; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.renderer.vertex.VertexFormatElement; +import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage; +import net.minecraft.util.EnumFacing; +import net.minecraftforge.client.model.pipeline.LightUtil; +import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by covers1624 on 4/10/2016. + * Utilities for anything to do with raw vertex data access. + */ +public class VertexDataUtils { + + /** + * Gets the position for the element 'position' in the elements list for use in LightUtil.pack/unpack for a given format. + * + * @param format The format. + * @return The element position, -1 if it does not exist. + */ + public static int getPositionElement(VertexFormat format) { + for (int e = 0; e < format.getElementCount(); e++) { + if (format.getElement(e).isPositionElement()) { + return e; + } + } + return -1; + } + + /** + * Gets the position for the element 'normal' in the elements list for use in LightUtil.pack/unpack for a given format. + * + * @param format The format. + * @return The element position, -1 if it does not exist. + */ + public static int getNormalElement(VertexFormat format) { + for (int e = 0; e < format.getElementCount(); e++) { + if (format.getElement(e).getUsage() == EnumUsage.NORMAL) { + return e; + } + } + return -1; + } + + /** + * Gets the position for the element 'uv' in the elements list for use in LightUtil.pack/unpack for a given format. + * + * @param format The format. + * @return The element position, -1 if it does not exist. + */ + public static int getUVElement(VertexFormat format) { + for (int e = 0; e < format.getElementCount(); e++) { + if (format.getElement(e).getUsage() == EnumUsage.UV && format.getElement(e).getIndex() == 0) { + return e; + } + } + return -1; + } + + /** + * Gets the position for the element provided in the elements list for use in LightUtil.pack/unpack for a given format. + * + * @param format The format. + * @param element THe element to get. + * @return The element position, -1 if it does not exist. + */ + public static int getElement(VertexFormat format, VertexFormatElement element) { + for (int e = 0; e < format.getElementCount(); e++) { + if (format.getElement(e).equals(element)) { + return e; + } + } + return -1; + } + + /** + * Attempts to get the TextureAtlasSprite for a given UV mapping. + * This is not threaded and will search EVERY sprite loaded in the texture map. + * This is meant to be a last resort, where possible always try to avoid using this or have this be fired. + * TODO Improve searching by caching value ranges somehow. + * + * @param textureMap The TextureMap to search. + * @param uv The UV mapping to find. + * @return The TextureAtlasSprite found, returns missing icon if it hasn't been found. + */ + public static TextureAtlasSprite getSpriteForUV(TextureMap textureMap, UV uv) { + for (TextureAtlasSprite sprite : textureMap.mapUploadedSprites.values()) { + if (MathHelper.between(sprite.getMinU(), uv.u, sprite.getMaxU()) && MathHelper.between(sprite.getMinV(), uv.v, sprite.getMaxV())) { + return sprite; + } + } + return textureMap.getMissingSprite(); + } + + /** + * Copies the data from a UnpackedBakedQuad to a normal baked quad to save space in ram. + * + * @param quad The UnpackedBakedQuad to copy from. + * @return The copied BakedQuad. + */ + public static BakedQuad copyQuad(UnpackedBakedQuad quad) { + return new BakedQuad(quad.getVertexData(), quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad.getFormat()); + } + + public static Map> sortFaceData(List quads) { + Map> faceQuadMap = new HashMap>(); + for (BakedQuad quad : quads) { + List faceQuads = faceQuadMap.get(quad.getFace()); + if (faceQuads == null) { + faceQuads = new ArrayList(); + faceQuadMap.put(quad.getFace(), faceQuads); + } + faceQuads.add(quad); + } + return faceQuadMap; + } + + public static void fullyPackQuads(int[] packedData, float[][][] unpackedData, VertexFormat format) { + for (int e = 0; e < format.getElementCount(); e++) { + for (int v = 0; v < 4; v++) { + LightUtil.pack(unpackedData[v][e], packedData, format, v, e); + } + } + } + + public static void fullyUnPackQuads(int[] packedData, float[][][] unpackedData, VertexFormat format) { + for (int e = 0; e < format.getElementCount(); e++) { + for (int v = 0; v < 4; v++) { + LightUtil.unpack(packedData, unpackedData[v][e], format, v, e); + } + } + } + +} diff --git a/dependencies/main/java/codechicken/lib/vec/AxisCycle.java b/dependencies/main/java/codechicken/lib/vec/AxisCycle.java index 585e36d177..66636a57d3 100644 --- a/dependencies/main/java/codechicken/lib/vec/AxisCycle.java +++ b/dependencies/main/java/codechicken/lib/vec/AxisCycle.java @@ -1,6 +1,7 @@ package codechicken.lib.vec; public class AxisCycle { + public static Transformation[] cycles = new Transformation[] { new RedundantTransformation(), new VariableTransformation(new Matrix4(0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1)) { @Override public void apply(Vector3 vec) { diff --git a/dependencies/main/java/codechicken/lib/vec/BlockCoord.java b/dependencies/main/java/codechicken/lib/vec/BlockCoord.java index 0d6598ea3d..f822696ec2 100644 --- a/dependencies/main/java/codechicken/lib/vec/BlockCoord.java +++ b/dependencies/main/java/codechicken/lib/vec/BlockCoord.java @@ -3,15 +3,21 @@ import codechicken.lib.math.MathHelper; import codechicken.lib.util.Copyable; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; +//TODO Find viability of keeping this, BlockPos is a thing now.. +//TODO, Maybe we should keep this and extend BlockPos.. +@Deprecated public class BlockCoord implements Comparable, Copyable { + public static final BlockCoord[] sideOffsets = new BlockCoord[] { new BlockCoord(0, -1, 0), new BlockCoord(0, 1, 0), new BlockCoord(0, 0, -1), new BlockCoord(0, 0, 1), new BlockCoord(-1, 0, 0), new BlockCoord(1, 0, 0) }; public int x; public int y; public int z; + private BlockPos posCache; + public BlockCoord(int x, int y, int z) { this.x = x; this.y = y; @@ -23,7 +29,7 @@ public BlockCoord(BlockPos pos) { } public BlockCoord(Vector3 v) { - this(MathHelper.floor_double(v.x), MathHelper.floor_double(v.y), MathHelper.floor_double(v.z)); + this(MathHelper.floor(v.x), MathHelper.floor(v.y), MathHelper.floor(v.z)); } public BlockCoord(TileEntity tile) { @@ -148,35 +154,35 @@ public BlockCoord inset(int side, int amount) { public int getSide(int side) { switch (side) { - case 0: - case 1: - return y; - case 2: - case 3: - return z; - case 4: - case 5: - return x; + case 0: + case 1: + return y; + case 2: + case 3: + return z; + case 4: + case 5: + return x; } throw new IndexOutOfBoundsException("Switch Falloff"); } public BlockCoord setSide(int s, int v) { switch (s) { - case 0: - case 1: - y = v; - break; - case 2: - case 3: - z = v; - break; - case 4: - case 5: - x = v; - break; - default: - throw new IndexOutOfBoundsException("Switch Falloff"); + case 0: + case 1: + y = v; + break; + case 2: + case 3: + z = v; + break; + case 4: + case 5: + x = v; + break; + default: + throw new IndexOutOfBoundsException("Switch Falloff"); } return this; } @@ -186,7 +192,10 @@ public int[] intArray() { } public BlockPos pos() { - return new BlockPos(x, y, z); + if (posCache == null || x != posCache.getX() || y != posCache.getY() || z != posCache.getZ()) { + posCache = new BlockPos(x, y, z); + } + return posCache; } public BlockCoord copy() { @@ -243,9 +252,7 @@ public int toSide() { } public int absSum() { - return (x < 0 ? -x : x) + - (y < 0 ? -y : y) + - (z < 0 ? -z : z); + return (x < 0 ? -x : x) + (y < 0 ? -y : y) + (z < 0 ? -z : z); } public String toString() { diff --git a/dependencies/main/java/codechicken/lib/vec/Cuboid6.java b/dependencies/main/java/codechicken/lib/vec/Cuboid6.java index 0fdb2b0c03..23e7fdbdcd 100644 --- a/dependencies/main/java/codechicken/lib/vec/Cuboid6.java +++ b/dependencies/main/java/codechicken/lib/vec/Cuboid6.java @@ -1,14 +1,15 @@ package codechicken.lib.vec; import codechicken.lib.util.Copyable; -import net.minecraft.block.Block; import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; public class Cuboid6 implements Copyable { + public static Cuboid6 full = new Cuboid6(0, 0, 0, 1, 1, 1); public Vector3 min; @@ -39,128 +40,200 @@ public Cuboid6(double minx, double miny, double minz, double maxx, double maxy, } public AxisAlignedBB aabb() { - return AxisAlignedBB.fromBounds(min.x, min.y, min.z, max.x, max.y, max.z); + return new AxisAlignedBB(min.x, min.y, min.z, max.x, max.y, max.z); } - public Cuboid6 copy() { - return new Cuboid6(this); + public Cuboid6 set(double minx, double miny, double minz, double maxx, double maxy, double maxz) { + min.set(minx, miny, minz); + max.set(maxx, maxy, maxz); + return this; + } + + public Cuboid6 set(Vector3 min, Vector3 max) { + return set(min.x, min.y, min.z, max.x, max.y, max.z); } public Cuboid6 set(Cuboid6 c) { - return set(c.min, c.max); + return set(c.min.x, c.min.y, c.min.z, c.max.x, c.max.y, c.max.z); } - public Cuboid6 set(Vector3 min, Vector3 max) { - this.min.set(min); - this.max.set(max); + public Cuboid6 add(double dx, double dy, double dz) { + min.add(dx, dy, dz); + max.add(dx, dy, dz); return this; } - public Cuboid6 set(double minx, double miny, double minz, double maxx, double maxy, double maxz) { - min.set(minx, miny, minz); - max.set(maxx, maxy, maxz); - return this; + public Cuboid6 add(double d) { + return add(d, d, d); } public Cuboid6 add(Vector3 vec) { - min.add(vec); - max.add(vec); - return this; + return add(vec.x, vec.y, vec.z); } - public Cuboid6 sub(Vector3 vec) { - min.subtract(vec); - max.subtract(vec); + public Cuboid6 add(BlockPos pos) { + return add(pos.getX(), pos.getY(), pos.getZ()); + } + + public Cuboid6 subtract(double dx, double dy, double dz) { + min.subtract(dx, dy, dz); + max.subtract(dx, dy, dz); return this; } - public Cuboid6 expand(double d) { - return expand(new Vector3(d, d, d)); + public Cuboid6 subtract(double d) { + return subtract(d, d, d); } - public Cuboid6 expand(Vector3 vec) { - min.sub(vec); - max.add(vec); - return this; + public Cuboid6 subtract(Vector3 vec) { + return subtract(vec.x, vec.y, vec.z); } - public void setBlockBounds(Block block) { - block.setBlockBounds((float) min.x, (float) min.y, (float) min.z, (float) max.x, (float) max.y, (float) max.z); + public Cuboid6 subtract(BlockPos pos) { + return subtract(pos.getX(), pos.getY(), pos.getZ()); } - public boolean intersects(Cuboid6 b) { - return max.x - 1E-5 > b.min.x && - b.max.x - 1E-5 > min.x && - max.y - 1E-5 > b.min.y && - b.max.y - 1E-5 > min.y && - max.z - 1E-5 > b.min.z && - b.max.z - 1E-5 > min.z; + @Deprecated //Use subtract + public Cuboid6 sub(Vector3 vec) { + return subtract(vec); } - public Cuboid6 offset(Cuboid6 o) { - min.add(o.min); - max.add(o.max); + public Cuboid6 expand(double dx, double dy, double dz) { + min.subtract(dx, dy, dz); + max.add(dx, dy, dz); return this; } - public Vector3 center() { - return min.copy().add(max).multiply(0.5); + public Cuboid6 expand(double d) { + return expand(d, d, d); } - public static boolean intersects(Cuboid6 a, Cuboid6 b) { - return a != null && b != null && a.intersects(b); + public Cuboid6 expand(Vector3 vec) { + return expand(vec.x, vec.y, vec.z); } - public String toString() { - MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "Cuboid: (" + new BigDecimal(min.x, cont) + ", " + new BigDecimal(min.y, cont) + ", " + new BigDecimal(min.z, cont) + ") -> (" + - new BigDecimal(max.x, cont) + ", " + new BigDecimal(max.y, cont) + ", " + new BigDecimal(max.z, cont) + ")"; + public Cuboid6 offset(Cuboid6 o) { + min.add(o.min); + max.add(o.max); + return this; } - public Cuboid6 enclose(Vector3 vec) { - if (min.x > vec.x) { - min.x = vec.x; + public Cuboid6 enclose(double minx, double miny, double minz, double maxx, double maxy, double maxz) { + if (min.x > minx) { + min.x = minx; } - if (min.y > vec.y) { - min.y = vec.y; + if (min.y > miny) { + min.y = miny; } - if (min.z > vec.z) { - min.z = vec.z; + if (min.z > minz) { + min.z = minz; } - if (max.x < vec.x) { - max.x = vec.x; + if (max.x < maxx) { + max.x = maxx; } - if (max.y < vec.y) { - max.y = vec.y; + if (max.y < maxy) { + max.y = maxy; } - if (max.z < vec.z) { - max.z = vec.z; + if (max.z < maxz) { + max.z = maxz; } return this; } + public Cuboid6 enclose(double x, double y, double z) { + return enclose(x, y, z, x, y, z); + } + + public Cuboid6 enclose(Vector3 vec) { + return enclose(vec.x, vec.y, vec.z, vec.x, vec.y, vec.z); + } + public Cuboid6 enclose(Cuboid6 c) { - if (min.x > c.min.x) { - min.x = c.min.x; - } - if (min.y > c.min.y) { - min.y = c.min.y; - } - if (min.z > c.min.z) { - min.z = c.min.z; - } - if (max.x < c.max.x) { - max.x = c.max.x; - } - if (max.y < c.max.y) { - max.y = c.max.y; + return enclose(c.min.x, c.min.y, c.min.z, c.max.x, c.max.y, c.max.z); + } + + public boolean contains(double x, double y, double z) { + return min.x - 1E-5 <= x && min.y - 1E-5 <= y && min.z - 1E-5 <= z && max.x + 1E-5 >= x && max.y + 1E-5 >= y && max.z + 1E-5 >= z; + } + + public boolean contains(Vector3 vec) { + return contains(vec.x, vec.y, vec.z); + } + + public boolean intersects(Cuboid6 b) { + return max.x - 1E-5 > b.min.x && max.y - 1E-5 > b.min.y && max.z - 1E-5 > b.min.z && b.max.x - 1E-5 > min.x && b.max.y - 1E-5 > min.y && b.max.z - 1E-5 > min.z; + } + + public Vector3 center() { + return min.copy().add(max).multiply(0.5); + } + + public double getSide(int s) { + switch (s) { + case 0: + return min.y; + case 1: + return max.y; + case 2: + return min.z; + case 3: + return max.z; + case 4: + return min.x; + case 5: + return max.x; } - if (max.z < c.max.z) { - max.z = c.max.z; + throw new IndexOutOfBoundsException("Switch Falloff"); + } + + public Cuboid6 setSide(int s, double d) { + switch (s) { + case 0: + min.y = d; + break; + case 1: + max.y = d; + break; + case 2: + min.z = d; + break; + case 3: + max.z = d; + break; + case 4: + min.x = d; + break; + case 5: + max.x = d; + break; + default: + throw new IndexOutOfBoundsException("Switch Falloff"); } return this; } + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Cuboid6)) { + return false; + } + Cuboid6 c = (Cuboid6) obj; + return min.equals(c.min) && max.equals(c.max); + } + + public boolean equalsT(Cuboid6 c) { + return min.equalsT(c.min) && max.equalsT(c.max); + } + + public Cuboid6 copy() { + return new Cuboid6(this); + } + + public String toString() { + MathContext cont = new MathContext(4, RoundingMode.HALF_UP); + return "Cuboid: (" + new BigDecimal(min.x, cont) + ", " + new BigDecimal(min.y, cont) + ", " + new BigDecimal(min.z, cont) + ") -> (" + new BigDecimal(max.x, cont) + ", " + new BigDecimal(max.y, cont) + ", " + new BigDecimal(max.z, cont) + ")"; + } + public Cuboid6 apply(Transformation t) { t.apply(min); t.apply(max); @@ -182,48 +255,4 @@ public Cuboid6 apply(Transformation t) { } return this; } - - public double getSide(int s) { - switch (s) { - case 0: - return min.y; - case 1: - return max.y; - case 2: - return min.z; - case 3: - return max.z; - case 4: - return min.x; - case 5: - return max.x; - } - throw new IndexOutOfBoundsException("Switch Falloff"); - } - - public Cuboid6 setSide(int s, double d) { - switch (s) { - case 0: - min.y = d; - break; - case 1: - max.y = d; - break; - case 2: - min.z = d; - break; - case 3: - max.z = d; - break; - case 4: - min.x = d; - break; - case 5: - max.x = d; - break; - default: - throw new IndexOutOfBoundsException("Switch Falloff"); - } - return this; - } } diff --git a/dependencies/main/java/codechicken/lib/vec/CuboidCoord.java b/dependencies/main/java/codechicken/lib/vec/CuboidCoord.java index 6618d013fd..e4882bf6e3 100644 --- a/dependencies/main/java/codechicken/lib/vec/CuboidCoord.java +++ b/dependencies/main/java/codechicken/lib/vec/CuboidCoord.java @@ -6,6 +6,7 @@ import java.util.Iterator; public class CuboidCoord implements Iterable, Copyable { + public BlockCoord min; public BlockCoord max; @@ -31,19 +32,48 @@ public CuboidCoord(int x1, int y1, int z1, int x2, int y2, int z2) { this(new BlockCoord(x1, y1, z1), new BlockCoord(x2, y2, z2)); } - public CuboidCoord expand(int amount) { - return expand(amount, amount, amount); + public AxisAlignedBB toAABB() { + return bounds().aabb(); + } + + public int[] intArray() { + return new int[] { min.x, min.y, min.z, max.x, max.y, max.z }; + } + + public Cuboid6 bounds() { + return new Cuboid6(min.x, min.y, min.z, max.x + 1, max.y + 1, max.z + 1); + } + + public CuboidCoord set(int x1, int y1, int z1, int x2, int y2, int z2) { + min.set(x1, y1, z1); + max.set(x2, y2, z2); + return this; + } + + public CuboidCoord set(BlockCoord min, BlockCoord max) { + return set(min.x, min.y, min.z, max.x, max.y, max.z); } - public CuboidCoord expand(int x, int y, int z) { - max.add(x, y, z); - min.sub(x, y, z); + public CuboidCoord set(BlockCoord coord) { + return set(coord.x, coord.y, coord.z, coord.x, coord.y, coord.z); + } + + public CuboidCoord set(int[] ia) { + return set(ia[0], ia[1], ia[2], ia[3], ia[4], ia[5]); + } + + public CuboidCoord expand(int dx, int dy, int dz) { + max.add(dx, dy, dz); + min.sub(dx, dy, dz); return this; } + public CuboidCoord expand(int d) { + return expand(d, d, d); + } + public CuboidCoord expand(int side, int amount) { - if (side % 2 == 0)//negative side - { + if (side % 2 == 0) { //negative side min = min.offset(side, amount); } else { max = max.offset(side, amount); @@ -51,145 +81,130 @@ public CuboidCoord expand(int side, int amount) { return this; } - public int size(int s) { - switch (s) { - case 0: - case 1: - return max.y - min.y + 1; - case 2: - case 3: - return max.z - min.z + 1; - case 4: - case 5: - return max.x - min.x + 1; - default: - return 0; + public CuboidCoord include(int x, int y, int z) { + if (x < min.x) { + min.x = x; + } else if (x > max.x) { + max.x = x; } - } - - public int getSide(int s) { - switch (s) { - case 0: - return min.y; - case 1: - return max.y; - case 2: - return min.z; - case 3: - return max.z; - case 4: - return min.x; - case 5: - return max.x; + if (y < min.y) { + min.y = y; + } else if (y > max.y) { + max.y = y; } - throw new IndexOutOfBoundsException("Switch Falloff"); - } - - public CuboidCoord setSide(int s, int v) { - switch (s) { - case 0: - min.y = v; - break; - case 1: - max.y = v; - break; - case 2: - min.z = v; - break; - case 3: - max.z = v; - break; - case 4: - min.x = v; - break; - case 5: - max.x = v; - break; - default: - throw new IndexOutOfBoundsException("Switch Falloff"); + if (z < min.z) { + min.z = z; + } else if (z > max.z) { + max.z = z; } return this; } - public int getVolume() { - return (max.x - min.x + 1) * (max.y - min.y + 1) * (max.z - min.z + 1); - } - - public Vector3 getCenterVec() { - return new Vector3(min.x + (max.x - min.x + 1) / 2D, min.y + (max.y - min.y + 1) / 2D, min.z + (max.z - min.z + 1) / 2D); + public CuboidCoord include(BlockCoord coord) { + return include(coord.x, coord.y, coord.z); } - public BlockCoord getCenter(BlockCoord store) { - store.set(min.x + (max.x - min.x) / 2, min.y + (max.y - min.y) / 2, min.z + (max.z - min.z) / 2); - return store; + public boolean contains(int x, int y, int z) { + return x >= min.x && x <= max.x && y >= min.y && y <= max.y && z >= min.z && z <= max.z; } public boolean contains(BlockCoord coord) { return contains(coord.x, coord.y, coord.z); } - public boolean contains(int x, int y, int z) { - return x >= min.x && x <= max.x && y >= min.y && y <= max.y && z >= min.z && z <= max.z; + public boolean intersects(CuboidCoord c) { + return max.x >= c.min.x && max.y >= c.min.y && max.z >= c.min.z && min.x <= c.max.x && min.y <= c.max.y && min.z <= c.max.z; } - public int[] intArray() { - return new int[] { min.x, min.y, min.z, max.x, max.y, max.z }; + public int volume() { + return (max.x - min.x + 1) * (max.y - min.y + 1) * (max.z - min.z + 1); } - public CuboidCoord copy() { - return new CuboidCoord(min.copy(), max.copy()); + public Vector3 centerVec() { + return new Vector3(min.x + (max.x - min.x + 1) / 2D, min.y + (max.y - min.y + 1) / 2D, min.z + (max.z - min.z + 1) / 2D); } - public Cuboid6 bounds() { - return new Cuboid6(min.x, min.y, min.z, max.x + 1, max.y + 1, max.z + 1); + public BlockCoord center() { + return new BlockCoord(min.x + (max.x - min.x) / 2, min.y + (max.y - min.y) / 2, min.z + (max.z - min.z) / 2); } - public AxisAlignedBB toAABB() { - return bounds().aabb(); + //TODO: Remove this? Does not conform... + public BlockCoord getCenter(BlockCoord store) { + store.set(min.x + (max.x - min.x) / 2, min.y + (max.y - min.y) / 2, min.z + (max.z - min.z) / 2); + return store; } - public void set(BlockCoord min, BlockCoord max) { - this.min.set(min); - this.max.set(max); + public int size(int s) { + switch (s) { + case 0: + case 1: + return max.y - min.y + 1; + case 2: + case 3: + return max.z - min.z + 1; + case 4: + case 5: + return max.x - min.x + 1; + default: + return 0; + } } - public CuboidCoord set(int x1, int y1, int z1, int x2, int y2, int z2) { - min.set(x1, y1, z1); - max.set(x2, y2, z2); - return this; + public int getSide(int s) { + switch (s) { + case 0: + return min.y; + case 1: + return max.y; + case 2: + return min.z; + case 3: + return max.z; + case 4: + return min.x; + case 5: + return max.x; + } + throw new IndexOutOfBoundsException("Switch Falloff"); } - public CuboidCoord set(BlockCoord coord) { - min.set(coord); - max.set(coord); + public CuboidCoord setSide(int s, int v) { + switch (s) { + case 0: + min.y = v; + break; + case 1: + max.y = v; + break; + case 2: + min.z = v; + break; + case 3: + max.z = v; + break; + case 4: + min.x = v; + break; + case 5: + max.x = v; + break; + default: + throw new IndexOutOfBoundsException("Switch Falloff"); + } return this; } - public CuboidCoord set(int[] ia) { - return set(ia[0], ia[1], ia[2], ia[3], ia[4], ia[5]); - } - - public CuboidCoord include(BlockCoord coord) { - return include(coord.x, coord.y, coord.z); + @Override + public boolean equals(Object obj) { + if (!(obj instanceof CuboidCoord)) { + return false; + } + CuboidCoord c = (CuboidCoord) obj; + return min.equals(c.min) && max.equals(c.max); } - public CuboidCoord include(int x, int y, int z) { - if (x < min.x) { - min.x = x; - } else if (x > max.x) { - max.x = x; - } - if (y < min.y) { - min.y = y; - } else if (y > max.y) { - max.y = y; - } - if (z < min.z) { - min.z = z; - } else if (z > max.z) { - max.z = z; - } - return this; + public CuboidCoord copy() { + return new CuboidCoord(min.copy(), max.copy()); } public Iterator iterator() { diff --git a/dependencies/main/java/codechicken/lib/vec/ITransformation.java b/dependencies/main/java/codechicken/lib/vec/ITransformation.java index 716c6cc8ad..1df3c3b736 100644 --- a/dependencies/main/java/codechicken/lib/vec/ITransformation.java +++ b/dependencies/main/java/codechicken/lib/vec/ITransformation.java @@ -7,6 +7,7 @@ * @param The transformation type */ public abstract class ITransformation { + /** * Applies this transformation to vec */ diff --git a/dependencies/main/java/codechicken/lib/vec/IrreversibleTransformationException.java b/dependencies/main/java/codechicken/lib/vec/IrreversibleTransformationException.java index 7cb6361664..94dbcfea1a 100644 --- a/dependencies/main/java/codechicken/lib/vec/IrreversibleTransformationException.java +++ b/dependencies/main/java/codechicken/lib/vec/IrreversibleTransformationException.java @@ -1,7 +1,8 @@ package codechicken.lib.vec; -@SuppressWarnings("serial") +@SuppressWarnings ("serial") public class IrreversibleTransformationException extends RuntimeException { + public ITransformation t; public IrreversibleTransformationException(ITransformation t) { diff --git a/dependencies/main/java/codechicken/lib/vec/Line3.java b/dependencies/main/java/codechicken/lib/vec/Line3.java index 8891bb92b9..93589975e9 100644 --- a/dependencies/main/java/codechicken/lib/vec/Line3.java +++ b/dependencies/main/java/codechicken/lib/vec/Line3.java @@ -1,6 +1,7 @@ package codechicken.lib.vec; public class Line3 { + public static final double tol = 0.0001D; public Vector3 pt1; @@ -16,7 +17,7 @@ public Line3() { } public static boolean intersection2D(Line3 line1, Line3 line2, Vector3 store) { - // calculate differences + // calculate differences double xD1 = line1.pt2.x - line1.pt1.x; double zD1 = line1.pt2.z - line1.pt1.z; double xD2 = line2.pt2.x - line2.pt1.x; @@ -33,10 +34,7 @@ public static boolean intersection2D(Line3 line1, Line3 line2, Vector3 store) { double ua = (xD2 * zD3 - zD2 * xD3) / div; store.set(line1.pt1.x + ua * xD1, 0, line1.pt1.z + ua * zD1); - if (store.x >= Math.min(line1.pt1.x, line1.pt2.x) - tol && store.x >= Math.min(line2.pt1.x, line2.pt2.x) - tol && store.z >= Math.min(line1.pt1.z, line1.pt2.z) - tol && store.z >= Math.min(line2.pt1.z, line2.pt2.z) - tol && store.x <= Math.max(line1.pt1.x, line1.pt2.x) + tol && store.x <= Math.max(line2.pt1.x, line2.pt2.x) + tol && store.z <= Math.max(line1.pt1.z, line1.pt2.z) + tol && store.z <= Math.max(line2.pt1.z, line2.pt2.z) + tol) { - return true; - } + return store.x >= Math.min(line1.pt1.x, line1.pt2.x) - tol && store.x >= Math.min(line2.pt1.x, line2.pt2.x) - tol && store.z >= Math.min(line1.pt1.z, line1.pt2.z) - tol && store.z >= Math.min(line2.pt1.z, line2.pt2.z) - tol && store.x <= Math.max(line1.pt1.x, line1.pt2.x) + tol && store.x <= Math.max(line2.pt1.x, line2.pt2.x) + tol && store.z <= Math.max(line1.pt1.z, line1.pt2.z) + tol && store.z <= Math.max(line2.pt1.z, line2.pt2.z) + tol; - return false; } } diff --git a/dependencies/main/java/codechicken/lib/vec/Matrix4.java b/dependencies/main/java/codechicken/lib/vec/Matrix4.java index 4041399900..02f41a2d4a 100644 --- a/dependencies/main/java/codechicken/lib/vec/Matrix4.java +++ b/dependencies/main/java/codechicken/lib/vec/Matrix4.java @@ -1,21 +1,25 @@ package codechicken.lib.vec; import codechicken.lib.util.Copyable; +import net.minecraft.client.renderer.GlStateManager; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.lwjgl.opengl.GL11; +import javax.vecmath.Matrix4d; +import javax.vecmath.Matrix4f; import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; import java.nio.ByteBuffer; import java.nio.ByteOrder; -import java.nio.DoubleBuffer; +import java.nio.FloatBuffer; +//TODO Decompose to individual transforms. public class Matrix4 extends Transformation implements Copyable { - private static DoubleBuffer glBuf = ByteBuffer.allocateDirect(16 * 8).order(ByteOrder.nativeOrder()).asDoubleBuffer(); - //m + private static FloatBuffer glBuf = ByteBuffer.allocateDirect(16 * 8).order(ByteOrder.nativeOrder()).asFloatBuffer(); + + //m public double m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33; public Matrix4() { @@ -269,6 +273,48 @@ public Matrix4 set(Matrix4 mat) { return this; } + public Matrix4d toMatrix4d() { + double[] matrix = new double[16]; + matrix[0] = m00; + matrix[1] = m01; + matrix[2] = m02; + matrix[3] = m03; + matrix[4] = m10; + matrix[5] = m11; + matrix[6] = m12; + matrix[7] = m13; + matrix[8] = m20; + matrix[9] = m21; + matrix[10] = m22; + matrix[11] = m23; + matrix[12] = m30; + matrix[13] = m31; + matrix[14] = m32; + matrix[15] = m33; + return new Matrix4d(matrix); + } + + public Matrix4f toMatrix4f() { + float[] matrix = new float[16]; + matrix[0] = (float) m00; + matrix[1] = (float) m01; + matrix[2] = (float) m02; + matrix[3] = (float) m03; + matrix[4] = (float) m10; + matrix[5] = (float) m11; + matrix[6] = (float) m12; + matrix[7] = (float) m13; + matrix[8] = (float) m20; + matrix[9] = (float) m21; + matrix[10] = (float) m22; + matrix[11] = (float) m23; + matrix[12] = (float) m30; + matrix[13] = (float) m31; + matrix[14] = (float) m32; + matrix[15] = (float) m33; + return new Matrix4f(matrix); + } + @Override public void apply(Matrix4 mat) { mat.multiply(this); @@ -299,10 +345,7 @@ public void applyN(Vector3 vec) { @Override public String toString() { MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "[" + new BigDecimal(m00, cont) + "," + new BigDecimal(m01, cont) + "," + new BigDecimal(m02, cont) + "," + new BigDecimal(m03, cont) + "]\n" + - "[" + new BigDecimal(m10, cont) + "," + new BigDecimal(m11, cont) + "," + new BigDecimal(m12, cont) + "," + new BigDecimal(m13, cont) + "]\n" + - "[" + new BigDecimal(m20, cont) + "," + new BigDecimal(m21, cont) + "," + new BigDecimal(m22, cont) + "," + new BigDecimal(m23, cont) + "]\n" + - "[" + new BigDecimal(m30, cont) + "," + new BigDecimal(m31, cont) + "," + new BigDecimal(m32, cont) + "," + new BigDecimal(m33, cont) + "]"; + return "[" + new BigDecimal(m00, cont) + "," + new BigDecimal(m01, cont) + "," + new BigDecimal(m02, cont) + "," + new BigDecimal(m03, cont) + "]\n" + "[" + new BigDecimal(m10, cont) + "," + new BigDecimal(m11, cont) + "," + new BigDecimal(m12, cont) + "," + new BigDecimal(m13, cont) + "]\n" + "[" + new BigDecimal(m20, cont) + "," + new BigDecimal(m21, cont) + "," + new BigDecimal(m22, cont) + "," + new BigDecimal(m23, cont) + "]\n" + "[" + new BigDecimal(m30, cont) + "," + new BigDecimal(m31, cont) + "," + new BigDecimal(m32, cont) + "," + new BigDecimal(m33, cont) + "]"; } public Matrix4 apply(Transformation t) { @@ -311,11 +354,11 @@ public Matrix4 apply(Transformation t) { } @Override - @SideOnly(Side.CLIENT) + @SideOnly (Side.CLIENT) public void glApply() { - glBuf.put(m00).put(m10).put(m20).put(m30).put(m01).put(m11).put(m21).put(m31).put(m02).put(m12).put(m22).put(m32).put(m03).put(m13).put(m23).put(m33); + glBuf.put((float) m00).put((float) m10).put((float) m20).put((float) m30).put((float) m01).put((float) m11).put((float) m21).put((float) m31).put((float) m02).put((float) m12).put((float) m22).put((float) m32).put((float) m03).put((float) m13).put((float) m23).put((float) m33); glBuf.flip(); - GL11.glMultMatrix(glBuf); + GlStateManager.multMatrix(glBuf); } @Override diff --git a/dependencies/main/java/codechicken/lib/vec/Quat.java b/dependencies/main/java/codechicken/lib/vec/Quat.java index 94c3d52e04..ae91c230d3 100644 --- a/dependencies/main/java/codechicken/lib/vec/Quat.java +++ b/dependencies/main/java/codechicken/lib/vec/Quat.java @@ -8,6 +8,7 @@ import java.math.RoundingMode; public class Quat implements Copyable { + public double x; public double y; public double z; diff --git a/dependencies/main/java/codechicken/lib/vec/Rectangle4i.java b/dependencies/main/java/codechicken/lib/vec/Rectangle4i.java index 3c06f59936..866cb7855c 100644 --- a/dependencies/main/java/codechicken/lib/vec/Rectangle4i.java +++ b/dependencies/main/java/codechicken/lib/vec/Rectangle4i.java @@ -1,6 +1,7 @@ package codechicken.lib.vec; public class Rectangle4i { + public int x; public int y; public int w; @@ -87,10 +88,7 @@ public boolean contains(int px, int py) { } public boolean intersects(Rectangle4i r) { - return r.x + r.w > x && - r.x < x + w && - r.y + r.h > y && - r.y < y + h; + return r.x + r.w > x && r.x < x + w && r.y + r.h > y && r.y < y + h; } public int area() { diff --git a/dependencies/main/java/codechicken/lib/vec/RedundantTransformation.java b/dependencies/main/java/codechicken/lib/vec/RedundantTransformation.java index df9f227d63..e314a21518 100644 --- a/dependencies/main/java/codechicken/lib/vec/RedundantTransformation.java +++ b/dependencies/main/java/codechicken/lib/vec/RedundantTransformation.java @@ -4,6 +4,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class RedundantTransformation extends Transformation { + @Override public void apply(Vector3 vec) { } @@ -22,7 +23,7 @@ public Transformation at(Vector3 point) { } @Override - @SideOnly(Side.CLIENT) + @SideOnly (Side.CLIENT) public void glApply() { } diff --git a/dependencies/main/java/codechicken/lib/vec/Rotation.java b/dependencies/main/java/codechicken/lib/vec/Rotation.java index 88f5ab7512..c4956392db 100644 --- a/dependencies/main/java/codechicken/lib/vec/Rotation.java +++ b/dependencies/main/java/codechicken/lib/vec/Rotation.java @@ -12,6 +12,7 @@ import java.math.RoundingMode; public class Rotation extends Transformation { + /** * Clockwise pi/2 about y looking down */ @@ -242,7 +243,7 @@ public Quat toQuat() { } @Override - @SideOnly(Side.CLIENT) + @SideOnly (Side.CLIENT) public void glApply() { GlStateManager.rotate((float) (angle * MathHelper.todeg), (float) axis.x, (float) axis.y, (float) axis.z); } @@ -274,7 +275,6 @@ public boolean isRedundant() { @Override public String toString() { MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "Rotation(" + new BigDecimal(angle, cont) + ", " + new BigDecimal(axis.x, cont) + ", " + - new BigDecimal(axis.y, cont) + ", " + new BigDecimal(axis.z, cont) + ")"; + return "Rotation(" + new BigDecimal(angle, cont) + ", " + new BigDecimal(axis.x, cont) + ", " + new BigDecimal(axis.y, cont) + ", " + new BigDecimal(axis.z, cont) + ")"; } } diff --git a/dependencies/main/java/codechicken/lib/vec/Scale.java b/dependencies/main/java/codechicken/lib/vec/Scale.java index 8dd77120cb..76f4df4d46 100644 --- a/dependencies/main/java/codechicken/lib/vec/Scale.java +++ b/dependencies/main/java/codechicken/lib/vec/Scale.java @@ -9,6 +9,7 @@ import java.math.RoundingMode; public class Scale extends Transformation { + public Vector3 factor; public Scale(Vector3 factor) { @@ -38,7 +39,7 @@ public void apply(Matrix4 mat) { } @Override - @SideOnly(Side.CLIENT) + @SideOnly (Side.CLIENT) public void glApply() { GlStateManager.scale(factor.x, factor.y, factor.z); } diff --git a/dependencies/main/java/codechicken/lib/vec/SwapYZ.java b/dependencies/main/java/codechicken/lib/vec/SwapYZ.java index 0f965e6393..ad256dd681 100644 --- a/dependencies/main/java/codechicken/lib/vec/SwapYZ.java +++ b/dependencies/main/java/codechicken/lib/vec/SwapYZ.java @@ -1,6 +1,7 @@ package codechicken.lib.vec; public class SwapYZ extends VariableTransformation { + public SwapYZ() { super(new Matrix4(1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1)); } diff --git a/dependencies/main/java/codechicken/lib/vec/Transformation.java b/dependencies/main/java/codechicken/lib/vec/Transformation.java index 37bb02a801..3f9119d6cc 100644 --- a/dependencies/main/java/codechicken/lib/vec/Transformation.java +++ b/dependencies/main/java/codechicken/lib/vec/Transformation.java @@ -1,13 +1,15 @@ package codechicken.lib.vec; import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; /** * Abstract supertype for any 3D vector transformation */ -public abstract class Transformation extends ITransformation implements CCRenderState.IVertexOperation { +public abstract class Transformation extends ITransformation implements IVertexOperation { + public static final int operationIndex = CCRenderState.registerOperation(); /** @@ -32,20 +34,20 @@ public TransformationList with(Transformation t) { return new TransformationList(this, t); } - @SideOnly(Side.CLIENT) + @SideOnly (Side.CLIENT) public abstract void glApply(); @Override - public boolean load() { - CCRenderState.pipeline.addRequirement(CCRenderState.normalAttrib.operationID()); + public boolean load(CCRenderState state) { + state.pipeline.addRequirement(state.normalAttrib.operationID()); return !isRedundant(); } @Override - public void operate() { - apply(CCRenderState.vert.vec); - if (CCRenderState.normalAttrib.active) { - applyN(CCRenderState.normal); + public void operate(CCRenderState state) { + apply(state.vert.vec); + if (state.normalAttrib.active) { + applyN(state.normal); } } diff --git a/dependencies/main/java/codechicken/lib/vec/TransformationList.java b/dependencies/main/java/codechicken/lib/vec/TransformationList.java index ec0132f7ce..aba6449c64 100644 --- a/dependencies/main/java/codechicken/lib/vec/TransformationList.java +++ b/dependencies/main/java/codechicken/lib/vec/TransformationList.java @@ -7,6 +7,7 @@ import java.util.Iterator; public class TransformationList extends Transformation { + private ArrayList transformations = new ArrayList(); private Matrix4 mat; @@ -147,7 +148,7 @@ public boolean isRedundant() { } @Override - @SideOnly(Side.CLIENT) + @SideOnly (Side.CLIENT) public void glApply() { for (int i = transformations.size() - 1; i >= 0; i--) { transformations.get(i).glApply(); diff --git a/dependencies/main/java/codechicken/lib/vec/Translation.java b/dependencies/main/java/codechicken/lib/vec/Translation.java index c74356f47e..46378bc2b8 100644 --- a/dependencies/main/java/codechicken/lib/vec/Translation.java +++ b/dependencies/main/java/codechicken/lib/vec/Translation.java @@ -8,7 +8,9 @@ import java.math.MathContext; import java.math.RoundingMode; +//TODO Constructor for BlockPos. public class Translation extends Transformation { + public Vector3 vec; public Translation(Vector3 vec) { @@ -39,7 +41,7 @@ public Transformation at(Vector3 point) { } @Override - @SideOnly(Side.CLIENT) + @SideOnly (Side.CLIENT) public void glApply() { GlStateManager.translate(vec.x, vec.y, vec.z); } diff --git a/dependencies/main/java/codechicken/lib/vec/VariableTransformation.java b/dependencies/main/java/codechicken/lib/vec/VariableTransformation.java index 333e3ec609..6f968d7b90 100644 --- a/dependencies/main/java/codechicken/lib/vec/VariableTransformation.java +++ b/dependencies/main/java/codechicken/lib/vec/VariableTransformation.java @@ -4,6 +4,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public abstract class VariableTransformation extends Transformation { + public Matrix4 mat; public VariableTransformation(Matrix4 mat) { @@ -21,8 +22,8 @@ public void apply(Matrix4 mat) { } @Override - @SideOnly(Side.CLIENT) + @SideOnly (Side.CLIENT) public void glApply() { mat.glApply(); } -} \ No newline at end of file +} diff --git a/dependencies/main/java/codechicken/lib/vec/Vector3.java b/dependencies/main/java/codechicken/lib/vec/Vector3.java index 68ba3128b0..1635942b19 100644 --- a/dependencies/main/java/codechicken/lib/vec/Vector3.java +++ b/dependencies/main/java/codechicken/lib/vec/Vector3.java @@ -2,13 +2,13 @@ import codechicken.lib.math.MathHelper; import codechicken.lib.util.Copyable; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.lwjgl.opengl.GL11; import org.lwjgl.util.vector.Vector3f; import org.lwjgl.util.vector.Vector4f; @@ -17,6 +17,7 @@ import java.math.RoundingMode; public class Vector3 implements Copyable { + public static Vector3 zero = new Vector3(); public static Vector3 one = new Vector3(1, 1, 1); public static Vector3 center = new Vector3(0.5, 0.5, 0.5); @@ -44,26 +45,29 @@ public Vector3(double[] da) { this(da[0], da[1], da[2]); } - public Vector3(Vec3 vec) { + public Vector3(float[] fa) { + this(fa[0], fa[1], fa[2]); + } + + public Vector3(Vec3d vec) { x = vec.xCoord; y = vec.yCoord; z = vec.zCoord; } - public Vector3(BlockCoord coord) { - x = coord.x; - y = coord.y; - z = coord.z; - } - + @Deprecated // use Vector3.fromBlockPos //TODO, 1.11 move this to Vec3i public Vector3(BlockPos pos) { x = pos.getX(); y = pos.getY(); z = pos.getZ(); } - public Vector3 copy() { - return new Vector3(this); + public static Vector3 fromBlockPos(BlockPos pos) { + return new Vector3(pos.getX(), pos.getY(), pos.getZ()); + } + + public static Vector3 fromBlockPosCenter(BlockPos pos) { + return fromBlockPos(pos).add(0.5); } public static Vector3 fromEntity(Entity e) { @@ -75,7 +79,7 @@ public static Vector3 fromEntityCenter(Entity e) { } public static Vector3 fromTile(TileEntity tile) { - return new Vector3(tile.getPos()); + return fromBlockPos(tile.getPos()); } public static Vector3 fromTileCenter(TileEntity tile) { @@ -86,91 +90,68 @@ public static Vector3 fromAxes(double[] da) { return new Vector3(da[2], da[0], da[1]); } - public Vector3 set(double d, double d1, double d2) { - x = d; - y = d1; - z = d2; - return this; + public static Vector3 fromAxes(float[] fa) { + return new Vector3(fa[2], fa[0], fa[1]); } - public Vector3 set(Vector3 vec) { - x = vec.x; - y = vec.y; - z = vec.z; - return this; + public static Vector3 fromArray(double[] da) { + return new Vector3(da[0], da[1], da[2]); } - public double getSide(int side) { - switch (side) { - case 0: - case 1: - return y; - case 2: - case 3: - return z; - case 4: - case 5: - return x; - } - throw new IndexOutOfBoundsException("Switch Falloff"); + public static Vector3 fromArray(float[] fa) { + return new Vector3(fa[0], fa[1], fa[2]); } - public Vector3 setSide(int s, double v) { - switch (s) { - case 0: - case 1: - y = v; - break; - case 2: - case 3: - z = v; - break; - case 4: - case 5: - x = v; - break; - default: - throw new IndexOutOfBoundsException("Switch Falloff"); - } - return this; + public Vec3d vec3() { + return new Vec3d(x, y, z); } - public double dotProduct(Vector3 vec) { - double d = vec.x * x + vec.y * y + vec.z * z; + public BlockPos pos() { + return new BlockPos(x, y, z); + } - if (d > 1 && d < 1.00001) { - d = 1; - } else if (d < -1 && d > -1.00001) { - d = -1; - } - return d; + @SideOnly (Side.CLIENT) + public Vector3f vector3f() { + return new Vector3f((float) x, (float) y, (float) z); + } + + @SideOnly (Side.CLIENT) + public Vector4f vector4f() { + return new Vector4f((float) x, (float) y, (float) z, 1); } - public double dotProduct(double d, double d1, double d2) { - return d * x + d1 * y + d2 * z; + @SideOnly (Side.CLIENT) + public void glVertex() { + GlStateManager.glVertex3f((float) x, (float) y, (float) z); } - public Vector3 crossProduct(Vector3 vec) { - double d = y * vec.z - z * vec.y; - double d1 = z * vec.x - x * vec.z; - double d2 = x * vec.y - y * vec.x; - x = d; - y = d1; - z = d2; + public Vector3 set(double x1, double y1, double z1) { + x = x1; + y = y1; + z = z1; return this; } - public Vector3 add(double d, double d1, double d2) { - x += d; - y += d1; - z += d2; - return this; + public Vector3 set(double d) { + return set(d, d, d); } - public Vector3 add(Vector3 vec) { - x += vec.x; - y += vec.y; - z += vec.z; + public Vector3 set(Vector3 vec) { + return set(vec.x, vec.y, vec.z); + } + + public Vector3 set(double[] da) { + return set(da[0], da[1], da[2]); + } + + public Vector3 set(float[] fa) { + return set(fa[0], fa[1], fa[2]); + } + + public Vector3 add(double dx, double dy, double dz) { + x += dx; + y += dy; + z += dz; return this; } @@ -178,36 +159,41 @@ public Vector3 add(double d) { return add(d, d, d); } - public Vector3 sub(Vector3 vec) { - return subtract(vec); + public Vector3 add(Vector3 vec) { + return add(vec.x, vec.y, vec.z); } - public Vector3 subtract(Vector3 vec) { - x -= vec.x; - y -= vec.y; - z -= vec.z; - return this; + public Vector3 add(BlockPos pos) { + return add(pos.getX(), pos.getY(), pos.getZ()); } - public Vector3 negate(Vector3 vec) { - x = -x; - y = -y; - z = -z; + public Vector3 subtract(double dx, double dy, double dz) { + x -= dx; + y -= dy; + z -= dz; return this; } - public Vector3 multiply(double d) { - x *= d; - y *= d; - z *= d; - return this; + public Vector3 subtract(double d) { + return subtract(d, d, d); } - public Vector3 multiply(Vector3 f) { - x *= f.x; - y *= f.y; - z *= f.z; - return this; + public Vector3 subtract(Vector3 vec) { + return subtract(vec.x, vec.y, vec.z); + } + + public Vector3 subtract(BlockPos pos) { + return subtract(pos.getX(), pos.getY(), pos.getZ()); + } + + @Deprecated //Use subtract + public Vector3 sub(Vector3 vec) { + return subtract(vec); + } + + @Deprecated //Use subtract + public Vector3 sub(BlockPos pos) { + return subtract(pos); } public Vector3 multiply(double fx, double fy, double fz) { @@ -217,6 +203,47 @@ public Vector3 multiply(double fx, double fy, double fz) { return this; } + public Vector3 multiply(double f) { + return multiply(f, f, f); + } + + public Vector3 multiply(Vector3 f) { + return multiply(f.x, f.y, f.z); + } + + public Vector3 divide(double fx, double fy, double fz) { + x /= fx; + y /= fy; + z /= fz; + return this; + } + + public Vector3 divide(double f) { + return divide(f, f, f); + } + + public Vector3 divide(Vector3 vec) { + return divide(vec.x, vec.y, vec.z); + } + + public Vector3 divide(BlockPos pos) { + return divide(pos.getX(), pos.getY(), pos.getZ()); + } + + public Vector3 floor() { + x = MathHelper.floor(x); + y = MathHelper.floor(y); + z = MathHelper.floor(z); + return this; + } + + public Vector3 celi() { + x = MathHelper.ceil(x); + y = MathHelper.ceil(y); + z = MathHelper.ceil(z); + return this; + } + public double mag() { return Math.sqrt(x * x + y * y + z * z); } @@ -225,6 +252,13 @@ public double magSquared() { return x * x + y * y + z * z; } + public Vector3 negate() { + x = -x; + y = -y; + z = -z; + return this; + } + public Vector3 normalize() { double d = mag(); if (d != 0) { @@ -233,9 +267,29 @@ public Vector3 normalize() { return this; } - public String toString() { - MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "Vector3(" + new BigDecimal(x, cont) + ", " + new BigDecimal(y, cont) + ", " + new BigDecimal(z, cont) + ")"; + public double dotProduct(double x1, double y1, double z1) { + return x1 * x + y1 * y + z1 * z; + } + + public double dotProduct(Vector3 vec) { + double d = vec.x * x + vec.y * y + vec.z * z; + + if (d > 1 && d < 1.00001) { + d = 1; + } else if (d < -1 && d > -1.00001) { + d = -1; + } + return d; + } + + public Vector3 crossProduct(Vector3 vec) { + double d = y * vec.z - z * vec.y; + double d1 = z * vec.x - x * vec.z; + double d2 = x * vec.y - y * vec.x; + x = d; + y = d1; + z = d2; + return this; } public Vector3 perpendicular() { @@ -272,6 +326,22 @@ public Vector3 yCrossProduct() { return this; } + public double scalarProject(Vector3 b) { + double l = b.mag(); + return l == 0 ? 0 : dotProduct(b) / l; + } + + public Vector3 project(Vector3 b) { + double l = b.magSquared(); + if (l == 0) { + set(0, 0, 0); + return this; + } + double m = dotProduct(b) / l; + set(b).multiply(m); + return this; + } + public Vector3 rotate(double angle, Vector3 axis) { Quat.aroundAxis(axis.copy().normalize(), angle).rotate(this); return this; @@ -282,37 +352,10 @@ public Vector3 rotate(Quat rotator) { return this; } - public Vec3 vec3() { - return new Vec3(x, y, z); - } - public double angle(Vector3 vec) { return Math.acos(copy().normalize().dotProduct(vec.copy().normalize())); } - public boolean isZero() { - return x == 0 && y == 0 && z == 0; - } - - public boolean isAxial() { - return x == 0 ? (y == 0 || z == 0) : (y == 0 && z == 0); - } - - @SideOnly(Side.CLIENT) - public Vector3f vector3f() { - return new Vector3f((float) x, (float) y, (float) z); - } - - @SideOnly(Side.CLIENT) - public Vector4f vector4f() { - return new Vector4f((float) x, (float) y, (float) z, 1); - } - - @SideOnly(Side.CLIENT) - public void glVertex() { - GL11.glVertex3d(x, y, z); - } - public Vector3 YZintercept(Vector3 end, double px) { double dx = end.x - x; double dy = end.y - y; @@ -385,30 +428,46 @@ public Vector3 XYintercept(Vector3 end, double pz) { return this; } - public Vector3 negate() { - x = -x; - y = -y; - z = -z; - return this; + public boolean isZero() { + return x == 0 && y == 0 && z == 0; } - public Translation translation() { - return new Translation(this); + public boolean isAxial() { + return x == 0 ? (y == 0 || z == 0) : (y == 0 && z == 0); } - public double scalarProject(Vector3 b) { - double l = b.mag(); - return l == 0 ? 0 : dotProduct(b) / l; + public double getSide(int side) { + switch (side) { + case 0: + case 1: + return y; + case 2: + case 3: + return z; + case 4: + case 5: + return x; + } + throw new IndexOutOfBoundsException("Switch Falloff"); } - public Vector3 project(Vector3 b) { - double l = b.magSquared(); - if (l == 0) { - set(0, 0, 0); - return this; + public Vector3 setSide(int s, double v) { + switch (s) { + case 0: + case 1: + y = v; + break; + case 2: + case 3: + z = v; + break; + case 4: + case 5: + x = v; + break; + default: + throw new IndexOutOfBoundsException("Switch Falloff"); } - double m = dotProduct(b) / l; - set(b).multiply(m); return this; } @@ -427,9 +486,20 @@ public boolean equals(Object o) { * @return true if this is equal to v within +-1E-5 */ public boolean equalsT(Vector3 v) { - return MathHelper.between(x - 1E-5, v.x, x + 1E-5) && - MathHelper.between(y - 1E-5, v.y, y + 1E-5) && - MathHelper.between(z - 1E-5, v.z, z + 1E-5); + return MathHelper.between(x - 1E-5, v.x, x + 1E-5) && MathHelper.between(y - 1E-5, v.y, y + 1E-5) && MathHelper.between(z - 1E-5, v.z, z + 1E-5); + } + + public Vector3 copy() { + return new Vector3(this); + } + + public String toString() { + MathContext cont = new MathContext(4, RoundingMode.HALF_UP); + return "Vector3(" + new BigDecimal(x, cont) + ", " + new BigDecimal(y, cont) + ", " + new BigDecimal(z, cont) + ")"; + } + + public Translation translation() { + return new Translation(this); } public Vector3 apply(Transformation t) { diff --git a/dependencies/main/java/codechicken/lib/render/Vertex5.java b/dependencies/main/java/codechicken/lib/vec/Vertex5.java similarity index 84% rename from dependencies/main/java/codechicken/lib/render/Vertex5.java rename to dependencies/main/java/codechicken/lib/vec/Vertex5.java index 3363ac5936..9f759ac923 100644 --- a/dependencies/main/java/codechicken/lib/render/Vertex5.java +++ b/dependencies/main/java/codechicken/lib/vec/Vertex5.java @@ -1,16 +1,15 @@ -package codechicken.lib.render; +package codechicken.lib.vec; -import codechicken.lib.render.uv.UV; -import codechicken.lib.render.uv.UVTransformation; import codechicken.lib.util.Copyable; -import codechicken.lib.vec.Transformation; -import codechicken.lib.vec.Vector3; +import codechicken.lib.vec.uv.UV; +import codechicken.lib.vec.uv.UVTransformation; import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; public class Vertex5 implements Copyable { + public Vector3 vec; public UV uv; @@ -63,8 +62,7 @@ public Vertex5 copy() { public String toString() { MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "Vertex: (" + new BigDecimal(vec.x, cont) + ", " + new BigDecimal(vec.y, cont) + ", " + new BigDecimal(vec.z, cont) + ") " + - "(" + new BigDecimal(uv.u, cont) + ", " + new BigDecimal(uv.v, cont) + ") (" + uv.tex + ")"; + return "Vertex: (" + new BigDecimal(vec.x, cont) + ", " + new BigDecimal(vec.y, cont) + ", " + new BigDecimal(vec.z, cont) + ") " + "(" + new BigDecimal(uv.u, cont) + ", " + new BigDecimal(uv.v, cont) + ") (" + uv.tex + ")"; } public Vertex5 apply(Transformation t) { diff --git a/dependencies/main/java/codechicken/lib/render/uv/IconTransformation.java b/dependencies/main/java/codechicken/lib/vec/uv/IconTransformation.java similarity index 74% rename from dependencies/main/java/codechicken/lib/render/uv/IconTransformation.java rename to dependencies/main/java/codechicken/lib/vec/uv/IconTransformation.java index 721daef13f..a06d97927a 100644 --- a/dependencies/main/java/codechicken/lib/render/uv/IconTransformation.java +++ b/dependencies/main/java/codechicken/lib/vec/uv/IconTransformation.java @@ -1,15 +1,23 @@ -package codechicken.lib.render.uv; +package codechicken.lib.vec.uv; +import codechicken.lib.render.CCRenderState; import codechicken.lib.vec.IrreversibleTransformationException; import net.minecraft.client.renderer.texture.TextureAtlasSprite; public class IconTransformation extends UVTransformation { + public TextureAtlasSprite icon; public IconTransformation(TextureAtlasSprite icon) { this.icon = icon; } + @Override + public void operate(CCRenderState state) { + super.operate(state); + state.sprite = icon; + } + @Override public void apply(UV uv) { uv.u = icon.getInterpolatedU(uv.u * 16); diff --git a/dependencies/main/java/codechicken/lib/vec/uv/IconVertexRangeUVTransform.java b/dependencies/main/java/codechicken/lib/vec/uv/IconVertexRangeUVTransform.java new file mode 100644 index 0000000000..11b94e292c --- /dev/null +++ b/dependencies/main/java/codechicken/lib/vec/uv/IconVertexRangeUVTransform.java @@ -0,0 +1,112 @@ +package codechicken.lib.vec.uv; + +import codechicken.lib.math.MathHelper; +import codechicken.lib.render.CCRenderState; +import codechicken.lib.util.TripleABC; +import codechicken.lib.vec.IrreversibleTransformationException; +import com.google.common.collect.ImmutableList; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; + +import java.util.LinkedList; +import java.util.List; + +/** + * Created by covers1624 on 8/29/2016. + * This UVTransform is used to assign "reserved" vertex indexes for an icon transform. + */ +public class IconVertexRangeUVTransform extends UVTransformation { + + private final ImmutableList> transformMap; + + private IconVertexRangeUVTransform(List> transformMap) { + this.transformMap = ImmutableList.copyOf(transformMap); + } + + /** + * Creates a new Builder for the IconVertexRangeUVTransform. + * + * @return The Builder. + */ + public static Builder builder() { + return new Builder(); + } + + @Override + public void operate(CCRenderState state) { + UV uv = state.vert.uv; + int index = state.vertexIndex; + TextureAtlasSprite sprite = getSpriteForVertexIndex(index); + if (sprite == null) { + return; + } + uv.u = sprite.getInterpolatedU(uv.u * 16); + uv.v = sprite.getInterpolatedV(uv.v * 16); + state.sprite = getSpriteForVertexIndex(state.vertexIndex); + } + + @Override + public void apply(UV uv) { + //We override operate as we need CCRS access. + } + + @Override + public UVTransformation inverse() { + throw new IrreversibleTransformationException(this); + } + + /** + * Retrieves a TextureAtlasSprite from the internal map based on a vertex index. + * + * @param index The vertex index. + * @return Returns the Icon, Null if no transform for the vertex index. + */ + public TextureAtlasSprite getSpriteForVertexIndex(int index) { + for (TripleABC entry : transformMap) { + if (MathHelper.between(entry.getA(), index, entry.getB())) { + return entry.getC(); + } + } + return null; + } + + /** + * Builds a IconVertexRangeUVTransform. + */ + public static class Builder { + + private LinkedList> transformMap; + + private Builder() { + transformMap = new LinkedList>(); + } + + /** + * Builds the IconVertexRangeUVTransform, Should be safe to call this more than once. + * + * @return The IconVertexRangeUVTransform. + */ + public IconVertexRangeUVTransform build() { + return new IconVertexRangeUVTransform(transformMap); + } + + /** + * Reserves a range for a specific transform. + * + * @param start The start index to reserve. + * @param end The end vertex to reserve. + * @param sprite The sprite to transform to in the range. + * @return The same instance of the builder. + * @throws IllegalArgumentException Thrown if the specified vertex range is already reserved. + */ + public Builder addTransform(int start, int end, TextureAtlasSprite sprite) { + for (TripleABC entry : transformMap) { + if (MathHelper.between(entry.getA(), start, entry.getB()) || MathHelper.between(entry.getA(), end, entry.getB())) { + throw new IllegalArgumentException("Unable to have overlapping sprite transforms!"); + } + } + transformMap.add(new TripleABC(start, end, sprite)); + return this; + } + + } +} diff --git a/dependencies/main/java/codechicken/lib/render/uv/MultiIconTransformation.java b/dependencies/main/java/codechicken/lib/vec/uv/MultiIconTransformation.java similarity index 67% rename from dependencies/main/java/codechicken/lib/render/uv/MultiIconTransformation.java rename to dependencies/main/java/codechicken/lib/vec/uv/MultiIconTransformation.java index 439d392a66..77263e46a2 100644 --- a/dependencies/main/java/codechicken/lib/render/uv/MultiIconTransformation.java +++ b/dependencies/main/java/codechicken/lib/vec/uv/MultiIconTransformation.java @@ -1,18 +1,27 @@ -package codechicken.lib.render.uv; +package codechicken.lib.vec.uv; +import codechicken.lib.render.CCRenderState; import codechicken.lib.vec.IrreversibleTransformationException; import net.minecraft.client.renderer.texture.TextureAtlasSprite; public class MultiIconTransformation extends UVTransformation { + public TextureAtlasSprite[] icons; + private TextureAtlasSprite icon; public MultiIconTransformation(TextureAtlasSprite... icons) { this.icons = icons; } + @Override + public void operate(CCRenderState state) { + super.operate(state); + state.sprite = icon; + } + @Override public void apply(UV uv) { - TextureAtlasSprite icon = icons[uv.tex % icons.length]; + icon = icons[uv.tex % icons.length]; uv.u = icon.getInterpolatedU(uv.u * 16); uv.v = icon.getInterpolatedV(uv.v * 16); } diff --git a/dependencies/main/java/codechicken/lib/vec/uv/ScaledIconTransformation.java b/dependencies/main/java/codechicken/lib/vec/uv/ScaledIconTransformation.java new file mode 100644 index 0000000000..c339b6be78 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/vec/uv/ScaledIconTransformation.java @@ -0,0 +1,29 @@ +package codechicken.lib.vec.uv; + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; + +public class ScaledIconTransformation extends IconTransformation { + + double su = 0.0F; + double sv = 0.0F; + + public ScaledIconTransformation(TextureAtlasSprite icon) { + + super(icon); + } + + public ScaledIconTransformation(TextureAtlasSprite icon, double scaleu, double scalev) { + + super(icon); + + su = scaleu; + sv = scalev; + } + + @Override + public void apply(UV texcoord) { + + texcoord.u = icon.getInterpolatedU(texcoord.u % 2 * 16) + su * (icon.getMaxU() - icon.getMinU()); + texcoord.v = icon.getInterpolatedV(texcoord.v % 2 * 16) + sv * (icon.getMaxV() - icon.getMinV()); + } +} diff --git a/dependencies/main/java/codechicken/lib/render/uv/UV.java b/dependencies/main/java/codechicken/lib/vec/uv/UV.java similarity index 97% rename from dependencies/main/java/codechicken/lib/render/uv/UV.java rename to dependencies/main/java/codechicken/lib/vec/uv/UV.java index d3538931d4..86e21daa63 100644 --- a/dependencies/main/java/codechicken/lib/render/uv/UV.java +++ b/dependencies/main/java/codechicken/lib/vec/uv/UV.java @@ -1,4 +1,4 @@ -package codechicken.lib.render.uv; +package codechicken.lib.vec.uv; import codechicken.lib.util.Copyable; @@ -7,6 +7,7 @@ import java.math.RoundingMode; public class UV implements Copyable { + public double u; public double v; public int tex; @@ -77,4 +78,4 @@ public boolean equals(Object o) { UV uv = (UV) o; return u == uv.u && v == uv.v; } -} \ No newline at end of file +} diff --git a/dependencies/main/java/codechicken/lib/render/uv/UVRotation.java b/dependencies/main/java/codechicken/lib/vec/uv/UVRotation.java similarity index 97% rename from dependencies/main/java/codechicken/lib/render/uv/UVRotation.java rename to dependencies/main/java/codechicken/lib/vec/uv/UVRotation.java index 20ae698e76..cc5747a0eb 100644 --- a/dependencies/main/java/codechicken/lib/render/uv/UVRotation.java +++ b/dependencies/main/java/codechicken/lib/vec/uv/UVRotation.java @@ -1,4 +1,4 @@ -package codechicken.lib.render.uv; +package codechicken.lib.vec.uv; import codechicken.lib.math.MathHelper; @@ -7,6 +7,7 @@ import java.math.RoundingMode; public class UVRotation extends UVTransformation { + public double angle; /** diff --git a/dependencies/main/java/codechicken/lib/render/uv/UVScale.java b/dependencies/main/java/codechicken/lib/vec/uv/UVScale.java similarity index 95% rename from dependencies/main/java/codechicken/lib/render/uv/UVScale.java rename to dependencies/main/java/codechicken/lib/vec/uv/UVScale.java index db229ec541..3ce0e0c721 100644 --- a/dependencies/main/java/codechicken/lib/render/uv/UVScale.java +++ b/dependencies/main/java/codechicken/lib/vec/uv/UVScale.java @@ -1,10 +1,11 @@ -package codechicken.lib.render.uv; +package codechicken.lib.vec.uv; import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; public class UVScale extends UVTransformation { + double su; double sv; diff --git a/dependencies/main/java/codechicken/lib/render/uv/UVTransformation.java b/dependencies/main/java/codechicken/lib/vec/uv/UVTransformation.java similarity index 71% rename from dependencies/main/java/codechicken/lib/render/uv/UVTransformation.java rename to dependencies/main/java/codechicken/lib/vec/uv/UVTransformation.java index f7f7b04860..317e347fea 100644 --- a/dependencies/main/java/codechicken/lib/render/uv/UVTransformation.java +++ b/dependencies/main/java/codechicken/lib/vec/uv/UVTransformation.java @@ -1,12 +1,14 @@ -package codechicken.lib.render.uv; +package codechicken.lib.vec.uv; import codechicken.lib.render.CCRenderState; +import codechicken.lib.render.pipeline.IVertexOperation; import codechicken.lib.vec.ITransformation; /** * Abstract supertype for any UV transformation */ -public abstract class UVTransformation extends ITransformation implements CCRenderState.IVertexOperation { +public abstract class UVTransformation extends ITransformation implements IVertexOperation { + public static final int operationIndex = CCRenderState.registerOperation(); public UVTransformation at(UV point) { @@ -18,13 +20,14 @@ public UVTransformationList with(UVTransformation t) { } @Override - public boolean load() { + public boolean load(CCRenderState state) { return !isRedundant(); } @Override - public void operate() { - apply(CCRenderState.vert.uv); + public void operate(CCRenderState state) { + apply(state.vert.uv); + state.sprite = null; } @Override diff --git a/dependencies/main/java/codechicken/lib/render/uv/UVTransformationList.java b/dependencies/main/java/codechicken/lib/vec/uv/UVTransformationList.java similarity index 98% rename from dependencies/main/java/codechicken/lib/render/uv/UVTransformationList.java rename to dependencies/main/java/codechicken/lib/vec/uv/UVTransformationList.java index c7df9d333a..0bee6fa5c1 100644 --- a/dependencies/main/java/codechicken/lib/render/uv/UVTransformationList.java +++ b/dependencies/main/java/codechicken/lib/vec/uv/UVTransformationList.java @@ -1,9 +1,10 @@ -package codechicken.lib.render.uv; +package codechicken.lib.vec.uv; import java.util.ArrayList; import java.util.Iterator; public class UVTransformationList extends UVTransformation { + private ArrayList transformations = new ArrayList(); public UVTransformationList(UVTransformation... transforms) { diff --git a/dependencies/main/java/codechicken/lib/render/uv/UVTranslation.java b/dependencies/main/java/codechicken/lib/vec/uv/UVTranslation.java similarity index 97% rename from dependencies/main/java/codechicken/lib/render/uv/UVTranslation.java rename to dependencies/main/java/codechicken/lib/vec/uv/UVTranslation.java index ac4b6b0ed5..728867c255 100644 --- a/dependencies/main/java/codechicken/lib/render/uv/UVTranslation.java +++ b/dependencies/main/java/codechicken/lib/vec/uv/UVTranslation.java @@ -1,4 +1,4 @@ -package codechicken.lib.render.uv; +package codechicken.lib.vec.uv; import codechicken.lib.math.MathHelper; @@ -7,6 +7,7 @@ import java.math.RoundingMode; public class UVTranslation extends UVTransformation { + public double du; public double dv; diff --git a/dependencies/main/java/codechicken/lib/world/ChunkExtension.java b/dependencies/main/java/codechicken/lib/world/ChunkExtension.java index 6c478ea6fc..28192ed750 100644 --- a/dependencies/main/java/codechicken/lib/world/ChunkExtension.java +++ b/dependencies/main/java/codechicken/lib/world/ChunkExtension.java @@ -3,14 +3,15 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.Packet; -import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.util.math.ChunkPos; import net.minecraft.world.chunk.Chunk; import java.util.HashSet; public abstract class ChunkExtension { + public final Chunk chunk; - public final ChunkCoordIntPair coord; + public final ChunkPos coord; public final WorldExtension world; public HashSet watchedPlayers; @@ -35,7 +36,7 @@ public void unload() { public final void sendPacketToPlayers(Packet packet) { for (EntityPlayerMP player : watchedPlayers) { - player.playerNetServerHandler.sendPacket(packet); + player.connection.sendPacket(packet); } } @@ -65,8 +66,6 @@ public int hashCode() { @Override public boolean equals(Object o) { - return (o instanceof ChunkExtension && ((ChunkExtension) o).coord.equals(coord)) || - (o instanceof ChunkCoordIntPair && coord.equals(o)) || - (o instanceof Long && (Long) o == (((long) coord.chunkXPos) << 32 | coord.chunkZPos)); + return (o instanceof ChunkExtension && ((ChunkExtension) o).coord.equals(coord)) || (o instanceof ChunkPos && coord.equals(o)) || (o instanceof Long && (Long) o == (((long) coord.chunkXPos) << 32 | coord.chunkZPos)); } } diff --git a/dependencies/main/java/codechicken/lib/world/IChunkLoadTile.java b/dependencies/main/java/codechicken/lib/world/IChunkLoadTile.java index 8e53c7692f..459086f919 100644 --- a/dependencies/main/java/codechicken/lib/world/IChunkLoadTile.java +++ b/dependencies/main/java/codechicken/lib/world/IChunkLoadTile.java @@ -7,5 +7,6 @@ * You could easily implement this in your own mod, but providing it here reduces the number of times the chunkTileEntityMap needs to be iterated */ public interface IChunkLoadTile { - public void onChunkLoad(); + + void onChunkLoad(); } diff --git a/dependencies/main/java/codechicken/lib/world/TileChunkLoadHook.java b/dependencies/main/java/codechicken/lib/world/TileChunkLoadHook.java index 3e48a94bf3..0e52a2380f 100644 --- a/dependencies/main/java/codechicken/lib/world/TileChunkLoadHook.java +++ b/dependencies/main/java/codechicken/lib/world/TileChunkLoadHook.java @@ -9,6 +9,7 @@ import java.util.List; public class TileChunkLoadHook { + private static boolean init; public static void init() { @@ -22,7 +23,7 @@ public static void init() { @SubscribeEvent public void onChunkLoad(ChunkEvent.Load event) { - List list = new ArrayList(event.getChunk().chunkTileEntityMap.values()); + List list = new ArrayList(event.getChunk().getTileEntityMap().values()); for (TileEntity t : list) { if (t instanceof IChunkLoadTile) { ((IChunkLoadTile) t).onChunkLoad(); diff --git a/dependencies/main/java/codechicken/lib/world/WorldExtension.java b/dependencies/main/java/codechicken/lib/world/WorldExtension.java index b84a437f1f..c44a0afb40 100644 --- a/dependencies/main/java/codechicken/lib/world/WorldExtension.java +++ b/dependencies/main/java/codechicken/lib/world/WorldExtension.java @@ -2,13 +2,14 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import java.util.HashMap; public abstract class WorldExtension { + public final World world; public HashMap chunkMap = new HashMap(); @@ -36,19 +37,31 @@ protected final void addChunk(ChunkExtension extension) { } protected final void loadChunk(Chunk chunk) { - chunkMap.get(chunk).load(); + ChunkExtension extension = chunkMap.get(chunk); + if (extension != null) { + extension.load(); + } } protected final void unloadChunk(Chunk chunk) { - chunkMap.get(chunk).unload(); + ChunkExtension extension = chunkMap.get(chunk); + if (extension != null) { + extension.unload(); + } } protected final void loadChunkData(Chunk chunk, NBTTagCompound tag) { - chunkMap.get(chunk).loadData(tag); + ChunkExtension extension = chunkMap.get(chunk); + if (extension != null) { + extension.loadData(tag); + } } protected final void saveChunkData(Chunk chunk, NBTTagCompound tag) { - chunkMap.get(chunk).saveData(tag); + ChunkExtension extension = chunkMap.get(chunk); + if (extension != null) { + extension.saveData(tag); + } } protected final void remChunk(Chunk chunk) { @@ -56,7 +69,10 @@ protected final void remChunk(Chunk chunk) { } protected final void watchChunk(Chunk chunk, EntityPlayerMP player) { - chunkMap.get(chunk).watchPlayer(player); + ChunkExtension extension = chunkMap.get(chunk); + if (extension != null) { + extension.watchPlayer(player); + } } protected final void unwatchChunk(Chunk chunk, EntityPlayerMP player) { @@ -67,7 +83,10 @@ protected final void unwatchChunk(Chunk chunk, EntityPlayerMP player) { } protected final void sendChunkUpdates(Chunk chunk) { - chunkMap.get(chunk).sendUpdatePackets(); + ChunkExtension extension = chunkMap.get(chunk); + if (extension != null) { + extension.sendUpdatePackets(); + } } public boolean containsChunk(Chunk chunk) { diff --git a/dependencies/main/java/codechicken/lib/world/WorldExtensionInstantiator.java b/dependencies/main/java/codechicken/lib/world/WorldExtensionInstantiator.java index fbd93ead01..38a4582aa9 100644 --- a/dependencies/main/java/codechicken/lib/world/WorldExtensionInstantiator.java +++ b/dependencies/main/java/codechicken/lib/world/WorldExtensionInstantiator.java @@ -4,6 +4,7 @@ import net.minecraft.world.chunk.Chunk; public abstract class WorldExtensionInstantiator { + public int instantiatorID; public abstract WorldExtension createWorldExtension(World world); diff --git a/dependencies/main/java/codechicken/lib/world/WorldExtensionManager.java b/dependencies/main/java/codechicken/lib/world/WorldExtensionManager.java index 585016d81a..c28645b6ba 100644 --- a/dependencies/main/java/codechicken/lib/world/WorldExtensionManager.java +++ b/dependencies/main/java/codechicken/lib/world/WorldExtensionManager.java @@ -3,7 +3,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.EmptyChunk; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.ChunkDataEvent; import net.minecraftforge.event.world.ChunkEvent; @@ -19,63 +18,65 @@ import java.util.HashMap; public class WorldExtensionManager { + public static class WorldExtensionEventHandler { + @SubscribeEvent public void onChunkDataLoad(ChunkDataEvent.Load event) { - if (!worldMap.containsKey(event.world)) { - WorldExtensionManager.onWorldLoad(event.world); + if (!worldMap.containsKey(event.getWorld())) { + WorldExtensionManager.onWorldLoad(event.getWorld()); } - createChunkExtension(event.world, event.getChunk()); + createChunkExtension(event.getWorld(), event.getChunk()); - for (WorldExtension extension : worldMap.get(event.world)) { + for (WorldExtension extension : worldMap.get(event.getWorld())) { extension.loadChunkData(event.getChunk(), event.getData()); } } @SubscribeEvent public void onChunkDataSave(ChunkDataEvent.Save event) { - for (WorldExtension extension : worldMap.get(event.world)) { + for (WorldExtension extension : worldMap.get(event.getWorld())) { extension.saveChunkData(event.getChunk(), event.getData()); } - if (!event.getChunk().isChunkLoaded) { - removeChunk(event.world, event.getChunk()); + if (!event.getChunk().isLoaded()) { + removeChunk(event.getWorld(), event.getChunk()); } } @SubscribeEvent public void onChunkLoad(ChunkEvent.Load event) { - if (!worldMap.containsKey(event.world)) { - WorldExtensionManager.onWorldLoad(event.world); + if (!worldMap.containsKey(event.getWorld())) { + WorldExtensionManager.onWorldLoad(event.getWorld()); } - createChunkExtension(event.world, event.getChunk()); + createChunkExtension(event.getWorld(), event.getChunk()); - for (WorldExtension extension : worldMap.get(event.world)) { + for (WorldExtension extension : worldMap.get(event.getWorld())) { extension.loadChunk(event.getChunk()); } } @SubscribeEvent public void onChunkUnLoad(ChunkEvent.Unload event) { - if (event.getChunk() instanceof EmptyChunk) { + if (event.getChunk().isEmpty()) { return; } - - for (WorldExtension extension : worldMap.get(event.world)) { + //TODO Maybe gate against worldMap.get returning null. Some dimension may be doing stupid things. + for (WorldExtension extension : worldMap.get(event.getWorld())) { extension.unloadChunk(event.getChunk()); } - if (event.world.isRemote) { - removeChunk(event.world, event.getChunk()); + if (event.getWorld().isRemote) { + removeChunk(event.getWorld(), event.getChunk()); } } @SubscribeEvent public void onWorldSave(WorldEvent.Save event) { - if (worldMap.containsKey(event.world)) { - for (WorldExtension extension : worldMap.get(event.world)) { + if (worldMap.containsKey(event.getWorld())) { + for (WorldExtension extension : worldMap.get(event.getWorld())) { extension.save(); } } @@ -83,16 +84,16 @@ public void onWorldSave(WorldEvent.Save event) { @SubscribeEvent public void onWorldLoad(WorldEvent.Load event) { - if (!worldMap.containsKey(event.world)) { - WorldExtensionManager.onWorldLoad(event.world); + if (!worldMap.containsKey(event.getWorld())) { + WorldExtensionManager.onWorldLoad(event.getWorld()); } } @SubscribeEvent public void onWorldUnLoad(WorldEvent.Unload event) { - if (worldMap.containsKey(event.world))//because force closing unloads a world twice + if (worldMap.containsKey(event.getWorld()))//because force closing unloads a world twice { - for (WorldExtension extension : worldMap.remove(event.world)) { + for (WorldExtension extension : worldMap.remove(event.getWorld())) { extension.unload(); } } @@ -100,23 +101,23 @@ public void onWorldUnLoad(WorldEvent.Unload event) { @SubscribeEvent public void onChunkWatch(Watch event) { - Chunk chunk = event.player.worldObj.getChunkFromChunkCoords(event.chunk.chunkXPos, event.chunk.chunkZPos); - for (WorldExtension extension : worldMap.get(event.player.worldObj)) { - extension.watchChunk(chunk, event.player); + Chunk chunk = event.getPlayer().worldObj.getChunkFromChunkCoords(event.getChunk().chunkXPos, event.getChunk().chunkZPos); + for (WorldExtension extension : worldMap.get(event.getPlayer().worldObj)) { + extension.watchChunk(chunk, event.getPlayer()); } } @SubscribeEvent - @SideOnly(Side.CLIENT) + @SideOnly (Side.CLIENT) public void onChunkUnWatch(UnWatch event) { - Chunk chunk = event.player.worldObj.getChunkFromChunkCoords(event.chunk.chunkXPos, event.chunk.chunkZPos); - for (WorldExtension extension : worldMap.get(event.player.worldObj)) { - extension.unwatchChunk(chunk, event.player); + Chunk chunk = event.getPlayer().worldObj.getChunkFromChunkCoords(event.getChunk().chunkXPos, event.getChunk().chunkZPos); + for (WorldExtension extension : worldMap.get(event.getPlayer().worldObj)) { + extension.unwatchChunk(chunk, event.getPlayer()); } } @SubscribeEvent - @SideOnly(Side.CLIENT) + @SideOnly (Side.CLIENT) public void clientTick(TickEvent.ClientTickEvent event) { World world = Minecraft.getMinecraft().theWorld; if (worldMap.containsKey(world)) { @@ -157,7 +158,6 @@ public static void registerWorldExtension(WorldExtensionInstantiator init) { private static void init() { initialised = true; MinecraftForge.EVENT_BUS.register(new WorldExtensionEventHandler()); - //FMLCommonHandler.instance().bus().register(new WorldExtensionEventHandler()); } private static HashMap worldMap = new HashMap(); diff --git a/dependencies/main/java/codechicken/lib/world/placement/BlockPlacementBatcher.java b/dependencies/main/java/codechicken/lib/world/placement/BlockPlacementBatcher.java new file mode 100644 index 0000000000..8141eca48f --- /dev/null +++ b/dependencies/main/java/codechicken/lib/world/placement/BlockPlacementBatcher.java @@ -0,0 +1,184 @@ +package codechicken.lib.world.placement; + +import codechicken.lib.world.placement.lighting.LightingCalcEntry; +import codechicken.lib.world.placement.lighting.LightingCalcEntryBuilder; +import gnu.trove.set.hash.THashSet; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.network.play.server.SPacketChunkData; +import net.minecraft.server.management.PlayerChunkMap; +import net.minecraft.server.management.PlayerChunkMapEntry; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.WorldServer; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.Chunk.EnumCreateEntityType; +import net.minecraft.world.chunk.storage.ExtendedBlockStorage; + +import java.util.LinkedList; + +/** + * Created by covers1624 on 8/1/2016. + * TODO, Rethink this entire system, we need to cache blocks for the delayed lighting calculation. + */ +public class BlockPlacementBatcher { + + private final WorldServer serverWorld; + private THashSet modifiedChunks = new THashSet(); + private LinkedList blockLightingUpdates = new LinkedList(); + + public BlockPlacementBatcher(WorldServer serverWorld) { + this.serverWorld = serverWorld; + } + + public void setBlockState(BlockPos pos, IBlockState newState) { + if (!hasBlockStorage(pos) && newState.getBlock() == Blocks.AIR) { + return; + } + IBlockState oldState = getChunk(pos).getBlockState(pos); + if (oldState == newState) { + return; + } + setRecalcPrecipitationHeightMap(pos); + LightingCalcEntryBuilder builder = new LightingCalcEntryBuilder(); + builder.setDimension(serverWorld.provider.getDimension()); + builder.setBasePos(pos); + builder.setOldState(oldState); + builder.setNewState(newState); + builder.setOldLightOpacity(oldState.getLightOpacity(serverWorld, pos)); + + createBlockStorageIfNeeded(pos, builder); + ExtendedBlockStorage storage = getBlockStorage(pos); + Chunk chunk = getChunk(pos); + storage.set(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15, newState); + + fireBlockBreak(pos, oldState, newState); + tileEntityRemoveCheck(pos, oldState, newState); + + builder.setNewLightOpacity(newState.getLightOpacity(serverWorld, pos)); + builder.setSkyLight(chunk.getLightFor(EnumSkyBlock.SKY, pos)); + builder.setBlockLight(chunk.getLightFor(EnumSkyBlock.BLOCK, pos)); + + fireBlockPlace(pos, oldState, newState); + tileEntityPlaceCheck(pos, newState); + + setChunkModified(pos); + blockLightingUpdates.add(builder.build()); + } + + public void setChunkModified(BlockPos blockPos) { + Chunk chunk = getChunk(blockPos); + setChunkModified(chunk); + } + + public void setChunkModified(Chunk chunk) { + modifiedChunks.add(chunk); + } + + private Chunk getChunk(BlockPos pos) { + return serverWorld.getChunkFromChunkCoords(pos.getX() >> 4, pos.getZ() >> 4); + } + + private boolean hasBlockStorage(BlockPos pos) { + Chunk chunk = getChunk(pos); + return chunk.storageArrays[pos.getY() >> 4] != null; + } + + private ExtendedBlockStorage getBlockStorage(BlockPos pos) { + Chunk chunk = getChunk(pos); + return chunk.storageArrays[pos.getY() >> 4]; + } + + /** + * Creates a ExtendedBlockStorage for the given BlockPos if needed. + * + * @param pos Position to create a storage for. + * @param builder Lighting Calculation builder, can be null. + */ + private void createBlockStorageIfNeeded(BlockPos pos, LightingCalcEntryBuilder builder) { + Chunk chunk = getChunk(pos); + ExtendedBlockStorage storage = chunk.storageArrays[pos.getY() >> 4]; + if (storage == null) { + int height = chunk.heightMap[(pos.getZ() & 15) << 4 | (pos.getX() & 15)]; + storage = new ExtendedBlockStorage(pos.getY() >> 4 << 4, !serverWorld.provider.getHasNoSky()); + chunk.storageArrays[pos.getY() >> 4] = storage; + builder.setHeight(height); + if (builder != null && pos.getY() >= height) { + builder.setChunkHeightModified(); + } + } + } + + private void setRecalcPrecipitationHeightMap(BlockPos pos) { + Chunk chunk = getChunk(pos); + int i = (pos.getZ() & 15) << 4 | (pos.getX() & 15); + if (pos.getY() >= chunk.precipitationHeightMap[i] - 1) { + chunk.precipitationHeightMap[i] = -999; + } + } + + private void fireBlockBreak(BlockPos pos, IBlockState oldState, IBlockState newState) { + if (oldState.getBlock() != newState.getBlock()) { + oldState.getBlock().breakBlock(serverWorld, pos, oldState); + } + } + + private void fireBlockPlace(BlockPos pos, IBlockState oldState, IBlockState newState) { + if (oldState.getBlock() != newState.getBlock() && newState.getBlock().hasTileEntity(newState)) { + oldState.getBlock().onBlockAdded(serverWorld, pos, oldState); + } + } + + private void tileEntityRemoveCheck(BlockPos pos, IBlockState oldState, IBlockState newState) { + + TileEntity tileEntity = getChunk(pos).getTileEntity(pos, EnumCreateEntityType.CHECK); + if (tileEntity != null && tileEntity.shouldRefresh(serverWorld, pos, oldState, newState)) { + serverWorld.removeTileEntity(pos); + } + } + + private void tileEntityPlaceCheck(BlockPos pos, IBlockState newState) { + if (newState.getBlock().hasTileEntity(newState)) { + TileEntity tileEntity = getChunk(pos).getTileEntity(pos, EnumCreateEntityType.CHECK); + + if (tileEntity == null) { + tileEntity = newState.getBlock().createTileEntity(serverWorld, newState); + serverWorld.setTileEntity(pos, tileEntity); + } else { + tileEntity.updateContainingBlockInfo(); + } + } + } + + /** + * Call when finished placing blocks to que lighting and send chunk updates to the client. + */ + public void finish() { + for (Chunk chunk : modifiedChunks) { + PlayerChunkMap playerChunkMap = serverWorld.getPlayerChunkMap(); + if (playerChunkMap == null) { + return; + } + PlayerChunkMapEntry watcher = playerChunkMap.getEntry(chunk.xPosition, chunk.zPosition); + if (watcher != null) {//TODO Change chunk mask to only the sub chunks changed. + watcher.sendPacket(new SPacketChunkData(chunk, 65535)); + } + } + modifiedChunks.clear(); + BlockPlacementLightingManager.uploadToLightingQue(blockLightingUpdates); + blockLightingUpdates.clear(); + } + + public boolean isAirBlock(BlockPos pos) { + return serverWorld.isAirBlock(pos); + } + + public IBlockState getBlockState(BlockPos pos) { + ExtendedBlockStorage storage = getBlockStorage(pos); + if (storage == null) { + return Blocks.AIR.getDefaultState(); + } + return storage.get(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15); + } +} diff --git a/dependencies/main/java/codechicken/lib/world/placement/BlockPlacementLightingManager.java b/dependencies/main/java/codechicken/lib/world/placement/BlockPlacementLightingManager.java new file mode 100644 index 0000000000..3fe7a265df --- /dev/null +++ b/dependencies/main/java/codechicken/lib/world/placement/BlockPlacementLightingManager.java @@ -0,0 +1,93 @@ +package codechicken.lib.world.placement; + +import codechicken.lib.world.placement.lighting.LightingCalcEntry; +import net.minecraft.server.MinecraftServer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.WorldServer; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.FMLLog; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; +import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; + +import java.util.Iterator; +import java.util.LinkedList; + +/** + * Created by covers1624 on 8/1/2016. + */ +public class BlockPlacementLightingManager { + + private static final LinkedList lightingQue = new LinkedList(); + public static final int lightEntriesPerTick = Integer.parseInt(System.getProperty("ccl.lightingEntriesPerTic", "100")); + + static { + MinecraftForge.EVENT_BUS.register(new BlockPlacementLightingManager()); + } + + @SubscribeEvent + public void tickEvent(ServerTickEvent serverTick) { + if (serverTick.phase == Phase.START) { + if (!lightingQue.isEmpty()) { + synchronized (lightingQue) { + FMLLog.info("Que Size: " + lightingQue.size()); + Iterator iterator = lightingQue.iterator(); + int entriesProcessed = 0; + while (iterator.hasNext()) { + if (entriesProcessed >= lightEntriesPerTick) { + break; + } + LightingCalcEntry entry = iterator.next(); + if (entry == null) { + continue; + } + WorldServer world = getServer().worldServerForDimension(entry.dimension); + Chunk chunk = getChunk(world, entry.pos); + if (entry.chunkHeightModified) { + //FMLLog.info("GeneratingSkyLightMap in Chunk: X: %s, Z: %s", entry.pos.getX() >> 4, entry.pos.getX() >> 4); + chunk.generateSkylightMap(); + } else { + if (entry.newLightOpacity > 0) { + if (entry.pos.getY() >= entry.height) { + //FMLLog.info("RelightBlock"); + chunk.relightBlock(entry.pos.getX() & 15, entry.pos.getY() + 1, entry.pos.getZ() & 15); + } + } else if (entry.pos.getY() == entry.height - 1) { + //FMLLog.info("RelightBlock"); + chunk.relightBlock(entry.pos.getX() & 15, entry.pos.getY(), entry.pos.getZ() & 15); + } + + if (entry.newLightOpacity != entry.oldLightOpacity && (entry.newLightOpacity < entry.oldLightOpacity || entry.skyLight > 0 || entry.blockLight > 0)) { + //FMLLog.info("SkyLightOcclusion at: X: %s, Z: %s", entry.pos.getX() & 15, entry.pos.getX() & 15); + chunk.propagateSkylightOcclusion(entry.pos.getX() & 15, entry.pos.getZ() & 15); + } + } + entriesProcessed++; + iterator.remove(); + } + } + } + } + } + + private static MinecraftServer getServer() { + return FMLCommonHandler.instance().getMinecraftServerInstance(); + } + + public static void uploadToLightingQue(LinkedList lightingEntries) { + addEntries(lightingEntries); + } + + public static synchronized void addEntries(LinkedList entries) { + synchronized (lightingQue) { + lightingQue.addAll(entries); + } + } + + protected static Chunk getChunk(WorldServer world, BlockPos pos) { + return world.getChunkFromChunkCoords(pos.getX() >> 4, pos.getZ() >> 4); + } + +} diff --git a/dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntry.java b/dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntry.java new file mode 100644 index 0000000000..4b0f972b04 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntry.java @@ -0,0 +1,34 @@ +package codechicken.lib.world.placement.lighting; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.math.BlockPos; + +/** + * Created by covers1624 on 8/1/2016. + */ +public class LightingCalcEntry { + + public final int dimension; + public final BlockPos pos; + public final boolean chunkHeightModified; + public final IBlockState oldState; + public final IBlockState newState; + public final int oldLightOpacity; + public final int newLightOpacity; + public final int skyLight; + public final int blockLight; + public final int height; + + public LightingCalcEntry(int dimension, BlockPos pos, boolean chunkHeightModified, IBlockState oldState, IBlockState newState, int oldLightOpacity, int newLightOpacity, int skyLight, int blockLight, int height) { + this.dimension = dimension; + this.pos = pos; + this.chunkHeightModified = chunkHeightModified; + this.oldState = oldState; + this.newState = newState; + this.oldLightOpacity = oldLightOpacity; + this.newLightOpacity = newLightOpacity; + this.skyLight = skyLight; + this.blockLight = blockLight; + this.height = height; + } +} diff --git a/dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntryBuilder.java b/dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntryBuilder.java new file mode 100644 index 0000000000..ed72af7841 --- /dev/null +++ b/dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntryBuilder.java @@ -0,0 +1,65 @@ +package codechicken.lib.world.placement.lighting; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.math.BlockPos; + +/** + * Created by covers1624 on 8/1/2016. + */ +public class LightingCalcEntryBuilder { + + private int dimension; + private BlockPos pos; + private boolean chunkHeightModified = false; + private IBlockState oldState; + private IBlockState newState; + private int oldLightOpacity; + private int newLightOpacity; + private int skyLight; + private int blockLight; + private int height; + + public void setDimension(int dimension) { + this.dimension = dimension; + } + + public void setBasePos(BlockPos pos) { + this.pos = pos; + } + + public void setChunkHeightModified() { + chunkHeightModified = true; + } + + public void setOldState(IBlockState state) { + oldState = state; + } + + public void setNewState(IBlockState state) { + newState = state; + } + + public void setOldLightOpacity(int lightOpacity) { + oldLightOpacity = lightOpacity; + } + + public void setNewLightOpacity(int lightOpacity) { + newLightOpacity = lightOpacity; + } + + public void setSkyLight(int light) { + skyLight = light; + } + + public void setBlockLight(int light) { + blockLight = light; + } + + public void setHeight(int height) { + this.height = height; + } + + public LightingCalcEntry build() { + return new LightingCalcEntry(dimension, pos, chunkHeightModified, oldState, newState, oldLightOpacity, newLightOpacity, skyLight, blockLight, height); + } +} diff --git a/dependencies/main/java/codechicken/nei/ButtonCycled.java b/dependencies/main/java/codechicken/nei/ButtonCycled.java index 9827416552..bd963ca2c3 100644 --- a/dependencies/main/java/codechicken/nei/ButtonCycled.java +++ b/dependencies/main/java/codechicken/nei/ButtonCycled.java @@ -1,5 +1,7 @@ package codechicken.nei; +import codechicken.nei.widget.Button; + public abstract class ButtonCycled extends Button { @Override public Image getRenderIcon() { diff --git a/dependencies/main/java/codechicken/nei/ClientHandler.java b/dependencies/main/java/codechicken/nei/ClientHandler.java index e0cde6d093..7640e9153f 100644 --- a/dependencies/main/java/codechicken/nei/ClientHandler.java +++ b/dependencies/main/java/codechicken/nei/ClientHandler.java @@ -1,10 +1,11 @@ package codechicken.nei; -import codechicken.core.ClientUtils; -import codechicken.core.GuiModListScroll; import codechicken.lib.packet.PacketCustom; -import codechicken.nei.api.API; +import codechicken.lib.util.ClientUtils; import codechicken.nei.api.ItemInfo; +import codechicken.nei.config.KeyBindings; +import codechicken.nei.network.NEIClientPacketHandler; +import codechicken.nei.util.NEIClientUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.*; @@ -14,7 +15,6 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.CustomModLoadingErrorDisplayException; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; @@ -112,15 +112,18 @@ public static void preInit() { public static void init() { instance = new ClientHandler(); - GuiModListScroll.register("NotEnoughItems"); - PacketCustom.assignHandler(NEICPH.channel, new NEICPH()); - FMLCommonHandler.instance().bus().register(instance); + //GuiModListScroll.register("NotEnoughItems"); + PacketCustom.assignHandler(NEIClientPacketHandler.channel, new NEIClientPacketHandler()); + +// MinecraftForge.EVENT_BUS.register(new ContainerEventHandler()); MinecraftForge.EVENT_BUS.register(instance); ItemInfo.init(); - API.registerHighlightHandler(new DefaultHighlightHandler(), ItemInfo.Layout.HEADER); - HUDRenderer.load(); + //API.registerHighlightHandler(new DefaultHighlightHandler(), ItemInfo.Layout.HEADER); + //HUDRenderer.load(); WorldOverlayRenderer.load(); + + KeyBindings.register(); } @SubscribeEvent @@ -135,7 +138,7 @@ public void tickEvent(TickEvent.ClientTickEvent event) { NEIClientConfig.setHasSMPCounterPart(false); NEIClientConfig.setInternalEnabled(false); - if (!Minecraft.getMinecraft().isSingleplayer())//wait for server to initiate in singleplayer + if (!Minecraft.getMinecraft().isSingleplayer() && ClientUtils.inWorld())//wait for server to initiate in singleplayer { NEIClientConfig.loadWorld("remote/" + ClientUtils.getServerIP().replace(':', '~')); } @@ -159,7 +162,7 @@ public void tickEvent(TickEvent.ClientTickEvent event) { if (gui != lastGui) { if (gui instanceof GuiMainMenu) { lastworld = null; - } else if (gui instanceof GuiSelectWorld) { + } else if (gui instanceof GuiWorldSelection) { NEIClientConfig.reloadSaves(); } } @@ -168,15 +171,15 @@ public void tickEvent(TickEvent.ClientTickEvent event) { @SubscribeEvent public void tickEvent(TickEvent.RenderTickEvent event) { - if (event.phase == Phase.END && NEIClientConfig.isEnabled()) { - HUDRenderer.renderOverlay(); - } + //if (event.phase == Phase.END && NEIClientConfig.isEnabled()) { + //HUDRenderer.renderOverlay(); + //} } @SubscribeEvent public void renderLastEvent(RenderWorldLastEvent event) { if (NEIClientConfig.isEnabled()) { - WorldOverlayRenderer.render(event.partialTicks); + WorldOverlayRenderer.render(event.getPartialTicks()); } } diff --git a/dependencies/main/java/codechicken/nei/ContainerEnchantmentModifier.java b/dependencies/main/java/codechicken/nei/ContainerEnchantmentModifier.java index 9eac2a200b..731c7a7b39 100644 --- a/dependencies/main/java/codechicken/nei/ContainerEnchantmentModifier.java +++ b/dependencies/main/java/codechicken/nei/ContainerEnchantmentModifier.java @@ -1,6 +1,8 @@ package codechicken.nei; -import codechicken.lib.render.CCRenderState; +import codechicken.lib.texture.TextureUtils; +import codechicken.nei.network.NEIClientPacketHandler; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.enchantment.Enchantment; @@ -8,11 +10,10 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ContainerEnchantment; import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.ArrayList; @@ -154,27 +155,35 @@ public boolean clickButton(int mousex, int mousey, int button) { private void toggleSlotEnchantment(int slot) { EnchantmentHash e = slotEnchantment.get(slot); if (e.state == 2) { - NEICPH.sendModifyEnchantment(e.enchantment.effectId, 0, false); + NEIClientPacketHandler.sendModifyEnchantment(Enchantment.getEnchantmentID(e.enchantment), 0, false); e.state = 0; } else if (e.state == 1) { return; } else { - NEICPH.sendModifyEnchantment(e.enchantment.effectId, level, true); + NEIClientPacketHandler.sendModifyEnchantment(Enchantment.getEnchantmentID(e.enchantment), level, true); e.state = 2; } updateEnchantmentOptions(GuiEnchantmentModifier.validateEnchantments()); } + @Deprecated public boolean addEnchantment(int e, int level) { - if (e < Enchantment.enchantmentsList.length && Enchantment.enchantmentsList[e] != null) { - ((Slot) inventorySlots.get(0)).getStack().addEnchantment(Enchantment.enchantmentsList[e], level); + return addEnchantment(Enchantment.REGISTRY.getNameForObject(Enchantment.getEnchantmentByID(e)).toString(), level); + } + + public boolean addEnchantment(String enchantmentLocation, int level) { + Enchantment enchantment = Enchantment.getEnchantmentByLocation(enchantmentLocation); + if (enchantment != null) { + inventorySlots.get(0).getStack().addEnchantment(enchantment, level); return true; } return false; } + @Deprecated + //TODO String variant. public void removeEnchantment(int e) { - ItemStack stack = ((Slot) inventorySlots.get(0)).getStack(); + ItemStack stack = inventorySlots.get(0).getStack(); NBTTagList nbttaglist = stack.getEnchantmentTagList(); if (nbttaglist != null) { for (int i = 0; i < nbttaglist.tagCount(); i++) { @@ -214,25 +223,25 @@ public void updateEnchantmentOptions(boolean validate) { } Item item = toolstack.getItem(); - int enchantablity = item.getItemEnchantability(); + int enchantablity = item.getItemEnchantability(toolstack); if (enchantablity == 0 && validate) { percentscrolled = 0; return; } - for (Enchantment e : Enchantment.enchantmentsList) { - if (e == null || e.type == null || (!e.type.canEnchantItem(item) && validate)) { + for (Enchantment enchantment : Enchantment.REGISTRY) { + if (enchantment == null || enchantment.type == null || (!enchantment.type.canEnchantItem(item) && validate)) { continue; } int state = 0; int level = -1; - if (NEIServerUtils.stackHasEnchantment(toolstack, e.effectId)) { + if (NEIServerUtils.stackHasEnchantment(toolstack, Enchantment.getEnchantmentID(enchantment))) { state = 2; - level = NEIServerUtils.getEnchantmentLevel(toolstack, e.effectId); - } else if (NEIServerUtils.doesEnchantmentConflict(NEIServerUtils.getEnchantments(toolstack), e) && validate) { + level = NEIServerUtils.getEnchantmentLevel(toolstack, Enchantment.getEnchantmentID(enchantment)); + } else if (NEIServerUtils.doesEnchantmentConflict(NEIServerUtils.getEnchantments(toolstack), enchantment) && validate) { state = 1; } - slotEnchantment.add(new EnchantmentHash(e, state, level)); + slotEnchantment.add(new EnchantmentHash(enchantment, state, level)); } if (numoptions != slotEnchantment.size()) { percentscrolled = 0; @@ -262,7 +271,7 @@ public void drawSlots(GuiEnchantmentModifier gui) { } } - CCRenderState.changeTexture("textures/gui/container/enchanting_table.png"); + TextureUtils.changeTexture("textures/gui/container/enchanting_table.png"); GlStateManager.color(1, 1, 1); if (hasScrollBar()) { gui.drawTexturedModalRect(relx, rely + slot * slotheight, 0, gui.ySize + slotheight * shade, cwidth - 30, slotheight); diff --git a/dependencies/main/java/codechicken/nei/ContainerPotionCreator.java b/dependencies/main/java/codechicken/nei/ContainerPotionCreator.java index 04e809483b..efb725601b 100644 --- a/dependencies/main/java/codechicken/nei/ContainerPotionCreator.java +++ b/dependencies/main/java/codechicken/nei/ContainerPotionCreator.java @@ -5,8 +5,11 @@ import codechicken.lib.inventory.InventoryNBT; import codechicken.lib.inventory.InventoryUtils; import codechicken.lib.packet.PacketCustom; +import codechicken.nei.network.NEIClientPacketHandler; +import codechicken.nei.util.NEIClientUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryBasic; import net.minecraft.inventory.Slot; @@ -14,6 +17,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; public class ContainerPotionCreator extends ContainerExtended { @@ -48,9 +52,9 @@ public SlotPotionStore(IInventory inv, int slotIndex, int x, int y) { } @Override - public ItemStack slotClick(ContainerExtended container, EntityPlayer player, int button, int modifier) { + public ItemStack slotClick(ContainerExtended container, EntityPlayer player, int button, ClickType clickType) { ItemStack held = player.inventory.getItemStack(); - if (button == 0 && modifier == 1) { + if (button == 0 && clickType == ClickType.QUICK_MOVE) { NEIClientUtils.cheatItem(getStack(), button, -1); } else if (button == 1) { putStack(null); @@ -132,36 +136,36 @@ public void handleInputPacket(PacketCustom packet) { } boolean add = packet.readBoolean(); - int effectID = packet.readUByte(); + Potion effect = Potion.getPotionById(packet.readUByte()); NBTTagList effects = potion.getTagCompound().getTagList("CustomPotionEffects", 10); NBTTagList newEffects = new NBTTagList(); for (int i = 0; i < effects.tagCount(); i++) { NBTTagCompound tag = effects.getCompoundTagAt(i); PotionEffect e = PotionEffect.readCustomPotionEffectFromNBT(tag); - if (e.getPotionID() != effectID) { + if (e.getPotion() != effect) { newEffects.appendTag(tag); } } if (add) { - newEffects.appendTag(new PotionEffect(effectID, packet.readInt(), packet.readUByte()).writeCustomPotionEffectToNBT(new NBTTagCompound())); + newEffects.appendTag(new PotionEffect(effect, packet.readInt(), packet.readUByte()).writeCustomPotionEffectToNBT(new NBTTagCompound())); } potion.getTagCompound().setTag("CustomPotionEffects", newEffects); } - public void setPotionEffect(int effectID, int duration, int amplifier) { - PacketCustom packet = NEICPH.createContainerPacket(); + public void setPotionEffect(Potion potion, int duration, int amplifier) { + PacketCustom packet = NEIClientPacketHandler.createContainerPacket(); packet.writeBoolean(true); - packet.writeByte(effectID); + packet.writeByte(Potion.getIdFromPotion(potion)); packet.writeInt(duration); packet.writeByte(amplifier); packet.sendToServer(); } - public void removePotionEffect(int effectID) { - PacketCustom packet = NEICPH.createContainerPacket(); + public void removePotionEffect(Potion potion) { + PacketCustom packet = NEIClientPacketHandler.createContainerPacket(); packet.writeBoolean(false); - packet.writeByte(effectID); + packet.writeByte(Potion.getIdFromPotion(potion)); packet.sendToServer(); } } \ No newline at end of file diff --git a/dependencies/main/java/codechicken/nei/DefaultHighlightHandler.java b/dependencies/main/java/codechicken/nei/DefaultHighlightHandler.java index 71c6bfdc98..b2d0f88602 100644 --- a/dependencies/main/java/codechicken/nei/DefaultHighlightHandler.java +++ b/dependencies/main/java/codechicken/nei/DefaultHighlightHandler.java @@ -8,14 +8,15 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import java.util.List; +@Deprecated public class DefaultHighlightHandler implements IHighlightHandler { @Override - public List handleTextData(ItemStack stack, World world, EntityPlayer player, MovingObjectPosition mop, List currenttip, ItemInfo.Layout layout) { + public List handleTextData(ItemStack stack, World world, EntityPlayer player, RayTraceResult rayTraceResult, List currenttip, ItemInfo.Layout layout) { String name = null; try { String s = GuiContainerManager.itemDisplayNameShort(stack); @@ -29,8 +30,8 @@ public List handleTextData(ItemStack stack, World world, EntityPlayer pl } catch (Exception ignored) { } - IBlockState b = world.getBlockState(mop.getBlockPos()); - if (name != null && b.getBlock() == Blocks.redstone_wire) { + IBlockState b = world.getBlockState(rayTraceResult.getBlockPos()); + if (name != null && b.getBlock() == Blocks.REDSTONE_WIRE) { String s = "" + b.getValue(BlockRedstoneWire.POWER); if (s.length() < 2) { s = " " + s; @@ -42,7 +43,7 @@ public List handleTextData(ItemStack stack, World world, EntityPlayer pl } @Override - public ItemStack identifyHighlight(World world, EntityPlayer player, MovingObjectPosition mop) { + public ItemStack identifyHighlight(World world, EntityPlayer player, RayTraceResult rayTraceResult) { return null; } } diff --git a/dependencies/main/java/codechicken/nei/FastTransferManager.java b/dependencies/main/java/codechicken/nei/FastTransferManager.java index f0a43f51f6..b31404fd43 100644 --- a/dependencies/main/java/codechicken/nei/FastTransferManager.java +++ b/dependencies/main/java/codechicken/nei/FastTransferManager.java @@ -1,15 +1,17 @@ package codechicken.nei; import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.util.NEIClientUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import java.util.*; -import static codechicken.nei.NEIServerUtils.*; +import static codechicken.nei.util.NEIServerUtils.*; public class FastTransferManager { /** @@ -88,7 +90,7 @@ public static int findSlotWithItem(Container container, ItemStack teststack) { public static void clearSlots(Container container) { for (int slotNo = 0; slotNo < container.inventorySlots.size(); slotNo++) { - ((Slot) container.inventorySlots.get(slotNo)).putStack(null); + container.inventorySlots.get(slotNo).putStack(null); } } @@ -141,7 +143,7 @@ public int findShiftClickDestinationSlot(Container container, int fromSlot) { slot.putStack(stack.copy()); LinkedList compareBefore = saveContainer(container); - container.slotClick(fromSlot, 0, 1, Minecraft.getMinecraft().thePlayer); + container.slotClick(fromSlot, 0, ClickType.QUICK_MOVE, Minecraft.getMinecraft().thePlayer); LinkedList compareAfter = saveContainer(container); try { @@ -185,7 +187,7 @@ public void restoreContainer(Container container, LinkedList items) { container.getSlot(i).putStack(items.get(i)); } - container.slotClick(-999, 0, 0, Minecraft.getMinecraft().thePlayer); + container.slotClick(-999, 0, ClickType.PICKUP, Minecraft.getMinecraft().thePlayer); } public void transferItem(GuiContainer window, int fromSlot) { @@ -304,11 +306,11 @@ public static void clickSlot(GuiContainer window, int slotIndex) { } public static void clickSlot(GuiContainer window, int slotIndex, int button) { - clickSlot(window, slotIndex, button, 0); + clickSlot(window, slotIndex, button, ClickType.PICKUP); } - public static void clickSlot(GuiContainer window, int slotIndex, int button, int modifier) { - GuiContainerManager.getManager(window).handleSlotClick(slotIndex, button, modifier); + public static void clickSlot(GuiContainer window, int slotIndex, int button, ClickType clickType) { + GuiContainerManager.getManager(window).handleSlotClick(slotIndex, button, clickType); } private boolean fillZoneWithHeldItem(GuiContainer window, int zoneIndex) { diff --git a/dependencies/main/java/codechicken/nei/FingerprintChecker.java b/dependencies/main/java/codechicken/nei/FingerprintChecker.java new file mode 100644 index 0000000000..688395937b --- /dev/null +++ b/dependencies/main/java/codechicken/nei/FingerprintChecker.java @@ -0,0 +1,86 @@ +package codechicken.nei; + +import codechicken.lib.fingerprint.FingerprintViolatedCrashCallable; +import com.google.common.collect.ImmutableList; +import net.minecraftforge.fml.common.*; +import org.apache.logging.log4j.Level; + +import java.security.cert.Certificate; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +/** + * Created by covers1624 on 13/12/2016. + * To be packaged in each mod runtime, used to cross verify jar fingerprints. + * Idea behind this: + * A malicious user would have to override the fingerprint data in all mod jars this is packaged with in order to avoid detection. + * This is not to be used as DRM. It is used simply to provide cross verification of jars. + */ +public class FingerprintChecker { + + private static final Map modCertMap = new HashMap(); + private static final List invalidMods = new ArrayList(); + + static { + //@formatter:off + modCertMap.put("CodeChickenLib" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("CodeChickenCore" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("ChickenChunks" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("EnderStorage" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("Translocator" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("NotEnoughItems" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + modCertMap.put("forgemultipartcbe" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); + //@formatter:on + } + + public static void runFingerprintChecks() { + try { + ModContainer activeContainer = Loader.instance().activeModContainer(); + for (Entry modEntry : Loader.instance().getIndexedModList().entrySet()) { + for (Entry certEntry : modCertMap.entrySet()) { + if (modEntry.getKey().equals(certEntry.getKey())) { + Object modInstance = modEntry.getValue().getMod(); + if (modInstance == null) { + FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "Unable to do Fingerprint Verification for mod %s! ModContainer returned a null mod instance!", modEntry.getKey()); + break; + } + if (modInstance.getClass().getName().contains("net.minecraftforge.")) { + FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "Unable to do Fingerprint Verification for mod %s! ModContainer returned is a suspected FML class! [%s]", modEntry.getKey(), modInstance.getClass().getName()); + } + + Certificate[] certificates = modInstance.getClass().getProtectionDomain().getCodeSource().getCertificates(); + ImmutableList.Builder certBuilder = ImmutableList.builder(); + if (certificates != null) { + for (Certificate cert : certificates) { + certBuilder.add(CertificateHelper.getFingerprint(cert)); + } + } + + ImmutableList certList = certBuilder.build(); + + String expectedFingerprint = certEntry.getValue(); + + if (expectedFingerprint != null && !expectedFingerprint.isEmpty()) { + if (!certList.contains(expectedFingerprint)) { + FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "The fingerprint for mod %s is invalid! Expected: %s", modEntry.getKey(), expectedFingerprint); + invalidMods.add(modEntry.getKey()); + break; + } else { + FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.DEBUG, "Valid fingerprint found for mod %s.", modEntry.getKey()); + } + } + + break; + } + } + } + FMLCommonHandler.instance().registerCrashCallable(new FingerprintViolatedCrashCallable(activeContainer.getModId(), invalidMods)); + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/dependencies/main/java/codechicken/nei/GuiEnchantmentModifier.java b/dependencies/main/java/codechicken/nei/GuiEnchantmentModifier.java index e9ce63d742..4438d0afb7 100644 --- a/dependencies/main/java/codechicken/nei/GuiEnchantmentModifier.java +++ b/dependencies/main/java/codechicken/nei/GuiEnchantmentModifier.java @@ -1,6 +1,6 @@ package codechicken.nei; -import codechicken.lib.render.CCRenderState; +import codechicken.lib.texture.TextureUtils; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; @@ -10,7 +10,7 @@ import java.io.IOException; -import static codechicken.nei.NEIClientUtils.translate; +import static codechicken.nei.util.NEIClientUtils.translate; public class GuiEnchantmentModifier extends GuiContainer { ContainerEnchantmentModifier container; @@ -29,7 +29,7 @@ protected void drawGuiContainerForegroundLayer(int par1, int par2) { protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GlStateManager.color(1, 1, 1, 1); - CCRenderState.changeTexture("textures/gui/container/enchanting_table.png"); + TextureUtils.changeTexture("textures/gui/container/enchanting_table.png"); GlStateManager.translate(guiLeft, guiTop, 0); drawTexturedModalRect(0, 0, 0, 0, xSize, ySize); @@ -78,8 +78,8 @@ protected void actionPerformed(GuiButton guibutton) { private void changeLevel(int i) { container.level += i; - ((GuiButton) buttonList.get(0)).enabled = container.level != 1; - ((GuiButton) buttonList.get(1)).enabled = container.level != 10; + buttonList.get(0).enabled = container.level != 1; + buttonList.get(1).enabled = container.level != 10; } @Override diff --git a/dependencies/main/java/codechicken/nei/GuiExtendedCreativeInv.java b/dependencies/main/java/codechicken/nei/GuiExtendedCreativeInv.java index 28a3aeaa15..56ec566427 100644 --- a/dependencies/main/java/codechicken/nei/GuiExtendedCreativeInv.java +++ b/dependencies/main/java/codechicken/nei/GuiExtendedCreativeInv.java @@ -1,8 +1,9 @@ package codechicken.nei; -import codechicken.lib.render.CCRenderState; +import codechicken.lib.texture.TextureUtils; import codechicken.nei.api.INEIGuiHandler; import codechicken.nei.api.TaggedInventoryArea; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.inventory.Container; @@ -20,7 +21,7 @@ public GuiExtendedCreativeInv(Container par1Container) { @Override protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { GlStateManager.color(1, 1, 1, 1); - CCRenderState.changeTexture("nei:textures/gui/inv.png"); + TextureUtils.changeTexture("nei:textures/gui/inv.png"); int x = guiLeft; int y = guiTop - 4; @@ -29,7 +30,7 @@ protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { } @Override - public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) { + public VisibilityData modifyVisiblity(GuiContainer gui, VisibilityData currentVisibility) { return currentVisibility; } diff --git a/dependencies/main/java/codechicken/nei/GuiPotionCreator.java b/dependencies/main/java/codechicken/nei/GuiPotionCreator.java index 4e0e8126d0..02f11d6284 100644 --- a/dependencies/main/java/codechicken/nei/GuiPotionCreator.java +++ b/dependencies/main/java/codechicken/nei/GuiPotionCreator.java @@ -4,15 +4,15 @@ import codechicken.core.gui.GuiCCTextField; import codechicken.core.gui.GuiScrollSlot; import codechicken.core.inventory.GuiContainerWidget; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.FontUtils; +import codechicken.lib.util.FontUtils; +import codechicken.lib.texture.TextureUtils; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagList; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -import net.minecraft.util.StatCollector; +import net.minecraft.util.text.translation.I18n; import java.awt.*; import java.util.ArrayList; @@ -25,7 +25,7 @@ public class GuiSlotPotionEffects extends GuiScrollSlot { public GuiSlotPotionEffects(int x, int y) { super(x, y, 108, 76); - for (Potion p : Potion.potionTypes) { + for (Potion p : Potion.REGISTRY) { if (p != null) { validPotions.add(p); } @@ -65,24 +65,24 @@ public Dimension scrollbarDim() { protected void drawSlot(int slot, int x, int y, int mx, int my, float frame) { GlStateManager.color(1, 1, 1, 1); Potion potion = validPotions.get(slot); - PotionEffect effect = getEffect(potion.id); + PotionEffect effect = getEffect(potion); boolean blank = effect == null; if (effect == null) { - effect = new PotionEffect(potion.id, 1200, 0); + effect = new PotionEffect(potion, 1200, 0); } int shade = selectedslot == slot ? 2 : blank ? 1 : 0; - CCRenderState.changeTexture("textures/gui/container/enchanting_table.png"); + TextureUtils.changeTexture("textures/gui/container/enchanting_table.png"); drawTexturedModalRect(x, y, 0, 166 + getSlotHeight(slot) * shade, width - 30, getSlotHeight(slot)); drawTexturedModalRect(x + width - 30, y, width - 23, 166 + getSlotHeight(slot) * shade, 30, getSlotHeight(slot)); if (potion.hasStatusIcon()) { - CCRenderState.changeTexture("textures/gui/container/inventory.png"); + TextureUtils.changeTexture("textures/gui/container/inventory.png"); int icon = potion.getStatusIconIndex(); drawTexturedModalRect(x + 1, y + 1, icon % 8 * 18, 198 + icon / 8 * 18, 18, 18); } - String name = StatCollector.translateToLocal(potion.getName()); + String name = I18n.translateToLocal(potion.getName()); String amp = effect.getAmplifier() > 0 ? " " + translateAmplifier(effect.getAmplifier()) : ""; int textColour = shade == 0 ? 0x685e4a : shade == 1 ? 0x407f10 : 0xffff80; if (fontRenderer.getStringWidth(name + amp) < width - 20) { @@ -92,18 +92,18 @@ protected void drawSlot(int slot, int x, int y, int mx, int my, float frame) { FontUtils.drawRightString(amp, x + width - 10, y + 10, textColour); } - String duration = Potion.getDurationString(effect); + String duration = Potion.getPotionDurationString(effect, 1.0F); textColour = shade == 0 ? 0xA0A0A0 : shade == 1 ? 0x808080 : 0xCCCCCC; fontRenderer.drawStringWithShadow(duration, x + 20, y + 10, textColour); } - private PotionEffect getEffect(int id) { - ItemStack potion = container.potionInv.getStackInSlot(0); - if (potion != null && potion.hasTagCompound() && potion.getTagCompound().hasKey("CustomPotionEffects")) { - NBTTagList potionTagList = potion.getTagCompound().getTagList("CustomPotionEffects", 10); + private PotionEffect getEffect(Potion potion) { + ItemStack potionStack = container.potionInv.getStackInSlot(0); + if (potionStack != null && potionStack.hasTagCompound() && potionStack.getTagCompound().hasKey("CustomPotionEffects")) { + NBTTagList potionTagList = potionStack.getTagCompound().getTagList("CustomPotionEffects", 10); for (int i = 0; i < potionTagList.tagCount(); i++) { PotionEffect effect = PotionEffect.readCustomPotionEffectFromNBT(potionTagList.getCompoundTagAt(i)); - if (effect.getPotionID() == id) { + if (effect.getPotion() == potion) { return effect; } } @@ -127,7 +127,7 @@ protected void slotClicked(int slot, int button, int mx, int my, int count) { applyEffect(); } else if (button == 1) { deselect(); - container.removePotionEffect(validPotions.get(slot).id); + container.removePotionEffect(validPotions.get(slot)); } } @@ -158,9 +158,9 @@ public void setEnabled(boolean b) { private void select(int slot) { selectedslot = slot; durationField.setEnabled(true); - PotionEffect effect = getEffect(validPotions.get(slot).id); + PotionEffect effect = getEffect(validPotions.get(slot)); if (effect == null) { - effect = new PotionEffect(validPotions.get(slot).id, 1200, 0); + effect = new PotionEffect(validPotions.get(slot), 1200, 0); } durationField.setDurationTicks(effect.getDuration()); amplifier = effect.getAmplifier(); @@ -174,8 +174,8 @@ private void deselect() { ampUp.setEnabled(false); } - public int selectedPotion() { - return validPotions.get(selectedslot).id; + public Potion selectedPotion() { + return validPotions.get(selectedslot); } } @@ -303,7 +303,7 @@ protected void drawGuiContainerForegroundLayer(int par1, int par2) { @Override public void drawBackground() { - CCRenderState.changeTexture("nei:textures/gui/potion.png"); + TextureUtils.changeTexture("nei:textures/gui/potion.png"); drawTexturedModalRect(0, 0, 0, 0, xSize, ySize); FontUtils.drawCenteredString("Favourite Potions", xSize / 2, 4, 0x404040); diff --git a/dependencies/main/java/codechicken/nei/HUDRenderer.java b/dependencies/main/java/codechicken/nei/HUDRenderer.java index 08eeec104c..023b0b642d 100644 --- a/dependencies/main/java/codechicken/nei/HUDRenderer.java +++ b/dependencies/main/java/codechicken/nei/HUDRenderer.java @@ -1,6 +1,5 @@ package codechicken.nei; -import codechicken.lib.config.ConfigTag; import codechicken.nei.KeyManager.IKeyStateTracker; import codechicken.nei.api.ItemInfo; import codechicken.nei.guihook.GuiContainerManager; @@ -8,7 +7,7 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition.MovingObjectType; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import java.awt.*; @@ -17,13 +16,14 @@ import static codechicken.lib.gui.GuiDraw.*; +@Deprecated public class HUDRenderer implements IKeyStateTracker { @Override public void tickKeyStates() { - if (KeyManager.keyStates.get("world.highlight_tips").down) { - ConfigTag tag = NEIClientConfig.getSetting("world.highlight_tips"); - tag.setBooleanValue(!tag.getBooleanValue()); - } +// if (KeyBindings.get("nei.options.keys.world.highlight_tips").isPressed()) { +// ConfigTag tag = NEIClientConfig.getSetting("world.highlight_tips"); +// tag.setBooleanValue(!tag.getBooleanValue()); +// } } public static void renderOverlay() { @@ -33,7 +33,7 @@ public static void renderOverlay() { !mc.gameSettings.keyBindPlayerList.isKeyDown() && NEIClientConfig.getBooleanSetting("world.highlight_tips") && mc.objectMouseOver != null && - mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) { + mc.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) { World world = mc.theWorld; ArrayList items = ItemInfo.getIdentifierItems(world, mc.thePlayer, mc.objectMouseOver); if (items.isEmpty()) { @@ -72,7 +72,7 @@ public static void renderOverlay(ItemStack stack, List textData, Point p RenderHelper.disableStandardItemLighting(); GlStateManager.disableDepth(); - drawTooltipBox(x, y, w, h); + //drawTooltipBox(x, y, w, h); int ty = (h - 8 * textData.size()) / 2; for (int i = 0; i < textData.size(); i++) { @@ -92,6 +92,6 @@ private static Point getPositioning() { } public static void load() { - KeyManager.trackers.add(new HUDRenderer()); + //KeyManager.trackers.add(new HUDRenderer()); } -} \ No newline at end of file +} diff --git a/dependencies/main/java/codechicken/nei/InfiniteStackSizeHandler.java b/dependencies/main/java/codechicken/nei/InfiniteStackSizeHandler.java index 7f28080549..cae95f8667 100644 --- a/dependencies/main/java/codechicken/nei/InfiniteStackSizeHandler.java +++ b/dependencies/main/java/codechicken/nei/InfiniteStackSizeHandler.java @@ -2,6 +2,7 @@ import codechicken.lib.inventory.InventoryUtils; import codechicken.nei.api.IInfiniteItemHandler; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; diff --git a/dependencies/main/java/codechicken/nei/ItemList.java b/dependencies/main/java/codechicken/nei/ItemList.java index 70963a1078..0624b2ae08 100644 --- a/dependencies/main/java/codechicken/nei/ItemList.java +++ b/dependencies/main/java/codechicken/nei/ItemList.java @@ -1,13 +1,18 @@ package codechicken.nei; -import codechicken.nei.ThreadOperationTimer.TimeoutException; -import codechicken.nei.api.ItemFilter; -import codechicken.nei.api.ItemFilter.ItemFilterProvider; +import codechicken.lib.item.filtering.IItemFilter; +import codechicken.lib.item.filtering.IItemFilterProvider; +import codechicken.lib.thread.RestartableTask; +import codechicken.lib.thread.ThreadOperationTimer; +import codechicken.lib.thread.ThreadOperationTimer.TimeoutException; import codechicken.nei.api.ItemInfo; import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.util.LogHelper; +import codechicken.nei.util.NEIServerUtils; +import codechicken.nei.widget.ItemPanel; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ListMultimap; -import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -29,27 +34,27 @@ public class ItemList { /** * Updates to this should be synchronised on this */ - public static final List itemFilterers = new LinkedList(); + public static final List itemFilterers = new LinkedList(); public static final List loadCallbacks = new LinkedList(); private static HashSet erroredItems = new HashSet(); private static HashSet stackTraces = new HashSet(); - public static class EverythingItemFilter implements ItemFilter { + public static class EverythingItemFilter implements IItemFilter { @Override public boolean matches(ItemStack item) { return true; } } - public static class NothingItemFilter implements ItemFilter { + public static class NothingItemFilter implements IItemFilter { @Override public boolean matches(ItemStack item) { return false; } } - public static class PatternItemFilter implements ItemFilter { + public static class PatternItemFilter implements IItemFilter { public Pattern pattern; public PatternItemFilter(Pattern pattern) { @@ -62,26 +67,26 @@ public boolean matches(ItemStack item) { } } - public static class AllMultiItemFilter implements ItemFilter { - public List filters = new LinkedList(); + public static class AllMultiItemFilter implements IItemFilter { + public List filters = new LinkedList(); - public AllMultiItemFilter(List filters) { + public AllMultiItemFilter(List filters) { this.filters = filters; } public AllMultiItemFilter() { - this(new LinkedList()); + this(new LinkedList()); } @Override public boolean matches(ItemStack item) { - for (ItemFilter filter : filters) { + for (IItemFilter filter : filters) { try { if (!filter.matches(item)) { return false; } } catch (Exception e) { - NEIClientConfig.logger.error("Exception filtering " + item + " with " + filter, e); + LogHelper.errorError("Exception filtering " + item + " with " + filter, e); } } @@ -89,26 +94,26 @@ public boolean matches(ItemStack item) { } } - public static class AnyMultiItemFilter implements ItemFilter { - public List filters = new LinkedList(); + public static class AnyMultiItemFilter implements IItemFilter { + public List filters = new LinkedList(); - public AnyMultiItemFilter(List filters) { + public AnyMultiItemFilter(List filters) { this.filters = filters; } public AnyMultiItemFilter() { - this(new LinkedList()); + this(new LinkedList()); } @Override public boolean matches(ItemStack item) { - for (ItemFilter filter : filters) { + for (IItemFilter filter : filters) { try { if (filter.matches(item)) { return true; } } catch (Exception e) { - NEIClientConfig.logger.error("Exception filtering " + item + " with " + filter, e); + LogHelper.errorError("Exception filtering " + item + " with " + filter, e); } } @@ -120,14 +125,14 @@ public interface ItemsLoadedCallback { void itemsLoaded(); } - public static boolean itemMatchesAll(ItemStack item, List filters) { - for (ItemFilter filter : filters) { + public static boolean itemMatchesAll(ItemStack item, List filters) { + for (IItemFilter filter : filters) { try { if (!filter.matches(item)) { return false; } } catch (Exception e) { - NEIClientConfig.logger.error("Exception filtering " + item + " with " + filter, e); + LogHelper.errorError("Exception filtering " + item + " with " + filter, e); } } @@ -142,14 +147,14 @@ public static boolean itemMatches(ItemStack item) { return getItemListFilter().matches(item); } - public static ItemFilter getItemListFilter() { + public static IItemFilter getItemListFilter() { return new AllMultiItemFilter(getItemFilters()); } - public static List getItemFilters() { - LinkedList filters = new LinkedList(); + public static List getItemFilters() { + LinkedList filters = new LinkedList(); synchronized (itemFilterers) { - for (ItemFilterProvider p : itemFilterers) { + for (IItemFilterProvider p : itemFilterers) { filters.add(p.getFilter()); } } @@ -162,7 +167,7 @@ private void damageSearch(Item item, List permutations) { for (int damage = 0; damage < 16; damage++) { try { ItemStack stack = new ItemStack(item, 1, damage); - IBakedModel model = GuiContainerManager.drawItems.getItemModelMesher().getItemModel(stack); + IBakedModel model = GuiContainerManager.getRenderItem().getItemModelMesher().getItemModel(stack); String name = GuiContainerManager.concatenatedDisplayName(stack, false); String s = name + "@" + (model == null ? 0 : model.hashCode()); if (!damageIconSet.contains(s)) { @@ -186,7 +191,7 @@ public void execute() { ListMultimap itemMap = ArrayListMultimap.create(); timer.setLimit(500); - for (Item item : Item.itemRegistry) { + for (Item item : Item.REGISTRY) { if (interrupted()) { return; } @@ -215,7 +220,7 @@ public void execute() { items.addAll(permutations); itemMap.putAll(item, permutations); } catch (Throwable t) { - NEIServerConfig.logger.error("Removing item: " + item + " from list.", t); + LogHelper.errorError("Removing item: %s from list.", t, item); erroredItems.add(item); } } @@ -237,7 +242,7 @@ public void execute() { @Override public void execute() { ArrayList filtered = new ArrayList(); - ItemFilter filter = getItemListFilter(); + IItemFilter filter = getItemListFilter(); for (ItemStack item : items) { if (interrupted()) { return; diff --git a/dependencies/main/java/codechicken/nei/ItemMobSpawner.java b/dependencies/main/java/codechicken/nei/ItemMobSpawner.java index a81ce68d2e..b84b174929 100644 --- a/dependencies/main/java/codechicken/nei/ItemMobSpawner.java +++ b/dependencies/main/java/codechicken/nei/ItemMobSpawner.java @@ -1,6 +1,8 @@ package codechicken.nei; -import codechicken.core.featurehack.GameDataManipulator; + +import codechicken.nei.network.NEIClientPacketHandler; +import codechicken.nei.util.LogHelper; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.creativetab.CreativeTabs; @@ -15,8 +17,9 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityMobSpawner; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraftforge.fml.common.registry.GameRegistry; import java.util.HashMap; import java.util.Iterator; @@ -32,15 +35,15 @@ public class ItemMobSpawner extends ItemBlock { private static ItemMobSpawner instance; public static void register() { - GameDataManipulator.replaceItem(Block.getIdFromBlock(Blocks.mob_spawner), instance = new ItemMobSpawner()); + //GameDataManipulator.replaceItemBlock(Blocks.MOB_SPAWNER, instance = new ItemMobSpawner()); } public static void initRender() { - SpawnerRenderer.load(instance); + //SpawnerRenderer.load(instance); } public ItemMobSpawner() { - super(Blocks.mob_spawner); + super(Blocks.MOB_SPAWNER); setHasSubtypes(true); } @@ -57,7 +60,7 @@ public static void onBlockPlaced(World world, BlockPos pos, ItemStack stack) { setDefaultTag(stack); String mobtype = IDtoNameMap.get(stack.getItemDamage()); if (mobtype != null) { - NEICPH.sendMobSpawnerID(pos.getX(), pos.getY(), pos.getZ(), mobtype); + NEIClientPacketHandler.sendMobSpawnerID(pos.getX(), pos.getY(), pos.getZ(), mobtype); tileentitymobspawner.getSpawnerBaseLogic().setEntityName(mobtype); } } @@ -78,14 +81,14 @@ public static EntityLiving getEntity(int ID) { EntityLiving e = entityHashMap.get(ID); if (e == null) { World world = Minecraft.getMinecraft().theWorld; - Class clazz = EntityList.idToClassMapping.get(ID); + Class clazz = EntityList.ID_TO_CLASS.get(ID); try { e = (EntityLiving) clazz.getConstructor(World.class).newInstance(world); } catch (Throwable t) { if (clazz == null) { - NEIClientConfig.logger.error("Null class for entity (" + ID + ", " + IDtoNameMap.get(ID)); + LogHelper.error("Null class for entity (" + ID + ", " + IDtoNameMap.get(ID)); } else { - NEIClientConfig.logger.error("Error creating instance of entity: " + clazz.getName(), t); + LogHelper.errorError("Error creating instance of entity: " + clazz.getName(), t); } e = getEntity(idPig); } @@ -105,8 +108,8 @@ public static void loadSpawners(World world) { return; } loaded = true; - HashMap, String> classToStringMapping = (HashMap, String>) EntityList.classToStringMapping; - HashMap, Integer> classToIDMapping = (HashMap, Integer>) EntityList.classToIDMapping; + HashMap, String> classToStringMapping = (HashMap, String>) EntityList.CLASS_TO_NAME; + HashMap, Integer> classToIDMapping = (HashMap, Integer>) EntityList.CLASS_TO_ID; for (Class entityClass : classToStringMapping.keySet()) { if (!EntityLiving.class.isAssignableFrom(entityClass)) { continue; diff --git a/dependencies/main/java/codechicken/nei/ItemQuantityField.java b/dependencies/main/java/codechicken/nei/ItemQuantityField.java index 9c9e0d0b28..2dc8c11f0b 100644 --- a/dependencies/main/java/codechicken/nei/ItemQuantityField.java +++ b/dependencies/main/java/codechicken/nei/ItemQuantityField.java @@ -1,5 +1,7 @@ package codechicken.nei; +import codechicken.nei.util.NEIClientUtils; + public class ItemQuantityField extends TextField { public ItemQuantityField(String ident) { super(ident); diff --git a/dependencies/main/java/codechicken/nei/ItemSorter.java b/dependencies/main/java/codechicken/nei/ItemSorter.java index 18918ac8ae..bf6b29f217 100644 --- a/dependencies/main/java/codechicken/nei/ItemSorter.java +++ b/dependencies/main/java/codechicken/nei/ItemSorter.java @@ -6,9 +6,10 @@ import codechicken.nei.api.ItemInfo; import codechicken.nei.config.GuiItemSorter; import codechicken.nei.config.OptionOpenGui; +import codechicken.nei.util.LogHelper; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; +import net.minecraft.util.text.translation.I18n; import java.util.*; @@ -23,12 +24,12 @@ public SortEntry(String name, Comparator comparator) { } public String getLocalisedName() { - return StatCollector.translateToLocal(name); + return I18n.translateToLocal(name); } public String getTooltip() { String tipname = name + ".tip"; - String tip = StatCollector.translateToLocal(tipname); + String tip = I18n.translateToLocal(tipname); return !tip.equals(tipname) ? tip : null; } } @@ -44,7 +45,7 @@ public static void sort(ArrayList items) { try { Collections.sort(items, instance); } catch (Exception e) { - NEIClientConfig.logger.error("Exception sorting item list", e); + LogHelper.errorError("Exception sorting item list", e); } } diff --git a/dependencies/main/java/codechicken/nei/ItemStackSet.java b/dependencies/main/java/codechicken/nei/ItemStackSet.java index 4fbcf1b10d..5d28e33cce 100644 --- a/dependencies/main/java/codechicken/nei/ItemStackSet.java +++ b/dependencies/main/java/codechicken/nei/ItemStackSet.java @@ -1,11 +1,11 @@ package codechicken.nei; -import codechicken.nei.api.ItemFilter; +import codechicken.lib.item.filtering.IItemFilter; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class ItemStackSet extends ItemStackMap implements ItemFilter { +public class ItemStackSet extends ItemStackMap implements IItemFilter { public ItemStackSet with(ItemStack... items) { for (ItemStack item : items) { add(item); diff --git a/dependencies/main/java/codechicken/nei/KeyManager.java b/dependencies/main/java/codechicken/nei/KeyManager.java index 3913379e55..e55e32ca89 100644 --- a/dependencies/main/java/codechicken/nei/KeyManager.java +++ b/dependencies/main/java/codechicken/nei/KeyManager.java @@ -1,43 +1,18 @@ package codechicken.nei; -import org.lwjgl.input.Keyboard; - -import java.util.HashMap; import java.util.LinkedList; -import java.util.Map.Entry; /** - * Good old down/held/up keystate tracker + * Good old key ticker */ public class KeyManager { - public static interface IKeyStateTracker { - public void tickKeyStates(); - } - - public static class KeyState { - public boolean down; - public boolean held; - public boolean up; + public interface IKeyStateTracker { + void tickKeyStates(); } - public static HashMap keyStates = new HashMap(); public static LinkedList trackers = new LinkedList(); public static void tickKeyStates() { - for (Entry entry : keyStates.entrySet()) { - int keyCode = NEIClientConfig.getKeyBinding(entry.getKey()); - boolean down = keyCode != 0 && Keyboard.isKeyDown(keyCode); - KeyState state = entry.getValue(); - if (down) { - state.down = !state.held; - state.up = false; - } else { - state.up = state.held; - state.down = false; - } - state.held = down; - } - for (IKeyStateTracker tracker : trackers) { tracker.tickKeyStates(); } diff --git a/dependencies/main/java/codechicken/nei/LayoutManager.java b/dependencies/main/java/codechicken/nei/LayoutManager.java index 56bd151471..50d50e1acd 100644 --- a/dependencies/main/java/codechicken/nei/LayoutManager.java +++ b/dependencies/main/java/codechicken/nei/LayoutManager.java @@ -3,7 +3,16 @@ import codechicken.lib.gui.GuiDraw; import codechicken.nei.KeyManager.IKeyStateTracker; import codechicken.nei.api.*; +import codechicken.nei.api.layout.LayoutStyle; +import codechicken.nei.config.KeyBindings; import codechicken.nei.guihook.*; +import codechicken.nei.layout.LayoutStyleMinecraft; +import codechicken.nei.layout.LayoutStyleTMIOld; +import codechicken.nei.network.NEIClientPacketHandler; +import codechicken.nei.widget.Button; +import codechicken.nei.widget.ItemPanel; +import codechicken.nei.widget.Label; +import codechicken.nei.widget.Widget; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; @@ -22,7 +31,7 @@ import static codechicken.lib.gui.GuiDraw.*; import static codechicken.nei.NEIClientConfig.*; -import static codechicken.nei.NEIClientUtils.*; +import static codechicken.nei.util.NEIClientUtils.*; public class LayoutManager implements IContainerInputHandler, IContainerTooltipHandler, IContainerDrawHandler, IContainerObjectHandler, IKeyStateTracker { private static LayoutManager instance; @@ -37,6 +46,8 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH */ private static TreeSet controlWidgets; + private static boolean showItemPanel; + public static ItemPanel itemPanel; public static SubsetWidget dropDown; public static TextField searchField; @@ -85,8 +96,8 @@ public void onPreDraw(GuiContainer gui) { gui.guiTop = (gui.height - gui.ySize) / 2; if (gui instanceof GuiContainerCreative && gui.buttonList.size() >= 2) { - GuiButton button1 = (GuiButton) gui.buttonList.get(0); - GuiButton button2 = (GuiButton) gui.buttonList.get(1); + GuiButton button1 = gui.buttonList.get(0); + GuiButton button2 = gui.buttonList.get(1); button1.xPosition = gui.guiLeft; button2.xPosition = gui.guiLeft + gui.xSize - 20; } @@ -159,7 +170,7 @@ public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) { @Override public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) { - if (keyID == getKeyBinding("gui.hide")) { + if (KeyBindings.get("nei.options.keys.gui.hide").isActiveAndMatches(keyID)) { toggleBooleanSetting("inventory.hidden"); return true; } @@ -217,6 +228,8 @@ public void renderObjects(GuiContainer gui, int mousex, int mousey) { GlStateManager.enableLighting(); GlStateManager.disableDepth(); + } else { + showItemPanel = false; } } @@ -265,8 +278,9 @@ public List handleItemTooltip(GuiContainer gui, ItemStack itemstack, int } public static void layout(GuiContainer gui) { - VisiblityData visiblity = new VisiblityData(); + VisibilityData visiblity = new VisibilityData(); if (isHidden()) { + //showItemPanel = false; visiblity.showNEI = false; } if (gui.height - gui.ySize <= 40) { @@ -316,11 +330,11 @@ public boolean onButtonPress(boolean rightclick) { return false; } - @Override - public String getRenderLabel() { - return translate("inventory.prev"); - } - }; + @Override + public String getRenderLabel() { + return translate("inventory.prev"); + } + }; next = new Button("Next") { public boolean onButtonPress(boolean rightclick) { if (!rightclick) { @@ -582,7 +596,7 @@ private static boolean setPropertyDisabled(String ident, boolean disable) { } } if (hasSMPCounterPart()) { - NEICPH.sendSetPropertyDisabled(ident, disable); + NEIClientPacketHandler.sendSetPropertyDisabled(ident, disable); } return true; @@ -614,24 +628,26 @@ public void refresh(GuiContainer gui) { public boolean checkCreativeInv(GuiContainer gui) { if (gui instanceof GuiContainerCreative && invCreativeMode()) { - NEICPH.sendCreativeInv(true); + NEIClientPacketHandler.sendCreativeInv(true); return true; } else if (gui instanceof GuiExtendedCreativeInv && !invCreativeMode()) { - NEICPH.sendCreativeInv(false); + NEIClientPacketHandler.sendCreativeInv(false); return true; } return false; } - public static void updateWidgetVisiblities(GuiContainer gui, VisiblityData visiblity) { + public static void updateWidgetVisiblities(GuiContainer gui, VisibilityData visiblity) { drawWidgets = new TreeSet(new WidgetZOrder(false)); controlWidgets = new TreeSet(new WidgetZOrder(true)); if (!visiblity.showNEI) { + //showItemPanel = false; return; } addWidget(options); + showItemPanel = visiblity.showItemPanel; if (visiblity.showItemPanel) { addWidget(itemPanel); addWidget(prev); @@ -764,11 +780,11 @@ public void renderSlotUnderlay(GuiContainer gui, Slot slot) { @Override public void renderSlotOverlay(GuiContainer window, Slot slot) { ItemStack item = slot.getStack(); - if (world.nbt.getBoolean("searchinventories") && (item == null ? !getSearchExpression().equals("") : !ItemList.itemMatches(item))) { + if (world.nbt.getBoolean("searchinventories") && (item == null ? !getSearchExpression().equals("") : !ItemList.getItemListFilter().matches(item))) { GlStateManager.disableLighting(); - GlStateManager.translate(0, 0, 150); + GlStateManager.translate(0, 0, 200); drawRect(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, 0x80000000); - GlStateManager.translate(0, 0, -150); + GlStateManager.translate(0, 0, -200); GlStateManager.enableLighting(); } } @@ -832,26 +848,30 @@ public void tickKeyStates() { return; } - if (KeyManager.keyStates.get("world.dawn").down) { + if (KeyBindings.get("nei.options.keys.world.dawn").isPressed()) { timeButtons[0].onButtonPress(false); } - if (KeyManager.keyStates.get("world.noon").down) { + if (KeyBindings.get("nei.options.keys.world.noon").isPressed()) { timeButtons[1].onButtonPress(false); } - if (KeyManager.keyStates.get("world.dusk").down) { + if (KeyBindings.get("nei.options.keys.world.dusk").isPressed()) { timeButtons[2].onButtonPress(false); } - if (KeyManager.keyStates.get("world.midnight").down) { + if (KeyBindings.get("nei.options.keys.world.midnight").isPressed()) { timeButtons[3].onButtonPress(false); } - if (KeyManager.keyStates.get("world.rain").down) { + if (KeyBindings.get("nei.options.keys.world.rain").isPressed()) { rain.onButtonPress(false); } - if (KeyManager.keyStates.get("world.heal").down) { + if (KeyBindings.get("nei.options.keys.world.heal").isPressed()) { heal.onButtonPress(false); } - if (KeyManager.keyStates.get("world.creative").down) { + if (KeyBindings.get("nei.options.keys.world.creative").isPressed()) { gamemode.onButtonPress(false); } } + + public static boolean isItemPanelActive() { + return showItemPanel; + } } diff --git a/dependencies/main/java/codechicken/nei/NEIChestGuiHandler.java b/dependencies/main/java/codechicken/nei/NEIChestGuiHandler.java index fb861d60c8..11429062f5 100644 --- a/dependencies/main/java/codechicken/nei/NEIChestGuiHandler.java +++ b/dependencies/main/java/codechicken/nei/NEIChestGuiHandler.java @@ -2,6 +2,7 @@ import codechicken.nei.api.INEIGuiAdapter; import codechicken.nei.api.TaggedInventoryArea; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.ContainerChest; diff --git a/dependencies/main/java/codechicken/nei/NEIClientConfig.java b/dependencies/main/java/codechicken/nei/NEIClientConfig.java index 5dde2a9713..7ea85d65a4 100644 --- a/dependencies/main/java/codechicken/nei/NEIClientConfig.java +++ b/dependencies/main/java/codechicken/nei/NEIClientConfig.java @@ -1,12 +1,19 @@ package codechicken.nei; import codechicken.core.*; +import codechicken.lib.asm.discovery.ClassDiscoverer; +import codechicken.lib.asm.discovery.IStringMatcher; import codechicken.lib.config.ConfigFile; import codechicken.lib.config.ConfigTag; import codechicken.lib.config.ConfigTagParent; +import codechicken.lib.util.ClientUtils; +import codechicken.lib.util.CommonUtils; import codechicken.nei.api.*; +import codechicken.nei.api.layout.LayoutStyle; import codechicken.nei.config.*; import codechicken.nei.recipe.RecipeInfo; +import codechicken.nei.util.LogHelper; +import codechicken.nei.util.NEIClientUtils; import codechicken.obfuscator.ObfuscationRun; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -15,10 +22,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.world.World; -import net.minecraft.world.storage.SaveFormatComparator; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.lwjgl.input.Keyboard; +import net.minecraft.world.storage.WorldSummary; import java.io.File; import java.util.Collections; @@ -31,7 +35,7 @@ public class NEIClientConfig { private static boolean configLoaded; private static boolean enabledOverride; - public static Logger logger = LogManager.getLogger("NotEnoughItems"); + //public static Logger logger = LogManager.getLogger("NotEnoughItems"); public static File configDir = new File(CommonUtils.getMinecraftDir(), "config/NEI/"); public static ConfigSet global = new ConfigSet(new File("saves/NEI/client.dat"), new ConfigFile(new File(configDir, "client.cfg"))); public static ConfigSet world; @@ -127,10 +131,10 @@ public boolean cycle() { tag.getTag("inventory.searchmode").getIntValue(1); API.addOption(new OptionCycled("inventory.searchmode", 3, true)); - tag.getTag("world.highlight_tips").getBooleanValue(false); - tag.getTag("world.highlight_tips.x").getIntValue(5000); - tag.getTag("world.highlight_tips.y").getIntValue(100); - API.addOption(new OptionOpenGui("world.highlight_tips", GuiHighlightTips.class)); + //tag.getTag("world.highlight_tips").getBooleanValue(false); + //tag.getTag("world.highlight_tips.x").getIntValue(5000); + //tag.getTag("world.highlight_tips.y").getIntValue(100); + //API.addOption(new OptionOpenGui("world.highlight_tips", GuiHighlightTips.class)); tag.getTag("inventory.profileRecipes").getBooleanValue(false); API.addOption(new OptionToggleButton("inventory.profileRecipes", true)); @@ -146,7 +150,26 @@ public boolean cycle() { tag.getTag("command.heal").setDefaultValue(""); API.addOption(new OptionTextField("command.heal")); - setDefaultKeyBindings(); +// JEIIntegrationManager.initConfig(tag); +// +// API.addOption(new ItemBrowserButton("jei.itemPanel") { +// @Override +// protected void setValue(EnumItemBrowser itemBrowser) { +// JEIIntegrationManager.setItemPanelOwner(itemBrowser); +// } +// }); +// +// API.addOption(new ItemBrowserButton("jei.searchBox") { +// @Override +// public boolean isEnabled() { +// return JEIIntegrationManager.itemPannelOwner == EnumItemBrowser.JEI; +// } +// +// @Override +// protected void setValue(EnumItemBrowser itemBrowser) { +// JEIIntegrationManager.setSearchBoxOwner(itemBrowser); +// } +// }); } private static void linkOptionList() { @@ -173,35 +196,13 @@ public GuiOptionList getGui(GuiScreen parent, OptionList list, boolean world) { }); } - private static void setDefaultKeyBindings() { - API.addKeyBind("gui.recipe", Keyboard.KEY_R); - API.addKeyBind("gui.usage", Keyboard.KEY_U); - API.addKeyBind("gui.back", Keyboard.KEY_BACK); - API.addKeyBind("gui.enchant", Keyboard.KEY_X); - API.addKeyBind("gui.potion", Keyboard.KEY_P); - API.addKeyBind("gui.prev", Keyboard.KEY_PRIOR); - API.addKeyBind("gui.next", Keyboard.KEY_NEXT); - API.addKeyBind("gui.hide", Keyboard.KEY_O); - API.addKeyBind("gui.search", Keyboard.KEY_F); - API.addKeyBind("world.chunkoverlay", Keyboard.KEY_F9); - API.addKeyBind("world.moboverlay", Keyboard.KEY_F7); - API.addKeyBind("world.highlight_tips", Keyboard.KEY_NUMPAD0); - API.addKeyBind("world.dawn", 0); - API.addKeyBind("world.noon", 0); - API.addKeyBind("world.dusk", 0); - API.addKeyBind("world.midnight", 0); - API.addKeyBind("world.rain", 0); - API.addKeyBind("world.heal", 0); - API.addKeyBind("world.creative", 0); - } - public static OptionList getOptionList() { return OptionList.getOptionList("nei.options"); } public static void loadWorld(String saveName) { setInternalEnabled(true); - logger.debug("Loading " + (Minecraft.getMinecraft().isSingleplayer() ? "Local" : "Remote") + " World"); + LogHelper.debug("Loading " + (Minecraft.getMinecraft().isSingleplayer() ? "Local" : "Remote") + " World"); bootNEI(ClientUtils.getWorld()); File saveDir = new File(CommonUtils.getMinecraftDir(), "saves/NEI/" + saveName); @@ -245,14 +246,6 @@ private static void setWorldDefaults() { world.saveNBT(); } - public static int getKeyBinding(String string) { - return getSetting("keys." + string).getIntValue(); - } - - public static void setDefaultKeyBinding(String string, int key) { - getSetting("keys." + string).getIntValue(key); - } - public static void bootNEI(World world) { if (configLoaded) { return; @@ -282,9 +275,9 @@ public boolean matches(String test) { IConfigureNEI config = (IConfigureNEI) clazz.newInstance(); config.loadConfig(); NEIModContainer.plugins.add(config); - logger.debug("Loaded " + clazz.getName()); + LogHelper.debug("Loaded " + clazz.getName()); } catch (Exception e) { - logger.error("Failed to Load " + clazz.getName(), e); + LogHelper.errorError("Failed to Load " + clazz.getName(), e); } } @@ -383,10 +376,25 @@ public static String getSearchExpression() { } public static void setSearchExpression(String expression) { +// JEIIntegrationManager.setFilterText(expression); world.nbt.setString("search", expression); world.saveNBT(); } + /** + * A split off of setSearchExpression that avoids a JEI update. + * + * @param expression Search term. + */ + public static void setSearchExpression(String expression, boolean updateJEI) { + if (updateJEI) { + setSearchExpression(expression); + } else { + world.nbt.setString("search", expression); + world.saveNBT(); + } + } + public static boolean getMagnetMode() { return enabledActions.contains("magnet"); } @@ -513,11 +521,8 @@ public static boolean canPerformAction(String name) { } String cmd = getStringSetting("command." + base); - if (cmd == null || !cmd.startsWith("/")) { - return false; - } + return !(cmd == null || !cmd.startsWith("/")); - return true; } private static boolean modePermitsAction(String name) { @@ -552,15 +557,15 @@ public static void reloadSaves() { return; } - List saves; + List saves; try { saves = Minecraft.getMinecraft().getSaveLoader().getSaveList(); } catch (Exception e) { - logger.error("Error loading saves", e); + LogHelper.errorError("Error loading saves", e); return; } HashSet saveFileNames = new HashSet(); - for (SaveFormatComparator save : saves) { + for (WorldSummary save : saves) { saveFileNames.add(save.getFileName()); } diff --git a/dependencies/main/java/codechicken/nei/NEIController.java b/dependencies/main/java/codechicken/nei/NEIController.java index 50c71b5f84..02d3d26269 100644 --- a/dependencies/main/java/codechicken/nei/NEIController.java +++ b/dependencies/main/java/codechicken/nei/NEIController.java @@ -4,10 +4,14 @@ import codechicken.nei.guihook.GuiContainerManager; import codechicken.nei.guihook.IContainerInputHandler; import codechicken.nei.guihook.IContainerSlotClickHandler; +import codechicken.nei.network.NEIClientPacketHandler; +import codechicken.nei.util.NEIClientUtils; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainerCreative; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotCrafting; import net.minecraft.item.ItemStack; @@ -92,10 +96,10 @@ public static void processCreativeCycling(InventoryPlayer inventory) { if (selectedItem != inventory.currentItem) { if (inventory.currentItem == selectedItem + 1 || (inventory.currentItem == 0 && selectedItem == 8))//foward { - NEICPH.sendCreativeScroll(1); + NEIClientPacketHandler.sendCreativeScroll(1); inventory.currentItem = selectedItem; } else if (inventory.currentItem == selectedItem - 1 || (inventory.currentItem == 8 && selectedItem == 0)) { - NEICPH.sendCreativeScroll(-1); + NEIClientPacketHandler.sendCreativeScroll(-1); inventory.currentItem = selectedItem; } } @@ -105,7 +109,7 @@ public static void processCreativeCycling(InventoryPlayer inventory) { } @Override - public void beforeSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, int modifier) { + public void beforeSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, ClickType clickType) { if (!NEIClientConfig.isEnabled()) { return; } @@ -114,11 +118,11 @@ public void beforeSlotClick(GuiContainer gui, int slotIndex, int button, Slot sl } @Override - public boolean handleSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, int modifier, boolean eventconsumed) { - if (eventconsumed || + public boolean handleSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, ClickType clickType, boolean eventConsumed) { + if (eventConsumed || !NEIClientConfig.isEnabled() || isSpreading(gui)) { - return eventconsumed; + return eventConsumed; } if (deleteMode && slotIndex >= 0 && slot != null) { @@ -140,7 +144,7 @@ public boolean handleSlotClick(GuiContainer gui, int slotIndex, int button, Slot { for (int i1 = 0; i1 < 64; i1++)//click this slot 64 times { - manager.handleSlotClick(slot.slotNumber, button, 0); + manager.handleSlotClick(slot.slotNumber, button, ClickType.PICKUP); } return true; } @@ -156,15 +160,15 @@ public boolean handleSlotClick(GuiContainer gui, int slotIndex, int button, Slot if (slotIndex >= 0 && NEIClientUtils.shiftKey() && NEIClientUtils.getHeldItem() != null && !slot.getHasStack()) { ItemStack held = NEIClientUtils.getHeldItem(); - manager.handleSlotClick(slot.slotNumber, button, 0); - if (slot.isItemValid(held) && !ItemInfo.fastTransferExemptions.contains(slot.getClass())) { + manager.handleSlotClick(slot.slotNumber, button, ClickType.PICKUP); + if (slot.isItemValid(held) && !ItemInfo.fastTransferExemptions.contains(slot.getClass()) && !ItemInfo.fastTransferContainerExemptions.contains(gui.getClass())) { fastTransferManager.performMassTransfer(gui, pickedUpFromSlot, slotIndex, held); } return true; } - if (slotIndex == -999 && NEIClientUtils.shiftKey() && button == 0) { + if (slotIndex == -999 && NEIClientUtils.shiftKey() && button == 0 && !ItemInfo.fastTransferContainerExemptions.contains(gui.getClass())) { fastTransferManager.throwAll(gui, pickedUpFromSlot); return true; } @@ -173,7 +177,7 @@ public boolean handleSlotClick(GuiContainer gui, int slotIndex, int button, Slot } @Override - public void afterSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, int modifier) { + public void afterSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, ClickType clickType) { if (!NEIClientConfig.isEnabled()) { return; } @@ -225,7 +229,7 @@ public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode) { int slotIndex = slot.slotNumber; - if (keyCode == Minecraft.getMinecraft().gameSettings.keyBindDrop.getKeyCode() && NEIClientUtils.shiftKey()) { + if (keyCode == Minecraft.getMinecraft().gameSettings.keyBindDrop.getKeyCode() && NEIClientUtils.shiftKey() && !ItemInfo.fastTransferContainerExemptions.contains(gui.getClass())) { FastTransferManager.clickSlot(gui, slotIndex); fastTransferManager.throwAll(gui, slotIndex); FastTransferManager.clickSlot(gui, slotIndex); @@ -244,7 +248,7 @@ public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrol Point mousePos = getMousePosition(); Slot mouseover = manager.window.getSlotAtPosition(mousePos.x, mousePos.y); - if (mouseover != null && mouseover.getHasStack()) { + if (mouseover != null && mouseover.getHasStack() && !ItemInfo.fastTransferContainerExemptions.contains(gui.getClass())) { if (scrolled > 0) { fastTransferManager.transferItem(manager.window, mouseover.slotNumber); } else { diff --git a/dependencies/main/java/codechicken/nei/NEICreativeGuiHandler.java b/dependencies/main/java/codechicken/nei/NEICreativeGuiHandler.java index 2ca53297a1..564ceb2be7 100644 --- a/dependencies/main/java/codechicken/nei/NEICreativeGuiHandler.java +++ b/dependencies/main/java/codechicken/nei/NEICreativeGuiHandler.java @@ -7,13 +7,13 @@ public class NEICreativeGuiHandler extends INEIGuiAdapter { @Override - public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) { + public VisibilityData modifyVisiblity(GuiContainer gui, VisibilityData currentVisibility) { if (!(gui instanceof GuiContainerCreative)) { return currentVisibility; } - if (((GuiContainerCreative) gui).getSelectedTabIndex() != CreativeTabs.tabInventory.getTabIndex()) { - currentVisibility.showItemSection = currentVisibility.enableDeleteMode = false; + if (((GuiContainerCreative) gui).getSelectedTabIndex() != CreativeTabs.INVENTORY.getTabIndex()) { + currentVisibility.showItemPanel = currentVisibility.enableDeleteMode = false; } return currentVisibility; diff --git a/dependencies/main/java/codechicken/nei/NEIDummySlotHandler.java b/dependencies/main/java/codechicken/nei/NEIDummySlotHandler.java index ddefba0547..25900bcf3d 100644 --- a/dependencies/main/java/codechicken/nei/NEIDummySlotHandler.java +++ b/dependencies/main/java/codechicken/nei/NEIDummySlotHandler.java @@ -3,6 +3,8 @@ import codechicken.core.inventory.ContainerExtended; import codechicken.core.inventory.SlotDummy; import codechicken.nei.api.INEIGuiAdapter; +import codechicken.nei.network.NEIClientPacketHandler; +import codechicken.nei.util.NEIClientUtils; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -13,7 +15,7 @@ public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemSta Slot slot = gui.getSlotAtPosition(mousex, mousey); if (slot instanceof SlotDummy && slot.isItemValid(draggedStack) && gui.inventorySlots instanceof ContainerExtended) { ((SlotDummy) slot).slotClick(draggedStack, button, NEIClientUtils.shiftKey()); - NEICPH.sendDummySlotSet(slot.slotNumber, slot.getStack()); + NEIClientPacketHandler.sendDummySlotSet(slot.slotNumber, slot.getStack()); return true; } return false; diff --git a/dependencies/main/java/codechicken/nei/NEIModContainer.java b/dependencies/main/java/codechicken/nei/NEIModContainer.java index 0b70680b5e..69ecd3af20 100644 --- a/dependencies/main/java/codechicken/nei/NEIModContainer.java +++ b/dependencies/main/java/codechicken/nei/NEIModContainer.java @@ -1,12 +1,12 @@ package codechicken.nei; -import codechicken.core.CommonUtils; import codechicken.core.launch.CodeChickenCorePlugin; +import codechicken.lib.CodeChickenLib; import codechicken.nei.api.IConfigureNEI; import codechicken.nei.asm.NEICorePlugin; import com.google.common.eventbus.EventBus; import com.google.common.eventbus.Subscribe; -import net.minecraft.util.TextFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.client.FMLFileResourcePack; import net.minecraftforge.fml.client.FMLFolderResourcePack; import net.minecraftforge.fml.common.*; @@ -34,7 +34,11 @@ public NEIModContainer() { @Override public Set getRequirements() { Set deps = new HashSet(); - deps.add(VersionParser.parseVersionReference("CodeChickenCore@[" + CodeChickenCorePlugin.version + ",)")); + if (!super.getMetadata().version.contains("$")) { + deps.add(VersionParser.parseVersionReference("CodeChickenLib@[" + CodeChickenLib.version + ",)")); + deps.add(VersionParser.parseVersionReference("CodeChickenCore@[" + CodeChickenCorePlugin.version + ",)")); + deps.add(VersionParser.parseVersionReference("JEI@[3.13.2,)")); + } return deps; } @@ -79,14 +83,15 @@ public boolean registerBus(EventBus bus, LoadController controller) { @Subscribe public void preInit(FMLPreInitializationEvent event) { - if (CommonUtils.isClient()) { + FingerprintChecker.runFingerprintChecks(); + if (event.getSide().isClient()) { ClientHandler.preInit(); } } @Subscribe public void init(FMLInitializationEvent event) { - if (CommonUtils.isClient()) { + if (event.getSide().isClient()) { ClientHandler.init(); } @@ -95,7 +100,7 @@ public void init(FMLInitializationEvent event) { @Override public VersionRange acceptableMinecraftVersionRange() { - return VersionParser.parseRange(CodeChickenCorePlugin.mcVersion); + return VersionParser.parseRange(CodeChickenLib.mcVersion); } @Override @@ -107,4 +112,9 @@ public File getSource() { public Class getCustomResourcePackClass() { return getSource().isFile() ? FMLFileResourcePack.class : FMLFolderResourcePack.class; } + + @Override + public Object getMod() { + return this; + } } diff --git a/dependencies/main/java/codechicken/nei/NEIServerConfig.java b/dependencies/main/java/codechicken/nei/NEIServerConfig.java index a6b5cfd638..9634a823d7 100644 --- a/dependencies/main/java/codechicken/nei/NEIServerConfig.java +++ b/dependencies/main/java/codechicken/nei/NEIServerConfig.java @@ -1,10 +1,13 @@ package codechicken.nei; -import codechicken.core.CommonUtils; -import codechicken.core.ServerUtils; +import codechicken.lib.util.CommonUtils; import codechicken.lib.config.ConfigFile; import codechicken.lib.inventory.InventoryUtils; import codechicken.lib.packet.PacketCustom; +import codechicken.lib.util.ServerUtils; +import codechicken.nei.network.NEIServerPacketHandler; +import codechicken.nei.util.LogHelper; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; @@ -15,8 +18,6 @@ import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import org.apache.commons.io.IOUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import java.io.File; import java.io.FileReader; @@ -26,7 +27,6 @@ public class NEIServerConfig { private static MinecraftServer server; - public static Logger logger = LogManager.getLogger("NotEnoughItems"); public static File saveDir; public static ConfigFile serverConfig; public static Map dimTags = new HashMap(); @@ -34,9 +34,9 @@ public class NEIServerConfig { public static ItemStackMap> bannedItems = new ItemStackMap>(); public static void load(World world) { - if (MinecraftServer.getServer() != server) { - logger.debug("Loading NEI Server"); - server = MinecraftServer.getServer(); + if (ServerUtils.mc() != server) { + LogHelper.debug("Loading NEI Server"); + server = ServerUtils.mc(); saveDir = new File(DimensionManager.getCurrentSaveRootDirectory(), "NEI"); dimTags.clear(); @@ -139,7 +139,7 @@ public static boolean isActionDisabled(int dim, String name) { public static void disableAction(int dim, String name, boolean disable) { dimTags.get(dim).setBoolean("disabled" + name, disable); - NEISPH.sendActionDisabled(dim, name, disable); + NEIServerPacketHandler.sendActionDisabled(dim, name, disable); saveWorld(dim); } @@ -188,7 +188,7 @@ private static void loadBannedItems() { bannedItems.clear(); File file = new File(saveDir, "banneditems.cfg"); if (!file.exists()) { - bannedItems.put(new ItemStack(Blocks.command_block), new HashSet(Arrays.asList("NONE"))); + bannedItems.put(new ItemStack(Blocks.COMMAND_BLOCK), new HashSet(Arrays.asList("NONE"))); saveBannedItems(); return; } @@ -201,7 +201,7 @@ private static void loadBannedItems() { } int delim = s.lastIndexOf('='); if (delim < 0) { - logger.error("line " + line + ": Missing ="); + LogHelper.error("line %s: Missing =", line); continue; } try { @@ -212,7 +212,7 @@ private static void loadBannedItems() { } bannedItems.put(InventoryUtils.loadPersistant(key), values); } catch (Exception e) { - logger.error("line " + line + ": " + e.getMessage()); + LogHelper.error("line %s: %s", line, e.getMessage()); } } r.close(); @@ -260,12 +260,12 @@ public static PlayerSave forPlayer(String username) { } public static void loadPlayer(EntityPlayer player) { - logger.debug("Loading Player: " + player.getGameProfile().getName()); + LogHelper.debug("Loading Player: " + player.getGameProfile().getName()); playerSaves.put(player.getName(), new PlayerSave((EntityPlayerMP) player, new File(saveDir, "players"))); } public static void unloadPlayer(EntityPlayer player) { - logger.debug("Unloading Player: " + player.getName()); + LogHelper.debug("Unloading Player: " + player.getName()); PlayerSave playerSave = playerSaves.remove(player.getName()); if (playerSave != null) { playerSave.save(); diff --git a/dependencies/main/java/codechicken/nei/OffsetPositioner.java b/dependencies/main/java/codechicken/nei/OffsetPositioner.java index a363029f36..8f54695c54 100644 --- a/dependencies/main/java/codechicken/nei/OffsetPositioner.java +++ b/dependencies/main/java/codechicken/nei/OffsetPositioner.java @@ -1,6 +1,7 @@ package codechicken.nei; import codechicken.nei.api.IStackPositioner; +import codechicken.nei.api.stack.PositionedStack; import java.util.ArrayList; diff --git a/dependencies/main/java/codechicken/nei/PlayerSave.java b/dependencies/main/java/codechicken/nei/PlayerSave.java index ba7fe65b67..0a6bedbe74 100644 --- a/dependencies/main/java/codechicken/nei/PlayerSave.java +++ b/dependencies/main/java/codechicken/nei/PlayerSave.java @@ -1,12 +1,15 @@ package codechicken.nei; import codechicken.lib.inventory.InventoryUtils; +import codechicken.lib.util.ServerUtils; +import codechicken.nei.network.NEIServerPacketHandler; +import codechicken.nei.util.LogHelper; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.server.MinecraftServer; import java.io.File; import java.util.HashSet; @@ -28,7 +31,7 @@ public class PlayerSave { public PlayerSave(EntityPlayerMP player, File saveLocation) { this.player = player; - wasOp = MinecraftServer.getServer().getConfigurationManager().canSendCommands(player.getGameProfile()); + wasOp = ServerUtils.mc().getPlayerList().canSendCommands(player.getGameProfile()); saveFile = new File(saveLocation, player.getName() + ".dat"); if (!saveFile.getParentFile().exists()) { @@ -47,7 +50,7 @@ private void load() { nbt = NEIServerUtils.readNBT(saveFile); } } catch (Exception e) { - NEIClientConfig.logger.error("Error loading player save: " + player, e); + LogHelper.errorError("Error loading player save: " + player, e); } loadCreativeInv(); @@ -74,7 +77,7 @@ public void save() { NEIServerUtils.writeNBT(nbt, saveFile); isDirty = false; } catch (Exception e) { - NEIClientConfig.logger.error("Error saving player: " + player, e); + LogHelper.errorError("Error saving player: " + player, e); } } @@ -94,9 +97,9 @@ public void setDirty() { } public void updateOpChange() { - boolean isOp = MinecraftServer.getServer().getConfigurationManager().canSendCommands(player.getGameProfile()); + boolean isOp = ServerUtils.mc().getPlayerList().canSendCommands(player.getGameProfile()); if (isOp != wasOp) { - NEISPH.sendHasServerSideTo(player); + NEIServerPacketHandler.sendHasServerSideTo(player); wasOp = isOp; } } @@ -115,12 +118,12 @@ private NBTTagCompound getEnabledActions() { public void enableAction(String name, boolean enabled) { getEnabledActions().setBoolean(name, enabled); - NEISPH.sendActionEnabled(player, name, enabled); + NEIServerPacketHandler.sendActionEnabled(player, name, enabled); setDirty(); } public void onWorldReload() { - NEISPH.sendHasServerSideTo(player); + NEIServerPacketHandler.sendHasServerSideTo(player); magneticItems.clear(); } } diff --git a/dependencies/main/java/codechicken/nei/PopupInputHandler.java b/dependencies/main/java/codechicken/nei/PopupInputHandler.java index 24e00dd844..1e84bb0790 100644 --- a/dependencies/main/java/codechicken/nei/PopupInputHandler.java +++ b/dependencies/main/java/codechicken/nei/PopupInputHandler.java @@ -1,10 +1,11 @@ package codechicken.nei; +import codechicken.nei.config.KeyBindings; import codechicken.nei.guihook.IContainerInputHandler; +import codechicken.nei.network.NEIClientPacketHandler; import net.minecraft.client.gui.inventory.GuiContainer; import static codechicken.nei.NEIClientConfig.canPerformAction; -import static codechicken.nei.NEIClientConfig.getKeyBinding; public class PopupInputHandler implements IContainerInputHandler { @Override @@ -23,12 +24,12 @@ public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) { @Override public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) { - if (keyID == getKeyBinding("gui.enchant") && canPerformAction("enchant")) { - NEICPH.sendOpenEnchantmentWindow(); + if (KeyBindings.get("nei.options.keys.gui.enchant").isActiveAndMatches(keyID) && canPerformAction("enchant")) { + NEIClientPacketHandler.sendOpenEnchantmentWindow(); return true; } - if (keyID == getKeyBinding("gui.potion") && canPerformAction("potion")) { - NEICPH.sendOpenPotionWindow(); + if (KeyBindings.get("nei.options.keys.gui.potion").isActiveAndMatches(keyID) && canPerformAction("potion")) { + NEIClientPacketHandler.sendOpenPotionWindow(); return true; } return false; diff --git a/dependencies/main/java/codechicken/nei/SaveLoadButton.java b/dependencies/main/java/codechicken/nei/SaveLoadButton.java index 947b131baa..4479cc1528 100644 --- a/dependencies/main/java/codechicken/nei/SaveLoadButton.java +++ b/dependencies/main/java/codechicken/nei/SaveLoadButton.java @@ -1,12 +1,14 @@ package codechicken.nei; +import codechicken.nei.util.NEIClientUtils; +import codechicken.nei.widget.Button; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.ChatAllowedCharacters; import org.lwjgl.input.Keyboard; import static codechicken.lib.gui.GuiDraw.drawString; import static codechicken.lib.gui.GuiDraw.getStringWidth; -import static codechicken.nei.NEIClientUtils.translate; +import static codechicken.nei.util.NEIClientUtils.translate; public abstract class SaveLoadButton extends Button { public SaveLoadButton(String s) { diff --git a/dependencies/main/java/codechicken/nei/SearchField.java b/dependencies/main/java/codechicken/nei/SearchField.java index 0ad88b668f..e3f2f7c9de 100644 --- a/dependencies/main/java/codechicken/nei/SearchField.java +++ b/dependencies/main/java/codechicken/nei/SearchField.java @@ -1,12 +1,13 @@ package codechicken.nei; +import codechicken.lib.item.filtering.IItemFilter; +import codechicken.lib.item.filtering.IItemFilterProvider; import codechicken.nei.ItemList.AnyMultiItemFilter; import codechicken.nei.ItemList.EverythingItemFilter; import codechicken.nei.ItemList.PatternItemFilter; import codechicken.nei.api.API; -import codechicken.nei.api.ItemFilter; -import codechicken.nei.api.ItemFilter.ItemFilterProvider; -import net.minecraft.util.TextFormatting; +import codechicken.nei.config.KeyBindings; +import net.minecraft.util.text.TextFormatting; import java.util.LinkedList; import java.util.List; @@ -17,20 +18,20 @@ import static codechicken.lib.gui.GuiDraw.drawRect; import static codechicken.nei.NEIClientConfig.world; -public class SearchField extends TextField implements ItemFilterProvider { +public class SearchField extends TextField implements IItemFilterProvider { /** * Interface for returning a custom filter based on search field text */ - public static interface ISearchProvider { + public interface ISearchProvider { /** * @return false if this filter should only be used if no other non-default filters match the search string */ - public boolean isPrimary(); + boolean isPrimary(); /** * @return An item filter for items matching SearchTex null to ignore this provider */ - public ItemFilter getFilter(String searchText); + IItemFilter getFilter(String searchText); } private static class DefaultSearchProvider implements ISearchProvider { @@ -40,7 +41,7 @@ public boolean isPrimary() { } @Override - public ItemFilter getFilter(String searchText) { + public IItemFilter getFilter(String searchText) { Pattern pattern = getPattern(searchText); return pattern == null ? null : new PatternItemFilter(pattern); } @@ -60,6 +61,14 @@ public static boolean searchInventories() { return world.nbt.getBoolean("searchinventories"); } + @Override + public int getTextColour() { +// if (JEIIntegrationManager.itemPannelOwner == EnumItemBrowser.JEI ? JEIIntegrationManager.getFilteredItems().size() == 0 : ItemPanel.items.size() == 0) { +// return Color.red.getRGB(); +// } + return super.getTextColour(); + } + @Override public void drawBox() { if (searchInventories()) { @@ -76,8 +85,9 @@ public boolean handleClick(int mousex, int mousey, int button) { if (focused() && (System.currentTimeMillis() - lastclicktime < 500)) {//double click NEIClientConfig.world.nbt.setBoolean("searchinventories", !searchInventories()); NEIClientConfig.world.saveNBT(); + } else { + lastclicktime = System.currentTimeMillis(); } - lastclicktime = System.currentTimeMillis(); } return super.handleClick(mousex, mousey, button); } @@ -90,7 +100,7 @@ public void onTextChange(String oldText) { @Override public void lastKeyTyped(int keyID, char keyChar) { - if (keyID == NEIClientConfig.getKeyBinding("gui.search")) { + if (KeyBindings.get("nei.options.keys.gui.search").isActiveAndMatches(keyID)) { setFocus(true); } } @@ -119,13 +129,13 @@ public static Pattern getPattern(String search) { } @Override - public ItemFilter getFilter() { + public IItemFilter getFilter() { String s_filter = text().toLowerCase(); - List primary = new LinkedList(); - List secondary = new LinkedList(); + List primary = new LinkedList(); + List secondary = new LinkedList(); for (ISearchProvider p : searchProviders) { - ItemFilter filter = p.getFilter(s_filter); + IItemFilter filter = p.getFilter(s_filter); if (filter != null) { (p.isPrimary() ? primary : secondary).add(filter); } diff --git a/dependencies/main/java/codechicken/nei/ServerHandler.java b/dependencies/main/java/codechicken/nei/ServerHandler.java index 0c2d96ce0a..06a384e8e8 100644 --- a/dependencies/main/java/codechicken/nei/ServerHandler.java +++ b/dependencies/main/java/codechicken/nei/ServerHandler.java @@ -1,6 +1,9 @@ package codechicken.nei; import codechicken.lib.packet.PacketCustom; +import codechicken.nei.network.NEIClientPacketHandler; +import codechicken.nei.network.NEIServerPacketHandler; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; @@ -8,7 +11,6 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.WorldEvent; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerChangedDimensionEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; @@ -25,11 +27,11 @@ public class ServerHandler { public static void init() { instance = new ServerHandler(); - PacketCustom.assignHandler(NEICPH.channel, new NEISPH()); - FMLCommonHandler.instance().bus().register(instance); + PacketCustom.assignHandler(NEIClientPacketHandler.channel, new NEIServerPacketHandler()); + //FMLCommonHandler.instance().bus().register(instance); MinecraftForge.EVENT_BUS.register(instance); - Item.getItemFromBlock(Blocks.mob_spawner).setHasSubtypes(true); + Item.getItemFromBlock(Blocks.MOB_SPAWNER).setHasSubtypes(true); NEIActions.init(); } @@ -44,8 +46,8 @@ public void tickEvent(TickEvent.WorldTickEvent event) { @SubscribeEvent public void loadEvent(WorldEvent.Load event) { - if (!event.world.isRemote) { - NEIServerConfig.load(event.world); + if (!event.getWorld().isRemote) { + NEIServerConfig.load(event.getWorld()); } } @@ -90,7 +92,7 @@ private void updateMagneticPlayer(EntityPlayerMP player, PlayerSave save) { continue; } if (save.magneticItems.add(item)) { - NEISPH.sendAddMagneticItemTo(player, item); + NEIServerPacketHandler.sendAddMagneticItemTo(player, item); } double dx = player.posX - item.posX; @@ -142,7 +144,7 @@ private void updateMagneticPlayer(EntityPlayerMP player, PlayerSave save) { @SubscribeEvent public void loginEvent(PlayerLoggedInEvent event) { NEIServerConfig.loadPlayer(event.player); - NEISPH.sendHasServerSideTo((EntityPlayerMP) event.player); + NEIServerPacketHandler.sendHasServerSideTo((EntityPlayerMP) event.player); } @SubscribeEvent diff --git a/dependencies/main/java/codechicken/nei/SpawnerRenderer.java b/dependencies/main/java/codechicken/nei/SpawnerRenderer.java index b7aa334920..125b65ffe3 100644 --- a/dependencies/main/java/codechicken/nei/SpawnerRenderer.java +++ b/dependencies/main/java/codechicken/nei/SpawnerRenderer.java @@ -1,31 +1,34 @@ package codechicken.nei; -import codechicken.core.ClientUtils; -import codechicken.lib.render.BlockRenderer; -import codechicken.lib.render.IItemRenderer; -import codechicken.lib.render.ModelRegistryHelper; +import codechicken.lib.model.ModelRegistryHelper; +import codechicken.lib.render.item.IItemRenderer; +import codechicken.lib.texture.TextureUtils; +import codechicken.lib.util.TransformUtils; +import codechicken.lib.util.ClientUtils; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.*; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.model.IBakedModel; -import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.entity.Entity; -import net.minecraft.entity.boss.BossStatus; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; +import net.minecraftforge.client.model.IPerspectiveAwareModel; +import org.apache.commons.lang3.tuple.Pair; +import javax.vecmath.Matrix4f; +import java.util.ArrayList; import java.util.List; -public class SpawnerRenderer implements IItemRenderer { +//import net.minecraft.entity.boss.BossStatus; + +public class SpawnerRenderer implements IItemRenderer, IPerspectiveAwareModel { public static void load(ItemMobSpawner item) { - ModelRegistryHelper.registerItemRenderer(item, new SpawnerRenderer(), new ResourceLocation("mob_spawner")); + ModelRegistryHelper.registerItemRenderer(item, new SpawnerRenderer()); } public void renderItem(ItemStack stack) { @@ -35,8 +38,8 @@ public void renderItem(ItemStack stack) { meta = ItemMobSpawner.idPig; } - String bossName = BossStatus.bossName; - int bossTimeout = BossStatus.statusBarTime; + //String bossName = BossStatus.bossName; + //int bossTimeout = BossStatus.statusBarTime; Minecraft mc = Minecraft.getMinecraft(); World world = mc.theWorld; @@ -59,31 +62,26 @@ public void renderItem(ItemStack stack) { GlStateManager.translate(0, -0.4, 0); GlStateManager.scale(scale, scale, scale); entity.setLocationAndAngles(0, 0, 0, 0, 0); - mc.getRenderManager().renderEntityWithPosYaw(entity, 0, 0, 0, 0, 0); + mc.getRenderManager().doRenderEntity(entity, 0, 0, 0, 0, 0, false); GlStateManager.disableLighting(); GlStateManager.popMatrix(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GlStateManager.enableRescaleNormal(); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GL11.glDisable(GL11.GL_TEXTURE_2D); + GlStateManager.disableTexture2D(); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); } catch (Exception e) { - if (Tessellator.getInstance().getWorldRenderer().isDrawing) { + if (Tessellator.getInstance().getBuffer().isDrawing) { Tessellator.getInstance().draw(); } } - BossStatus.bossName = bossName; - BossStatus.statusBarTime = bossTimeout; + //BossStatus.bossName = bossName; + //BossStatus.statusBarTime = bossTimeout; } @Override - public List getFaceQuads(EnumFacing p_177551_1_) { - return null; - } - - @Override - public List getGeneralQuads() { - return null; + public List getQuads(IBlockState state, EnumFacing side, long rand) { + return new ArrayList(); } @Override @@ -103,11 +101,21 @@ public boolean isBuiltInRenderer() { @Override public TextureAtlasSprite getParticleTexture() { - return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/mob_spawner"); + return TextureUtils.getBlockTexture("mob_spawner"); } @Override public ItemCameraTransforms getItemCameraTransforms() { - return BlockRenderer.blockCameraTransform; + return ItemCameraTransforms.DEFAULT; + } + + @Override + public ItemOverrideList getOverrides() { + return ItemOverrideList.NONE; + } + + @Override + public Pair handlePerspective(TransformType cameraTransformType) { + return MapWrapper.handlePerspective(this, TransformUtils.DEFAULT_BLOCK.getTransforms(), cameraTransformType); } } diff --git a/dependencies/main/java/codechicken/nei/SubsetWidget.java b/dependencies/main/java/codechicken/nei/SubsetWidget.java index d213a5c30a..c6e4f58204 100644 --- a/dependencies/main/java/codechicken/nei/SubsetWidget.java +++ b/dependencies/main/java/codechicken/nei/SubsetWidget.java @@ -2,21 +2,24 @@ import codechicken.core.gui.GuiScrollSlot; import codechicken.lib.gui.GuiDraw; +import codechicken.lib.item.filtering.IItemFilter; +import codechicken.lib.item.filtering.IItemFilterProvider; +import codechicken.lib.thread.RestartableTask; import codechicken.lib.vec.Rectangle4i; import codechicken.nei.ItemList.AnyMultiItemFilter; import codechicken.nei.ItemList.ItemsLoadedCallback; import codechicken.nei.ItemList.NothingItemFilter; import codechicken.nei.SearchField.ISearchProvider; import codechicken.nei.api.API; -import codechicken.nei.api.ItemFilter; -import codechicken.nei.api.ItemFilter.ItemFilterProvider; import codechicken.nei.api.ItemInfo; import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.util.LogHelper; +import codechicken.nei.util.NEIClientUtils; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.TextFormatting; +import net.minecraft.util.text.TextFormatting; import java.awt.*; import java.util.*; @@ -24,7 +27,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.regex.Pattern; -public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoadedCallback, ISearchProvider { +public class SubsetWidget extends codechicken.nei.widget.Button implements IItemFilterProvider, ItemsLoadedCallback, ISearchProvider { public static class SubsetState { int state = 2; ArrayList items = new ArrayList(); @@ -52,7 +55,11 @@ protected void slotClicked(int slot, int button, int mx, int my, int count) { if (slot < sorted.size()) { SubsetTag tag = sorted.get(slot); if (NEIClientUtils.shiftKey()) { - LayoutManager.searchField.setText("@" + tag.fullname); + String searchTag = tag.fullname;//TODO + if (searchTag.startsWith("Mod.")/* && JEIIntegrationManager.itemPannelOwner == EnumItemBrowser.JEI*/){ + searchTag = searchTag.replace("Mod.", "").replace(" ", ""); + } + LayoutManager.searchField.setText("@" + searchTag); } else if (button == 0 && count >= 2) { SubsetWidget.showOnly(tag); } else { @@ -119,7 +126,7 @@ public int scrollbarGuideAlignment() { } public final String fullname; - public final ItemFilter filter; + public final IItemFilter filter; public TreeMap children = new TreeMap(); public List sorted = Collections.emptyList(); private int childwidth; @@ -134,7 +141,7 @@ public SubsetTag(String fullname) { this(fullname, new NothingItemFilter()); } - public SubsetTag(String fullname, ItemFilter filter) { + public SubsetTag(String fullname, IItemFilter filter) { assert filter != null : "Filter cannot be null"; this.fullname = TextFormatting.getTextWithoutFormattingCodes(fullname); this.filter = filter; @@ -207,7 +214,7 @@ protected void cacheState() { } } - public void addFilters(List filters) { + public void addFilters(List filters) { if (filter != null) { filters.add(filter); } @@ -476,7 +483,7 @@ public static void loadHidden() { itemList.add(ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i))); } } catch (Exception e) { - NEIClientConfig.logger.error("Error loading hiddenItems", e); + LogHelper.errorError("Error loading hiddenItems", e); return; } @@ -738,8 +745,8 @@ public ItemStack getStackMouseOver(int mx, int my) { } @Override - public ItemFilter getFilter() { - return new ItemFilter()//synchronise access on hiddenItems + public IItemFilter getFilter() { + return new IItemFilter()//synchronise access on hiddenItems { @Override public boolean matches(ItemStack item) { @@ -756,7 +763,7 @@ public boolean isPrimary() { } @Override - public ItemFilter getFilter(String searchText) { + public IItemFilter getFilter(String searchText) { if (!searchText.startsWith("@")) { return null; } diff --git a/dependencies/main/java/codechicken/nei/TextField.java b/dependencies/main/java/codechicken/nei/TextField.java index 0a124e524e..d035317006 100644 --- a/dependencies/main/java/codechicken/nei/TextField.java +++ b/dependencies/main/java/codechicken/nei/TextField.java @@ -1,5 +1,6 @@ package codechicken.nei; +import codechicken.nei.widget.Widget; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.ChatAllowedCharacters; import org.lwjgl.input.Keyboard; @@ -11,6 +12,13 @@ public TextField(String ident) { identifier = ident; } + private String text = ""; + public boolean centered; + public long backdowntime; + public int backs; + public String identifier; + public int cursorCounter; + public int getTextColour() { return focused() ? 0xFFE0E0E0 : 0xFF909090; } @@ -121,6 +129,14 @@ public void setText(String s) { onTextChange(oldText); } + public void setText(String s, boolean updateJEI) { + if (updateJEI) { + setText(s); + } else { + text = filterText(s); + } + } + public String filterText(String s) { return s; } @@ -140,11 +156,4 @@ public boolean focused() { public String text() { return text; } - - private String text = ""; - public boolean centered; - public long backdowntime; - public int backs; - public String identifier; - public int cursorCounter; } diff --git a/dependencies/main/java/codechicken/nei/VisiblityData.java b/dependencies/main/java/codechicken/nei/VisibilityData.java similarity index 68% rename from dependencies/main/java/codechicken/nei/VisiblityData.java rename to dependencies/main/java/codechicken/nei/VisibilityData.java index e77eb007c7..43da0020e6 100644 --- a/dependencies/main/java/codechicken/nei/VisiblityData.java +++ b/dependencies/main/java/codechicken/nei/VisibilityData.java @@ -1,6 +1,6 @@ package codechicken.nei; -public class VisiblityData { +public class VisibilityData { public boolean showUtilityButtons = true; public boolean showStateButtons = true; /** @@ -10,6 +10,7 @@ public class VisiblityData { /** * Item and search section */ + @Deprecated public boolean showItemSection = true; /** * Dropdown and Item search field @@ -30,10 +31,14 @@ public void translateDependancies() { showWidgets = false; } if (!showWidgets) { - showItemSection = showUtilityButtons = showStateButtons = false; - } - if (!showItemSection) { - showSearchSection = showItemPanel = false; + showSearchSection = showItemPanel = showUtilityButtons = showStateButtons = false; } +// JEIIntegrationManager.pushChanges(this); + + //if (!showItemSection){ + // showSearchSection = showItemPanel = false; + //} else { + // showSearchSection = showItemPanel = true; + //} } } diff --git a/dependencies/main/java/codechicken/nei/WidgetZOrder.java b/dependencies/main/java/codechicken/nei/WidgetZOrder.java index 2e0159337f..3631a6724b 100644 --- a/dependencies/main/java/codechicken/nei/WidgetZOrder.java +++ b/dependencies/main/java/codechicken/nei/WidgetZOrder.java @@ -1,15 +1,17 @@ package codechicken.nei; +import codechicken.nei.widget.Widget; + import java.util.Comparator; public class WidgetZOrder implements Comparator { - boolean topfirst; + boolean topFirst; - public WidgetZOrder(boolean topfirst) { - this.topfirst = topfirst; + public WidgetZOrder(boolean topFirst) { + this.topFirst = topFirst; } public int compare(Widget w1, Widget w2) { - return w1.z != w2.z ? ((topfirst ? w1.z > w2.z : w1.z < w2.z) ? 1 : -1) : 1; + return w1.z != w2.z ? ((topFirst ? w1.z > w2.z : w1.z < w2.z) ? 1 : -1) : 1; } } diff --git a/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java b/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java index d513ecc4c7..2def5ce147 100644 --- a/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java +++ b/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java @@ -2,14 +2,15 @@ import codechicken.lib.math.MathHelper; import codechicken.lib.render.RenderUtils; +import codechicken.lib.render.state.GlStateManagerHelper; import codechicken.lib.vec.Cuboid6; import codechicken.nei.KeyManager.IKeyStateTracker; +import codechicken.nei.config.KeyBindings; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving.SpawnPlacementType; import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.passive.EntityPig; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.EnumSkyBlock; @@ -35,24 +36,27 @@ public void tickKeyStates() { return; } - if (KeyManager.keyStates.get("world.moboverlay").down) { + if (KeyBindings.get("nei.options.keys.world.moboverlay").isPressed()) { mobOverlay = (mobOverlay + 1) % 2; } - if (KeyManager.keyStates.get("world.chunkoverlay").down) { + if (KeyBindings.get("nei.options.keys.world.chunkoverlay").isPressed()) { chunkOverlay = (chunkOverlay + 1) % 3; } } public static void render(float frame) { GlStateManager.pushMatrix(); + GlStateManagerHelper.pushState(); Entity entity = Minecraft.getMinecraft().getRenderViewEntity(); RenderUtils.translateToWorldCoords(entity, frame); renderChunkBounds(entity); renderMobSpawnOverlay(entity); + GlStateManagerHelper.popState(); GlStateManager.popMatrix(); } + //TODO Improve the performance of this. private static void renderMobSpawnOverlay(Entity entity) { if (mobOverlay == 0) { return; @@ -104,7 +108,7 @@ private static void renderMobSpawnOverlay(Entity entity) { GlStateManager.enableTexture2D(); } - private static Entity dummyEntity = new EntityPig(null); + //private static Entity dummyEntity = new EntityPig(null); private static Cuboid6 c = new Cuboid6(); private static int getSpawnMode(Chunk chunk, int x, int y, int z) { @@ -116,9 +120,7 @@ private static int getSpawnMode(Chunk chunk, int x, int y, int z) { c.set(x + 0.2, y + 0.01, z + 0.2, x + 0.8, y + 1.8, z + 0.8); AxisAlignedBB aabb = c.aabb(); - if (!world.checkNoEntityCollision(aabb) || - !world.getCollisionBoxes(dummyEntity, aabb).isEmpty() || - world.containsAnyLiquid(aabb)) { + if (!world.checkNoEntityCollision(aabb) || !world.getEntitiesWithinAABBExcludingEntity(null, aabb).isEmpty() || world.containsAnyLiquid(aabb)) { return 0; } diff --git a/dependencies/main/java/codechicken/nei/api/API.java b/dependencies/main/java/codechicken/nei/api/API.java index 910ceaea8e..3f13601f0d 100644 --- a/dependencies/main/java/codechicken/nei/api/API.java +++ b/dependencies/main/java/codechicken/nei/api/API.java @@ -1,18 +1,23 @@ package codechicken.nei.api; +import codechicken.lib.item.filtering.IItemFilter; +import codechicken.lib.item.filtering.IItemFilterProvider; import codechicken.nei.*; -import codechicken.nei.KeyManager.KeyState; import codechicken.nei.SearchField.ISearchProvider; import codechicken.nei.SubsetWidget.SubsetTag; -import codechicken.nei.api.ItemFilter.ItemFilterProvider; +import codechicken.nei.api.layout.LayoutStyle; +import codechicken.nei.config.KeyBindings; import codechicken.nei.config.Option; -import codechicken.nei.config.OptionKeyBind; import codechicken.nei.recipe.*; import net.minecraft.block.Block; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.settings.KeyBinding; import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraftforge.client.settings.IKeyConflictContext; +import net.minecraftforge.client.settings.KeyModifier; +import net.minecraftforge.fml.client.registry.ClientRegistry; import org.lwjgl.input.Keyboard; import java.util.Collections; @@ -141,11 +146,11 @@ public static void setItemListEntries(Item item, Iterable items) { * * @param ident An identifier for your key, eg "shoot" * @param defaultKey The default value, commonly obtained from {@link Keyboard} + * @deprecated use {@link ClientRegistry#registerKeyBinding(KeyBinding)} */ + @Deprecated public static void addKeyBind(String ident, int defaultKey) { - NEIClientConfig.setDefaultKeyBinding(ident, defaultKey); - KeyManager.keyStates.put(ident, new KeyState()); - addOption(new OptionKeyBind(ident)); + KeyBindings.setDefaultKeyBinding(ident, defaultKey); } public static void addOption(Option option) { @@ -177,6 +182,7 @@ public static void addInfiniteItemHandler(IInfiniteItemHandler handler) { * @param block The block to handle, null for all. * @param handler The handler to be registered. */ + @Deprecated public static void registerHighlightIdentifier(Block block, IHighlightHandler handler) { ItemInfo.highlightIdentifiers.put(block, handler); } @@ -190,12 +196,22 @@ public static void addFastTransferExemptSlot(Class slotClass) { ItemInfo.fastTransferExemptions.add(slotClass); } + /** + * Tells NEI not to perform any Fast Transfer operations on a GuiContainer of a specific class. + * + * @param guiClass The class of the container to be exempted + */ + public static void addFastTransferExemptContainer(Class guiClass) { + ItemInfo.fastTransferContainerExemptions.add(guiClass); + } + /** * Register a new text handler for the block highlight tooltip with a layout specification (HEADER, BODY or FOOTER). * * @param handler The handler to be registered. * @param layout A HUDAugmenterRegistry.Layout entry. HEADER is displayed before BODY which is displayed before FOOTER. */ + @Deprecated public static void registerHighlightHandler(IHighlightHandler handler, ItemInfo.Layout... layout) { ItemInfo.registerHighlightHandler(handler, layout); } @@ -214,7 +230,7 @@ public static void registerModeHandler(INEIModeHandler handler) { * * @param filterProvider The filter provider to be registered. */ - public static void addItemFilter(ItemFilterProvider filterProvider) { + public static void addItemFilter(IItemFilterProvider filterProvider) { synchronized (ItemList.itemFilterers) { ItemList.itemFilterers.add(filterProvider); } @@ -226,7 +242,7 @@ public static void addItemFilter(ItemFilterProvider filterProvider) { * @param name The fully qualified name, Eg Blocks.MobSpawners. NOT case sensitive * @param filter A filter for matching items that fit in this subset */ - public static void addSubset(String name, ItemFilter filter) { + public static void addSubset(String name, IItemFilter filter) { addSubset(new SubsetTag(name, filter)); } diff --git a/dependencies/main/java/codechicken/nei/api/DefaultOverlayRenderer.java b/dependencies/main/java/codechicken/nei/api/DefaultOverlayRenderer.java index 142a4a1f67..fb37cad9c8 100644 --- a/dependencies/main/java/codechicken/nei/api/DefaultOverlayRenderer.java +++ b/dependencies/main/java/codechicken/nei/api/DefaultOverlayRenderer.java @@ -1,6 +1,6 @@ package codechicken.nei.api; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import codechicken.nei.guihook.GuiContainerManager; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.inventory.Slot; diff --git a/dependencies/main/java/codechicken/nei/api/IConfigureNEI.java b/dependencies/main/java/codechicken/nei/api/IConfigureNEI.java index fd67a61d79..604ba82eab 100644 --- a/dependencies/main/java/codechicken/nei/api/IConfigureNEI.java +++ b/dependencies/main/java/codechicken/nei/api/IConfigureNEI.java @@ -5,9 +5,9 @@ * loadConfig will only be called when NEI is installed. */ public interface IConfigureNEI { - public void loadConfig(); + void loadConfig(); - public String getName(); + String getName(); - public String getVersion(); + String getVersion(); } diff --git a/dependencies/main/java/codechicken/nei/api/IGuiContainerOverlay.java b/dependencies/main/java/codechicken/nei/api/IGuiContainerOverlay.java index 94d6d940af..6d5a5a6efc 100644 --- a/dependencies/main/java/codechicken/nei/api/IGuiContainerOverlay.java +++ b/dependencies/main/java/codechicken/nei/api/IGuiContainerOverlay.java @@ -3,5 +3,5 @@ import net.minecraft.client.gui.inventory.GuiContainer; public interface IGuiContainerOverlay { - public GuiContainer getFirstScreen(); + GuiContainer getFirstScreen(); } diff --git a/dependencies/main/java/codechicken/nei/api/IHighlightHandler.java b/dependencies/main/java/codechicken/nei/api/IHighlightHandler.java index ca262b0d6e..d47476e5b2 100644 --- a/dependencies/main/java/codechicken/nei/api/IHighlightHandler.java +++ b/dependencies/main/java/codechicken/nei/api/IHighlightHandler.java @@ -2,13 +2,14 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import java.util.List; +@Deprecated public interface IHighlightHandler { - public ItemStack identifyHighlight(World world, EntityPlayer player, MovingObjectPosition mop); + ItemStack identifyHighlight(World world, EntityPlayer player, RayTraceResult rayTraceResult); - public List handleTextData(ItemStack itemStack, World world, EntityPlayer player, MovingObjectPosition mop, List currenttip, ItemInfo.Layout layout); + List handleTextData(ItemStack itemStack, World world, EntityPlayer player, RayTraceResult rayTraceResult, List currentTip, ItemInfo.Layout layout); } diff --git a/dependencies/main/java/codechicken/nei/api/IInfiniteItemHandler.java b/dependencies/main/java/codechicken/nei/api/IInfiniteItemHandler.java index 1c9552bbf2..a130a25afa 100644 --- a/dependencies/main/java/codechicken/nei/api/IInfiniteItemHandler.java +++ b/dependencies/main/java/codechicken/nei/api/IInfiniteItemHandler.java @@ -12,7 +12,7 @@ public interface IInfiniteItemHandler { boolean isItemInfinite(ItemStack stack); - public void replenishInfiniteStack(InventoryPlayer inventory, int slotNo); + void replenishInfiniteStack(InventoryPlayer inventory, int slotNo); - public ItemStack getInfiniteItem(ItemStack typeStack); + ItemStack getInfiniteItem(ItemStack typeStack); } diff --git a/dependencies/main/java/codechicken/nei/api/INEIGuiAdapter.java b/dependencies/main/java/codechicken/nei/api/INEIGuiAdapter.java index fb72849d9e..2bf4aed79b 100644 --- a/dependencies/main/java/codechicken/nei/api/INEIGuiAdapter.java +++ b/dependencies/main/java/codechicken/nei/api/INEIGuiAdapter.java @@ -1,6 +1,6 @@ package codechicken.nei.api; -import codechicken.nei.VisiblityData; +import codechicken.nei.VisibilityData; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.item.ItemStack; @@ -12,7 +12,7 @@ */ public class INEIGuiAdapter implements INEIGuiHandler { @Override - public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) { + public VisibilityData modifyVisiblity(GuiContainer gui, VisibilityData currentVisibility) { return currentVisibility; } diff --git a/dependencies/main/java/codechicken/nei/api/INEIGuiHandler.java b/dependencies/main/java/codechicken/nei/api/INEIGuiHandler.java index e968e4f5eb..ac8af74aa9 100644 --- a/dependencies/main/java/codechicken/nei/api/INEIGuiHandler.java +++ b/dependencies/main/java/codechicken/nei/api/INEIGuiHandler.java @@ -1,6 +1,6 @@ package codechicken.nei.api; -import codechicken.nei.VisiblityData; +import codechicken.nei.VisibilityData; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.item.ItemStack; @@ -10,18 +10,18 @@ * If this is implemented on a gui, it will be automatically registered */ public interface INEIGuiHandler { - public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility); + VisibilityData modifyVisiblity(GuiContainer gui, VisibilityData currentVisibility); /** * NEI will give the specified item to the InventoryRange returned if the player's inventory is full. * Should not return null, just an empty list */ - public Iterable getItemSpawnSlots(GuiContainer gui, ItemStack item); + Iterable getItemSpawnSlots(GuiContainer gui, ItemStack item); /** * @return A list of TaggedInventoryAreas that will be used with the savestates. */ - public List getInventoryAreas(GuiContainer gui); + List getInventoryAreas(GuiContainer gui); /** * Handles clicks while an itemstack has been dragged from the item panel. Use this to set configurable slots and the like. @@ -34,7 +34,7 @@ public interface INEIGuiHandler { * @param button The button presed * @return True if the drag n drop was handled. False to resume processing through other routes. The held stack will be deleted if draggedStack.stackSize == 0 */ - public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button); + boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button); /** * Used to prevent the item panel from drawing on top of other gui elements. @@ -46,5 +46,5 @@ public interface INEIGuiHandler { * @param h The h coordinate of the rectangle bounding the slot * @return true if the item panel slot within the specified rectangle should not be rendered. */ - public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h); + boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h); } diff --git a/dependencies/main/java/codechicken/nei/api/INEIModeHandler.java b/dependencies/main/java/codechicken/nei/api/INEIModeHandler.java index 49a6d0b732..80355dba14 100644 --- a/dependencies/main/java/codechicken/nei/api/INEIModeHandler.java +++ b/dependencies/main/java/codechicken/nei/api/INEIModeHandler.java @@ -1,5 +1,5 @@ package codechicken.nei.api; public interface INEIModeHandler { - public boolean isModeValid(int mode); + boolean isModeValid(int mode); } diff --git a/dependencies/main/java/codechicken/nei/api/IOverlayHandler.java b/dependencies/main/java/codechicken/nei/api/IOverlayHandler.java index c068ef13f1..6bceaef4d3 100644 --- a/dependencies/main/java/codechicken/nei/api/IOverlayHandler.java +++ b/dependencies/main/java/codechicken/nei/api/IOverlayHandler.java @@ -4,5 +4,5 @@ import net.minecraft.client.gui.inventory.GuiContainer; public interface IOverlayHandler { - public void overlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex, boolean shift); + void overlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex, boolean shift); } diff --git a/dependencies/main/java/codechicken/nei/api/IRecipeOverlayRenderer.java b/dependencies/main/java/codechicken/nei/api/IRecipeOverlayRenderer.java index b94ef0fe7a..431942c02f 100644 --- a/dependencies/main/java/codechicken/nei/api/IRecipeOverlayRenderer.java +++ b/dependencies/main/java/codechicken/nei/api/IRecipeOverlayRenderer.java @@ -4,5 +4,5 @@ import net.minecraft.inventory.Slot; public interface IRecipeOverlayRenderer { - public void renderOverlay(GuiContainerManager gui, Slot slot); + void renderOverlay(GuiContainerManager gui, Slot slot); } diff --git a/dependencies/main/java/codechicken/nei/api/IStackPositioner.java b/dependencies/main/java/codechicken/nei/api/IStackPositioner.java index 70baf7f598..bb42cce39c 100644 --- a/dependencies/main/java/codechicken/nei/api/IStackPositioner.java +++ b/dependencies/main/java/codechicken/nei/api/IStackPositioner.java @@ -1,6 +1,6 @@ package codechicken.nei.api; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import java.util.ArrayList; @@ -8,5 +8,5 @@ * For repositioning recipes in overlay renderers. */ public interface IStackPositioner { - public ArrayList positionStacks(ArrayList ai); + ArrayList positionStacks(ArrayList ai); } diff --git a/dependencies/main/java/codechicken/nei/api/ItemFilter.java b/dependencies/main/java/codechicken/nei/api/ItemFilter.java deleted file mode 100644 index d65ed71118..0000000000 --- a/dependencies/main/java/codechicken/nei/api/ItemFilter.java +++ /dev/null @@ -1,14 +0,0 @@ -package codechicken.nei.api; - -import net.minecraft.item.ItemStack; - -public interface ItemFilter { - /** - * Provides an item filter. May be called from any thread. Returned filter should only reference objects with immutable state. - */ - public static interface ItemFilterProvider { - public ItemFilter getFilter(); - } - - public boolean matches(ItemStack item); -} \ No newline at end of file diff --git a/dependencies/main/java/codechicken/nei/api/ItemInfo.java b/dependencies/main/java/codechicken/nei/api/ItemInfo.java index 461f861085..0c455af309 100644 --- a/dependencies/main/java/codechicken/nei/api/ItemInfo.java +++ b/dependencies/main/java/codechicken/nei/api/ItemInfo.java @@ -1,42 +1,49 @@ package codechicken.nei.api; +import codechicken.lib.item.filtering.IItemFilter; +import codechicken.lib.item.filtering.IItemFilterProvider; import codechicken.nei.*; import codechicken.nei.ItemList.ItemsLoadedCallback; -import codechicken.nei.api.ItemFilter.ItemFilterProvider; -import codechicken.nei.config.ArrayDumper; import codechicken.nei.config.ItemPanelDumper; -import codechicken.nei.config.RegistryDumper; +import codechicken.nei.config.dumps.FluidRegistryDumper; +import codechicken.nei.config.dumps.ForgeRegistryDumper; import codechicken.nei.guihook.GuiContainerManager; import codechicken.nei.recipe.BrewingRecipeHandler; import codechicken.nei.recipe.RecipeItemInputHandler; +import codechicken.nei.recipe.potion.PotionRecipeHelper; +import codechicken.nei.thirdparty.colossalchests.ColossalChestsConfig; +import codechicken.nei.util.LogHelper; import com.google.common.collect.ArrayListMultimap; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityList.EntityEggInfo; -import net.minecraft.entity.monster.EntityIronGolem; -import net.minecraft.entity.monster.EntitySnowman; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.inventory.Slot; import net.minecraft.item.*; import net.minecraft.potion.Potion; -import net.minecraft.util.BlockPos; -import net.minecraft.util.TextFormatting; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.RegistryNamespaced; +import net.minecraft.potion.PotionHelper; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundEvent; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.common.IShearable; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.common.registry.GameRegistry.UniqueIdentifier; +import net.minecraftforge.fml.common.registry.ForgeRegistries; +import net.minecraftforge.fml.common.registry.IForgeRegistry; import java.util.*; import java.util.Map.Entry; @@ -45,10 +52,13 @@ * This is an internal class for storing information about items, to be accessed by the API */ public class ItemInfo { - public static enum Layout { - HEADER, BODY, FOOTER + public enum Layout { + HEADER, + BODY, + FOOTER } + @Deprecated public static final ArrayListMultimap highlightHandlers = ArrayListMultimap.create(); public static final ItemStackMap nameOverrides = new ItemStackMap(); public static final ItemStackSet hiddenItems = new ItemStackSet(); @@ -57,8 +67,10 @@ public static enum Layout { public static final ArrayListMultimap itemVariants = ArrayListMultimap.create(); public static final LinkedList infiniteHandlers = new LinkedList(); + @Deprecated public static final ArrayListMultimap highlightIdentifiers = ArrayListMultimap.create(); public static final HashSet> fastTransferExemptions = new HashSet>(); + public static final HashSet> fastTransferContainerExemptions = new HashSet>(); public static final HashMap itemOwners = new HashMap(); @@ -98,6 +110,8 @@ public static void init() { } public static void load(World world) { + ColossalChestsConfig.init(); + PotionRecipeHelper.init(); addVanillaBlockProperties(); addDefaultDropDowns(); searchItems(); @@ -112,8 +126,8 @@ public static void load(World world) { } private static void addVanillaBlockProperties() { - API.hideItem(new ItemStack(Blocks.farmland)); - API.hideItem(new ItemStack(Blocks.lit_furnace)); + API.hideItem(new ItemStack(Blocks.FARMLAND)); + API.hideItem(new ItemStack(Blocks.LIT_FURNACE)); } private static void addSearchOptimisation() { @@ -126,10 +140,10 @@ public void itemsLoaded() { } private static void addHiddenItemFilter() { - API.addItemFilter(new ItemFilterProvider() { + API.addItemFilter(new IItemFilterProvider() { @Override - public ItemFilter getFilter() { - return new ItemFilter() { + public IItemFilter getFilter() { + return new IItemFilter() { @Override public boolean matches(ItemStack item) { return !hiddenItems.contains(item); @@ -140,106 +154,139 @@ public boolean matches(ItemStack item) { } private static void addIDDumps() { - API.addOption(new RegistryDumper("tools.dump.item") { + API.addOption(new ForgeRegistryDumper("tools.dump.item") { @Override - public String[] header() { - return new String[] { "Name", "ID", "Has Block", "Mod", "Class" }; + public IForgeRegistry registry() { + return ForgeRegistries.ITEMS; } @Override - public String[] dump(Item item, int id, String name) { - return new String[] { name, Integer.toString(id), Boolean.toString(Block.getBlockFromItem(item) != Blocks.AIR), ItemInfo.itemOwners.get(item), item.getClass().getCanonicalName() }; + public String[] dump(Item obj, ResourceLocation registryName) { + int id = Item.getIdFromItem(obj); + boolean hasBlock = Block.getBlockFromItem(obj) != null && Block.getBlockFromItem(obj) != Blocks.AIR; + return new String[] { registryName.toString(), Integer.toString(id), Boolean.toString(hasBlock), obj.getClass().getCanonicalName() }; } @Override - public RegistryNamespaced registry() { - return Item.itemRegistry; + public String[] header() { + return new String[] { "Registry Name", "ID", "Has Block", "Class" }; } }); - API.addOption(new RegistryDumper("tools.dump.block") { + API.addOption(new ForgeRegistryDumper("tools.dump.block") { @Override - public String[] header() { - return new String[] { "Name", "ID", "Has Item", "Mod", "Class" }; + public IForgeRegistry registry() { + return ForgeRegistries.BLOCKS; } @Override - public String[] dump(Block item, int id, String name) { - return new String[] { name, Integer.toString(id), Boolean.toString(Item.getItemFromBlock(item) != null), ItemInfo.itemOwners.get(item), item.getClass().getCanonicalName() }; + public String[] dump(Block obj, ResourceLocation registryName) { + int id = Block.getIdFromBlock(obj); + boolean hasBlock = Item.getItemFromBlock(obj) != null; //&& Block.getBlockFromItem(obj) != Blocks.AIR; + return new String[] { registryName.toString(), Integer.toString(id), Boolean.toString(hasBlock), obj.getClass().getCanonicalName() }; } @Override - public RegistryNamespaced registry() { - return Block.blockRegistry; + public String[] header() { + return new String[] { "Registry Name", "ID", "Has Item", "Class" }; } }); - API.addOption(new ArrayDumper("tools.dump.potion") { - public String[] header() { - return new String[] { "ID", "Unlocalised name", "Class" }; + API.addOption(new FluidRegistryDumper()); + API.addOption(new ForgeRegistryDumper("tools.dump.potion") { + @Override + public IForgeRegistry registry() { + return ForgeRegistries.POTIONS; } @Override - public String[] dump(Potion potion, int id) { - return new String[] { Integer.toString(id), potion.getName(), potion.getClass().getCanonicalName() }; + public String[] dump(Potion obj, ResourceLocation registryName) { + int id = Potion.getIdFromPotion(obj); + return new String[] { registryName.toString(), Integer.toString(id), Boolean.toString(obj.isBadEffect()), Boolean.toString(obj.isBeneficial()), obj.getClass().getCanonicalName() }; } @Override - public Potion[] array() { - return Potion.potionTypes; + public String[] header() { + return new String[] { "Registry Name", "ID", "Is bad Effect", "Is beneficial", "Class" }; } }); - API.addOption(new ArrayDumper("tools.dump.enchantment") { - public String[] header() { - return new String[] { "ID", "Unlocalised name", "Type", "Min Level", "Max Level", "Class" }; + API.addOption(new ForgeRegistryDumper("tools.dump.biome") { + @Override + public IForgeRegistry registry() { + return ForgeRegistries.BIOMES; } @Override - public String[] dump(Enchantment ench, int id) { - return new String[] { Integer.toString(id), ench.getName(), ench.type.toString(), Integer.toString(ench.getMinLevel()), Integer.toString(ench.getMaxLevel()), ench.getClass().getCanonicalName() }; + public String[] dump(Biome obj, ResourceLocation registryName) { + int id = Biome.getIdForBiome(obj); + + BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(obj); + StringBuilder s_types = new StringBuilder(); + for (BiomeDictionary.Type t : types) { + if (s_types.length() > 0) { + s_types.append(", "); + } + s_types.append(t.name()); + } + return new String[] { registryName.toString(), Integer.toString(id), obj.getBiomeName(), Float.toString(obj.getFloatTemperature(BlockPos.ORIGIN)), Float.toString(obj.getRainfall()), Float.toString(obj.getSpawningChance()), Float.toString(obj.getBaseHeight()), Float.toString(obj.getHeightVariation()), s_types.toString(), obj.getClass().getCanonicalName() }; } @Override - public Enchantment[] array() { - return Enchantment.enchantmentsList; + public String[] header() { + return new String[] { "Registry Name", "ID", "Name", "Temperature", "Rainfall", "Spawn Chance", "Root Height", "Height Variation", "Types", "Class" }; } }); - API.addOption(new ArrayDumper("tools.dump.biome") { + API.addOption(new ForgeRegistryDumper("tools.dump.sound_event") { + @Override + public IForgeRegistry registry() { + return ForgeRegistries.SOUND_EVENTS; + } + + @Override + public String[] dump(SoundEvent obj, ResourceLocation registryName) { + int id = SoundEvent.REGISTRY.getIDForObject(obj); + return new String[] { registryName.toString(), Integer.toString(id), obj.getClass().getCanonicalName() }; + } + @Override public String[] header() { - return new String[] { "ID", "Name", "Temperature", "Rainfall", "Spawn Chance", "Root Height", "Height Variation", "Types", "Class" }; + return new String[] { "Registry Name", "ID", "Class" }; + } + }); + API.addOption(new ForgeRegistryDumper("tools.dump.enchantment") { + @Override + public IForgeRegistry registry() { + return null; } @Override - public String[] dump(BiomeGenBase biome, int id) { - BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(biome); - StringBuilder s_types = new StringBuilder(); - for (BiomeDictionary.Type t : types) { - if (s_types.length() > 0) { - s_types.append(", "); + public String[] dump(Enchantment obj, ResourceLocation registryName) { + int id = Enchantment.getEnchantmentID(obj); + StringBuilder s_slots = new StringBuilder(); + for (EntityEquipmentSlot slot : obj.applicableEquipmentTypes) { + if (s_slots.length() > 0) { + s_slots.append(", "); } - s_types.append(t.name()); + s_slots.append(slot.getName()); } - - return new String[] { Integer.toString(id), biome.biomeName, Float.toString(biome.getFloatTemperature(BlockPos.ORIGIN)), Float.toString(biome.getFloatRainfall()), Float.toString(biome.getSpawningChance()), Float.toString(biome.minHeight), Float.toString(biome.maxHeight), s_types.toString(), biome.getClass().getCanonicalName() }; + return new String[] { registryName.toString(), Integer.toString(id), obj.getName(), obj.type.toString(), Integer.toString(obj.getMinLevel()), Integer.toString(obj.getMinLevel()), obj.getRarity().name(), s_slots.toString(), obj.getClass().getCanonicalName() }; } @Override - public BiomeGenBase[] array() { - return BiomeGenBase.getBiomeGenArray(); + public String[] header() { + return new String[] { "Registry Name", "ID", "Name", "Type", "Min Level", "Max Level", "Rarity", "Slots", "Class" }; } }); API.addOption(new ItemPanelDumper("tools.dump.itempanel")); - //TODO Fluid registry Dumper. } private static void parseModItems() { HashMap modSubsets = new HashMap(); - for (Item item : (Iterable) Item.itemRegistry) { - UniqueIdentifier ident = GameRegistry.findUniqueIdentifierFor(item); + for (Item item : Item.REGISTRY) { + ResourceLocation ident = Item.REGISTRY.getNameForObject(item); if (ident == null) { - NEIClientConfig.logger.error("Failed to find identifier for: " + item); + LogHelper.error("Failed to find identifier for: " + item); continue; } - String modId = GameRegistry.findUniqueIdentifierFor(item).modId; + String modId = ident.getResourceDomain(); itemOwners.put(item, modId); ItemStackSet itemset = modSubsets.get(modId); if (itemset == null) { @@ -252,7 +299,7 @@ private static void parseModItems() { for (Entry entry : modSubsets.entrySet()) { ModContainer mc = FMLCommonHandler.instance().findContainerFor(entry.getKey()); if (mc == null) { - NEIClientConfig.logger.error("Missing container for " + entry.getKey()); + LogHelper.error("Missing container for " + entry.getKey()); } else { API.addSubset("Mod." + mc.getName(), entry.getValue()); } @@ -270,19 +317,19 @@ private static void addInfiniteHandlers() { } private static void addDefaultDropDowns() { - API.addSubset("Items", new ItemFilter() { + API.addSubset("Items", new IItemFilter() { @Override public boolean matches(ItemStack item) { return Block.getBlockFromItem(item.getItem()) == Blocks.AIR; } }); - API.addSubset("Blocks", new ItemFilter() { + API.addSubset("Blocks", new IItemFilter() { @Override public boolean matches(ItemStack item) { return Block.getBlockFromItem(item.getItem()) != Blocks.AIR; } }); - API.addSubset("Blocks.MobSpawners", ItemStackSet.of(Blocks.mob_spawner)); + API.addSubset("Blocks.MobSpawners", ItemStackSet.of(Blocks.MOB_SPAWNER)); } private static void searchItems() { @@ -301,10 +348,10 @@ private static void searchItems() { ItemStackSet food = new ItemStackSet(); ItemStackSet potioningredients = new ItemStackSet(); - ArrayList creativeTabRanges = new ArrayList(CreativeTabs.creativeTabArray.length); + ArrayList creativeTabRanges = new ArrayList(CreativeTabs.CREATIVE_TAB_ARRAY.length); List stackList = new LinkedList(); - for (Item item : (Iterable) Item.itemRegistry) { + for (Item item : Item.REGISTRY) { if (item == null) { continue; } @@ -326,6 +373,7 @@ private static void searchItems() { } } + //TODO EntityEquipmentSlot if (item.isDamageable()) { tools.with(item); if (item instanceof ItemPickaxe) { @@ -340,22 +388,22 @@ private static void searchItems() { swords.with(item); } else if (item instanceof ItemArmor) { switch (((ItemArmor) item).armorType) { - case 0: - helmets.with(item); - break; - case 1: - chest.with(item); - break; - case 2: - legs.with(item); - break; - case 3: - boots.with(item); - break; + case HEAD: + helmets.with(item); + break; + case CHEST: + chest.with(item); + break; + case LEGS: + legs.with(item); + break; + case FEET: + boots.with(item); + break; } - } else if (item == Items.arrow || item == Items.bow) { + } else if (item == Items.ARROW || item == Items.BOW) { ranged.with(item); - } else if (item == Items.fishing_rod || item == Items.flint_and_steel || item == Items.shears) { + } else if (item == Items.FISHING_ROD || item == Items.FLINT_AND_STEEL || item == Items.SHEARS) { other.with(item); } } @@ -368,14 +416,14 @@ private static void searchItems() { LinkedList subItems = new LinkedList(); item.getSubItems(item, null, subItems); for (ItemStack stack : subItems) { - if (item.isPotionIngredient(stack)) { + if (PotionHelper.isReagent(stack)) { BrewingRecipeHandler.ingredients.add(stack); potioningredients.add(stack); } } } catch (Exception e) { - NEIClientConfig.logger.error("Error loading brewing ingredients for: " + item, e); + LogHelper.errorError("Error loading brewing ingredients for: " + item, e); } } API.addSubset("Items.Tools.Pickaxes", picks); @@ -392,7 +440,7 @@ private static void searchItems() { API.addSubset("Items.Food", food); API.addSubset("Items.Potions.Ingredients", potioningredients); - for (CreativeTabs tab : CreativeTabs.creativeTabArray) { + for (CreativeTabs tab : CreativeTabs.CREATIVE_TAB_ARRAY) { if (tab.getTabIndex() >= creativeTabRanges.size()) { continue; } @@ -405,17 +453,19 @@ private static void searchItems() { BrewingRecipeHandler.searchPotions(); } + //TODO private static void addSpawnEggs() { - addEntityEgg(EntitySnowman.class, 0xEEFFFF, 0xffa221); - addEntityEgg(EntityIronGolem.class, 0xC5C2C1, 0xffe1cc); + //addEntityEgg(EntitySnowman.class, 0xEEFFFF, 0xffa221); + //addEntityEgg(EntityIronGolem.class, 0xC5C2C1, 0xffe1cc); } - private static void addEntityEgg(Class entity, int i, int j) { - int id = (Integer) EntityList.classToIDMapping.get(entity); - EntityList.entityEggs.put(id, new EntityEggInfo(id, i, j)); + private static void addEntityEgg(Class entity, int i, int j) { + String id = EntityList.getEntityStringFromClass(entity); + EntityList.ENTITY_EGGS.put(id, new EntityEggInfo(id, i, j)); } - public static ArrayList getIdentifierItems(World world, EntityPlayer player, MovingObjectPosition hit) { + @Deprecated + public static ArrayList getIdentifierItems(World world, EntityPlayer player, RayTraceResult hit) { BlockPos pos = hit.getBlockPos(); IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); @@ -440,7 +490,7 @@ public static ArrayList getIdentifierItems(World world, EntityPlayer return items; } - ItemStack pick = block.getPickBlock(hit, world, pos); + ItemStack pick = block.getPickBlock(state, hit, world, pos, player); if (pick != null) { items.add(pick); } @@ -451,8 +501,8 @@ public static ArrayList getIdentifierItems(World world, EntityPlayer } if (block instanceof IShearable) { IShearable shearable = (IShearable) block; - if (shearable.isShearable(new ItemStack(Items.shears), world, pos)) { - items.addAll(shearable.onSheared(new ItemStack(Items.shears), world, pos, 0)); + if (shearable.isShearable(new ItemStack(Items.SHEARS), world, pos)) { + items.addAll(shearable.onSheared(new ItemStack(Items.SHEARS), world, pos, 0)); } } @@ -463,18 +513,20 @@ public static ArrayList getIdentifierItems(World world, EntityPlayer return items; } + @Deprecated public static void registerHighlightHandler(IHighlightHandler handler, ItemInfo.Layout... layouts) { for (ItemInfo.Layout layout : layouts) { ItemInfo.highlightHandlers.get(layout).add(handler); } } - public static List getText(ItemStack itemStack, World world, EntityPlayer player, MovingObjectPosition mop) { + @Deprecated + public static List getText(ItemStack itemStack, World world, EntityPlayer player, RayTraceResult rayTraceResult) { List retString = new ArrayList(); for (ItemInfo.Layout layout : ItemInfo.Layout.values()) { for (IHighlightHandler handler : ItemInfo.highlightHandlers.get(layout)) { - retString = handler.handleTextData(itemStack, world, player, mop, retString, layout); + retString = handler.handleTextData(itemStack, world, player, rayTraceResult, retString, layout); } } diff --git a/dependencies/main/java/codechicken/nei/api/LayoutStyle.java b/dependencies/main/java/codechicken/nei/api/layout/LayoutStyle.java similarity index 61% rename from dependencies/main/java/codechicken/nei/api/LayoutStyle.java rename to dependencies/main/java/codechicken/nei/api/layout/LayoutStyle.java index a43b932a5d..18581935da 100644 --- a/dependencies/main/java/codechicken/nei/api/LayoutStyle.java +++ b/dependencies/main/java/codechicken/nei/api/layout/LayoutStyle.java @@ -1,8 +1,8 @@ -package codechicken.nei.api; +package codechicken.nei.api.layout; -import codechicken.nei.Button; -import codechicken.nei.VisiblityData; +import codechicken.nei.VisibilityData; import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.widget.Button; import net.minecraft.client.gui.inventory.GuiContainer; public abstract class LayoutStyle { @@ -10,14 +10,14 @@ public abstract class LayoutStyle { public abstract void reset(); - public abstract void layout(GuiContainer gui, VisiblityData visibility); + public abstract void layout(GuiContainer gui, VisibilityData visibility); public abstract String getName(); public void drawBackground(GuiContainerManager gui) { } - public abstract void drawButton(Button button, int mousex, int mousey); + public abstract void drawButton(Button button, int mouseX, int mouseY); public abstract void drawSubsetTag(String text, int x, int y, int w, int h, int state, boolean mouseover); } diff --git a/dependencies/main/java/codechicken/nei/PositionedStack.java b/dependencies/main/java/codechicken/nei/api/stack/PositionedStack.java similarity index 93% rename from dependencies/main/java/codechicken/nei/PositionedStack.java rename to dependencies/main/java/codechicken/nei/api/stack/PositionedStack.java index 6463fbd96a..8680dc393b 100644 --- a/dependencies/main/java/codechicken/nei/PositionedStack.java +++ b/dependencies/main/java/codechicken/nei/api/stack/PositionedStack.java @@ -1,5 +1,7 @@ -package codechicken.nei; +package codechicken.nei.api.stack; +import codechicken.nei.ItemList; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -67,7 +69,7 @@ public void generatePermutations() { items = stacks.toArray(new ItemStack[0]); if (items.length == 0) { - items = new ItemStack[] { new ItemStack(Blocks.fire) }; + items = new ItemStack[] { new ItemStack(Blocks.FIRE) }; } permutated = true; @@ -89,7 +91,7 @@ public PositionedStack copy() { public void setPermutationToRender(int index) { item = items[index].copy(); if (item.getItem() == null) { - item = new ItemStack(Blocks.fire); + item = new ItemStack(Blocks.FIRE); } else if (item.getItemDamage() == OreDictionary.WILDCARD_VALUE) { item.setItemDamage(0); } diff --git a/dependencies/main/java/codechicken/nei/asm/NEICorePlugin.java b/dependencies/main/java/codechicken/nei/asm/NEICorePlugin.java index e0bb54bab4..9836e07171 100644 --- a/dependencies/main/java/codechicken/nei/asm/NEICorePlugin.java +++ b/dependencies/main/java/codechicken/nei/asm/NEICorePlugin.java @@ -1,9 +1,10 @@ package codechicken.nei.asm; -import codechicken.core.launch.CodeChickenCorePlugin; +import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.relauncher.IFMLCallHook; import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions; +import org.apache.logging.log4j.Level; import java.io.File; import java.util.Map; @@ -11,10 +12,18 @@ @TransformerExclusions({ "codechicken.nei.asm" }) public class NEICorePlugin implements IFMLLoadingPlugin, IFMLCallHook { public static File location; + public static boolean missingCCL = false; + + public NEICorePlugin() { + cclCheck(); + } @Override public String[] getASMTransformerClass() { - CodeChickenCorePlugin.versionCheck(CodeChickenCorePlugin.mcVersion, "NotEnoughItems"); + if (missingCCL) { + FMLLog.log("NotEnoughItems", Level.FATAL, "Missing CCL! not registering class transformer."); + return new String[0]; + } return new String[] { "codechicken.nei.asm.NEITransformer" }; } @@ -45,4 +54,13 @@ public String getAccessTransformerClass() { public Void call() { return null; } + private static void cclCheck() { + try { + Class.forName("codechicken.lib.asm.ASMHelper", false, NEICorePlugin.class.getClassLoader()); + missingCCL = false; + } catch (ClassNotFoundException cNFE) { + cNFE.printStackTrace(); + missingCCL = true; + } + } } diff --git a/dependencies/main/java/codechicken/nei/asm/NEITransformer.java b/dependencies/main/java/codechicken/nei/asm/NEITransformer.java index 7d6a7d4f0e..de5e593c28 100644 --- a/dependencies/main/java/codechicken/nei/asm/NEITransformer.java +++ b/dependencies/main/java/codechicken/nei/asm/NEITransformer.java @@ -21,7 +21,8 @@ public class NEITransformer implements IClassTransformer { public NEITransformer() { if (FMLLaunchHandler.side().isClient()) { //Generates method to set the placed position of a mob spawner for the item callback. More portable than copying vanilla placement code - transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping("net/minecraft/block/BlockMobSpawner", "func_180633_a", "(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;)V"), asmblocks.get("spawnerPlaced"))); + //transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping("net/minecraft/block/BlockMobSpawner", "func_180633_a", "(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;)V"), asmblocks.get("spawnerPlaced"))); + transformer.add(new MethodInjector(new ObfMapping("net/minecraft/client/gui/inventory/GuiContainerCreative", "func_147053_i", "()V"), asmblocks.get("i_creativeTabSearch"), true)); } //Removes trailing seperators from NBTTagList/Compound.toString because OCD @@ -39,71 +40,72 @@ public void transform(MethodNode mv) { } }); - String GuiContainer = "net/minecraft/client/gui/inventory/GuiContainer"; + String guiContainer = "net/minecraft/client/gui/inventory/GuiContainer"; //add manager field - transformer.add(new FieldWriter(ACC_PUBLIC, new ObfMapping(GuiContainer, "manager", "Lcodechicken/nei/guihook/GuiContainerManager;"))); + transformer.add(new FieldWriter(ACC_PUBLIC, new ObfMapping(guiContainer, "manager", "Lcodechicken/nei/guihook/GuiContainerManager;"))); //Fill out getManager in GuiContainerManager transformer.add(new MethodWriter(ACC_PUBLIC | ACC_STATIC, new ObfMapping("codechicken/nei/guihook/GuiContainerManager", "getManager", "(Lnet/minecraft/client/gui/inventory/GuiContainer;)Lcodechicken/nei/guihook/GuiContainerManager;"), asmblocks.get("m_getManager"))); //Generate load method - transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(GuiContainer, "func_146280_a", "(Lnet/minecraft/client/Minecraft;II)V"), asmblocks.get("m_setWorldAndResolution"))); + transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(guiContainer, "func_146280_a", "(Lnet/minecraft/client/Minecraft;II)V"), asmblocks.get("m_setWorldAndResolution"))); //Generate handleKeyboardInput method - transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(GuiContainer, "func_146282_l", "()V"), asmblocks.get("m_handleKeyboardInput"))); + transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(guiContainer, "func_146282_l", "()V"), asmblocks.get("m_handleKeyboardInput"))); //Generate handleKeyboardInput method - transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(GuiContainer, "func_146282_l", "()V"), asmblocks.get("m_handleKeyboardInput"))); + transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(guiContainer, "func_146282_l", "()V"), asmblocks.get("m_handleKeyboardInput"))); //Generate handleKeyboardInput method - transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(GuiContainer, "func_146282_l", "()V"), asmblocks.get("m_handleKeyboardInput"))); + transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(guiContainer, "func_146282_l", "()V"), asmblocks.get("m_handleKeyboardInput"))); //Generate handleMouseInput method - transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(GuiContainer, "func_146274_d", "()V"), asmblocks.get("m_handleMouseInput"))); + transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(guiContainer, "func_146274_d", "()V"), asmblocks.get("m_handleMouseInput"))); - addProtectedForwarder(new ObfMapping(GuiContainer, "func_73869_a", "(CI)V"), new ObfMapping("codechicken/nei/guihook/GuiContainerManager", "callKeyTyped", "(Lnet/minecraft/client/gui/inventory/GuiContainer;CI)V")); + addProtectedForwarder(new ObfMapping(guiContainer, "func_73869_a", "(CI)V"), new ObfMapping("codechicken/nei/guihook/GuiContainerManager", "callKeyTyped", "(Lnet/minecraft/client/gui/inventory/GuiContainer;CI)V")); - addProtectedForwarder(new ObfMapping(GuiContainer, "func_146984_a", "(Lnet/minecraft/inventory/Slot;III)V"), new ObfMapping("codechicken/nei/guihook/DefaultSlotClickHandler", "callHandleMouseClick", "(Lnet/minecraft/client/gui/inventory/GuiContainer;Lnet/minecraft/inventory/Slot;III)V")); + addProtectedForwarder(new ObfMapping(guiContainer, "func_184098_a", "(Lnet/minecraft/inventory/Slot;IILnet/minecraft/inventory/ClickType;)V"), new ObfMapping("codechicken/nei/guihook/DefaultSlotClickHandler", "callHandleMouseClick", "(Lnet/minecraft/client/gui/inventory/GuiContainer;Lnet/minecraft/inventory/Slot;IILnet/minecraft/inventory/ClickType;)V")); //Inject preDraw at the start of drawScreen - transformer.add(new MethodInjector(new ObfMapping(GuiContainer, "func_73863_a", "(IIF)V"), asmblocks.get("preDraw"), true)); + transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_73863_a", "(IIF)V"), asmblocks.get("preDraw"), true)); //Inject objectUnderMouse check before drawing slot highlights - transformer.add(new MethodInjector(new ObfMapping(GuiContainer, "func_73863_a", "(IIF)V"), asmblocks.get("n_objectUnderMouse"), asmblocks.get("objectUnderMouse"), false)); + transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_73863_a", "(IIF)V"), asmblocks.get("n_objectUnderMouse"), asmblocks.get("objectUnderMouse"), false)); //Inject renderObjects after drawGuiContainerForegroundLayer - transformer.add(new MethodInjector(new ObfMapping(GuiContainer, "func_73863_a", "(IIF)V"), asmblocks.get("n_renderObjects"), asmblocks.get("renderObjects"), false)); + transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_73863_a", "(IIF)V"), asmblocks.get("n_renderObjects"), asmblocks.get("renderObjects"), false)); //Replace default renderToolTip with delegate - transformer.add(new MethodReplacer(new ObfMapping(GuiContainer, "func_73863_a", "(IIF)V"), asmblocks.get("d_renderToolTip"), asmblocks.get("renderTooltips"))); + ASMBlock d_renderToolTip = Boolean.parseBoolean(System.getProperty("nei.altRenderToolTipNeedle", "false")) ? asmblocks.get("d_renderToolTipIntellijEclipseCompilerFix") : asmblocks.get("d_renderToolTip"); + transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_73863_a", "(IIF)V"), d_renderToolTip, asmblocks.get("renderTooltips"))); //Replace zLevel = 200 with zLevel = 500 in drawItemStack - transformer.add(new MethodReplacer(new ObfMapping(GuiContainer, "func_146982_a", "(Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V"), asmblocks.get("d_zLevel"), asmblocks.get("zLevel"))); + transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_146982_a", "(Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V"), asmblocks.get("d_zLevel"), asmblocks.get("zLevel"))); //Replace default renderItem with delegate and slot overlay/underlay - transformer.add(new MethodReplacer(new ObfMapping(GuiContainer, "func_146977_a", "(Lnet/minecraft/inventory/Slot;)V"), asmblocks.get("d_drawSlot"), asmblocks.get("drawSlot"))); + transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_146977_a", "(Lnet/minecraft/inventory/Slot;)V"), asmblocks.get("d_drawSlot"), asmblocks.get("drawSlot"))); //Inject mouseClicked hook at the start of mouseClicked - transformer.add(new MethodInjector(new ObfMapping(GuiContainer, "func_73864_a", "(III)V"), asmblocks.get("mouseClicked"), true)); + transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_73864_a", "(III)V"), asmblocks.get("mouseClicked"), true)); //Replace general handleMouseClicked call with delegate - transformer.add(new MethodReplacer(new ObfMapping(GuiContainer, "func_73864_a", "(III)V"), asmblocks.get("d_handleMouseClick"), asmblocks.get("handleMouseClick")));//mouseClicked - transformer.add(new MethodReplacer(new ObfMapping(GuiContainer, "func_146273_a", "(IIIJ)V"), asmblocks.get("d_handleMouseClick"), asmblocks.get("handleMouseClick")));//mouseClickMove - transformer.add(new MethodReplacer(new ObfMapping(GuiContainer, "func_146286_b", "(III)V"), asmblocks.get("d_handleMouseClick"), asmblocks.get("handleMouseClick")));//mouseReleased - transformer.add(new MethodReplacer(new ObfMapping(GuiContainer, "func_73869_a", "(CI)V"), asmblocks.get("d_handleMouseClick"), asmblocks.get("handleMouseClick")));//keyTyped - transformer.add(new MethodReplacer(new ObfMapping(GuiContainer, "func_146983_a", "(I)Z"), asmblocks.get("d_handleMouseClick"), asmblocks.get("handleMouseClick")));//checkHotbarKeys + transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_73864_a", "(III)V"), asmblocks.get("d_handleMouseClick"), asmblocks.get("handleMouseClick")));//mouseClicked + transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_146273_a", "(IIIJ)V"), asmblocks.get("d_handleMouseClick"), asmblocks.get("handleMouseClick")));//mouseClickMove + transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_146286_b", "(III)V"), asmblocks.get("d_handleMouseClick"), asmblocks.get("handleMouseClick")));//mouseReleased + transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_73869_a", "(CI)V"), asmblocks.get("d_handleMouseClick"), asmblocks.get("handleMouseClick")));//keyTyped + transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_146983_a", "(I)Z"), asmblocks.get("d_handleMouseClick"), asmblocks.get("handleMouseClick")));//checkHotbarKeys //Write delegate for handleMouseClicked - transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(GuiContainer, "managerHandleMouseClick", "(Lnet/minecraft/inventory/Slot;III)V"), asmblocks.get("m_managerHandleMouseClick"))); + transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(guiContainer, "managerHandleMouseClick", "(Lnet/minecraft/inventory/Slot;IILnet/minecraft/inventory/ClickType;)V"), asmblocks.get("m_managerHandleMouseClick"))); //Inject mouseDragged hook after super call in mouseDragged - transformer.add(new MethodInjector(new ObfMapping(GuiContainer, "func_146273_a", "(IIIJ)V"), asmblocks.get("n_mouseDragged"), asmblocks.get("mouseDragged"), false)); + transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_146273_a", "(IIIJ)V"), asmblocks.get("n_mouseDragged"), asmblocks.get("mouseDragged"), false)); //Inject overrideMouseUp at the start of mouseReleased - transformer.add(new MethodInjector(new ObfMapping(GuiContainer, "func_146286_b", "(III)V"), asmblocks.get("overrideMouseUp"), true)); + transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_146286_b", "(III)V"), asmblocks.get("overrideMouseUp"), true)); //Inject mouseUp at the end of main elseif chain in mouseReleased - transformer.add(new MethodTransformer(new ObfMapping(GuiContainer, "func_146286_b", "(III)V")) { + transformer.add(new MethodTransformer(new ObfMapping(guiContainer, "func_146286_b", "(III)V")) { @Override public void transform(MethodNode mv) { ASMHelper.logger.debug("NEI: Injecting mouseUp call"); @@ -120,14 +122,14 @@ public void transform(MethodNode mv) { } }); - //Replace general handleSlotClick call with delegate - transformer.add(new MethodReplacer(new ObfMapping(GuiContainer, "func_146984_a", "(Lnet/minecraft/inventory/Slot;III)V"), asmblocks.get("d_handleSlotClick"), asmblocks.get("handleSlotClick"))); + //Replace general handleMouseClick call with delegate + transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_184098_a", "(Lnet/minecraft/inventory/Slot;IILnet/minecraft/inventory/ClickType;)V"), asmblocks.get("d_handleSlotClick"), asmblocks.get("handleSlotClick"))); //Inject lastKeyTyped at the start of keyTyped - transformer.add(new MethodInjector(new ObfMapping(GuiContainer, "func_73869_a", "(CI)V"), asmblocks.get("lastKeyTyped"), true)); + transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_73869_a", "(CI)V"), asmblocks.get("lastKeyTyped"), true)); //Inject updateScreen hook after super call - transformer.add(new MethodInjector(new ObfMapping(GuiContainer, "func_73876_c", "()V"), asmblocks.get("n_updateScreen"), asmblocks.get("updateScreen"), false)); + transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_73876_c", "()V"), asmblocks.get("n_updateScreen"), asmblocks.get("updateScreen"), false)); //Cancel tab click calls when tabs are obscured transformer.add(new MethodInjector(new ObfMapping("net/minecraft/client/gui/inventory/GuiContainerCreative", "func_147049_a", "(Lnet/minecraft/creativetab/CreativeTabs;II)Z"), asmblocks.get("handleTabClick"), true)); diff --git a/dependencies/main/java/codechicken/nei/config/ConfigSet.java b/dependencies/main/java/codechicken/nei/config/ConfigSet.java index 184f1b4b19..d30d0c9dd4 100644 --- a/dependencies/main/java/codechicken/nei/config/ConfigSet.java +++ b/dependencies/main/java/codechicken/nei/config/ConfigSet.java @@ -1,7 +1,7 @@ package codechicken.nei.config; import codechicken.lib.config.ConfigTagParent; -import codechicken.nei.NEIServerUtils; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.nbt.NBTTagCompound; import java.io.File; diff --git a/dependencies/main/java/codechicken/nei/config/DataDumper.java b/dependencies/main/java/codechicken/nei/config/DataDumper.java index fc66034faa..f31814f038 100644 --- a/dependencies/main/java/codechicken/nei/config/DataDumper.java +++ b/dependencies/main/java/codechicken/nei/config/DataDumper.java @@ -1,13 +1,13 @@ package codechicken.nei.config; -import codechicken.core.CommonUtils; +import codechicken.lib.util.CommonUtils; import codechicken.lib.vec.Rectangle4i; import codechicken.nei.LayoutManager; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.NEIClientUtils; +import codechicken.nei.util.LogHelper; +import codechicken.nei.util.NEIClientUtils; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.ITextComponent; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentTranslation; import java.io.File; import java.io.IOException; @@ -43,7 +43,7 @@ public void dumpFile() { NEIClientUtils.printChatMessage(dumpMessage(file)); } catch (Exception e) { - NEIClientConfig.logger.error("Error dumping " + renderName() + " mode: " + getMode(), e); + LogHelper.errorError("Error dumping " + renderName() + " mode: " + getMode(), e); } } @@ -56,7 +56,7 @@ public String getFileExtension() { } public ITextComponent dumpMessage(File file) { - return new ChatComponentTranslation("nei.options.tools.dump.dumped", translateN(name), "dumps/" + file.getName()); + return new TextComponentTranslation("nei.options.tools.dump.dumped", translateN(name), "dumps/" + file.getName()); } public void dumpTo(File file) throws IOException { diff --git a/dependencies/main/java/codechicken/nei/config/GuiHighlightTips.java b/dependencies/main/java/codechicken/nei/config/GuiHighlightTips.java index 461fc5bae0..3f7e71563b 100644 --- a/dependencies/main/java/codechicken/nei/config/GuiHighlightTips.java +++ b/dependencies/main/java/codechicken/nei/config/GuiHighlightTips.java @@ -5,11 +5,11 @@ import codechicken.lib.math.MathHelper; import codechicken.lib.vec.Rectangle4i; import codechicken.nei.HUDRenderer; -import codechicken.nei.NEIClientUtils; +import codechicken.nei.util.NEIClientUtils; import net.minecraft.client.Minecraft; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.util.TextFormatting; +import net.minecraft.util.text.TextFormatting; import org.lwjgl.input.Keyboard; import java.awt.*; @@ -19,6 +19,7 @@ import static codechicken.lib.gui.GuiDraw.displaySize; import static codechicken.lib.gui.GuiDraw.getMousePosition; +@Deprecated//Waila is a thing now. public class GuiHighlightTips extends GuiScreenWidget { private String name; private GuiCCButton toggleButton; @@ -70,7 +71,7 @@ public void keyTyped(char c, int keycode) throws IOException { public void drawScreen(int mousex, int mousey, float f) { super.drawScreen(mousex, mousey, f); if (show()) { - HUDRenderer.renderOverlay(new ItemStack(Blocks.redstone_block), Arrays.asList("RedstoneBlock", TextFormatting.RED + "Sample"), renderPos()); + //HUDRenderer.renderOverlay(new ItemStack(Blocks.REDSTONE_BLOCK), Arrays.asList("RedstoneBlock", TextFormatting.RED + "Sample"), renderPos()); } } diff --git a/dependencies/main/java/codechicken/nei/config/GuiItemIconDumper.java b/dependencies/main/java/codechicken/nei/config/GuiItemIconDumper.java index 9f3553860f..3e4225dd6c 100644 --- a/dependencies/main/java/codechicken/nei/config/GuiItemIconDumper.java +++ b/dependencies/main/java/codechicken/nei/config/GuiItemIconDumper.java @@ -1,11 +1,11 @@ package codechicken.nei.config; -import codechicken.core.CommonUtils; +import codechicken.lib.util.CommonUtils; import codechicken.lib.gui.GuiDraw; -import codechicken.nei.ItemPanel; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.NEIClientUtils; import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.util.LogHelper; +import codechicken.nei.util.NEIClientUtils; +import codechicken.nei.widget.ItemPanel; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; @@ -14,9 +14,9 @@ import net.minecraft.client.renderer.texture.TextureUtil; import net.minecraft.client.shader.Framebuffer; import net.minecraft.item.ItemStack; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.TextFormatting; -import net.minecraft.util.ITextComponent; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; import org.lwjgl.BufferUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; @@ -71,7 +71,7 @@ private void returnScreen(ITextComponent msg) { @Override protected void keyTyped(char c, int keycode) throws IOException { if (keycode == Keyboard.KEY_ESCAPE || keycode == Keyboard.KEY_BACK) { - returnScreen(new ChatComponentTranslation(opt.fullName() + ".icon.cancelled")); + returnScreen(new TextComponentTranslation(opt.fullName() + ".icon.cancelled")); return; } super.keyTyped(c, keycode); @@ -83,7 +83,7 @@ public void drawScreen(int mousex, int mousey, float frame) { drawItems(); exportItems(); } catch (Exception e) { - NEIClientConfig.logger.error("Error dumping item icons", e); + LogHelper.errorError("Error dumping item icons", e); } } @@ -126,7 +126,7 @@ private void exportItems() throws IOException { } if (parseIndex >= ItemPanel.items.size()) { - returnScreen(new ChatComponentTranslation(opt.fullName() + ".icon.dumped", "dumps/itempanel_icons")); + returnScreen(new TextComponentTranslation(opt.fullName() + ".icon.dumped", "dumps/itempanel_icons")); } } diff --git a/dependencies/main/java/codechicken/nei/config/GuiNEIOptionList.java b/dependencies/main/java/codechicken/nei/config/GuiNEIOptionList.java index dbf4859b5e..ca751a0012 100644 --- a/dependencies/main/java/codechicken/nei/config/GuiNEIOptionList.java +++ b/dependencies/main/java/codechicken/nei/config/GuiNEIOptionList.java @@ -1,7 +1,7 @@ package codechicken.nei.config; import codechicken.core.gui.GuiCCButton; -import codechicken.nei.NEIClientConfig; +import codechicken.nei.util.LogHelper; import net.minecraft.client.gui.GuiConfirmOpenLink; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiYesNoCallback; @@ -46,7 +46,7 @@ public void confirmClicked(boolean yes, int id) { try { Desktop.getDesktop().browse(new URI("http://patreon.com/cb")); } catch (Exception e) { - NEIClientConfig.logger.error("Failed to open patreon page", e); + LogHelper.errorError("Failed to open patreon page", e); } } mc.displayGuiScreen(this); diff --git a/dependencies/main/java/codechicken/nei/config/GuiOptionList.java b/dependencies/main/java/codechicken/nei/config/GuiOptionList.java index 7942caea77..dd9f25bd30 100644 --- a/dependencies/main/java/codechicken/nei/config/GuiOptionList.java +++ b/dependencies/main/java/codechicken/nei/config/GuiOptionList.java @@ -17,7 +17,7 @@ import java.util.List; import static codechicken.lib.gui.GuiDraw.*; -import static net.minecraft.util.StatCollector.translateToLocal; +import static net.minecraft.util.text.translation.I18n.translateToLocal; public class GuiOptionList extends GuiScreenWidget { public class OptionScrollSlot extends GuiScrollSlot { diff --git a/dependencies/main/java/codechicken/nei/config/GuiOptionPane.java b/dependencies/main/java/codechicken/nei/config/GuiOptionPane.java index 2ae827f5e2..e5c0ec5624 100644 --- a/dependencies/main/java/codechicken/nei/config/GuiOptionPane.java +++ b/dependencies/main/java/codechicken/nei/config/GuiOptionPane.java @@ -4,6 +4,7 @@ import codechicken.core.gui.GuiScreenWidget; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.util.text.translation.I18n; import org.lwjgl.input.Keyboard; import java.awt.*; @@ -12,7 +13,6 @@ import java.util.List; import static codechicken.lib.gui.GuiDraw.*; -import static net.minecraft.util.StatCollector.translateToLocal; public abstract class GuiOptionPane extends GuiScreenWidget { public class ScrollPane extends OptionScrollPane { @@ -57,7 +57,7 @@ public void initGui() { @Override public void addWidgets() { add(pane = new ScrollPane()); - add(backButton = new GuiCCButton(0, 0, 0, 20, translateToLocal("nei.options.back")).setActionCommand("back")); + add(backButton = new GuiCCButton(0, 0, 0, 20, I18n.translateToLocal("nei.options.back")).setActionCommand("back")); initGui(); } diff --git a/dependencies/main/java/codechicken/nei/config/ItemPanelDumper.java b/dependencies/main/java/codechicken/nei/config/ItemPanelDumper.java index be0ed0bc30..7f99121f3b 100644 --- a/dependencies/main/java/codechicken/nei/config/ItemPanelDumper.java +++ b/dependencies/main/java/codechicken/nei/config/ItemPanelDumper.java @@ -2,17 +2,17 @@ import codechicken.lib.inventory.InventoryUtils; import codechicken.lib.vec.Rectangle4i; -import codechicken.nei.ItemPanel; -import codechicken.nei.NEIClientUtils; import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.util.NEIClientUtils; +import codechicken.nei.widget.ItemPanel; import net.minecraft.client.Minecraft; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.TextFormatting; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; import java.io.File; import java.io.FileOutputStream; @@ -36,7 +36,7 @@ public String[] header() { public Iterable dump(int mode) { LinkedList list = new LinkedList(); for (ItemStack stack : ItemPanel.items) { - list.add(new String[] { Item.itemRegistry.getNameForObject(stack.getItem()).toString(), Integer.toString(Item.getIdFromItem(stack.getItem())), Integer.toString(InventoryUtils.actualDamage(stack)), stack.getTagCompound() == null ? "false" : "true", TextFormatting.getTextWithoutFormattingCodes(GuiContainerManager.itemDisplayNameShort(stack)) }); + list.add(new String[] { Item.REGISTRY.getNameForObject(stack.getItem()).toString(), Integer.toString(Item.getIdFromItem(stack.getItem())), Integer.toString(InventoryUtils.actualDamage(stack)), stack.getTagCompound() == null ? "false" : "true", TextFormatting.getTextWithoutFormattingCodes(GuiContainerManager.itemDisplayNameShort(stack)) }); } return list; @@ -93,8 +93,8 @@ public String getFileExtension() { } @Override - public ChatComponentTranslation dumpMessage(File file) { - return new ChatComponentTranslation(namespaced(name + ".dumped"), "dumps/" + file.getName()); + public TextComponentTranslation dumpMessage(File file) { + return new TextComponentTranslation(namespaced(name + ".dumped"), "dumps/" + file.getName()); } @Override diff --git a/dependencies/main/java/codechicken/nei/config/KeyBindings.java b/dependencies/main/java/codechicken/nei/config/KeyBindings.java new file mode 100644 index 0000000000..3e9a38d93b --- /dev/null +++ b/dependencies/main/java/codechicken/nei/config/KeyBindings.java @@ -0,0 +1,79 @@ +package codechicken.nei.config; + +import net.minecraft.client.settings.KeyBinding; +import net.minecraftforge.client.settings.IKeyConflictContext; +import net.minecraftforge.client.settings.KeyConflictContext; +import net.minecraftforge.client.settings.KeyModifier; +import net.minecraftforge.fml.client.registry.ClientRegistry; +import org.lwjgl.input.Keyboard; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class KeyBindings { + private static final String categoryNameGui = "NEI (Not Enough Items) Gui"; + private static final String categoryNameWorld = "NEI (Not Enough Items) World"; + private static Map keyBindings = new HashMap(); + private static List keyBindingsToRegister = new ArrayList(); + + static { +// setDefaultKeyBinding("nei.options.keys.gui.recipe", JEIIntegrationManager.getShowRecipes()); +// setDefaultKeyBinding("nei.options.keys.gui.usage", JEIIntegrationManager.getShowUses()); +// setDefaultKeyBinding("nei.options.keys.gui.back", JEIIntegrationManager.getRecipeBack()); + setDefaultKeyBinding("nei.options.keys.gui.enchant", KeyConflictContext.GUI, KeyModifier.NONE, Keyboard.KEY_X, categoryNameGui); + setDefaultKeyBinding("nei.options.keys.gui.potion", KeyConflictContext.GUI, KeyModifier.NONE, Keyboard.KEY_P, categoryNameGui); + setDefaultKeyBinding("nei.options.keys.gui.prev", KeyConflictContext.GUI, KeyModifier.NONE, Keyboard.KEY_PRIOR, categoryNameGui); + setDefaultKeyBinding("nei.options.keys.gui.next", KeyConflictContext.GUI, KeyModifier.NONE, Keyboard.KEY_NEXT, categoryNameGui); +// setDefaultKeyBinding("nei.options.keys.gui.hide", JEIIntegrationManager.getToggleOverlay()); +// setDefaultKeyBinding("nei.options.keys.gui.search", JEIIntegrationManager.getFocusSearch()); + + setDefaultKeyBinding("nei.options.keys.world.chunkoverlay", KeyConflictContext.IN_GAME, KeyModifier.NONE, Keyboard.KEY_F9, categoryNameWorld); + setDefaultKeyBinding("nei.options.keys.world.moboverlay", KeyConflictContext.IN_GAME, KeyModifier.NONE, Keyboard.KEY_F7, categoryNameWorld); + setDefaultKeyBinding("nei.options.keys.world.dawn", KeyConflictContext.IN_GAME, KeyModifier.NONE, Keyboard.KEY_NONE, categoryNameWorld); + setDefaultKeyBinding("nei.options.keys.world.noon", KeyConflictContext.IN_GAME, KeyModifier.NONE, Keyboard.KEY_NONE, categoryNameWorld); + setDefaultKeyBinding("nei.options.keys.world.dusk", KeyConflictContext.IN_GAME, KeyModifier.NONE, Keyboard.KEY_NONE, categoryNameWorld); + setDefaultKeyBinding("nei.options.keys.world.midnight", KeyConflictContext.IN_GAME, KeyModifier.NONE, Keyboard.KEY_NONE, categoryNameWorld); + setDefaultKeyBinding("nei.options.keys.world.rain", KeyConflictContext.IN_GAME, KeyModifier.NONE, Keyboard.KEY_NONE, categoryNameWorld); + setDefaultKeyBinding("nei.options.keys.world.heal", KeyConflictContext.IN_GAME, KeyModifier.NONE, Keyboard.KEY_NONE, categoryNameWorld); + setDefaultKeyBinding("nei.options.keys.world.creative", KeyConflictContext.IN_GAME, KeyModifier.NONE, Keyboard.KEY_NONE, categoryNameWorld); + } + + public static KeyBinding get(String string) { + KeyBinding keyBinding = keyBindings.get(string); + if (keyBinding == null) { + throw new IllegalArgumentException("There is no key binding for " + string); + } + return keyBinding; + } + + @Deprecated + public static void setDefaultKeyBinding(String string, int key) { + KeyBinding keyBinding = new KeyBinding(string, KeyConflictContext.UNIVERSAL, KeyModifier.NONE, key, "misc"); + keyBindings.put(string, keyBinding); + keyBindingsToRegister.add(keyBinding); + } + + /** + * Add a new keybinding to get registered + */ + public static void setDefaultKeyBinding(String description, IKeyConflictContext keyConflictContext, KeyModifier keyModifier, int keyCode, String category) { + KeyBinding keyBinding = new KeyBinding(description, keyConflictContext, keyModifier, keyCode, category); + keyBindings.put(description, keyBinding); + keyBindingsToRegister.add(keyBinding); + } + + /** + * Add a keybinding that is already being registered somewhere else + */ + public static void setDefaultKeyBinding(String description, KeyBinding keyBinding) { + keyBindings.put(description, keyBinding); + } + + public static void register() { + for (KeyBinding keyBinding : keyBindingsToRegister) { + ClientRegistry.registerKeyBinding(keyBinding); + } + } +} diff --git a/dependencies/main/java/codechicken/nei/config/Option.java b/dependencies/main/java/codechicken/nei/config/Option.java index d7da2f62c4..b309eb18b6 100644 --- a/dependencies/main/java/codechicken/nei/config/Option.java +++ b/dependencies/main/java/codechicken/nei/config/Option.java @@ -4,14 +4,14 @@ import codechicken.nei.config.GuiOptionList.OptionScrollSlot; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; +import net.minecraft.init.SoundEvents; +import net.minecraft.util.text.translation.I18n; import java.util.List; public abstract class Option { public static void playClickSound() { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); } public OptionScrollSlot slot; @@ -37,7 +37,7 @@ public String namespaced(String name) { } public String translateN(String s, Object... args) { - return StatCollector.translateToLocalFormatted(namespaced(s), args); + return I18n.translateToLocalFormatted(namespaced(s), args); } public int getHeight() { diff --git a/dependencies/main/java/codechicken/nei/config/OptionButton.java b/dependencies/main/java/codechicken/nei/config/OptionButton.java index 04d05731ee..cbca29f455 100644 --- a/dependencies/main/java/codechicken/nei/config/OptionButton.java +++ b/dependencies/main/java/codechicken/nei/config/OptionButton.java @@ -109,9 +109,11 @@ public boolean pointInside(int mx, int my) { @Override public void mouseClicked(int x, int y, int button) { - if (pointInside(x, y)) { - if (onClick(button)) { - playClickSound(); + if (isEnabled()) { + if (pointInside(x, y)) { + if (onClick(button)) { + playClickSound(); + } } } } diff --git a/dependencies/main/java/codechicken/nei/config/OptionKeyBind.java b/dependencies/main/java/codechicken/nei/config/OptionKeyBind.java deleted file mode 100644 index 474aed51d4..0000000000 --- a/dependencies/main/java/codechicken/nei/config/OptionKeyBind.java +++ /dev/null @@ -1,83 +0,0 @@ -package codechicken.nei.config; - -import net.minecraft.util.TextFormatting; -import org.lwjgl.input.Keyboard; - -public class OptionKeyBind extends OptionButton { - private boolean hasFocus = false; - - public OptionKeyBind(String name) { - super("keys." + name); - } - - @Override - public void onMouseClicked(int mousex, int mousey, int button) { - hasFocus = false; - } - - @Override - public void keyTyped(char c, int keycode) { - if (hasFocus) { - setValue(keycode); - hasFocus = false; - } - } - - @Override - public boolean onClick(int button) { - if (button == 0) { - hasFocus = true; - return true; - } - if (button == 1 && getValue() != 0) { - setValue(0); - return true; - } - return false; - } - - public boolean conflicted() { - if (getValue() == 0) { - return false; - } - - for (Option o : slot.options) { - if (o instanceof OptionKeyBind && o != this && ((OptionKeyBind) o).getValue() == getValue()) { - return true; - } - } - - return false; - } - - public void setValue(int keycode) { - getTag().setIntValue(keycode); - } - - public int getValue() { - return renderTag().getIntValue(); - } - - @Override - public String getPrefix() { - return translateN(name); - } - - @Override - public String getButtonText() { - if (hasFocus) { - return TextFormatting.WHITE + "> " + TextFormatting.YELLOW + "??? " + TextFormatting.WHITE + "<"; - } - - if (conflicted()) { - return TextFormatting.RED + Keyboard.getKeyName(getValue()); - } - - return Keyboard.getKeyName(getValue()); - } - - @Override - public int getTextColour(int mousex, int mousey) { - return -1; - } -} diff --git a/dependencies/main/java/codechicken/nei/config/OptionList.java b/dependencies/main/java/codechicken/nei/config/OptionList.java index 78e5542f00..1a30454ee2 100644 --- a/dependencies/main/java/codechicken/nei/config/OptionList.java +++ b/dependencies/main/java/codechicken/nei/config/OptionList.java @@ -1,7 +1,7 @@ package codechicken.nei.config; -import codechicken.nei.NEIClientConfig; import codechicken.nei.config.GuiOptionList.OptionScrollSlot; +import codechicken.nei.util.LogHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -111,7 +111,7 @@ private void addOption(Option o, String fullName, String subName) { } if (options.containsKey(subName)) { - NEIClientConfig.logger.warn("Replacing option: " + fullName); + LogHelper.warn("Replacing option: " + fullName); } options.put(subName, o); diff --git a/dependencies/main/java/codechicken/nei/config/OptionOpenGui.java b/dependencies/main/java/codechicken/nei/config/OptionOpenGui.java index d715f1d5ae..afba08c7f6 100644 --- a/dependencies/main/java/codechicken/nei/config/OptionOpenGui.java +++ b/dependencies/main/java/codechicken/nei/config/OptionOpenGui.java @@ -1,6 +1,6 @@ package codechicken.nei.config; -import codechicken.nei.NEIClientConfig; +import codechicken.nei.util.LogHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -17,7 +17,7 @@ public boolean onClick(int button) { try { Minecraft.getMinecraft().displayGuiScreen(guiClass.getConstructor(Option.class).newInstance(this)); } catch (Exception e) { - NEIClientConfig.logger.error("Unable to open gui class: " + guiClass.getName() + " from option " + fullName(), e); + LogHelper.errorError("Unable to open gui class: " + guiClass.getName() + " from option " + fullName(), e); } return true; } diff --git a/dependencies/main/java/codechicken/nei/config/OptionScrollPane.java b/dependencies/main/java/codechicken/nei/config/OptionScrollPane.java index 45911df345..0c4717c38a 100644 --- a/dependencies/main/java/codechicken/nei/config/OptionScrollPane.java +++ b/dependencies/main/java/codechicken/nei/config/OptionScrollPane.java @@ -5,7 +5,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import org.lwjgl.opengl.GL11; @@ -59,20 +59,15 @@ public static void drawOverlay(int y, int height, int screenwidth, float zLevel) public static void drawOverlayTex(int x, int y, int w, int h, float zLevel) { GlStateManager.color(1, 1, 1, 1); - Minecraft.getMinecraft().renderEngine.bindTexture(Gui.optionsBackground); - //TODO Add CCRenderState.startDrawing(VertexFormat); defaults to quads. - WorldRenderer worldRenderer = CCRenderState.startDrawing(7, DefaultVertexFormats.POSITION_TEX); + Minecraft.getMinecraft().renderEngine.bindTexture(Gui.OPTIONS_BACKGROUND); + CCRenderState ccrs = CCRenderState.instance(); + VertexBuffer worldRenderer = ccrs.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); worldRenderer.pos(x, y, zLevel).tex(0, 0).endVertex(); worldRenderer.pos(x, y + h, zLevel).tex(0, h / 16D).endVertex(); worldRenderer.pos(x + w, y + h, zLevel).tex(w / 16D, h / 16D).endVertex(); worldRenderer.pos(x + w, y, zLevel).tex(w / 16D, 0).endVertex(); - - //worldRenderer.addVertexWithUV(x, y, zLevel, 0, 0); - //worldRenderer.addVertexWithUV(x, y + h, zLevel, 0, h / 16D); - //worldRenderer.addVertexWithUV(x + w, y + h, zLevel, w / 16D, h / 16D); - //worldRenderer.addVertexWithUV(x + w, y, zLevel, w / 16D, 0); - CCRenderState.draw(); + ccrs.draw(); } public static void drawOverlayGrad(int x1, int x2, int y1, int y2, float zLevel) { @@ -81,21 +76,15 @@ public static void drawOverlayGrad(int x1, int x2, int y1, int y2, float zLevel) GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.shadeModel(GL11.GL_SMOOTH); - //TODO Add CCRenderState.startDrawing(VertexFormat); defaults to quads. - WorldRenderer worldRenderer = CCRenderState.startDrawing(7, DefaultVertexFormats.POSITION_COLOR); + CCRenderState ccrs = CCRenderState.instance(); + VertexBuffer worldRenderer = ccrs.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); worldRenderer.pos(x2, y1, zLevel).color(0, 0, 0, 255).endVertex(); worldRenderer.pos(x1, y1, zLevel).color(0, 0, 0, 255).endVertex(); worldRenderer.pos(x1, y2, zLevel).color(0, 0, 0, 0).endVertex(); worldRenderer.pos(x2, y2, zLevel).color(0, 0, 0, 0).endVertex(); - //worldRenderer.setColorRGBA_I(0, 255); - //worldRenderer.addVertex(x2, y1, zLevel); - //worldRenderer.addVertex(x1, y1, zLevel); - //worldRenderer.setColorRGBA_I(0, 0); - //worldRenderer.addVertex(x1, y2, zLevel); - //worldRenderer.addVertex(x2, y2, zLevel); - CCRenderState.draw(); + ccrs.draw(); GlStateManager.disableBlend(); GlStateManager.enableCull(); GlStateManager.enableTexture2D(); diff --git a/dependencies/main/java/codechicken/nei/config/OptionUtilities.java b/dependencies/main/java/codechicken/nei/config/OptionUtilities.java index 51359e5d2e..d05c225b5b 100644 --- a/dependencies/main/java/codechicken/nei/config/OptionUtilities.java +++ b/dependencies/main/java/codechicken/nei/config/OptionUtilities.java @@ -44,13 +44,13 @@ public void drawIcons() { x += 24; RenderHelper.enableGUIStandardItemLighting(); GlStateManager.enableRescaleNormal(); - ItemStack sword = new ItemStack(Items.diamond_sword); - sword.addEnchantment(Enchantment.sharpness, 1); + ItemStack sword = new ItemStack(Items.DIAMOND_SWORD); + sword.addEnchantment(Enchantment.getEnchantmentByLocation("sharpness"), 1); GuiContainerManager.drawItem(x + 2, 2, sword); x += 24; - GuiContainerManager.drawItem(x + 2, 2, new ItemStack(Items.potionitem)); + GuiContainerManager.drawItem(x + 2, 2, new ItemStack(Items.POTIONITEM)); x += 24; - GuiContainerManager.drawItem(x + 2, 2, new ItemStack(Blocks.stone)); + GuiContainerManager.drawItem(x + 2, 2, new ItemStack(Blocks.STONE)); x += 24; } } diff --git a/dependencies/main/java/codechicken/nei/config/PatreonButton.java b/dependencies/main/java/codechicken/nei/config/PatreonButton.java index 816f7af0f9..7c17a12377 100644 --- a/dependencies/main/java/codechicken/nei/config/PatreonButton.java +++ b/dependencies/main/java/codechicken/nei/config/PatreonButton.java @@ -1,7 +1,7 @@ package codechicken.nei.config; import codechicken.core.gui.GuiCCButton; -import codechicken.lib.render.CCRenderState; +import codechicken.lib.texture.TextureUtils; import net.minecraft.client.renderer.GlStateManager; public class PatreonButton extends GuiCCButton { @@ -14,7 +14,7 @@ public void drawButtonTex(int mousex, int mousey) { super.drawButtonTex(mousex, mousey); GlStateManager.color(1, 1, 1, 1); - CCRenderState.changeTexture("nei:textures/patreonNeon.png"); + TextureUtils.changeTexture("nei:textures/patreonNeon.png"); int texh = height - 4; int texw = texh * 4; drawModalRectWithCustomSizedTexture(x + width / 2 - texw / 2, y + height / 2 - texh / 2, 0, 0, texw, texh, texw, texh); diff --git a/dependencies/main/java/codechicken/nei/config/RegistryDumper.java b/dependencies/main/java/codechicken/nei/config/RegistryDumper.java index 3471a4c859..05b5ed0fa9 100644 --- a/dependencies/main/java/codechicken/nei/config/RegistryDumper.java +++ b/dependencies/main/java/codechicken/nei/config/RegistryDumper.java @@ -1,9 +1,10 @@ package codechicken.nei.config; -import net.minecraft.util.RegistryNamespaced; +import net.minecraft.util.registry.RegistryNamespaced; import java.util.LinkedList; +@Deprecated// Use ForgeRegistryDumper. public abstract class RegistryDumper extends DataDumper { public RegistryDumper(String name) { super(name); @@ -15,7 +16,7 @@ public Iterable dump(int mode) { RegistryNamespaced registry = registry(); for (T obj : (Iterable) registry) { - list.add(dump(obj, registry.getIDForObject(obj), (String) registry.getNameForObject(obj))); + list.add(dump(obj, registry.getIDForObject(obj), registry.getNameForObject(obj).toString())); } return list; diff --git a/dependencies/main/java/codechicken/nei/config/dumps/FluidRegistryDumper.java b/dependencies/main/java/codechicken/nei/config/dumps/FluidRegistryDumper.java new file mode 100644 index 0000000000..4ad6a29ba2 --- /dev/null +++ b/dependencies/main/java/codechicken/nei/config/dumps/FluidRegistryDumper.java @@ -0,0 +1,43 @@ +package codechicken.nei.config.dumps; + +import codechicken.nei.config.DataDumper; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; + +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +/** + * Created by covers1624 on 9/01/2017. + */ +public class FluidRegistryDumper extends DataDumper { + + public FluidRegistryDumper() { + super("tools.dump.fluid"); + } + + @Override + public String[] header() { + return new String[] {"Name", "ID", "Unlocalized Name", "Luminosity", "Density", "Temperature", "Viscosity", "Is Gas", "Rarity", "Block", "Still Texture", "Flowing Texture", "Fill Sound", "Empty Sound", "Class"}; + } + + @Override + public Iterable dump(int mode) { + Map registeredFluids = FluidRegistry.getRegisteredFluids(); + Map fluidIDMap = FluidRegistry.getRegisteredFluidIDs(); + List dumps = new LinkedList(); + for (Entry fluidEntry : registeredFluids.entrySet()) { + Fluid fluid = fluidEntry.getValue(); + int id = fluidIDMap.get(fluid); + dumps.add(new String[] {fluidEntry.getKey(), Integer.toString(id), fluid.getUnlocalizedName(), String.valueOf(fluid.getLuminosity()), String.valueOf(fluid.getDensity()), String.valueOf(fluid.getTemperature()), String.valueOf(fluid.isGaseous()), fluid.getRarity().toString(), fluid.getBlock().getRegistryName().toString(), fluid.getStill().toString(), fluid.getFlowing().toString(), fluid.getFillSound().getRegistryName().toString(), fluid.getEmptySound().getRegistryName().toString(), fluid.getClass().getCanonicalName()}); + } + return dumps; + } + + @Override + public int modeCount() { + return 1; + } +} diff --git a/dependencies/main/java/codechicken/nei/config/dumps/ForgeRegistryDumper.java b/dependencies/main/java/codechicken/nei/config/dumps/ForgeRegistryDumper.java new file mode 100644 index 0000000000..d43324f85d --- /dev/null +++ b/dependencies/main/java/codechicken/nei/config/dumps/ForgeRegistryDumper.java @@ -0,0 +1,42 @@ +package codechicken.nei.config.dumps; + +import codechicken.nei.config.DataDumper; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.registry.IForgeRegistry; +import net.minecraftforge.fml.common.registry.IForgeRegistryEntry; + +import java.util.LinkedList; + +/** + * Created by covers1624 on 8/01/2017. + */ +public abstract class ForgeRegistryDumper> extends DataDumper { + + public ForgeRegistryDumper(String name) { + super(name); + } + + @Override + public Iterable dump(int mode) { + LinkedList list = new LinkedList(); + IForgeRegistry registry = registry(); + + for (V obj : registry) { + if (obj.getRegistryName() == null) { + continue; + } + list.add(dump(obj, obj.getRegistryName())); + } + + return list; + } + + public abstract IForgeRegistry registry(); + + public abstract String[] dump(V obj, ResourceLocation registryName); + + @Override + public int modeCount() { + return 1; + } +} diff --git a/dependencies/main/java/codechicken/nei/ContainerCreativeInv.java b/dependencies/main/java/codechicken/nei/container/ContainerCreativeInv.java similarity index 59% rename from dependencies/main/java/codechicken/nei/ContainerCreativeInv.java rename to dependencies/main/java/codechicken/nei/container/ContainerCreativeInv.java index cc3a130fb0..f9570e1f38 100644 --- a/dependencies/main/java/codechicken/nei/ContainerCreativeInv.java +++ b/dependencies/main/java/codechicken/nei/container/ContainerCreativeInv.java @@ -1,8 +1,9 @@ -package codechicken.nei; +package codechicken.nei.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemArmor; @@ -11,39 +12,40 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class ContainerCreativeInv extends Container { + + public static final EntityEquipmentSlot[] VALID_EQUIPMENT_SLOTS = new EntityEquipmentSlot[] { EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET, EntityEquipmentSlot.OFFHAND }; + public static final String[] SLOT_TEXTURES = new String[] { "", "minecraft:items/empty_armor_slot_boots", "minecraft:items/empty_armor_slot_leggings", "minecraft:items/empty_armor_slot_chestplate", "minecraft:items/empty_armor_slot_helmet", "minecraft:items/empty_armor_slot_shield" }; + private class SlotArmor extends Slot { - int armorType; + EntityEquipmentSlot equipmentSlot; + int stackLimit; - public SlotArmor(IInventory inv, int slot, int x, int y, int armor) { + public SlotArmor(IInventory inv, int slot, int x, int y, EntityEquipmentSlot armor, int stackLimit) { super(inv, slot, x, y); - armorType = armor; + equipmentSlot = armor; + this.stackLimit = stackLimit; + } + + public SlotArmor(IInventory inv, int slot, int x, int y, EntityEquipmentSlot armor) { + super(inv, slot, x, y); + equipmentSlot = armor; + stackLimit = 1; } @Override public int getSlotStackLimit() { - return 1; + return stackLimit; } @Override public boolean isItemValid(ItemStack stack) { - return stack != null && stack.getItem().isValidArmor(stack, armorType, player); + return equipmentSlot.equals(EntityEquipmentSlot.OFFHAND) || stack != null && stack.getItem().isValidArmor(stack, equipmentSlot, player); } @Override @SideOnly(Side.CLIENT) public String getSlotTexture() { - return ItemArmor.EMPTY_SLOT_NAMES[armorType]; - } - } - - private class SlotBlockArmor extends SlotArmor { - public SlotBlockArmor(IInventory inv, int slot, int x, int y, int armor) { - super(inv, slot, x, y, armor); - } - - @Override - public boolean isItemValid(ItemStack stack) { - return super.isItemValid(stack) || stack != null;// && Block.getBlockFromItem(stack.getItem()) != Blocks.AIR; + return SLOT_TEXTURES[equipmentSlot.getSlotIndex()]; } } @@ -67,17 +69,17 @@ public ContainerCreativeInv(EntityPlayer player, ExtendedCreativeInv extraInv) { for (int col = 0; col < 9; ++col) { addSlotToContainer(new Slot(invPlayer, col, 8 + col * 18, 176)); } - - addSlotToContainer(new SlotBlockArmor(invPlayer, invPlayer.getSizeInventory() - 1, -15, 23, 0)); - for (int armorType = 1; armorType < 4; armorType++) { - addSlotToContainer(new SlotArmor(invPlayer, invPlayer.getSizeInventory() - 1 - armorType, -15, 23 + armorType * 18, armorType)); + for (int i = 0; i < 4; i++) { + EntityEquipmentSlot entityEquipmentSlot = VALID_EQUIPMENT_SLOTS[i]; + addSlotToContainer(new SlotArmor(invPlayer, 36 + (3 - i), -15, 23 + i * 18, entityEquipmentSlot)); } + addSlotToContainer(new SlotArmor(invPlayer, 40, -15, 23 + 4 * 18, VALID_EQUIPMENT_SLOTS[4], 64)); } @Override public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slotIndex) { ItemStack transferredStack = null; - Slot slot = (Slot) inventorySlots.get(slotIndex); + Slot slot = inventorySlots.get(slotIndex); if (slot != null && slot.getHasStack()) { ItemStack stack = slot.getStack(); @@ -85,8 +87,8 @@ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slotInde if (stack.getItem() instanceof ItemArmor) { ItemArmor armor = (ItemArmor) stack.getItem(); - if (!getSlot(90 + armor.armorType).getHasStack()) { - getSlot(90 + armor.armorType).putStack(transferredStack); + if (!getSlot(90 + armor.armorType.getIndex()).getHasStack()) { + getSlot(90 + armor.armorType.getIndex()).putStack(transferredStack); slot.putStack(null); return transferredStack; } @@ -110,7 +112,7 @@ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slotInde return transferredStack; } - public boolean canInteractWith(EntityPlayer var1) { + public boolean canInteractWith(EntityPlayer player) { return true; } } diff --git a/dependencies/main/java/codechicken/nei/ExtendedCreativeInv.java b/dependencies/main/java/codechicken/nei/container/ExtendedCreativeInv.java similarity index 94% rename from dependencies/main/java/codechicken/nei/ExtendedCreativeInv.java rename to dependencies/main/java/codechicken/nei/container/ExtendedCreativeInv.java index 5712c56cec..93d1233485 100644 --- a/dependencies/main/java/codechicken/nei/ExtendedCreativeInv.java +++ b/dependencies/main/java/codechicken/nei/container/ExtendedCreativeInv.java @@ -1,9 +1,11 @@ -package codechicken.nei; +package codechicken.nei.container; +import codechicken.nei.NEIClientConfig; +import codechicken.nei.PlayerSave; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.util.ITextComponent; +import net.minecraft.util.text.ITextComponent; import net.minecraftforge.fml.relauncher.Side; public class ExtendedCreativeInv implements IInventory { diff --git a/dependencies/main/java/codechicken/nei/InventoryCraftingDummy.java b/dependencies/main/java/codechicken/nei/container/InventoryCraftingDummy.java similarity index 92% rename from dependencies/main/java/codechicken/nei/InventoryCraftingDummy.java rename to dependencies/main/java/codechicken/nei/container/InventoryCraftingDummy.java index fa4ed8473c..9cf8ef3aef 100644 --- a/dependencies/main/java/codechicken/nei/InventoryCraftingDummy.java +++ b/dependencies/main/java/codechicken/nei/container/InventoryCraftingDummy.java @@ -1,4 +1,4 @@ -package codechicken.nei; +package codechicken.nei.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; diff --git a/dependencies/main/java/codechicken/nei/featurehack/VanillaCreativeTabSearchHooks.java b/dependencies/main/java/codechicken/nei/featurehack/VanillaCreativeTabSearchHooks.java new file mode 100644 index 0000000000..967f8755e0 --- /dev/null +++ b/dependencies/main/java/codechicken/nei/featurehack/VanillaCreativeTabSearchHooks.java @@ -0,0 +1,141 @@ +package codechicken.nei.featurehack; + +import codechicken.lib.item.filtering.IItemFilter; +import codechicken.lib.thread.RestartableTask; +import com.google.common.base.Strings; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiTextField; +import net.minecraft.client.gui.inventory.GuiContainerCreative; +import net.minecraft.client.gui.inventory.GuiContainerCreative.ContainerCreative; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.enchantment.Enchantment; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.text.TextFormatting; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * Created by covers1624 on 7/20/2016. + */ +public class VanillaCreativeTabSearchHooks { + + private static HashMap> tabCache = new HashMap>(); + + public static void updateSearchListThreaded(GuiContainerCreative guiContainerCreative) { + filterTask.stop(); + filterTask.setContainerCreative((ContainerCreative) guiContainerCreative.inventorySlots); + filterTask.setSearchBox(guiContainerCreative.searchField); + filterTask.setCreativeTab(CreativeTabs.CREATIVE_TAB_ARRAY[guiContainerCreative.getSelectedTabIndex()]); + filterTask.restart(); + } + + public static final VanillaFilterTask filterTask = new VanillaFilterTask("NEI Vanilla creative tab filtering."); + + public static class VanillaFilterTask extends RestartableTask { + private ContainerCreative containerCreative; + private GuiTextField searchBox; + private CreativeTabs creativeTab; + + public VanillaFilterTask(String name) { + super(name); + } + + public void setContainerCreative(ContainerCreative containerCreative) { + this.containerCreative = containerCreative; + } + + public void setSearchBox(GuiTextField searchBox) { + this.searchBox = searchBox; + } + + public void setCreativeTab(CreativeTabs creativeTab) { + this.creativeTab = creativeTab; + } + + public GuiTextField getSearchBox() { + return searchBox; + } + + public CreativeTabs getCreativeTab() { + return creativeTab; + } + + @Override + public void execute() { + ArrayList filtered = new ArrayList(); + if (containerCreative == null) { + stop(); + } + IItemFilter filter = VanillaFilter.INSTANCE; + for (ItemStack item : getStacksForTab(getCreativeTab())) { + if (interrupted()) { + return; + } + + if (filter.matches(item)) { + filtered.add(item); + } + } + + if (interrupted()) { + return; + } + containerCreative.itemList = filtered; + containerCreative.scrollTo(0.0F); + } + + } + + public static class VanillaFilter implements IItemFilter { + + public static VanillaFilter INSTANCE = new VanillaFilter(); + + @Override + public boolean matches(ItemStack item) { + GuiTextField textField = filterTask.getSearchBox(); + if (Strings.isNullOrEmpty(textField.getText())) { + return true; + }//TODO Replace this with logic inside VanillaFilterTask.execute and allow for oreDict search. + if (textField.getText().toLowerCase().startsWith("@")) { + String expectedMod = textField.getText().toLowerCase().replace("@", ""); + if (expectedMod.isEmpty()) { + return true; + } + if (item.getItem().getRegistryName().getResourceDomain().startsWith(expectedMod)) { + return true; + } + } + for (String toolTipString : item.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips)) { + if (TextFormatting.getTextWithoutFormattingCodes(toolTipString).toLowerCase().contains(textField.getText().toLowerCase())) { + return true; + } + } + return false; + } + } + + private static List getStacksForTab(CreativeTabs creativeTab) { + ArrayList tabStacks = new ArrayList(); + if (creativeTab == CreativeTabs.SEARCH) { + for (Item item : Item.REGISTRY) { + if (item != null) { + item.getSubItems(item, null, tabStacks); + } + } + for (Enchantment enchantment : Enchantment.REGISTRY) { + if (enchantment != null && enchantment.type != null) { + Items.ENCHANTED_BOOK.getAll(enchantment, tabStacks); + } + } + } + + creativeTab.displayAllRelevantItems(tabStacks); + + return tabStacks; + } + +} diff --git a/dependencies/main/java/codechicken/nei/guihook/DefaultSlotClickHandler.java b/dependencies/main/java/codechicken/nei/guihook/DefaultSlotClickHandler.java index 9aa8a430b0..d921d86888 100644 --- a/dependencies/main/java/codechicken/nei/guihook/DefaultSlotClickHandler.java +++ b/dependencies/main/java/codechicken/nei/guihook/DefaultSlotClickHandler.java @@ -1,27 +1,28 @@ package codechicken.nei.guihook; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Slot; public class DefaultSlotClickHandler implements IContainerSlotClickHandler { @Override - public void beforeSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, int modifier) { + public void beforeSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, ClickType modifier) { } @Override - public boolean handleSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, int modifier, boolean eventconsumed) { - if (!eventconsumed) { - callHandleMouseClick(gui, slot, slotIndex, button, modifier); + public boolean handleSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, ClickType clickType, boolean eventConsumed) { + if (!eventConsumed) { + callHandleMouseClick(gui, slot, slotIndex, button, clickType); } return true; } - private static void callHandleMouseClick(GuiContainer gui, Slot slot, int slotIndex, int button, int modifiers) { + private static void callHandleMouseClick(GuiContainer gui, Slot slot, int slotIndex, int button, ClickType modifiers) { //calls GuiContainer.mouseClicked using ASM generated forwarder } @Override - public void afterSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, int modifier) { + public void afterSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, ClickType clickType) { } } diff --git a/dependencies/main/java/codechicken/nei/guihook/GuiContainerManager.java b/dependencies/main/java/codechicken/nei/guihook/GuiContainerManager.java index 7e249cfc1a..dbcc0ed5a6 100644 --- a/dependencies/main/java/codechicken/nei/guihook/GuiContainerManager.java +++ b/dependencies/main/java/codechicken/nei/guihook/GuiContainerManager.java @@ -6,12 +6,13 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderItem; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.init.Blocks; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.TextFormatting; +import net.minecraft.util.text.TextFormatting; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @@ -30,7 +31,7 @@ public class GuiContainerManager { public GuiContainer window; - public static RenderItem drawItems = Minecraft.getMinecraft().getRenderItem(); + //public static RenderItem drawItems = Minecraft.getMinecraft().getRenderItem(); public static final LinkedList tooltipHandlers = new LinkedList(); public static final LinkedList inputHandlers = new LinkedList(); public static final LinkedList drawHandlers = new LinkedList(); @@ -51,6 +52,10 @@ public static GuiContainerManager getManager(GuiContainer gui) { return null; } + public static RenderItem getRenderItem() { + return Minecraft.getMinecraft().getRenderItem(); + } + /** * Register a new Tooltip render handler; * @@ -188,6 +193,7 @@ public static void drawItem(int i, int j, ItemStack itemstack) { public static void drawItem(int i, int j, ItemStack itemstack, FontRenderer fontRenderer) { enable3DRender(); + RenderItem drawItems = getRenderItem(); float zLevel = drawItems.zLevel += 100F; try { drawItems.renderItemAndEffectIntoGUI(itemstack, i, j); @@ -196,7 +202,7 @@ public static void drawItem(int i, int j, ItemStack itemstack, FontRenderer font if (!checkMatrixStack()) { throw new IllegalStateException("Modelview matrix stack too deep"); } - if (Tessellator.getInstance().getWorldRenderer().isDrawing) { + if (Tessellator.getInstance().getBuffer().isDrawing) { throw new IllegalStateException("Still drawing"); } } catch (Exception e) { @@ -210,12 +216,12 @@ public static void drawItem(int i, int j, ItemStack itemstack, FontRenderer font } restoreMatrixStack(); - if (Tessellator.getInstance().getWorldRenderer().isDrawing) { + if (Tessellator.getInstance().getBuffer().isDrawing) { Tessellator.getInstance().draw(); } drawItems.zLevel = zLevel; - drawItems.renderItemIntoGUI(new ItemStack(Blocks.fire), i, j); + drawItems.renderItemIntoGUI(new ItemStack(Blocks.STONE), i, j); } enable2DRender(); @@ -430,6 +436,7 @@ public void renderObjects(int mousex, int mousey) { public void renderToolTips(int mousex, int mousey) { List tooltip = new LinkedList(); + ItemStack stack = null; for (IContainerTooltipHandler handler : instanceTooltipHandlers) { tooltip = handler.handleTooltip(window, mousex, mousey, tooltip); @@ -437,7 +444,7 @@ public void renderToolTips(int mousex, int mousey) { if (tooltip.isEmpty() && shouldShowTooltip(window))//mouseover tip, not holding an item { - ItemStack stack = getStackMouseOver(window); + stack = getStackMouseOver(window); if (stack != null) { tooltip = itemDisplayNameMultiline(stack, window, true); } @@ -450,7 +457,7 @@ public void renderToolTips(int mousex, int mousey) { if (tooltip.size() > 0) { tooltip.set(0, tooltip.get(0) + GuiDraw.TOOLTIP_LINESPACE);//add space after 'title' } - drawMultilineTip(mousex + 12, mousey - 12, tooltip); + drawMultilineTip(stack, mousex + 12, mousey - 12, tooltip); } public static boolean shouldShowTooltip(GuiContainer window) { @@ -489,18 +496,18 @@ public boolean objectUnderMouse(int mousex, int mousey) { return false; } - public void handleMouseClick(Slot slot, int slotIndex, int button, int modifier) { + public void handleMouseClick(Slot slot, int slotIndex, int button, ClickType clickType) { for (IContainerSlotClickHandler handler : slotClickHandlers) { - handler.beforeSlotClick(window, slotIndex, button, slot, modifier); + handler.beforeSlotClick(window, slotIndex, button, slot, clickType); } boolean eventHandled = false; for (IContainerSlotClickHandler handler : slotClickHandlers) { - eventHandled = handler.handleSlotClick(window, slotIndex, button, slot, modifier, eventHandled); + eventHandled = handler.handleSlotClick(window, slotIndex, button, slot, clickType, eventHandled); } for (IContainerSlotClickHandler handler : slotClickHandlers) { - handler.afterSlotClick(window, slotIndex, button, slot, modifier); + handler.afterSlotClick(window, slotIndex, button, slot, clickType); } } @@ -535,6 +542,7 @@ public void drawSlotItem(Slot slot, ItemStack stack, int x, int y, String quanti if (window instanceof IGuiSlotDraw) { ((IGuiSlotDraw) window).drawSlotItem(slot, stack, x, y, quantity); } else { + RenderItem drawItems = getRenderItem(); drawItems.renderItemAndEffectIntoGUI(stack, x, y); drawItems.renderItemOverlayIntoGUI(fontRenderer, stack, x, y, quantity); } @@ -543,16 +551,18 @@ public void drawSlotItem(Slot slot, ItemStack stack, int x, int y, String quanti /** * Implementation for handleMouseClick */ - public void handleSlotClick(int slotIndex, int button, int modifiers) { + public void handleSlotClick(int slotIndex, int button, ClickType clickType) { if (slotIndex == -1) { return; } if (window instanceof IGuiClientSide)//send the calls directly to the container bypassing the MPController window send { - window.mc.thePlayer.openContainer.slotClick(slotIndex, button, modifiers, window.mc.thePlayer); + //slotClick + window.mc.thePlayer.openContainer.slotClick(slotIndex, button, clickType, window.mc.thePlayer); } else { - window.mc.playerController.windowClick(window.inventorySlots.windowId, slotIndex, button, modifiers, window.mc.thePlayer); + //windowClick + window.mc.playerController.windowClick(window.inventorySlots.windowId, slotIndex, button, clickType, window.mc.thePlayer); } } diff --git a/dependencies/main/java/codechicken/nei/guihook/IContainerDrawHandler.java b/dependencies/main/java/codechicken/nei/guihook/IContainerDrawHandler.java index b0660daab3..d519922d3b 100644 --- a/dependencies/main/java/codechicken/nei/guihook/IContainerDrawHandler.java +++ b/dependencies/main/java/codechicken/nei/guihook/IContainerDrawHandler.java @@ -9,7 +9,7 @@ public interface IContainerDrawHandler { * * @param gui An instance of the currentscreen */ - public void onPreDraw(GuiContainer gui); + void onPreDraw(GuiContainer gui); /** * Draw your objects. Called after all normal gui rendering has been performed. @@ -18,7 +18,7 @@ public interface IContainerDrawHandler { * @param mousex The x position of the mouse in pixels from left * @param mousey The y position of the mouse in pixels from top */ - public void renderObjects(GuiContainer gui, int mousex, int mousey); + void renderObjects(GuiContainer gui, int mousex, int mousey); /** * Use this to draw things that should always be on top, for example objects being held by the mouse. @@ -27,7 +27,7 @@ public interface IContainerDrawHandler { * @param mousex The x position of the mouse in pixels from left * @param mousey The y position of the mouse in pixels from top */ - public void postRenderObjects(GuiContainer gui, int mousex, int mousey); + void postRenderObjects(GuiContainer gui, int mousex, int mousey); /** * Render something over a slot before the item in the slot. @@ -35,7 +35,7 @@ public interface IContainerDrawHandler { * @param gui An instance of the currentscreen * @param slot The slot being rendered. */ - public void renderSlotUnderlay(GuiContainer gui, Slot slot); + void renderSlotUnderlay(GuiContainer gui, Slot slot); /** * Render something over a slot after the item in the slot. @@ -43,5 +43,5 @@ public interface IContainerDrawHandler { * @param gui An instance of the currentscreen * @param slot The slot being rendered. */ - public void renderSlotOverlay(GuiContainer gui, Slot slot); + void renderSlotOverlay(GuiContainer gui, Slot slot); } diff --git a/dependencies/main/java/codechicken/nei/guihook/IContainerInputHandler.java b/dependencies/main/java/codechicken/nei/guihook/IContainerInputHandler.java index 34ec612d19..e400efa30f 100644 --- a/dependencies/main/java/codechicken/nei/guihook/IContainerInputHandler.java +++ b/dependencies/main/java/codechicken/nei/guihook/IContainerInputHandler.java @@ -12,7 +12,7 @@ public interface IContainerInputHandler { * @param keyCode The KeyCode as defined in {@link Keyboard} * @return true to terminate further processing of this event. */ - public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode); + boolean keyTyped(GuiContainer gui, char keyChar, int keyCode); /** * This version of keyTyped is passive and will be called on every input handler before keyTyped is processed @@ -21,7 +21,7 @@ public interface IContainerInputHandler { * @param keyChar The character representing the keyPress * @param keyID The KeyCode as defined in {@link Keyboard} */ - public void onKeyTyped(GuiContainer gui, char keyChar, int keyID); + void onKeyTyped(GuiContainer gui, char keyChar, int keyID); /** * This version of keyTyped is called if the key event has not been handled by the first pass, use this for key bindings that work globally @@ -31,7 +31,7 @@ public interface IContainerInputHandler { * @param keyID The KeyCode as defined in {@link Keyboard} * @return true to terminate further processing of this event. */ - public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID); + boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID); /** * Called when the mouse is clicked in the gui @@ -42,7 +42,7 @@ public interface IContainerInputHandler { * @param button The button index being pressed, {0 = Left Click, 1 = Right Click, 2 = Middle Click} * @return true to terminate further processing of this event. */ - public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button); + boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button); /** * This version of mouseClicked is passive and will be called on every input handler before mouseClicked is processed @@ -52,7 +52,7 @@ public interface IContainerInputHandler { * @param mousey The y position of the mouse in pixels from top * @param button The button index being pressed, {0 = Left Click, 1 = Right Click, 2 = Middle Click} */ - public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button); + void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button); /** * @param gui An instance of the currentscreen @@ -60,7 +60,7 @@ public interface IContainerInputHandler { * @param mousey The y position of the mouse in pixels from top * @param button The button index being released, {0 = Left Click, 1 = Right Click, 2 = Middle Click} */ - public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button); + void onMouseUp(GuiContainer gui, int mousex, int mousey, int button); /** * @param gui An instance of the currentscreen @@ -69,7 +69,7 @@ public interface IContainerInputHandler { * @param scrolled The number of notches scrolled. Positive for up. * @return true to terminate further processing of this event. */ - public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled); + boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled); /** * This version of mouseScrolled is passive and will be called on every input handler before mouseScrolled is processed @@ -79,7 +79,7 @@ public interface IContainerInputHandler { * @param mousey The y position of the mouse in pixels from top * @param scrolled The number of notches scrolled. Positive for up. */ - public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled); + void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled); /** * This version of mouseClicked is passive and will be called on every input handler before mouseClicked is processed @@ -90,6 +90,6 @@ public interface IContainerInputHandler { * @param button The button index being pressed, {0 = Left Click, 1 = Right Click, 2 = Middle Click} * @param heldTime The number of milliseconds since the button was first pressed */ - public void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime); + void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime); } diff --git a/dependencies/main/java/codechicken/nei/guihook/IContainerObjectHandler.java b/dependencies/main/java/codechicken/nei/guihook/IContainerObjectHandler.java index 094a5e4759..1ee18437b8 100644 --- a/dependencies/main/java/codechicken/nei/guihook/IContainerObjectHandler.java +++ b/dependencies/main/java/codechicken/nei/guihook/IContainerObjectHandler.java @@ -12,21 +12,21 @@ public interface IContainerObjectHandler { * * @param gui An instance of the currentscreen */ - public void guiTick(GuiContainer gui); + void guiTick(GuiContainer gui); /** * Called when the same gui is reshown. * * @param gui An instance of the currentscreen */ - public void refresh(GuiContainer gui); + void refresh(GuiContainer gui); /** * Called when the gui is shown * * @param gui An instance of the currentscreen */ - public void load(GuiContainer gui); + void load(GuiContainer gui); /** * Do not return an item that is handled somewhere else @@ -36,7 +36,7 @@ public interface IContainerObjectHandler { * @param mousey The y position of the mouse in pixels from top * @return The itemstack from one of your objects that the mouse is hovering over */ - public ItemStack getStackUnderMouse(GuiContainer gui, int mousex, int mousey); + ItemStack getStackUnderMouse(GuiContainer gui, int mousex, int mousey); /** * @param gui An instance of the currentscreen @@ -44,11 +44,11 @@ public interface IContainerObjectHandler { * @param mousey The y position of the mouse in pixels from top * @return true if there is an object of yours obscuring the slot that the mouse would otherwise be hovering over. */ - public boolean objectUnderMouse(GuiContainer gui, int mousex, int mousey); + boolean objectUnderMouse(GuiContainer gui, int mousex, int mousey); /** * @param gui An instance of the currentscreen * @return false if tooltips should not be shown. Eg. if you have a custom object being held */ - public boolean shouldShowTooltip(GuiContainer gui); + boolean shouldShowTooltip(GuiContainer gui); } diff --git a/dependencies/main/java/codechicken/nei/guihook/IContainerSlotClickHandler.java b/dependencies/main/java/codechicken/nei/guihook/IContainerSlotClickHandler.java index 9740048331..5fb1be5cd0 100644 --- a/dependencies/main/java/codechicken/nei/guihook/IContainerSlotClickHandler.java +++ b/dependencies/main/java/codechicken/nei/guihook/IContainerSlotClickHandler.java @@ -1,12 +1,13 @@ package codechicken.nei.guihook; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Slot; public interface IContainerSlotClickHandler { - public void beforeSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, int modifier); + void beforeSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, ClickType clickType); - public boolean handleSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, int modifier, boolean eventconsumed); + boolean handleSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, ClickType clickType, boolean eventConsumed); - public void afterSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, int modifier); + void afterSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, ClickType clickType); } diff --git a/dependencies/main/java/codechicken/nei/guihook/IContainerTooltipHandler.java b/dependencies/main/java/codechicken/nei/guihook/IContainerTooltipHandler.java index 64fc623cae..f1245d78a5 100644 --- a/dependencies/main/java/codechicken/nei/guihook/IContainerTooltipHandler.java +++ b/dependencies/main/java/codechicken/nei/guihook/IContainerTooltipHandler.java @@ -18,7 +18,7 @@ public interface IContainerTooltipHandler { * @param currenttip A list of strings, representing each line of the current tooltip as modified by other handlers * @return The modified list. NOTE: Do not return null */ - public List handleTooltip(GuiContainer gui, int mousex, int mousey, List currenttip); + List handleTooltip(GuiContainer gui, int mousex, int mousey, List currenttip); /** * Use this for modifying the multiline display name of an item which may not necessarily be under the mouse. GuiContainerManager.shouldShowTooltip is enforced here. @@ -28,7 +28,7 @@ public interface IContainerTooltipHandler { * @param currenttip A list of strings, representing each line of the current tooltip as modified by other handlers * @return The modified list. NOTE: Do not return null */ - public List handleItemDisplayName(GuiContainer gui, ItemStack itemstack, List currenttip); + List handleItemDisplayName(GuiContainer gui, ItemStack itemstack, List currenttip); /** * Use this for modifying the tooltips of items that are under the mouse. GuiContainerManager.shouldShowTooltip is enforced here. @@ -38,5 +38,5 @@ public interface IContainerTooltipHandler { * @param currenttip A list of strings, representing each line of the current tooltip as modified by other handlers * @return The modified list. NOTE: Do not return null */ - public List handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey, List currenttip); + List handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey, List currenttip); } diff --git a/dependencies/main/java/codechicken/nei/guihook/IGuiHandleMouseWheel.java b/dependencies/main/java/codechicken/nei/guihook/IGuiHandleMouseWheel.java index 9645e23bb4..a7264f9123 100644 --- a/dependencies/main/java/codechicken/nei/guihook/IGuiHandleMouseWheel.java +++ b/dependencies/main/java/codechicken/nei/guihook/IGuiHandleMouseWheel.java @@ -4,5 +4,5 @@ * Interface for GuiContainers to recieve NEI compatible mouse wheel events */ public interface IGuiHandleMouseWheel { - public void mouseScrolled(int i); + void mouseScrolled(int i); } diff --git a/dependencies/main/java/codechicken/nei/guihook/IGuiSlotDraw.java b/dependencies/main/java/codechicken/nei/guihook/IGuiSlotDraw.java index 82118b7a11..150d6765a0 100644 --- a/dependencies/main/java/codechicken/nei/guihook/IGuiSlotDraw.java +++ b/dependencies/main/java/codechicken/nei/guihook/IGuiSlotDraw.java @@ -4,5 +4,5 @@ import net.minecraft.item.ItemStack; public interface IGuiSlotDraw { - public void drawSlotItem(Slot slot, ItemStack stack, int x, int y, String quantity); + void drawSlotItem(Slot slot, ItemStack stack, int x, int y, String quantity); } diff --git a/dependencies/main/java/codechicken/nei/LayoutStyleDefault.java b/dependencies/main/java/codechicken/nei/layout/LayoutStyleDefault.java similarity index 93% rename from dependencies/main/java/codechicken/nei/LayoutStyleDefault.java rename to dependencies/main/java/codechicken/nei/layout/LayoutStyleDefault.java index 9eef52b848..78a23a361d 100644 --- a/dependencies/main/java/codechicken/nei/LayoutStyleDefault.java +++ b/dependencies/main/java/codechicken/nei/layout/LayoutStyleDefault.java @@ -1,6 +1,11 @@ -package codechicken.nei; - -import codechicken.nei.api.LayoutStyle; +package codechicken.nei.layout; + +import codechicken.nei.NEIActions; +import codechicken.nei.NEIController; +import codechicken.nei.VisibilityData; +import codechicken.nei.api.layout.LayoutStyle; +import codechicken.nei.util.NEIClientUtils; +import codechicken.nei.widget.Button; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.nbt.NBTTagCompound; @@ -10,7 +15,7 @@ public abstract class LayoutStyleDefault extends LayoutStyle { @Override - public void layout(GuiContainer gui, VisiblityData visiblity) { + public void layout(GuiContainer gui, VisibilityData visiblity) { int windowWidth = gui.width; int windowHeight = gui.height; int containerWidth = gui.xSize; @@ -117,7 +122,7 @@ public void layout(GuiContainer gui, VisiblityData visiblity) { searchField.w = 150; searchField.x = (windowWidth - searchField.w) / 2; - if (!visiblity.showItemSection) { + if (!visiblity.showSearchSection) { //TODO dropDown.setDropDown(0); searchField.setFocus(false); } diff --git a/dependencies/main/java/codechicken/nei/LayoutStyleMinecraft.java b/dependencies/main/java/codechicken/nei/layout/LayoutStyleMinecraft.java similarity index 95% rename from dependencies/main/java/codechicken/nei/LayoutStyleMinecraft.java rename to dependencies/main/java/codechicken/nei/layout/LayoutStyleMinecraft.java index 2c0fc736c7..4b0a5d798d 100644 --- a/dependencies/main/java/codechicken/nei/LayoutStyleMinecraft.java +++ b/dependencies/main/java/codechicken/nei/layout/LayoutStyleMinecraft.java @@ -1,5 +1,8 @@ -package codechicken.nei; +package codechicken.nei.layout; +import codechicken.nei.Image; +import codechicken.nei.LayoutManager; +import codechicken.nei.widget.Button; import net.minecraft.client.renderer.GlStateManager; import static codechicken.lib.gui.GuiDraw.drawStringC; diff --git a/dependencies/main/java/codechicken/nei/LayoutStyleTMIOld.java b/dependencies/main/java/codechicken/nei/layout/LayoutStyleTMIOld.java similarity index 96% rename from dependencies/main/java/codechicken/nei/LayoutStyleTMIOld.java rename to dependencies/main/java/codechicken/nei/layout/LayoutStyleTMIOld.java index c2453a8fd8..2ace5bcbf6 100644 --- a/dependencies/main/java/codechicken/nei/LayoutStyleTMIOld.java +++ b/dependencies/main/java/codechicken/nei/layout/LayoutStyleTMIOld.java @@ -1,6 +1,9 @@ -package codechicken.nei; +package codechicken.nei.layout; +import codechicken.nei.Image; +import codechicken.nei.LayoutManager; import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.widget.Button; import static codechicken.lib.gui.GuiDraw.*; import static codechicken.nei.LayoutManager.*; diff --git a/dependencies/main/java/codechicken/nei/NEICPH.java b/dependencies/main/java/codechicken/nei/network/NEIClientPacketHandler.java similarity index 91% rename from dependencies/main/java/codechicken/nei/NEICPH.java rename to dependencies/main/java/codechicken/nei/network/NEIClientPacketHandler.java index 56c513cbc7..39d66061c1 100644 --- a/dependencies/main/java/codechicken/nei/NEICPH.java +++ b/dependencies/main/java/codechicken/nei/network/NEIClientPacketHandler.java @@ -1,18 +1,25 @@ -package codechicken.nei; +package codechicken.nei.network; -import codechicken.core.ClientUtils; +import codechicken.lib.util.ClientUtils; import codechicken.lib.inventory.InventoryUtils; import codechicken.lib.packet.PacketCustom; import codechicken.lib.packet.PacketCustom.IClientPacketHandler; +import codechicken.nei.*; +import codechicken.nei.container.ContainerCreativeInv; +import codechicken.nei.container.ExtendedCreativeInv; +import codechicken.nei.util.LogHelper; +import codechicken.nei.util.NEIClientUtils; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.item.ItemStack; import net.minecraft.network.play.INetHandlerPlayClient; -import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; -public class NEICPH implements IClientPacketHandler { +public class NEIClientPacketHandler implements IClientPacketHandler { public static final String channel = "NEI"; @Override @@ -106,9 +113,9 @@ private void handleLoginState(PacketCustom packet) { private void handleSMPCheck(int serverprotocol, String worldName, World world) { if (serverprotocol > NEIActions.protocol) { - NEIClientUtils.printChatMessage(new ChatComponentTranslation("nei.chat.mismatch.client")); + NEIClientUtils.printChatMessage(new TextComponentTranslation("nei.chat.mismatch.client")); } else if (serverprotocol < NEIActions.protocol) { - NEIClientUtils.printChatMessage(new ChatComponentTranslation("nei.chat.mismatch.server")); + NEIClientUtils.printChatMessage(new TextComponentTranslation("nei.chat.mismatch.server")); } else { try { ClientHandler.instance().loadWorld(world); @@ -116,7 +123,7 @@ private void handleSMPCheck(int serverprotocol, String worldName, World world) { NEIClientConfig.loadWorld(getSaveName(worldName)); sendRequestLoginInfo(); } catch (Exception e) { - NEIClientConfig.logger.error("Error handling SMP Check", e); + LogHelper.errorError("Error handling SMP Check", e); } } } @@ -195,6 +202,7 @@ public static void sendOpenEnchantmentWindow() { packet.sendToServer(); } + @Deprecated public static void sendModifyEnchantment(int enchID, int level, boolean add) { PacketCustom packet = new PacketCustom(channel, 22); packet.writeByte(enchID); @@ -228,7 +236,7 @@ public static void sendCreativeScroll(int steps) { public static void sendMobSpawnerID(int x, int y, int z, String mobtype) { PacketCustom packet = new PacketCustom(channel, 15); - packet.writeCoord(x, y, z); + packet.writePos(new BlockPos(x, y, z)); packet.writeString(mobtype); packet.sendToServer(); } diff --git a/dependencies/main/java/codechicken/nei/NEISPH.java b/dependencies/main/java/codechicken/nei/network/NEIServerPacketHandler.java similarity index 91% rename from dependencies/main/java/codechicken/nei/NEISPH.java rename to dependencies/main/java/codechicken/nei/network/NEIServerPacketHandler.java index 1edcba2e65..56b0af13a5 100644 --- a/dependencies/main/java/codechicken/nei/NEISPH.java +++ b/dependencies/main/java/codechicken/nei/network/NEIServerPacketHandler.java @@ -1,12 +1,17 @@ -package codechicken.nei; +package codechicken.nei.network; -import codechicken.core.IGuiPacketSender; -import codechicken.core.ServerUtils; +import codechicken.lib.gui.IGuiPacketSender; import codechicken.core.inventory.ContainerExtended; import codechicken.core.inventory.SlotDummy; import codechicken.lib.packet.PacketCustom; import codechicken.lib.packet.PacketCustom.IServerPacketHandler; -import codechicken.lib.vec.BlockCoord; +import codechicken.lib.util.ServerUtils; +import codechicken.nei.*; +import codechicken.nei.container.ContainerCreativeInv; +import codechicken.nei.container.ExtendedCreativeInv; +import codechicken.nei.util.LogHelper; +import codechicken.nei.util.NEIServerUtils; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.InventoryBasic; @@ -15,13 +20,14 @@ import net.minecraft.network.play.INetHandlerPlayServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityMobSpawner; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import java.util.LinkedList; import java.util.Set; -public class NEISPH implements IServerPacketHandler { +public class NEIServerPacketHandler implements IServerPacketHandler { @Override public void handlePacket(PacketCustom packet, EntityPlayerMP sender, INetHandlerPlayServer netHandler) { if (!NEIServerConfig.authenticatePacket(sender, packet)) { @@ -66,7 +72,7 @@ public void handlePacket(PacketCustom packet, EntityPlayerMP sender, INetHandler NEIServerUtils.cycleCreativeInv(sender, packet.readInt()); break; case 15: - handleMobSpawnerID(sender.worldObj, packet.readCoord(), packet.readString()); + handleMobSpawnerID(sender.worldObj, packet.readPos(), packet.readString()); break; case 20: handleContainerPacket(sender, packet); @@ -102,12 +108,13 @@ private void handleContainerPacket(EntityPlayerMP sender, PacketCustom packet) { } } - private void handleMobSpawnerID(World world, BlockCoord coord, String mobtype) { - TileEntity tile = world.getTileEntity(coord.pos()); + private void handleMobSpawnerID(World world, BlockPos coord, String mobtype) { + TileEntity tile = world.getTileEntity(coord); if (tile instanceof TileEntityMobSpawner) { ((TileEntityMobSpawner) tile).getSpawnerBaseLogic().setEntityName(mobtype); tile.markDirty(); - world.markBlockForUpdate(coord.pos()); + IBlockState state = world.getBlockState(coord); + world.notifyBlockUpdate(coord, state, state, 4); } } @@ -153,6 +160,7 @@ private void setInventorySlot(EntityPlayerMP player, PacketCustom packet) { } } + @Deprecated private void modifyEnchantment(EntityPlayerMP player, int e, int lvl, boolean add) { ContainerEnchantmentModifier containerem = (ContainerEnchantmentModifier) player.openContainer; if (add) { @@ -246,7 +254,7 @@ private void sendLoginState(EntityPlayerMP player) { } public static void sendHasServerSideTo(EntityPlayerMP player) { - NEIServerConfig.logger.debug("Sending serverside check to: " + player.getName()); + LogHelper.debug("Sending serverside check to: " + player.getName()); PacketCustom packet = new PacketCustom(channel, 1); packet.writeByte(NEIActions.protocol); packet.writeString(player.worldObj.getWorldInfo().getWorldName()); diff --git a/dependencies/main/java/codechicken/nei/recipe/BrewingOverlayHandler.java b/dependencies/main/java/codechicken/nei/recipe/BrewingOverlayHandler.java index 64f26665c6..38cc639418 100644 --- a/dependencies/main/java/codechicken/nei/recipe/BrewingOverlayHandler.java +++ b/dependencies/main/java/codechicken/nei/recipe/BrewingOverlayHandler.java @@ -1,6 +1,6 @@ package codechicken.nei.recipe; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Slot; @@ -12,7 +12,7 @@ public Slot[][] mapIngredSlots(GuiContainer gui, List ingredien Slot[][] map = super.mapIngredSlots(gui, ingredients); Slot[] potSlots = new Slot[3]; for (int i = 0; i < 3; i++) { - potSlots[i] = (Slot) gui.inventorySlots.inventorySlots.get(i); + potSlots[i] = gui.inventorySlots.inventorySlots.get(i); } map[1] = potSlots; return map; diff --git a/dependencies/main/java/codechicken/nei/recipe/BrewingRecipeHandler.java b/dependencies/main/java/codechicken/nei/recipe/BrewingRecipeHandler.java index 1d2e50f83a..f6c20889b6 100644 --- a/dependencies/main/java/codechicken/nei/recipe/BrewingRecipeHandler.java +++ b/dependencies/main/java/codechicken/nei/recipe/BrewingRecipeHandler.java @@ -1,29 +1,27 @@ package codechicken.nei.recipe; import codechicken.nei.ItemStackSet; -import codechicken.nei.NEIClientUtils; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; import codechicken.nei.api.API; -import codechicken.nei.api.ItemFilter; -import com.google.common.base.Function; -import com.google.common.collect.Iterables; +import codechicken.nei.api.stack.PositionedStack; +import codechicken.nei.recipe.potion.IPotionRecipe; +import codechicken.nei.recipe.potion.PotionRecipeHelper; +import codechicken.nei.util.NEIClientUtils; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.client.gui.inventory.GuiBrewingStand; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.init.Items; -import net.minecraft.item.ItemPotion; import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; -import net.minecraft.potion.PotionHelper; +import net.minecraft.potion.PotionType; import net.minecraftforge.common.brewing.*; import java.awt.*; import java.util.ArrayList; import java.util.HashSet; import java.util.List; -import java.util.TreeSet; +//FIXME Need rewrite public class BrewingRecipeHandler extends TemplateRecipeHandler { public static class NEIBrewingRecipe { @@ -33,15 +31,15 @@ public static class NEIBrewingRecipe { final PositionedStack ingredient; public NEIBrewingRecipe(AbstractBrewingRecipe recipe) { - input = new PositionedStack(recipe.input, 51, 35); - output = new PositionedStack(recipe.output, 97, 35); - ingredient = new PositionedStack(recipe.ingredient, 74, 6); + input = new PositionedStack(recipe.getInput(), 51, 40); + output = new PositionedStack(recipe.getOutput(), 97, 40); + ingredient = new PositionedStack(recipe.getIngredient(), 74, 6); } - public NEIBrewingRecipe(ItemStack ingred, int basePotionID, int resultDamage) { - input = new PositionedStack(new ItemStack(Items.potionitem, 1, basePotionID), 51, 35); - output = new PositionedStack(new ItemStack(Items.potionitem, 1, resultDamage), 97, 35); - ingredient = new PositionedStack(ingred, 74, 6); + public NEIBrewingRecipe(IPotionRecipe recipe) { + input = new PositionedStack(recipe.getRecipeInput(), 51, 40); + output = new PositionedStack(recipe.getRecipeOutput(), 97, 40); + ingredient = new PositionedStack(recipe.getRecipeIngredient(), 74, 6); } } @@ -57,6 +55,10 @@ public CachedBrewingRecipe(AbstractBrewingRecipe recipe) { this(new NEIBrewingRecipe(recipe)); } + public CachedBrewingRecipe(IPotionRecipe recipe) { + this(new NEIBrewingRecipe(recipe)); + } + @Override public PositionedStack getResult() { return recipe.output; @@ -102,6 +104,9 @@ public void loadCraftingRecipes(String outputId, Object... results) { arecipes.add(new CachedBrewingRecipe((AbstractBrewingRecipe) recipe)); } } + for (IPotionRecipe recipe : PotionRecipeHelper.getRecipes()) { + arecipes.add(new CachedBrewingRecipe(recipe)); + } } else { super.loadCraftingRecipes(outputId, results); } @@ -109,7 +114,7 @@ public void loadCraftingRecipes(String outputId, Object... results) { @Override public void loadCraftingRecipes(ItemStack result) { - if (result.getItem() == Items.potionitem) { + if (result.getItem() == Items.POTIONITEM) { int damage = result.getItemDamage(); for (NEIBrewingRecipe recipe : apotions) { if (recipe.output.item.getItemDamage() == damage) { @@ -120,16 +125,21 @@ public void loadCraftingRecipes(ItemStack result) { for (IBrewingRecipe recipe : BrewingRecipeRegistry.getRecipes()) { if (recipe instanceof BrewingRecipe || recipe instanceof BrewingOreRecipe) { - if (NEIServerUtils.areStacksSameType(((AbstractBrewingRecipe) recipe).output, result)) { + if (NEIServerUtils.areStacksSameType(((AbstractBrewingRecipe) recipe).getOutput(), result)) { arecipes.add(new CachedBrewingRecipe((AbstractBrewingRecipe) recipe)); } } } + for (IPotionRecipe recipe : PotionRecipeHelper.getRecipes()) { + if (NEIServerUtils.areStacksSameType(recipe.getRecipeOutput(), result)) { + arecipes.add(new CachedBrewingRecipe(recipe)); + } + } } @Override public void loadUsageRecipes(ItemStack ingredient) { - if (ingredient.getItem() == Items.potionitem || ingredients.contains(ingredient)) { + if (ingredient.getItem() == Items.POTIONITEM || ingredients.contains(ingredient)) { for (NEIBrewingRecipe recipe : apotions) { if (NEIServerUtils.areStacksSameType(recipe.ingredient.item, ingredient) || NEIServerUtils.areStacksSameType(recipe.input.item, ingredient)) { arecipes.add(new CachedBrewingRecipe(recipe)); @@ -141,10 +151,10 @@ public void loadUsageRecipes(ItemStack ingredient) { for (IBrewingRecipe recipe : BrewingRecipeRegistry.getRecipes()) { if (recipe instanceof BrewingRecipe || recipe instanceof BrewingOreRecipe) { AbstractBrewingRecipe arecipe = (AbstractBrewingRecipe) recipe; - if (NEIServerUtils.areStacksSameType(arecipe.input, ingredient)) { + if (NEIServerUtils.areStacksSameType(arecipe.getInput(), ingredient)) { arecipes.add(new CachedBrewingRecipe(arecipe)); } else { - ItemStack[] recipeIngredients = NEIServerUtils.extractRecipeItems(arecipe.ingredient); + ItemStack[] recipeIngredients = NEIServerUtils.extractRecipeItems(arecipe.getIngredient()); for (ItemStack recipeIngredient : recipeIngredients) { if (NEIServerUtils.areStacksSameType(recipeIngredient, ingredient)) { arecipes.add(new CachedBrewingRecipe(arecipe)); @@ -154,6 +164,16 @@ public void loadUsageRecipes(ItemStack ingredient) { } } } + for (IPotionRecipe recipe : PotionRecipeHelper.getRecipes()) { + if (NEIServerUtils.areStacksSameType(recipe.getRecipeInput(), ingredient)) { + arecipes.add(new CachedBrewingRecipe(recipe)); + } else { + if (NEIServerUtils.areStacksSameType(recipe.getRecipeIngredient(), ingredient)) { + arecipes.add(new CachedBrewingRecipe(recipe)); + } + } + } + } @Override @@ -164,103 +184,67 @@ public String getGuiTexture() { @Override public void drawExtras(int recipe) { drawProgressBar(92, 5, 176, 0, 8, 30, 120, 1); - drawProgressBar(60, 1, 185, -2, 12, 30, 35, 3); + drawProgressBar(58, 1, 185, -2, 12, 30, 35, 3); } public static void searchPotions() { - TreeSet allPotions = new TreeSet(); - HashSet searchPotions = new HashSet(); - searchPotions.add(0); - allPotions.add(0); - do { - HashSet newPotions = new HashSet(); - for (Integer basePotion : searchPotions) { - if (ItemPotion.isSplash(basePotion)) { - continue; - } - - for (ItemStack ingred : ingredients.values()) { - int result = PotionHelper.applyIngredient(basePotion, ingred.getItem().getPotionEffect(ingred)); - - if (ItemPotion.isSplash(result)) {//splash potions qualify - addPotion(ingred, basePotion, result, allPotions, newPotions); - continue; - } - - List baseMods = Items.potionitem.getEffects(basePotion); - List newMods = Items.potionitem.getEffects(result);//compare ID's - if (basePotion > 0 && baseMods == newMods || //same modifers and not water->empty - baseMods != null && (baseMods.equals(newMods) || newMods == null) || //modifiers different and doesn't lose modifiers - basePotion == result || //same potion - levelModifierChanged(basePotion, result))//redstone/glowstone cycle - { - continue; - } - - addPotion(ingred, basePotion, result, allPotions, newPotions); - } - } - - searchPotions = newPotions; - } while (!searchPotions.isEmpty()); + ArrayList allPotions = new ArrayList(); + for (IPotionRecipe recipe : PotionRecipeHelper.getRecipes()) { + allPotions.add(recipe.getRecipeOutput()); + } - API.setItemListEntries(Items.potionitem, Iterables.transform(allPotions, new Function()//override with only potions that can be crafted - { - @Override - public ItemStack apply(Integer potionID) { - return new ItemStack(Items.potionitem, 1, potionID); + ItemStackSet positiveEffects = new ItemStackSet(); + ItemStackSet negativeEffects = new ItemStackSet(); + ItemStackSet neutralEffects = new ItemStackSet(); + for (ItemStack potionStack : allPotions) { + PotionType potionType = getPotionTypeFromStack(potionStack); + if (potionType == null) { + continue; } - })); - API.addSubset("Items.Potions", new ItemStackSet().with(Items.potionitem)); - API.addSubset("Items.Potions.Splash", new ItemFilter() { - @Override - public boolean matches(ItemStack item) { - return item.getItem() == Items.potionitem && (item.getItemDamage() & 0x4000) != 0; + List stackEffects = potionType.getEffects(); + if (stackEffects.isEmpty()) { + neutralEffects.add(potionStack); + continue; } - }); - - ItemStackSet positivepots = new ItemStackSet(); - ItemStackSet negativepots = new ItemStackSet(); - ItemStackSet neutralpots = new ItemStackSet(); - - for (int potionID : allPotions) { - List effectlist = Items.potionitem.getEffects(potionID); - int type = 0; - if (effectlist != null && !effectlist.isEmpty()) { - for (PotionEffect potioneffect : effectlist) { - if (Potion.potionTypes[potioneffect.getPotionID()].isBadEffect()) { - type--; - } else { - type++; + for (PotionEffect effect : stackEffects) { + //If for some reason a vanilla potion has positive and negative effects, make sure we don't add it to the list more than once. + if (effect.getPotion().isBadEffect()) { + if (!negativeEffects.contains(potionStack)) { + negativeEffects.add(potionStack); + } + } else { + if (!positiveEffects.contains(potionStack)) { + positiveEffects.add(potionStack); } } } - - (type == 0 ? neutralpots : type > 0 ? positivepots : negativepots).add(new ItemStack(Items.potionitem, 1, potionID)); } - API.addSubset("Items.Potions.Positive", positivepots); - API.addSubset("Items.Potions.Negative", negativepots); - API.addSubset("Items.Potions.Neutral", neutralpots); + API.addSubset("Items.Potions", new ItemStackSet().with(Items.POTIONITEM).with(Items.SPLASH_POTION).with(Items.LINGERING_POTION)); + API.addSubset("Items.Potions.Splash", new ItemStackSet().with(Items.SPLASH_POTION)); + API.addSubset("Items.Potions.Lingering", new ItemStackSet().with(Items.LINGERING_POTION)); + API.addSubset("Items.Potions.Positive", positiveEffects); + API.addSubset("Items.Potions.Negative", negativeEffects); + API.addSubset("Items.Potions.Neutral", neutralEffects); } - private static boolean levelModifierChanged(int basePotionID, int result) { - int basemod = basePotionID & 0xE0; - int resultmod = result & 0xE0; - - return basemod != 0 && basemod != resultmod; + @Override + public String getOverlayIdentifier() { + return "brewing"; } - private static void addPotion(ItemStack ingred, int basePotion, int result, TreeSet allPotions, HashSet newPotions) { - apotions.add(new NEIBrewingRecipe(ingred, basePotion, result)); - if (allPotions.add(result))//it's new - { - newPotions.add(result); + private static PotionType getPotionTypeFromStack(ItemStack itemStack) { + if (itemStack.hasTagCompound()) { + NBTTagCompound tagCompound = itemStack.getTagCompound(); + if (tagCompound.hasKey("Potion")) { + String potion = tagCompound.getString("Potion"); + PotionType type = PotionType.getPotionTypeForName(potion); + if (type != null) { + return type; + } + } } + return null; } - @Override - public String getOverlayIdentifier() { - return "brewing"; - } } diff --git a/dependencies/main/java/codechicken/nei/recipe/ContainerRecipe.java b/dependencies/main/java/codechicken/nei/recipe/ContainerRecipe.java index e3e061e127..f25522959c 100644 --- a/dependencies/main/java/codechicken/nei/recipe/ContainerRecipe.java +++ b/dependencies/main/java/codechicken/nei/recipe/ContainerRecipe.java @@ -1,12 +1,12 @@ package codechicken.nei.recipe; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.ITextComponent; +import net.minecraft.util.text.ITextComponent; public class ContainerRecipe extends Container { private class RecipeInventory implements IInventory { @@ -25,7 +25,7 @@ public ItemStack getStackInSlot(int i) { if (i < 0 || i > inventoryItemStacks.size()) { return null; } - return (ItemStack) inventoryItemStacks.get(i); + return inventoryItemStacks.get(i); } @Override @@ -118,9 +118,15 @@ public ItemStack slotClick(int slot, int button, boolean flag, EntityPlayer enti ItemStack stack = recipeInventory.getStackInSlot(slot); if (stack != null) { if (button == 0) { - GuiCraftingRecipe.openRecipeGui("item", stack); + boolean opened = GuiCraftingRecipe.openRecipeGui("item", stack); + if (!opened) { +// JEIIntegrationManager.openRecipeGui(stack); + } } else if (button == 1) { - GuiUsageRecipe.openRecipeGui("item", stack); + boolean opened = GuiUsageRecipe.openRecipeGui("item", stack); + if (!opened) { +// JEIIntegrationManager.openUsageGui(stack); + } } } return null; @@ -139,7 +145,7 @@ public boolean isItemValid(ItemStack par1ItemStack) { public Slot getSlotWithStack(PositionedStack stack, int recipex, int recipey) { for (int i = 0; i < inventorySlots.size(); i++) { - Slot slot = (Slot) inventorySlots.get(i); + Slot slot = inventorySlots.get(i); if (slot.xDisplayPosition == (stack.relx + recipex) && slot.yDisplayPosition == (stack.rely + recipey)) { return slot; } diff --git a/dependencies/main/java/codechicken/nei/recipe/DefaultOverlayHandler.java b/dependencies/main/java/codechicken/nei/recipe/DefaultOverlayHandler.java index c8b06ed830..3289a4fd7f 100644 --- a/dependencies/main/java/codechicken/nei/recipe/DefaultOverlayHandler.java +++ b/dependencies/main/java/codechicken/nei/recipe/DefaultOverlayHandler.java @@ -2,10 +2,11 @@ import codechicken.lib.inventory.InventoryUtils; import codechicken.nei.FastTransferManager; -import codechicken.nei.PositionedStack; import codechicken.nei.api.IOverlayHandler; +import codechicken.nei.api.stack.PositionedStack; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -74,13 +75,13 @@ public void overlayRecipe(GuiContainer gui, IRecipeHandler recipe, int recipeInd @SuppressWarnings("unchecked") private boolean clearIngredients(GuiContainer gui, List ingreds) { for (PositionedStack pstack : ingreds) { - for (Slot slot : (List) gui.inventorySlots.inventorySlots) { + for (Slot slot : gui.inventorySlots.inventorySlots) { if (slot.xDisplayPosition == pstack.relx + offsetx && slot.yDisplayPosition == pstack.rely + offsety) { if (!slot.getHasStack()) { continue; } - FastTransferManager.clickSlot(gui, slot.slotNumber, 0, 1); + FastTransferManager.clickSlot(gui, slot.slotNumber, 0, ClickType.QUICK_MOVE); if (slot.getHasStack()) { return false; } @@ -103,7 +104,7 @@ private void moveIngredients(GuiContainer gui, List assi int slotTransferred = 0; int slotTransferCap = pstack.getMaxStackSize(); - for (Slot slot : (List) gui.inventorySlots.inventorySlots) { + for (Slot slot : gui.inventorySlots.inventorySlots) { if (!slot.getHasStack() || !canMoveFrom(slot, gui)) { continue; } @@ -246,7 +247,7 @@ private List assignIngredients(List ing @SuppressWarnings("unchecked") private void findInventoryQuantities(GuiContainer gui, List ingredStacks) { - for (Slot slot : (List) gui.inventorySlots.inventorySlots)//work out how much we have to go round + for (Slot slot : gui.inventorySlots.inventorySlots)//work out how much we have to go round { if (slot.getHasStack() && canMoveFrom(slot, gui)) { ItemStack pstack = slot.getStack(); @@ -284,7 +285,7 @@ public Slot[][] mapIngredSlots(GuiContainer gui, List ingredien { LinkedList recipeSlots = new LinkedList(); PositionedStack pstack = ingredients.get(i); - for (Slot slot : (List) gui.inventorySlots.inventorySlots) { + for (Slot slot : gui.inventorySlots.inventorySlots) { if (slot.xDisplayPosition == pstack.relx + offsetx && slot.yDisplayPosition == pstack.rely + offsety) { recipeSlots.add(slot); break; diff --git a/dependencies/main/java/codechicken/nei/recipe/FireworkRecipeHandler.java b/dependencies/main/java/codechicken/nei/recipe/FireworkRecipeHandler.java index 2d683e120c..17c26cb3e8 100644 --- a/dependencies/main/java/codechicken/nei/recipe/FireworkRecipeHandler.java +++ b/dependencies/main/java/codechicken/nei/recipe/FireworkRecipeHandler.java @@ -1,10 +1,10 @@ package codechicken.nei.recipe; import codechicken.lib.gui.GuiDraw; -import codechicken.nei.InventoryCraftingDummy; -import codechicken.nei.NEIClientUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; +import codechicken.nei.container.InventoryCraftingDummy; import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.util.NEIClientUtils; import net.minecraft.init.Items; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; @@ -25,7 +25,7 @@ public class CachedFireworkRecipe extends CachedShapelessRecipe { public int recipeType; public CachedFireworkRecipe(Object[] base, Object extra, int type) { - super(new ItemStack(Items.fireworks)); + super(new ItemStack(Items.FIREWORKS)); this.baseIngredients = base; this.extraIngred = extra; this.recipeType = type; @@ -69,28 +69,28 @@ public FireworkRecipeHandler() { private void loadAllFireworks() { //charges - Item[] shapes = new Item[] { null, Items.fire_charge, Items.gold_nugget, Items.feather, Items.skull }; - Item[] effects = new Item[] { null, Items.diamond, Items.glowstone_dust }; + Item[] shapes = new Item[] { null, Items.FIRE_CHARGE, Items.GOLD_NUGGET, Items.FEATHER, Items.SKULL }; + Item[] effects = new Item[] { null, Items.DIAMOND, Items.GLOWSTONE_DUST }; for (Item shape : shapes) { for (Item effect : effects) { - genRecipe(Items.gunpowder, shape, effect, Items.dye, Items.dye, 0); + genRecipe(Items.GUNPOWDER, shape, effect, Items.DYE, Items.DYE, 0); } } //fireworks - genRecipe(Items.gunpowder, Items.paper, Items.firework_charge, 2); - genRecipe(Items.gunpowder, Items.gunpowder, Items.paper, Items.firework_charge, 2); - genRecipe(Items.gunpowder, Items.gunpowder, Items.gunpowder, Items.paper, Items.firework_charge, 2); + genRecipe(Items.GUNPOWDER, Items.PAPER, Items.FIREWORK_CHARGE, 2); + genRecipe(Items.GUNPOWDER, Items.GUNPOWDER, Items.PAPER, Items.FIREWORK_CHARGE, 2); + genRecipe(Items.GUNPOWDER, Items.GUNPOWDER, Items.GUNPOWDER, Items.PAPER, Items.FIREWORK_CHARGE, 2); //setup a valid charge to use for the recolour recipe for (int i = 0; i < 9; i++) { inventoryCrafting.setInventorySlotContents(i, null); } - inventoryCrafting.setInventorySlotContents(0, new ItemStack(Items.gunpowder)); - inventoryCrafting.setInventorySlotContents(1, new ItemStack(Items.dye)); + inventoryCrafting.setInventorySlotContents(0, new ItemStack(Items.GUNPOWDER)); + inventoryCrafting.setInventorySlotContents(1, new ItemStack(Items.DYE)); recipeFireworks.matches(inventoryCrafting, null); ItemStack charge = recipeFireworks.getCraftingResult(null); - genRecipe(charge, Items.dye, Items.dye, 1); + genRecipe(charge, Items.DYE, Items.DYE, 1); } private void genRecipe(Object... params) { diff --git a/dependencies/main/java/codechicken/nei/recipe/FuelRecipeHandler.java b/dependencies/main/java/codechicken/nei/recipe/FuelRecipeHandler.java index 78e57c019f..f4c71c5c43 100644 --- a/dependencies/main/java/codechicken/nei/recipe/FuelRecipeHandler.java +++ b/dependencies/main/java/codechicken/nei/recipe/FuelRecipeHandler.java @@ -1,7 +1,7 @@ package codechicken.nei.recipe; -import codechicken.nei.NEIClientUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; +import codechicken.nei.util.NEIClientUtils; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; @@ -10,7 +10,7 @@ import java.util.Map; import java.util.Map.Entry; -import static codechicken.nei.NEIClientUtils.translate; +import static codechicken.nei.util.NEIClientUtils.translate; public class FuelRecipeHandler extends FurnaceRecipeHandler { public class CachedFuelRecipe extends CachedRecipe { @@ -48,7 +48,7 @@ public String getRecipeName() { } private void loadAllSmelting() { - Map recipes = (Map) FurnaceRecipes.instance().getSmeltingList(); + Map recipes = FurnaceRecipes.instance().getSmeltingList(); for (Entry recipe : recipes.entrySet()) { mfurnace.add(new SmeltingPair(recipe.getKey(), recipe.getValue())); diff --git a/dependencies/main/java/codechicken/nei/recipe/FurnaceRecipeHandler.java b/dependencies/main/java/codechicken/nei/recipe/FurnaceRecipeHandler.java index df108aedf4..051b3e11a7 100644 --- a/dependencies/main/java/codechicken/nei/recipe/FurnaceRecipeHandler.java +++ b/dependencies/main/java/codechicken/nei/recipe/FurnaceRecipeHandler.java @@ -1,9 +1,9 @@ package codechicken.nei.recipe; import codechicken.nei.ItemList; -import codechicken.nei.NEIClientUtils; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; +import codechicken.nei.util.NEIClientUtils; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.block.Block; import net.minecraft.block.BlockDoor; import net.minecraft.client.gui.inventory.GuiContainer; @@ -137,11 +137,11 @@ public void drawExtras(int recipe) { private static Set excludedFuels() { Set efuels = new HashSet(); - efuels.add(Item.getItemFromBlock(Blocks.brown_mushroom)); - efuels.add(Item.getItemFromBlock(Blocks.red_mushroom)); - efuels.add(Item.getItemFromBlock(Blocks.standing_sign)); - efuels.add(Item.getItemFromBlock(Blocks.wall_sign)); - efuels.add(Item.getItemFromBlock(Blocks.trapped_chest)); + efuels.add(Item.getItemFromBlock(Blocks.BROWN_MUSHROOM)); + efuels.add(Item.getItemFromBlock(Blocks.RED_MUSHROOM)); + efuels.add(Item.getItemFromBlock(Blocks.STANDING_SIGN)); + efuels.add(Item.getItemFromBlock(Blocks.WALL_SIGN)); + efuels.add(Item.getItemFromBlock(Blocks.TRAPPED_CHEST)); return efuels; } diff --git a/dependencies/main/java/codechicken/nei/recipe/GuiCraftingRecipe.java b/dependencies/main/java/codechicken/nei/recipe/GuiCraftingRecipe.java index 4d480af022..c9275ff332 100644 --- a/dependencies/main/java/codechicken/nei/recipe/GuiCraftingRecipe.java +++ b/dependencies/main/java/codechicken/nei/recipe/GuiCraftingRecipe.java @@ -1,6 +1,6 @@ package codechicken.nei.recipe; -import codechicken.core.TaskProfiler; +import codechicken.lib.thread.TaskProfiler; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; diff --git a/dependencies/main/java/codechicken/nei/recipe/GuiRecipe.java b/dependencies/main/java/codechicken/nei/recipe/GuiRecipe.java index 3e9da457ca..08ac56a260 100644 --- a/dependencies/main/java/codechicken/nei/recipe/GuiRecipe.java +++ b/dependencies/main/java/codechicken/nei/recipe/GuiRecipe.java @@ -1,16 +1,19 @@ package codechicken.nei.recipe; import codechicken.lib.gui.GuiDraw; -import codechicken.lib.render.CCRenderState; -import codechicken.nei.*; +import codechicken.lib.texture.TextureUtils; +import codechicken.nei.GuiNEIButton; import codechicken.nei.LayoutManager; import codechicken.nei.api.IGuiContainerOverlay; import codechicken.nei.api.IOverlayHandler; import codechicken.nei.api.IRecipeOverlayRenderer; +import codechicken.nei.api.stack.PositionedStack; +import codechicken.nei.config.KeyBindings; import codechicken.nei.guihook.GuiContainerManager; import codechicken.nei.guihook.IContainerTooltipHandler; import codechicken.nei.guihook.IGuiClientSide; import codechicken.nei.guihook.IGuiHandleMouseWheel; +import codechicken.nei.util.NEIClientUtils; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; @@ -89,9 +92,9 @@ public void keyTyped(char c, int i) { } } - if (i == mc.gameSettings.keyBindInventory.getKeyCode()) { + if (mc.gameSettings.keyBindInventory.isActiveAndMatches(i)) { mc.displayGuiScreen(firstGui); - } else if (i == NEIClientConfig.getKeyBinding("gui.back")) { + } else if (KeyBindings.get("nei.options.keys.gui.back").isActiveAndMatches(i)) { mc.displayGuiScreen(prevGui); } @@ -273,7 +276,7 @@ protected void drawGuiContainerForegroundLayer(int par1, int par2) { @Override protected void drawGuiContainerBackgroundLayer(float f, int mx, int my) { GlStateManager.color(1, 1, 1, 1); - CCRenderState.changeTexture("nei:textures/gui/recipebg.png"); + TextureUtils.changeTexture("nei:textures/gui/recipebg.png"); int j = (width - xSize) / 2; int k = (height - ySize) / 2; drawTexturedModalRect(j, k, 0, 0, xSize, ySize); diff --git a/dependencies/main/java/codechicken/nei/recipe/GuiUsageRecipe.java b/dependencies/main/java/codechicken/nei/recipe/GuiUsageRecipe.java index f06ea70acd..b2a2246364 100644 --- a/dependencies/main/java/codechicken/nei/recipe/GuiUsageRecipe.java +++ b/dependencies/main/java/codechicken/nei/recipe/GuiUsageRecipe.java @@ -1,6 +1,6 @@ package codechicken.nei.recipe; -import codechicken.core.TaskProfiler; +import codechicken.lib.thread.TaskProfiler; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; diff --git a/dependencies/main/java/codechicken/nei/recipe/ICraftingHandler.java b/dependencies/main/java/codechicken/nei/recipe/ICraftingHandler.java index 32e5c08e04..84c8a67983 100644 --- a/dependencies/main/java/codechicken/nei/recipe/ICraftingHandler.java +++ b/dependencies/main/java/codechicken/nei/recipe/ICraftingHandler.java @@ -10,5 +10,5 @@ public interface ICraftingHandler extends IRecipeHandler { * @param results Objects representing the results that matching recipes must produce. * @return An instance of {@link ICraftingHandler} configured with a list of recipes that produce matching output. */ - public ICraftingHandler getRecipeHandler(String outputId, Object... results); + ICraftingHandler getRecipeHandler(String outputId, Object... results); } diff --git a/dependencies/main/java/codechicken/nei/recipe/IRecipeHandler.java b/dependencies/main/java/codechicken/nei/recipe/IRecipeHandler.java index ade4b9b73f..abe5c9f8d7 100644 --- a/dependencies/main/java/codechicken/nei/recipe/IRecipeHandler.java +++ b/dependencies/main/java/codechicken/nei/recipe/IRecipeHandler.java @@ -1,8 +1,8 @@ package codechicken.nei.recipe; -import codechicken.nei.PositionedStack; import codechicken.nei.api.IOverlayHandler; import codechicken.nei.api.IRecipeOverlayRenderer; +import codechicken.nei.api.stack.PositionedStack; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; @@ -18,12 +18,12 @@ public interface IRecipeHandler { * @return The name of this inventory. * To be displayed at the top of the viewing container. */ - public String getRecipeName(); + String getRecipeName(); /** * @return The number of recipes that this handler contains. */ - public int numRecipes(); + int numRecipes(); /** * Draw the background of this recipe handler (basically the slot layout image). @@ -31,7 +31,7 @@ public interface IRecipeHandler { * @param gui A GuiManager for drawing functions. * @param recipe The recipe index to draw at this position. */ - public void drawBackground(int recipe); + void drawBackground(int recipe); /** * Draw the foreground of this recipe handler (for things like progress bars). @@ -39,30 +39,30 @@ public interface IRecipeHandler { * @param gui A GuiManager for drawing functions. * @param recipe The recipe index to draw at this position. */ - public void drawForeground(int recipe); + void drawForeground(int recipe); /** * @param recipe The recipe index to get items for. * @return A list of the ingredient {@link PositionedStack}s in this recipe relative to the top left corner of your recipe drawing space. */ - public List getIngredientStacks(int recipe); + List getIngredientStacks(int recipe); /** * @param recipe The recipe index to get items for. * @return A list of the other {@link PositionedStack}s in this recipe relative to the top left corner of your recipe drawing space. For example fuel in furnaces. */ - public List getOtherStacks(int recipetype); + List getOtherStacks(int recipetype); /** * @param recipe The recipe index to get the result for. * @return The recipe result {@link PositionedStack} relative to the top left corner of your recipe drawing space. */ - public PositionedStack getResultStack(int recipe); + PositionedStack getResultStack(int recipe); /** * A tick function called for updating progress bars and cycling damage items. */ - public void onUpdate(); + void onUpdate(); /** * @param recipe The recipe index to check for. @@ -70,24 +70,24 @@ public interface IRecipeHandler { * @param container The container of the GUI. * @return true if this recipe can render an overlay for the specified type of inventory GUI. */ - public boolean hasOverlay(GuiContainer gui, Container container, int recipe); + boolean hasOverlay(GuiContainer gui, Container container, int recipe); /** * @param recipe The recipe index to get the overlay renderer for. * @return An instance of {@link IRecipeOverlayRenderer} to be used for rendering the overlay of this specific recipe. */ - public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe); + IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe); /** * @param recipe The recipe index to get the overlay renderer for. * @return An instance of {@link IOverlayHandler} to be used for rendering the overlay of this specific recipe. */ - public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe); + IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe); /** * @return The number of recipes that can fit on a page in the viewer (1 or 2) */ - public int recipiesPerPage(); + int recipiesPerPage(); /** * @param gui An instance of the currentscreen @@ -95,7 +95,7 @@ public interface IRecipeHandler { * @param recipe The recipe index being handled * @return The modified tooltip. DO NOT return null */ - public List handleTooltip(GuiRecipe gui, List currenttip, int recipe); + List handleTooltip(GuiRecipe gui, List currenttip, int recipe); /** * @param gui An instance of the currentscreen @@ -104,7 +104,7 @@ public interface IRecipeHandler { * @param recipe The recipe index being handled * @return The modified tooltip. DO NOT return null */ - public List handleItemTooltip(GuiRecipe gui, ItemStack stack, List currenttip, int recipe); + List handleItemTooltip(GuiRecipe gui, ItemStack stack, List currenttip, int recipe); /** * @param gui An instance of the currentscreen @@ -112,12 +112,12 @@ public interface IRecipeHandler { * @param keyCode The KeyCode as defined in {@link Keyboard} * @return true to terminate further processing of this event. */ - public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe); + boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe); /** * @param gui An instance of the currentscreen * @param button The button index being pressed, {0 = Left Click, 1 = Right Click, 2 = Middle Click} * @return true to terminate further processing of this event. */ - public boolean mouseClicked(GuiRecipe gui, int button, int recipe); + boolean mouseClicked(GuiRecipe gui, int button, int recipe); } diff --git a/dependencies/main/java/codechicken/nei/recipe/IUsageHandler.java b/dependencies/main/java/codechicken/nei/recipe/IUsageHandler.java index ad0b9e60b9..9856db09aa 100644 --- a/dependencies/main/java/codechicken/nei/recipe/IUsageHandler.java +++ b/dependencies/main/java/codechicken/nei/recipe/IUsageHandler.java @@ -10,5 +10,5 @@ public interface IUsageHandler extends IRecipeHandler { * @param ingredients Objects representing the ingredients that matching recipes must contain. * @return An instance of {@link IUsageHandler} configured with a list of recipes that contain matching input */ - public IUsageHandler getUsageHandler(String inputId, Object... ingredients); + IUsageHandler getUsageHandler(String inputId, Object... ingredients); } diff --git a/dependencies/main/java/codechicken/nei/recipe/ProfilerRecipeHandler.java b/dependencies/main/java/codechicken/nei/recipe/ProfilerRecipeHandler.java index 69d384ad9a..7bda897abf 100644 --- a/dependencies/main/java/codechicken/nei/recipe/ProfilerRecipeHandler.java +++ b/dependencies/main/java/codechicken/nei/recipe/ProfilerRecipeHandler.java @@ -1,12 +1,12 @@ package codechicken.nei.recipe; -import codechicken.core.TaskProfiler; -import codechicken.core.TaskProfiler.ProfilerResult; +import codechicken.lib.thread.TaskProfiler; +import codechicken.lib.thread.TaskProfiler.ProfilerResult; import codechicken.nei.NEIClientConfig; -import codechicken.nei.NEIClientUtils; -import codechicken.nei.PositionedStack; import codechicken.nei.api.IOverlayHandler; import codechicken.nei.api.IRecipeOverlayRenderer; +import codechicken.nei.api.stack.PositionedStack; +import codechicken.nei.util.NEIClientUtils; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; diff --git a/dependencies/main/java/codechicken/nei/recipe/RecipeItemInputHandler.java b/dependencies/main/java/codechicken/nei/recipe/RecipeItemInputHandler.java index dec77861e4..e258e210fc 100644 --- a/dependencies/main/java/codechicken/nei/recipe/RecipeItemInputHandler.java +++ b/dependencies/main/java/codechicken/nei/recipe/RecipeItemInputHandler.java @@ -1,7 +1,6 @@ package codechicken.nei.recipe; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.NEIClientUtils; +import codechicken.nei.config.KeyBindings; import codechicken.nei.guihook.GuiContainerManager; import codechicken.nei.guihook.IContainerInputHandler; import net.minecraft.client.gui.inventory.GuiContainer; @@ -15,12 +14,20 @@ public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode) { return false; } - if (keyCode == NEIClientConfig.getKeyBinding("gui.usage") || (keyCode == NEIClientConfig.getKeyBinding("gui.recipe") && NEIClientUtils.shiftKey())) { - return GuiUsageRecipe.openRecipeGui("item", stackover.copy()); + if (KeyBindings.get("nei.options.keys.gui.usage").isActiveAndMatches(keyCode)) { + boolean opened = GuiUsageRecipe.openRecipeGui("item", stackover.copy()); + if (!opened) { +// opened = JEIIntegrationManager.openUsageGui(stackover.copy()); + } + return opened; } - if (keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) { - return GuiCraftingRecipe.openRecipeGui("item", stackover.copy()); + if (KeyBindings.get("nei.options.keys.gui.recipe").isActiveAndMatches(keyCode)) { + boolean opened = GuiCraftingRecipe.openRecipeGui("item", stackover.copy()); + if (!opened) { +// opened = JEIIntegrationManager.openRecipeGui(stackover.copy()); + } + return opened; } return false; diff --git a/dependencies/main/java/codechicken/nei/recipe/ShapedRecipeHandler.java b/dependencies/main/java/codechicken/nei/recipe/ShapedRecipeHandler.java index 570a05bb53..7abe4469ee 100644 --- a/dependencies/main/java/codechicken/nei/recipe/ShapedRecipeHandler.java +++ b/dependencies/main/java/codechicken/nei/recipe/ShapedRecipeHandler.java @@ -1,14 +1,14 @@ package codechicken.nei.recipe; -import codechicken.core.ReflectionManager; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.NEIClientUtils; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; +import codechicken.lib.util.ReflectionManager; import codechicken.nei.api.DefaultOverlayRenderer; import codechicken.nei.api.IOverlayHandler; import codechicken.nei.api.IRecipeOverlayRenderer; import codechicken.nei.api.IStackPositioner; +import codechicken.nei.api.stack.PositionedStack; +import codechicken.nei.util.LogHelper; +import codechicken.nei.util.NEIClientUtils; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiCrafting; import net.minecraft.inventory.Container; @@ -90,7 +90,7 @@ public String getRecipeName() { @Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals("crafting") && getClass() == ShapedRecipeHandler.class) { - for (IRecipe irecipe : (List) CraftingManager.getInstance().getRecipeList()) { + for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) { CachedShapedRecipe recipe = null; if (irecipe instanceof ShapedRecipes) { recipe = new CachedShapedRecipe((ShapedRecipes) irecipe); @@ -112,7 +112,7 @@ public void loadCraftingRecipes(String outputId, Object... results) { @Override public void loadCraftingRecipes(ItemStack result) { - for (IRecipe irecipe : (List) CraftingManager.getInstance().getRecipeList()) { + for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) { if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) { CachedShapedRecipe recipe = null; if (irecipe instanceof ShapedRecipes) { @@ -133,7 +133,7 @@ public void loadCraftingRecipes(ItemStack result) { @Override public void loadUsageRecipes(ItemStack ingredient) { - for (IRecipe irecipe : (List) CraftingManager.getInstance().getRecipeList()) { + for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) { CachedShapedRecipe recipe = null; if (irecipe instanceof ShapedRecipes) { recipe = new CachedShapedRecipe((ShapedRecipes) irecipe); @@ -160,7 +160,7 @@ public CachedShapedRecipe forgeShapedRecipe(ShapedOreRecipe recipe) { width = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 4); height = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 5); } catch (Exception e) { - NEIClientConfig.logger.error("Error loading recipe", e); + LogHelper.errorError("Error loading recipe", e); return null; } diff --git a/dependencies/main/java/codechicken/nei/recipe/ShapelessRecipeHandler.java b/dependencies/main/java/codechicken/nei/recipe/ShapelessRecipeHandler.java index 19515b0400..b9f00ef53a 100644 --- a/dependencies/main/java/codechicken/nei/recipe/ShapelessRecipeHandler.java +++ b/dependencies/main/java/codechicken/nei/recipe/ShapelessRecipeHandler.java @@ -1,8 +1,8 @@ package codechicken.nei.recipe; -import codechicken.nei.NEIClientUtils; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; +import codechicken.nei.util.NEIClientUtils; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; diff --git a/dependencies/main/java/codechicken/nei/recipe/TemplateRecipeHandler.java b/dependencies/main/java/codechicken/nei/recipe/TemplateRecipeHandler.java index 025c38b10d..f577a0e39a 100644 --- a/dependencies/main/java/codechicken/nei/recipe/TemplateRecipeHandler.java +++ b/dependencies/main/java/codechicken/nei/recipe/TemplateRecipeHandler.java @@ -1,16 +1,16 @@ package codechicken.nei.recipe; -import codechicken.nei.NEIClientConfig; -import codechicken.nei.NEIClientUtils; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; import codechicken.nei.api.DefaultOverlayRenderer; import codechicken.nei.api.IOverlayHandler; import codechicken.nei.api.IRecipeOverlayRenderer; import codechicken.nei.api.IStackPositioner; +import codechicken.nei.api.stack.PositionedStack; +import codechicken.nei.config.KeyBindings; import codechicken.nei.guihook.GuiContainerManager; import codechicken.nei.guihook.IContainerInputHandler; import codechicken.nei.guihook.IContainerTooltipHandler; +import codechicken.nei.util.NEIClientUtils; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.inventory.Container; @@ -214,9 +214,9 @@ public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode) { return false; } - if (keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) { + if (KeyBindings.get("nei.options.keys.gui.recipe").isActiveAndMatches(keyCode)) { return transferRect(gui, false); - } else if (keyCode == NEIClientConfig.getKeyBinding("gui.usage")) { + } else if (KeyBindings.get("nei.options.keys.gui.usage").isActiveAndMatches(keyCode)) { return transferRect(gui, true); } @@ -561,9 +561,9 @@ public List handleItemTooltip(GuiRecipe gui, ItemStack stack, List allRecipes = new ArrayList(); + private static ArrayList normalRecipes = new ArrayList(); + private static ArrayList splashRecipes = new ArrayList(); + private static ArrayList lingeringRecipes = new ArrayList(); + + public static void addNormalRecipe(Item potionItem, PotionType input, Item ingredient, PotionType output) { + IPotionRecipe recipe = new PotionTypeRecipe(PotionUtils.addPotionToItemStack(new ItemStack(potionItem), input), new ItemStack(ingredient), output); + normalRecipes.add(recipe); + allRecipes.add(recipe); + } + + public static void addNormalRecipe(IPotionRecipe recipe) { + normalRecipes.add(recipe); + } + + public static void addSplashRecipe(Item potionItem, PotionType input, Item ingredient, PotionType output) { + IPotionRecipe recipe = new PotionTypeRecipe(PotionUtils.addPotionToItemStack(new ItemStack(potionItem), input), new ItemStack(ingredient), output); + splashRecipes.add(recipe); + allRecipes.add(recipe); + } + + public static void addSplashRecipe(IPotionRecipe recipe) { + splashRecipes.add(recipe); + } + + public static void addLingeringRecipe(Item potionItem, PotionType input, Item ingredient, PotionType output) { + IPotionRecipe recipe = new PotionTypeRecipe(PotionUtils.addPotionToItemStack(new ItemStack(potionItem), input), new ItemStack(ingredient), output); + lingeringRecipes.add(recipe); + allRecipes.add(recipe); + } + + public static void addLingeringRecipe(IPotionRecipe recipe) { + lingeringRecipes.add(recipe); + } + + public static void init() {//TODO Don't make assumptions as to what the ingredient is to achieve next tear, as Minetweaker may change it. + try { + for (PotionHelper.MixPredicate entry : PotionHelper.POTION_TYPE_CONVERSIONS) { + PotionType input = entry.input; + PotionHelper.ItemPredicateInstance ingredient = (PotionHelper.ItemPredicateInstance) entry.reagent; + PotionType output = entry.output; + addNormalRecipe(Items.POTIONITEM, input, ingredient.item, output); + addSplashRecipe(Items.SPLASH_POTION, input, ingredient.item, output); + addLingeringRecipe(Items.LINGERING_POTION, input, ingredient.item, output); + } + + for (IPotionRecipe recipe : normalRecipes) { + IPotionRecipe upgradeRecipe = new PotionUpgradeRecipe(recipe.getRecipeOutput(), new ItemStack(Items.GUNPOWDER), Items.SPLASH_POTION); + allRecipes.add(upgradeRecipe); + } + + for (IPotionRecipe recipe : splashRecipes) { + IPotionRecipe upgradeRecipe = new PotionUpgradeRecipe(recipe.getRecipeOutput(), new ItemStack(Items.DRAGON_BREATH), Items.LINGERING_POTION); + allRecipes.add(upgradeRecipe); + } + + //for (IPotionRecipe recipe : allRecipes) { + // LogHelper.info("Input: [%s], Ingredient: [%s], Output: [%s].", recipe.getRecipeInput().toString() + " " + recipe.getRecipeInput().getTagCompound().toString(), recipe.getRecipeIngredient().toString(), recipe.getRecipeOutput().toString() + " " + recipe.getRecipeOutput().getTagCompound().toString()); + //} + } catch (Exception e) { + LogHelper.error("Unable to load potion recipes!"); + e.printStackTrace(); + } + } + + public static List getRecipes() { + return allRecipes; + } + +} diff --git a/dependencies/main/java/codechicken/nei/recipe/potion/PotionTypeRecipe.java b/dependencies/main/java/codechicken/nei/recipe/potion/PotionTypeRecipe.java new file mode 100644 index 0000000000..c23a6f932d --- /dev/null +++ b/dependencies/main/java/codechicken/nei/recipe/potion/PotionTypeRecipe.java @@ -0,0 +1,37 @@ +package codechicken.nei.recipe.potion; + +import net.minecraft.item.ItemStack; +import net.minecraft.potion.PotionType; +import net.minecraft.potion.PotionUtils; + +/** + * Created by covers1624 on 3/21/2016. + * Between different types Water > Mundane > blah. + */ +public class PotionTypeRecipe implements IPotionRecipe { + + private ItemStack input; + private ItemStack ingredient; + private ItemStack output; + + public PotionTypeRecipe(ItemStack input, ItemStack ingredient, PotionType outputType) { + this.ingredient = ingredient.copy(); + this.input = input.copy(); + this.output = PotionUtils.addPotionToItemStack(input, outputType); + } + + @Override + public ItemStack getRecipeOutput() { + return output; + } + + @Override + public ItemStack getRecipeInput() { + return input; + } + + @Override + public ItemStack getRecipeIngredient() { + return ingredient; + } +} diff --git a/dependencies/main/java/codechicken/nei/recipe/potion/PotionUpgradeRecipe.java b/dependencies/main/java/codechicken/nei/recipe/potion/PotionUpgradeRecipe.java new file mode 100644 index 0000000000..a986dbab09 --- /dev/null +++ b/dependencies/main/java/codechicken/nei/recipe/potion/PotionUpgradeRecipe.java @@ -0,0 +1,41 @@ +package codechicken.nei.recipe.potion; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +/** + * Created by covers1624 on 3/21/2016. + * Upgrade between different states, Normal > Splash > Lingering. + */ +public class PotionUpgradeRecipe implements IPotionRecipe { + + private ItemStack input; + private ItemStack ingredient; + private ItemStack output; + + public PotionUpgradeRecipe(ItemStack input, ItemStack ingredient, Item output) { + this.input = input; + this.ingredient = ingredient; + int stackSize = input.stackSize; + int meta = input.getItemDamage(); + NBTTagCompound tagCompound = input.getTagCompound(); + this.output = new ItemStack(output, stackSize, meta); + this.output.setTagCompound(tagCompound); + } + + @Override + public ItemStack getRecipeOutput() { + return output; + } + + @Override + public ItemStack getRecipeInput() { + return input; + } + + @Override + public ItemStack getRecipeIngredient() { + return ingredient; + } +} diff --git a/dependencies/main/java/codechicken/nei/thirdparty/colossalchests/ColossalChestsConfig.java b/dependencies/main/java/codechicken/nei/thirdparty/colossalchests/ColossalChestsConfig.java new file mode 100644 index 0000000000..69f601a2a8 --- /dev/null +++ b/dependencies/main/java/codechicken/nei/thirdparty/colossalchests/ColossalChestsConfig.java @@ -0,0 +1,34 @@ +package codechicken.nei.thirdparty.colossalchests; + +import codechicken.lib.util.ReflectionManager; +import codechicken.nei.api.API; +import codechicken.nei.util.LogHelper; +import net.minecraft.client.gui.inventory.GuiContainer; + +/** + * Created by covers1624 on 9/02/2017. + */ +public class ColossalChestsConfig { + + private static boolean hasInit = false; + + public static void init() { + if (hasInit) { + return; + } + hasInit = true; + try { + Class clazz = null; + try { + clazz = ReflectionManager.findClass("org.cyclops.colossalchests.client.gui.container.GuiColossalChest"); + } catch (Exception ignored) { + } + if (clazz != null) { + API.addFastTransferExemptContainer((Class) clazz); + } + } catch (Exception e) { + LogHelper.fatalError("Something went wring trying to enable ColossalChests ingegration.", e); + } + } + +} diff --git a/dependencies/main/java/codechicken/nei/util/LogHelper.java b/dependencies/main/java/codechicken/nei/util/LogHelper.java new file mode 100644 index 0000000000..75b7a0204c --- /dev/null +++ b/dependencies/main/java/codechicken/nei/util/LogHelper.java @@ -0,0 +1,240 @@ +package codechicken.nei.util; + +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +/** + * Created by covers1624 on 3/21/2016. + */ +public class LogHelper { + + private static Logger logger = LogManager.getLogger("NotEnoughItems"); + + /** + * Log with a supplied level. + */ + public static void log(Level logLevel, Object object) { + logger.log(logLevel, String.valueOf(object)); + } + + public static void log(Level logLevel, Object object, Throwable throwable) { + logger.log(logLevel, String.valueOf(object), throwable); + } + + //Standard log entries. + + public static void all(Object object) { + log(Level.ALL, object); + } + + public static void debug(Object object) { + log(Level.DEBUG, object); + } + + public static void error(Object object) { + log(Level.ERROR, object); + } + + public static void fatal(Object object) { + log(Level.FATAL, object); + } + + public static void info(Object object) { + log(Level.INFO, object); + } + + public static void off(Object object) { + log(Level.OFF, object); + } + + public static void trace(Object object) { + log(Level.TRACE, object); + } + + public static void warn(Object object) { + log(Level.WARN, object); + } + + //log with format. + + public static void all(String object, Object... format) { + log(Level.ALL, String.format(object, format)); + } + + public static void debug(String object, Object... format) { + log(Level.DEBUG, String.format(object, format)); + } + + public static void error(String object, Object... format) { + log(Level.ERROR, String.format(object, format)); + } + + public static void fatal(String object, Object... format) { + log(Level.FATAL, String.format(object, format)); + } + + public static void info(String object, Object... format) { + log(Level.INFO, String.format(object, format)); + } + + public static void off(String object, Object... format) { + log(Level.OFF, String.format(object, format)); + } + + public static void trace(String object, Object... format) { + log(Level.TRACE, String.format(object, format)); + } + + public static void warn(String object, Object... format) { + log(Level.WARN, String.format(object, format)); + } + + //Log Throwable with format. + + public static void allError(String object, Throwable throwable, Object... format) { + log(Level.ALL, String.format(object, format), throwable); + } + + public static void debugError(String object, Throwable throwable, Object... format) { + log(Level.DEBUG, String.format(object, format), throwable); + } + + public static void errorError(String object, Throwable throwable, Object... format) { + log(Level.ERROR, String.format(object, format), throwable); + } + + public static void fatalError(String object, Throwable throwable, Object... format) { + log(Level.FATAL, String.format(object, format), throwable); + } + + public static void infoError(String object, Throwable throwable, Object... format) { + log(Level.INFO, String.format(object, format), throwable); + } + + public static void offError(String object, Throwable throwable, Object... format) { + log(Level.OFF, String.format(object, format), throwable); + } + + public static void traceError(String object, Throwable throwable, Object... format) { + log(Level.TRACE, String.format(object, format), throwable); + } + + public static void warnError(String object, Throwable throwable, Object... format) { + log(Level.WARN, String.format(object, format), throwable); + } + + //Log throwable. + public static void allError(String object, Throwable throwable) { + log(Level.ALL, object, throwable); + } + + public static void debugError(String object, Throwable throwable) { + log(Level.DEBUG, object, throwable); + } + + public static void errorError(String object, Throwable throwable) { + log(Level.ERROR, object, throwable); + } + + public static void fatalError(String object, Throwable throwable) { + log(Level.FATAL, object, throwable); + } + + public static void infoError(String object, Throwable throwable) { + log(Level.INFO, object, throwable); + } + + public static void offError(String object, Throwable throwable) { + log(Level.OFF, object, throwable); + } + + public static void traceError(String object, Throwable throwable) { + log(Level.TRACE, object, throwable); + } + + public static void warnError(String object, Throwable throwable) { + log(Level.WARN, object, throwable); + } + + //Log with trace element. + public static void bigAll(String format, Object... data) { + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); + all("****************************************"); + all("* " + format, data); + for (int i = 2; i < 8 && i < trace.length; i++) { + all("* at %s%s", trace[i].toString(), i == 7 ? "..." : ""); + } + all("****************************************"); + } + + public static void bigDebug(String format, Object... data) { + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); + debug("****************************************"); + debug("* " + format, data); + for (int i = 2; i < 8 && i < trace.length; i++) { + debug("* at %s%s", trace[i].toString(), i == 7 ? "..." : ""); + } + debug("****************************************"); + } + + public static void bigError(String format, Object... data) { + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); + error("****************************************"); + error("* " + format, data); + for (int i = 2; i < 8 && i < trace.length; i++) { + error("* at %s%s", trace[i].toString(), i == 7 ? "..." : ""); + } + error("****************************************"); + } + + public static void bigFatal(String format, Object... data) { + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); + fatal("****************************************"); + fatal("* " + format, data); + for (int i = 2; i < 8 && i < trace.length; i++) { + fatal("* at %s%s", trace[i].toString(), i == 7 ? "..." : ""); + } + fatal("****************************************"); + } + + public static void bigInfo(String format, Object... data) { + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); + info("****************************************"); + info("* " + format, data); + for (int i = 2; i < 8 && i < trace.length; i++) { + info("* at %s%s", trace[i].toString(), i == 7 ? "..." : ""); + } + info("****************************************"); + } + + public static void bigOff(String format, Object... data) { + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); + off("****************************************"); + off("* " + format, data); + for (int i = 2; i < 8 && i < trace.length; i++) { + off("* at %s%s", trace[i].toString(), i == 7 ? "..." : ""); + } + off("****************************************"); + } + + public static void bigTrace(String format, Object... data) { + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); + trace("****************************************"); + trace("* " + format, data); + for (int i = 2; i < 8 && i < trace.length; i++) { + trace("* at %s%s", trace[i].toString(), i == 7 ? "..." : ""); + } + trace("****************************************"); + } + + public static void bigWarn(String format, Object... data) { + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); + warn("****************************************"); + warn("* " + format, data); + for (int i = 2; i < 8 && i < trace.length; i++) { + warn("* at %s%s", trace[i].toString(), i == 7 ? "..." : ""); + } + warn("****************************************"); + } +} diff --git a/dependencies/main/java/codechicken/nei/NEIClientUtils.java b/dependencies/main/java/codechicken/nei/util/NEIClientUtils.java similarity index 89% rename from dependencies/main/java/codechicken/nei/NEIClientUtils.java rename to dependencies/main/java/codechicken/nei/util/NEIClientUtils.java index 8a3995aa5d..6a0757b771 100644 --- a/dependencies/main/java/codechicken/nei/NEIClientUtils.java +++ b/dependencies/main/java/codechicken/nei/util/NEIClientUtils.java @@ -1,23 +1,28 @@ -package codechicken.nei; +package codechicken.nei.util; import codechicken.lib.inventory.InventoryRange; import codechicken.lib.inventory.InventoryUtils; import codechicken.lib.util.LangProxy; +import codechicken.nei.LayoutManager; +import codechicken.nei.NEIActions; +import codechicken.nei.NEIClientConfig; import codechicken.nei.api.GuiInfo; import codechicken.nei.api.IInfiniteItemHandler; import codechicken.nei.api.INEIGuiHandler; import codechicken.nei.api.ItemInfo; +import codechicken.nei.network.NEIClientPacketHandler; import com.google.common.collect.Iterables; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.SoundEvents; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.ITextComponent; -import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.ITextComponent; import org.lwjgl.input.Keyboard; import java.text.MessageFormat; @@ -48,7 +53,7 @@ public static void deleteHeldItem() { } public static void dropHeldItem() { - mc().playerController.windowClick(((GuiContainer) mc().currentScreen).inventorySlots.windowId, -999, 0, 0, mc().thePlayer); + mc().playerController.windowClick(((GuiContainer) mc().currentScreen).inventorySlots.windowId, -999, 0, ClickType.PICKUP, mc().thePlayer); } public static void deleteSlotStack(int slotNumber) { @@ -71,7 +76,7 @@ public static void decreaseSlotStack(int slotNumber) { } public static void deleteEverything() { - NEICPH.sendDeleteAllItems(); + NEIClientPacketHandler.sendDeleteAllItems(); } public static void deleteItemsOfType(ItemStack type) { @@ -95,7 +100,7 @@ public static ItemStack getHeldItem() { } public static void setSlotContents(int slot, ItemStack item, boolean containerInv) { - NEICPH.sendSetSlot(slot, item, containerInv); + NEIClientPacketHandler.sendSetSlot(slot, item, containerInv); if (slot == -999) { mc().thePlayer.inventory.setItemStack(item); @@ -178,15 +183,15 @@ public static void giveStack(ItemStack base, int i, boolean infinite) { } } if (given > 0) { - NEICPH.sendGiveItem(copyStack(typestack, given), false, false); + NEIClientPacketHandler.sendGiveItem(copyStack(typestack, given), false, false); } } else { - NEICPH.sendGiveItem(stack, infinite, true); + NEIClientPacketHandler.sendGiveItem(stack, infinite, true); } } else { for (int given = 0; given < stack.stackSize; ) { int qty = Math.min(stack.stackSize - given, stack.getMaxStackSize()); - sendCommand(getStringSetting("command.item"), mc().thePlayer.getName(), Item.itemRegistry.getNameForObject(stack.getItem()), qty, stack.getItemDamage(), stack.hasTagCompound() ? stack.getTagCompound().toString() : "", Item.getIdFromItem(stack.getItem())); + sendCommand(getStringSetting("command.item"), mc().thePlayer.getName(), Item.REGISTRY.getNameForObject(stack.getItem()), qty, stack.getItemDamage(), stack.hasTagCompound() ? stack.getTagCompound().toString() : "", Item.getIdFromItem(stack.getItem())); given += qty; } } @@ -209,7 +214,7 @@ public static int getGamemode() { return 2; } else if (mc().playerController.isInCreativeMode()) { return 1; - } else if (mc().playerController.currentGameType.isAdventure()) { + } else if (mc().playerController.getCurrentGameType().isAdventure()) { return 3; } else { return 0; @@ -240,7 +245,7 @@ public static void cycleGamemode() { } if (hasSMPCounterPart()) { - NEICPH.sendGamemode(nmode); + NEIClientPacketHandler.sendGamemode(nmode); } else { sendCommand(getStringSetting("command.creative"), getGameType(nmode), mc().thePlayer.getName()); } @@ -259,7 +264,7 @@ public static void setHourForward(int hour) { long newTime = day + 24000L + hour * 1000; if (hasSMPCounterPart()) { - NEICPH.sendSetTime(hour); + NEIClientPacketHandler.sendSetTime(hour); } else { sendCommand(getStringSetting("command.time"), newTime); } @@ -288,7 +293,7 @@ public static boolean isRaining() { public static void toggleRaining() { if (hasSMPCounterPart()) { - NEICPH.sendToggleRain(); + NEIClientPacketHandler.sendToggleRain(); } else { sendCommand(getStringSetting("command.rain"), isRaining() ? 0 : 1); } @@ -296,7 +301,7 @@ public static void toggleRaining() { public static void healPlayer() { if (hasSMPCounterPart()) { - NEICPH.sendHeal(); + NEIClientPacketHandler.sendHeal(); } else { sendCommand(getStringSetting("command.heal"), mc().thePlayer.getName()); } @@ -304,7 +309,7 @@ public static void healPlayer() { public static void toggleMagnetMode() { if (hasSMPCounterPart()) { - NEICPH.sendToggleMagnetMode(); + NEIClientPacketHandler.sendToggleMagnetMode(); } } @@ -370,6 +375,6 @@ public static boolean altKey() { } public static void playClickSound() { - mc().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + mc().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); } } diff --git a/dependencies/main/java/codechicken/nei/NEIServerUtils.java b/dependencies/main/java/codechicken/nei/util/NEIServerUtils.java similarity index 89% rename from dependencies/main/java/codechicken/nei/NEIServerUtils.java rename to dependencies/main/java/codechicken/nei/util/NEIServerUtils.java index fa16594cc8..468b639f71 100644 --- a/dependencies/main/java/codechicken/nei/NEIServerUtils.java +++ b/dependencies/main/java/codechicken/nei/util/NEIServerUtils.java @@ -1,10 +1,16 @@ -package codechicken.nei; +package codechicken.nei.util; -import codechicken.core.CommonUtils; -import codechicken.core.ServerUtils; +import codechicken.lib.util.CommonUtils; import codechicken.lib.inventory.InventoryRange; import codechicken.lib.inventory.InventoryUtils; import codechicken.lib.packet.PacketCustom; +import codechicken.lib.util.ServerUtils; +import codechicken.nei.ClientHandler; +import codechicken.nei.NEIActions; +import codechicken.nei.NEIServerConfig; +import codechicken.nei.PlayerSave; +import codechicken.nei.container.ContainerCreativeInv; +import codechicken.nei.network.NEIServerPacketHandler; import net.minecraft.command.ICommandSender; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.player.EntityPlayer; @@ -16,13 +22,12 @@ import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.ChatComponentTranslation; -import net.minecraft.util.TextFormatting; -import net.minecraft.util.ITextComponent; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.world.GameType; import net.minecraft.world.World; import net.minecraft.world.WorldServer; -import net.minecraft.world.WorldSettings.GameType; import net.minecraftforge.oredict.OreDictionary; import java.io.*; @@ -47,7 +52,7 @@ public static void toggleRaining(World world, boolean notify) { } if (notify) { - ServerUtils.sendChatToAll(new ChatComponentTranslation("nei.chat.rain." + (raining ? "on" : "off"))); + ServerUtils.sendChatToAll(new TextComponentTranslation("nei.chat.rain." + (raining ? "on" : "off"))); } } @@ -87,7 +92,7 @@ public static ItemStack getSlotContents(EntityPlayer player, int slot, boolean c @SuppressWarnings("unchecked") public static void deleteAllItems(EntityPlayerMP player) { - for (Slot slot : (List) player.openContainer.inventorySlots) { + for (Slot slot : player.openContainer.inventorySlots) { slot.putStack(null); } @@ -99,7 +104,7 @@ public static void setHourForward(World world, int hour, boolean notify) { long newTime = day + 24000L + hour * 1000; setTime(newTime, world); if (notify) { - ServerUtils.sendChatToAll(new ChatComponentTranslation("nei.chat.time", getTime(world) / 24000L, hour)); + ServerUtils.sendChatToAll(new TextComponentTranslation("nei.chat.time", getTime(world) / 24000L, hour)); } } @@ -121,11 +126,11 @@ public static boolean canItemFitInInventory(EntityPlayer player, ItemStack items } public static void sendNotice(ICommandSender sender, ITextComponent msg, String permission) { - ChatComponentTranslation notice = new ChatComponentTranslation("chat.type.admin", sender.getName(), msg.createCopy()); - notice.getChatStyle().setColor(TextFormatting.GRAY).setItalic(true); + TextComponentTranslation notice = new TextComponentTranslation("chat.type.admin", sender.getName(), msg.createCopy()); + notice.getStyle().setColor(TextFormatting.GRAY).setItalic(true); if (NEIServerConfig.canPlayerPerformAction("CONSOLE", permission)) { - MinecraftServer.getServer().addChatMessage(notice); + ServerUtils.mc().addChatMessage(notice); } for (EntityPlayer p : ServerUtils.getPlayers()) { @@ -190,13 +195,13 @@ public static boolean areStacksIdentical(ItemStack stack1, ItemStack stack2) { } public static ITextComponent setColour(ITextComponent msg, TextFormatting colour) { - msg.getChatStyle().setColor(colour); + msg.getStyle().setColor(colour); return msg; } public static void givePlayerItem(EntityPlayerMP player, ItemStack stack, boolean infinite, boolean doGive) { if (stack.getItem() == null) { - player.addChatComponentMessage(setColour(new ChatComponentTranslation("nei.chat.give.noitem"), TextFormatting.WHITE)); + player.addChatComponentMessage(setColour(new TextComponentTranslation("nei.chat.give.noitem"), TextFormatting.WHITE)); return; } @@ -209,7 +214,7 @@ public static void givePlayerItem(EntityPlayerMP player, ItemStack stack, boolea } } - sendNotice(player, new ChatComponentTranslation("commands.give.success", stack.getChatComponent(), infinite ? "\u221E" : Integer.toString(given), player.getName()), "notify-item"); + sendNotice(player, new TextComponentTranslation("commands.give.success", stack.getTextComponent(), infinite ? "\u221E" : Integer.toString(given), player.getName()), "notify-item"); player.openContainer.detectAndSendChanges(); } @@ -238,9 +243,9 @@ public static void toggleMagnetMode(EntityPlayerMP player) { public static int getCreativeMode(EntityPlayerMP player) { if (NEIServerConfig.forPlayer(player.getName()).isActionEnabled("creative+")) { return 2; - } else if (player.theItemInWorldManager.isCreative()) { + } else if (player.interactionManager.isCreative()) { return 1; - } else if (player.theItemInWorldManager.getGameType().isAdventure()) { + } else if (player.interactionManager.getGameType().isAdventure()) { return 3; } else { return 0; @@ -270,15 +275,15 @@ public static void setGamemode(EntityPlayerMP player, int mode) { NEIServerConfig.forPlayer(player.getName()).enableAction("creative+", mode == 2); if (mode == 2 && !(player.openContainer instanceof ContainerCreativeInv))//open the container immediately for the client { - NEISPH.processCreativeInv(player, true); + NEIServerPacketHandler.processCreativeInv(player, true); } //change it on the server - player.theItemInWorldManager.setGameType(getGameType(mode)); + player.interactionManager.setGameType(getGameType(mode)); //tell the client to change it - new PacketCustom(NEISPH.channel, 14).writeByte(mode).sendToPlayer(player); - player.addChatMessage(new ChatComponentTranslation("nei.chat.gamemode." + mode)); + new PacketCustom(NEIServerPacketHandler.channel, 14).writeByte(mode).sendToPlayer(player); + player.addChatMessage(new TextComponentTranslation("nei.chat.gamemode." + mode)); } public static void cycleCreativeInv(EntityPlayerMP player, int steps) { @@ -355,9 +360,9 @@ public static int getEnchantmentLevel(ItemStack itemstack, int e) { return -1; } - public static boolean doesEnchantmentConflict(List enchantments, Enchantment e) { + public static boolean doesEnchantmentConflict(List enchantments, Enchantment enchantment) { for (int[] ai : enchantments) { - if (!e.canApplyTogether(Enchantment.enchantmentsList[ai[0]])) { + if (!enchantment.canApplyTogether(Enchantment.getEnchantmentByID(ai[0]))) { return true; } } @@ -418,7 +423,7 @@ public static void logOnce(Throwable t, Set stackTraces, String message, t.printStackTrace(new PrintWriter(sw)); String stackTrace = identifier + sw.toString(); if (!stackTraces.contains(stackTrace)) { - NEIServerConfig.logger.error(message, t); + LogHelper.errorError(message, t); stackTraces.add(stackTrace); } } diff --git a/dependencies/main/java/codechicken/nei/Button.java b/dependencies/main/java/codechicken/nei/widget/Button.java similarity index 91% rename from dependencies/main/java/codechicken/nei/Button.java rename to dependencies/main/java/codechicken/nei/widget/Button.java index 89392c7315..92973700f6 100644 --- a/dependencies/main/java/codechicken/nei/Button.java +++ b/dependencies/main/java/codechicken/nei/widget/Button.java @@ -1,4 +1,8 @@ -package codechicken.nei; +package codechicken.nei.widget; + +import codechicken.nei.Image; +import codechicken.nei.LayoutManager; +import codechicken.nei.util.NEIClientUtils; import java.util.List; diff --git a/dependencies/main/java/codechicken/nei/ItemPanel.java b/dependencies/main/java/codechicken/nei/widget/ItemPanel.java similarity index 90% rename from dependencies/main/java/codechicken/nei/ItemPanel.java rename to dependencies/main/java/codechicken/nei/widget/ItemPanel.java index 88d09a54f6..80ea6e68fb 100644 --- a/dependencies/main/java/codechicken/nei/ItemPanel.java +++ b/dependencies/main/java/codechicken/nei/widget/ItemPanel.java @@ -1,13 +1,20 @@ -package codechicken.nei; +package codechicken.nei.widget; import codechicken.lib.vec.Rectangle4i; +import codechicken.nei.NEIClientConfig; +import codechicken.nei.NEIController; import codechicken.nei.api.GuiInfo; import codechicken.nei.api.INEIGuiHandler; +import codechicken.nei.config.KeyBindings; import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.network.NEIClientPacketHandler; import codechicken.nei.recipe.GuiCraftingRecipe; import codechicken.nei.recipe.GuiRecipe; import codechicken.nei.recipe.GuiUsageRecipe; +import codechicken.nei.util.NEIClientUtils; +import codechicken.nei.util.NEIServerUtils; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.RenderItem; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -147,9 +154,10 @@ public void draw(int mousex, int mousey) { @Override public void postDraw(int mousex, int mousey) { if (draggedStack != null) { - GuiContainerManager.drawItems.zLevel += 100; + RenderItem drawItems = GuiContainerManager.getRenderItem(); + drawItems.zLevel += 100; GuiContainerManager.drawItem(mousex - 8, mousey - 8, draggedStack); - GuiContainerManager.drawItems.zLevel -= 100; + drawItems.zLevel -= 100; } } @@ -249,7 +257,7 @@ private boolean handleDraggedClick(int mousex, int mousey, int button) { if (total > contents) { NEIClientUtils.setSlotContents(overSlot.slotNumber, NEIServerUtils.copyStack(draggedStack, total), true); - NEICPH.sendGiveItem(NEIServerUtils.copyStack(draggedStack, total), false, false); + NEIClientPacketHandler.sendGiveItem(NEIServerUtils.copyStack(draggedStack, total), false, false); draggedStack.stackSize -= total - contents; } if (draggedStack.stackSize == 0) { @@ -277,9 +285,15 @@ public void mouseUp(int mousex, int mousey, int button) { ItemStack item = hoverSlot.item; if (NEIController.manager.window instanceof GuiRecipe || !NEIClientConfig.canCheatItem(item)) { if (button == 0) { - GuiCraftingRecipe.openRecipeGui("item", item); + boolean opened = GuiCraftingRecipe.openRecipeGui("item", item); + if (!opened) { +// JEIIntegrationManager.openRecipeGui(item); + } } else if (button == 1) { - GuiUsageRecipe.openRecipeGui("item", item); + boolean opened = GuiUsageRecipe.openRecipeGui("item", item); + if (!opened) { +// JEIIntegrationManager.openUsageGui(item); + } } draggedStack = null; @@ -305,11 +319,11 @@ public boolean onMouseWheel(int i, int mousex, int mousey) { @Override public boolean handleKeyPress(int keyID, char keyChar) { - if (keyID == NEIClientConfig.getKeyBinding("gui.next")) { + if (KeyBindings.get("nei.options.keys.gui.next").isActiveAndMatches(keyID)) { scroll(1); return true; } - if (keyID == NEIClientConfig.getKeyBinding("gui.prev")) { + if (KeyBindings.get("nei.options.keys.gui.prev").isActiveAndMatches(keyID)) { scroll(-1); return true; } diff --git a/dependencies/main/java/codechicken/nei/Label.java b/dependencies/main/java/codechicken/nei/widget/Label.java similarity index 91% rename from dependencies/main/java/codechicken/nei/Label.java rename to dependencies/main/java/codechicken/nei/widget/Label.java index da55025e63..e1ae131a6e 100644 --- a/dependencies/main/java/codechicken/nei/Label.java +++ b/dependencies/main/java/codechicken/nei/widget/Label.java @@ -1,4 +1,4 @@ -package codechicken.nei; +package codechicken.nei.widget; import static codechicken.lib.gui.GuiDraw.drawString; import static codechicken.lib.gui.GuiDraw.drawStringC; @@ -6,7 +6,7 @@ public class Label extends Widget { boolean centered; int colour; - String text; + public String text; public Label(String s, boolean center, int color) { text = s; diff --git a/dependencies/main/java/codechicken/nei/Widget.java b/dependencies/main/java/codechicken/nei/widget/Widget.java similarity index 97% rename from dependencies/main/java/codechicken/nei/Widget.java rename to dependencies/main/java/codechicken/nei/widget/Widget.java index 539889e32f..66cdb4913f 100644 --- a/dependencies/main/java/codechicken/nei/Widget.java +++ b/dependencies/main/java/codechicken/nei/widget/Widget.java @@ -1,4 +1,4 @@ -package codechicken.nei; +package codechicken.nei.widget; import codechicken.lib.vec.Rectangle4i; import net.minecraft.item.ItemStack; diff --git a/dependencies/main/java/codechicken/obfuscator/IHeirachyEvaluator.java b/dependencies/main/java/codechicken/obfuscator/IHeirachyEvaluator.java index b74fed9fe0..c032d0a305 100644 --- a/dependencies/main/java/codechicken/obfuscator/IHeirachyEvaluator.java +++ b/dependencies/main/java/codechicken/obfuscator/IHeirachyEvaluator.java @@ -9,11 +9,11 @@ public interface IHeirachyEvaluator { * @param desc The mapping descriptor of the class to evaluate heirachy for * @return A list of parents (srg or obf names) */ - public List getParents(ObfuscationEntry desc); + List getParents(ObfuscationEntry desc); /** * @param srg_class The srg name of the class in question * @return True if this class does not inherit from any obfuscated class. */ - public boolean isLibClass(ObfuscationEntry desc); + boolean isLibClass(ObfuscationEntry desc); } diff --git a/dependencies/main/java/codechicken/obfuscator/ILogStreams.java b/dependencies/main/java/codechicken/obfuscator/ILogStreams.java index 3beeedf832..c58707684a 100644 --- a/dependencies/main/java/codechicken/obfuscator/ILogStreams.java +++ b/dependencies/main/java/codechicken/obfuscator/ILogStreams.java @@ -3,7 +3,7 @@ import java.io.PrintStream; public interface ILogStreams { - public PrintStream err(); + PrintStream err(); - public PrintStream out(); + PrintStream out(); } diff --git a/dependencies/main/java/cofh/api/energy/TileEnergyHandler.java b/dependencies/main/java/cofh/api/energy/TileEnergyHandler.java index 3ba60a664d..3cceab215c 100644 --- a/dependencies/main/java/cofh/api/energy/TileEnergyHandler.java +++ b/dependencies/main/java/cofh/api/energy/TileEnergyHandler.java @@ -24,10 +24,11 @@ public void readFromNBT(NBTTagCompound nbt) { } @Override - public void writeToNBT(NBTTagCompound nbt) { + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); storage.writeToNBT(nbt); + return nbt; } /* IEnergyConnection */ diff --git a/dependencies/main/java/ic2/api/Direction.class b/dependencies/main/java/ic2/api/Direction.class deleted file mode 100644 index c9f31f734eb18c650a53d1eb6c66a6c056fa7866..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4271 zcmb7H`CnVd5&teao)8a%@fBl}$gzn*m?*|LNeyv*04^;yu7yctyG{;F z5y!pKyXoEZN{=)>($*15p1`K>4h`aER43~nGJS@Xy(fObZAClq2GJGV6kCvp51o1I^ zT!v4G@+X7%6h7U6&)~E5cod%#_VWh5VBm`ez7)hw_;LVW5&G47iXIE%Yxugb-w5EF zLcb-$<3Vh~x9jQSI|BOM0PYrgNnC#~fPF%r2%t~s_XFq``eXq22>n3-`-T2cEPfQk zkMWeSKatr_W%e@zR}|{*JEpL1BoXh4SeZm*Ad$7>`9wO^C!*sVVwBg#WOhnsr#Le% zj80AE?7V^+CO5y#85fsl!O3NuoWlCkHQ~)vdc_;Hnnuo9b5>+FpGZcccAoz0qlxL1 zm7mSp3Og#L{WTEx)1=W#Cf%UMj`4#dCkLYn{y8f-Ytzrhj?UWgcn_y1>8WWXk+P4? z&P>?ZF>4~p6+@ejPATl{D20)RyH9R4v;rx%@D6; zH3;MDPoxt0{Sx15@o?w3f;WFQ!T7zogoH^lo#KY0c`JVYsFl$!n79U>R`7I)LE}_5 zJrkw&xNKdJhieDBMid8Avok|hoLf@p?HEbf`N#}UBA&IT@}*lTYusSd9^SgbE&s<> zVXc+PB+W^8tiwqwm+Nz>t@O#Vr8uIUk}Oy@6tB%i6HkmP=MzOvtKzNS#KsjHlqSq;psIol1MzYdKvN2HxCWYu*{d^0WEc zsY!)ycNW!1nu=E7M@R1$} zcWqsSKU{?2OYRRZB5v;zC;WqE%Wi}XY^SRiDr-|Xwes6}sc^Bi| zg+_E^9U|C&~^D;bHRA=^W->1|WyoP=ML$d!X5$>8U==y*m2RX*TGXL5TbD zfCJG(Di8slW8)ImRNL=!*#}@@g1QQEOgi=l8A2V`8pB;hH1V&wh_%%q0~%ywNzpk% zn!v`CcF#}019z1N=_TBeu9q;-wX2AhXR%K4#j*Yg^a{V>%CT$M6uX9-VvE?^(ptop zuB+HuL|YLzx7 z1z{v`j@k@jCDbE0k0h~VZ3ZcBL~h&QKVSyZVG1&MkFx{!ok(taFR!|jxa&+C93M(v z4i3ahjflM=*ZLH_xoafpLI^qtb@JX?38GYG4Z1oqzO&xRYKU1EL^+6A%sCKy=ukFX zU%+;v>{zvnc^5#v6GH$G;*10Es=i3z(QEL=TG~B}xNQMDHPhkMOs8hTKFxG#W|vhW5kfE8`CRQ}vNYi$F7fwaJc7$SjZ$O0 KfO&lx7yk$3<_XUL diff --git a/dependencies/main/java/ic2/api/Direction.java b/dependencies/main/java/ic2/api/Direction.java deleted file mode 100644 index 372f83eb6a..0000000000 --- a/dependencies/main/java/ic2/api/Direction.java +++ /dev/null @@ -1,132 +0,0 @@ -package ic2.api; - -import java.util.EnumSet; -import java.util.Set; - -import net.minecraft.init.Blocks; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -/** - * Represents the 6 possible directions along the axis of a block. - */ -public enum Direction { - /** - * -X - */ - XN, - /** - * +X - */ - XP, - - /** - * -Y - */ - YN, //MC-Code starts with 0 here - /** - * +Y - */ - YP, // 1... - - /** - * -Z - */ - ZN, - /** - * +Z - */ - ZP; - - private Direction() { - int side = ordinal() / 2; - int sign = getSign(); - - xOffset = side == 0 ? sign : 0; - yOffset = side == 1 ? sign : 0; - zOffset = side == 2 ? sign : 0; - } - - public static Direction fromSideValue(int side) { - return directions[(side + 2) % 6]; - } - - public static Direction fromEnumFacing(EnumFacing dir) { - - return fromSideValue(dir.ordinal()); - } - - /** - * Get the tile entity next to a tile entity following this direction. - * - * @param tileEntity tile entity to check - * @return Adjacent tile entity or null if none exists - */ - public TileEntity applyToTileEntity(TileEntity te) { - return applyTo(te.getWorld(), te.getPos()); - } - - /** - * Get the tile entity next to a position following this direction. - * - * @param world World to check - * @param x X coordinate to check from - * @param y Y coordinate to check from - * @param z Z coordinate to check from - * @return Adjacent tile entity or null if none exists - */ - public TileEntity applyTo(World world, BlockPos pos) { - - if (world != null && world.getBlockState(pos).getBlock() != Blocks.AIR) { - try { - return world.getTileEntity(pos); - } catch (Exception e) { - throw new RuntimeException("error getting TileEntity at dim "+world.provider.getDimension()+" "+pos); - } - } - - return null; - } - - /** - * Get the inverse of this direction (XN -> XP, XP -> XN, etc.) - * - * @return Inverse direction - */ - public Direction getInverse() { - return directions[ordinal() ^ 1]; - } - - /** - * Convert this direction to a Minecraft side value. - * - * @return Minecraft side value - */ - public int toSideValue() { - return (ordinal() + 4) % 6; - } - - /** - * Determine direction sign (N for negative or P for positive). - * - * @return -1 if the direction is negative, +1 if the direction is positive - */ - private int getSign() { - return (ordinal() % 2) * 2 - 1; - } - - public EnumFacing toFacing() { - return EnumFacing.VALUES[toSideValue()]; - } - - public final int xOffset; - public final int yOffset; - public final int zOffset; - - public static final Direction[] directions = Direction.values(); - public static final Set noDirections = EnumSet.noneOf(Direction.class); - public static final Set allDirections = EnumSet.allOf(Direction.class); -} - diff --git a/dependencies/main/java/ic2/api/energy/EnergyNet.class b/dependencies/main/java/ic2/api/energy/EnergyNet.class deleted file mode 100644 index 197104654adb0ed888e8f30094f0c97e2892663f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 331 zcmZ8c%T5A85UgGn7FPu1Wb_BrgA=)GxEM)DHgJG&pB*RIWSuq3VB%+aBJtn{_)*55 zjUk3hS66lQ>-*>P3&0SA6b&rZTX5XQg7N)b`~ckvC{i<@w5G{zuF6M`fq@!+YHu_>0WS+@{h&4Ul%Lm8(F z@lP-6WxvdRGryVHeS3d-1<=EZiz64u0&YrXlI0|D=M4)oa*-93==k2qmD2f4-d1N& zvr3cY@+w!!!&p59{xC~=GJeb?6{OQ=$u7z8+6EOo5NLCssGP1_wK%X`feY`~V!zh> z`&DofOjAIh!T$}o jj=&ZifOUJLO}I90VaIA4yH-2cv$~HiS2CB+1`a;}Yg41- diff --git a/dependencies/main/java/ic2/api/energy/IEnergyNet.java b/dependencies/main/java/ic2/api/energy/IEnergyNet.java index ab3b20ebd0..fc2dc58a06 100644 --- a/dependencies/main/java/ic2/api/energy/IEnergyNet.java +++ b/dependencies/main/java/ic2/api/energy/IEnergyNet.java @@ -1,6 +1,6 @@ package ic2.api.energy; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import ic2.api.energy.tile.IEnergyTile; @@ -53,7 +53,7 @@ public interface IEnergyNet { * * The statistics apply to the last simulated tick. * - * @param te Tile entity to check. + * @param tile Tile entity to check. * @return Statistics for the tile entity. */ NodeStats getNodeStats(IEnergyTile tile); diff --git a/dependencies/main/java/ic2/api/energy/NodeStats.class b/dependencies/main/java/ic2/api/energy/NodeStats.class deleted file mode 100644 index eceb34029f314b4b047f8061329202be61ca273d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 675 zcmZ`#%TB^T6g@**%A*2;AmS^ogf48tR^vuAF(I(Pupe-OLrQB(A@Qq>iNwT(AK*tB z?+nO-;O0Kg%z4aw|9pM{XyP=3B&umxI8ddg%At)T8^;VO5r}B?avw0T7DIZuc4skz zJrDhuj|4;VN(M5%rlHCqBENeMD)N1J|V?+IOKkxM^f!8(2Sqt zl%dv^!=}fdrMGnPIwaDIc|5&j$c{vOyUt?N8(cV*8X3nOfQ^8LvbgSYi_M{ zG3ImbAd3?RHc}4Ks$`I2sQ%~9P*5z-=fTM94#r|gucrikoY7Y$=@Si@N{uE{3F=Oo zx>IyGVA!E;LN{&dW%mQjJzpT1fdBvi diff --git a/dependencies/main/java/ic2/api/energy/event/EnergyTileEvent.class b/dependencies/main/java/ic2/api/energy/event/EnergyTileEvent.class deleted file mode 100644 index b19f4665ae985380a0e605ede66b70be9493108f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 929 zcma)4T~8B16g{(T*|u!06i^T?tyJuXGKNM6i{`so=2^S9O_oT z>te%2gCT2FC>iR$3bwfzDK52)hv(dy`Lk}K?9qRRVeYZg%Iq>Un*T(%21NZNIwb0{ zue9tXG>HTGG-+xn6}5FN&V-9i5BJe@(eltn$3qDZJUqk}L)8L!DD;r`CSmv@QrgJ4 z`zDYhqasa7Uq^9xSX1MgCch2k9_HcEOj7gvYuOAfEe$`VfdsKQGDlH7lza+JnEAft zPg-PHPf?~ z-bVW!Smz@g2N%e+-y{1CrO(K{tjt}&{o3w)K>jV^GPq8%f-K20@hqT e7x@=SBi1A*BdCEXHV&S7K6PTIkR6BzW)#_@l(x zR1jjNvoJgF?aZ6m`TTnS05C)=zyX>*j(waEyepHKd`vj+h9(*+y)=pw&K@=@H!-W* zNdcx3k1l2e_c~oLp&6Ql?^e%q&Zc@E3)2eINXIjs8H;~NH-9uQgkD*i*PP_)S2|4f zVq&=wp}K8vJ6;kx<5rX@4l|_6b6@>N<)xncq>l$2C2;I^z{~bkEvM05e7#%pW yP-`SddWiP~jfHpQ_Imv{(5plaeDOiSo=ILChk{SHSvZmxYaXho6-&$S(u&ocIM6Oe0;vW1L&X`VGWHCJ0W%n!KJaL=n;;NW0Q20elm(J=XWovFe$5H zzXT(RyC-9Uf0a#{(1?xY>)GRk^O2sU!ZhP7(dk&{#^Dv|7x(6wa8{M(Iom>gOW)cw z)6>3VyM)?u0N3+^(5e>yn2QkIWV1Zsfm9F29>d71u z@{;%R^8NGq1)#)HfrA2v2Gf_YiJtDcA%m07`8QY76-yOnYu7u2^XH9ZZfVJhR}IZY zLUx&hB!kNbp=?_g^3hef3b7_zwT<?;lX47(H?wPlQFs@M+AZ!% zgGm=d&#$D4V+E9DaKXN`O0=Yl^@pXNB-{V~434)BZR4c2kE=ELdD#$ykvhVS?R+DfSZfe*q`0MzjC` diff --git a/dependencies/main/java/ic2/api/energy/event/package-info.java b/dependencies/main/java/ic2/api/energy/event/package-info.java deleted file mode 100644 index 25ed85d13e..0000000000 --- a/dependencies/main/java/ic2/api/energy/event/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.energy.event; -import net.minecraftforge.fml.common.API; - diff --git a/dependencies/main/java/ic2/api/energy/package-info.class b/dependencies/main/java/ic2/api/energy/package-info.class deleted file mode 100644 index 68a0db695e2cbb94f24c0b0745b9fbeee2c26975..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 266 zcmYjMO-lno41H;Bx7P22f_U_7NB8Qf2tq+S0UDHsb@$48pr`)Nb}r z5=LDNTmQF(QoB3+ZE?)qIp1!t=9{PWI4+E{| RIvFZbB#f}1FvdZ`;V%?IL|p&? diff --git a/dependencies/main/java/ic2/api/energy/package-info.java b/dependencies/main/java/ic2/api/energy/package-info.java deleted file mode 100644 index 26bd21e312..0000000000 --- a/dependencies/main/java/ic2/api/energy/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.energy; -import net.minecraftforge.fml.common.API; - diff --git a/dependencies/main/java/ic2/api/energy/prefab/BasicSink.java b/dependencies/main/java/ic2/api/energy/prefab/BasicSink.java new file mode 100644 index 0000000000..70c29fb63d --- /dev/null +++ b/dependencies/main/java/ic2/api/energy/prefab/BasicSink.java @@ -0,0 +1,374 @@ +package ic2.api.energy.prefab; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; + +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.FMLCommonHandler; + +import ic2.api.energy.event.EnergyTileLoadEvent; +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.api.energy.tile.IEnergyEmitter; +import ic2.api.energy.tile.IEnergySink; +import ic2.api.info.Info; +import ic2.api.item.ElectricItem; + +/** + * BasicSink is a simple adapter to provide an ic2 energy sink. + * + * It's designed to be attached to a tile entity as a delegate. Functionally BasicSink acts as a + * one-time configurable input energy buffer, thus providing a common use case for machines. + * + * Sub-classing BasicSink instead of using it as a delegate works as well, but isn't recommended. + * The delegate can be extended with additional functionality through a sub class though. + * + * The constraints set by BasicSink like the strict tank-like energy buffering should provide a + * more easy to use and stable interface than using IEnergySink directly while aiming for + * optimal performance. + * + * Using BasicSink involves the following steps: + * - create a BasicSink instance in your TileEntity, typically in a field + * - forward invalidate, onChunkUnload, readFromNBT, writeToNBT and updateEntity to the BasicSink + * instance. + * If you have other means of determining when the tile entity is fully loaded, notify onLoaded + * that way instead of forwarding updateEntity. + * - call useEnergy whenever appropriate. canUseEnergy determines if enough energy is available + * without consuming the energy. + * - optionally use getEnergyStored to display the output buffer charge level + * - optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container) + * + * Example implementation code: + * @code{.java} + * public class SomeTileEntity extends TileEntity { + * // new basic energy sink, 1000 EU buffer, tier 1 (32 EU/t, LV) + * private BasicSink ic2EnergySink = new BasicSink(this, 1000, 1); + * + * @Override + * public void invalidate() { + * ic2EnergySink.invalidate(); // notify the energy sink + * ... + * super.invalidate(); // this is important for mc! + * } + * + * @Override + * public void onChunkUnload() { + * ic2EnergySink.onChunkUnload(); // notify the energy sink + * ... + * } + * + * @Override + * public void readFromNBT(NBTTagCompound tag) { + * super.readFromNBT(tag); + * + * ic2EnergySink.readFromNBT(tag); + * ... + * } + * + * @Override + * public void writeToNBT(NBTTagCompound tag) { + * super.writeToNBT(tag); + * + * ic2EnergySink.writeToNBT(tag); + * ... + * } + * + * @Override + * public void update() { + * ic2EnergySink.update(); // notify the energy sink + * ... + * if (ic2EnergySink.useEnergy(5)) { // use 5 eu from the sink's buffer this tick + * ... // do something with the energy + * } + * ... + * } + * + * ... + * } + * @endcode + */ +public class BasicSink extends TileEntity implements IEnergySink, ITickable { + // ********************************** + // *** Methods for use by the mod *** + // ********************************** + + /** + * Constructor for a new BasicSink delegate. + * + * @param parent1 TileEntity represented by this energy sink. + * @param capacity1 Maximum amount of eu to store. + * @param tier1 IC2 tier, 1 = LV, 2 = MV, ... + */ + public BasicSink(TileEntity parent1, int capacity1, int tier1) { + this.parent = parent1; + this.capacity = capacity1; + this.tier = tier1; + } + + // in-world te forwards >> + + /** + * Forward for the base TileEntity's update(), used for creating the energy net link. + * Either updateEntity or onLoaded have to be used. + */ + @Override + public void update() { + if (!addedToEnet) onLoaded(); + } + + /** + * Notification that the base TileEntity finished loaded, for advanced uses. + * Either updateEntity or onLoaded have to be used. + */ + public void onLoaded() { + if (!addedToEnet && + !parent.getWorld().isRemote && + Info.isIc2Available()) { + worldObj = parent.getWorld(); + pos = parent.getPos(); + + MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + + addedToEnet = true; + } + } + + /** + * Forward for the base TileEntity's invalidate(), used for destroying the energy net link. + * Both invalidate and onChunkUnload have to be used. + */ + @Override + public void invalidate() { + super.invalidate(); + + onChunkUnload(); + } + + /** + * Forward for the base TileEntity's onChunkUnload(), used for destroying the energy net link. + * Both invalidate and onChunkUnload have to be used. + */ + @Override + public void onChunkUnload() { + if (addedToEnet && + Info.isIc2Available()) { + MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + + addedToEnet = false; + } + } + + /** + * Forward for the base TileEntity's readFromNBT(), used for loading the state. + * + * @param tag Compound tag as supplied by TileEntity.readFromNBT() + */ + @Override + public void readFromNBT(NBTTagCompound tag) { + super.readFromNBT(tag); + + NBTTagCompound data = tag.getCompoundTag("IC2BasicSink"); + + energyStored = data.getDouble("energy"); + } + + /** + * Forward for the base TileEntity's writeToNBT(), used for saving the state. + * + * @param tag Compound tag as supplied by TileEntity.writeToNBT() + */ + @Override + public NBTTagCompound writeToNBT(NBTTagCompound tag) { + try { + super.writeToNBT(tag); + } catch (RuntimeException e) { + // happens if this is a delegate, ignore + } + + NBTTagCompound data = new NBTTagCompound(); + + data.setDouble("energy", energyStored); + + tag.setTag("IC2BasicSink", data); + + return tag; + } + + // << in-world te forwards + // methods for using this adapter >> + + /** + * Get the maximum amount of energy this sink can hold in its buffer. + * + * @return Capacity in EU. + */ + public int getCapacity() { + return capacity; + } + + /** + * Set the maximum amount of energy this sink can hold in its buffer. + * + * @param capacity1 Capacity in EU. + */ + public void setCapacity(int capacity1) { + this.capacity = capacity1; + } + + /** + * Get the IC2 energy tier for this sink. + * + * @return IC2 Tier. + */ + public int getTier() { + return tier; + } + + /** + * Set the IC2 energy tier for this sink. + * + * @param tier1 IC2 Tier. + */ + public void setTier(int tier1) { + this.tier = tier1; + } + + /** + * Determine the energy stored in the sink's input buffer. + * + * @return amount in EU, may be above capacity + */ + public double getEnergyStored() { + return energyStored; + } + + /** + * Set the stored energy to the specified amount. + * + * This is intended for server -> client synchronization, e.g. to display the stored energy in + * a GUI through getEnergyStored(). + * + * @param amount + */ + public void setEnergyStored(double amount) { + energyStored = amount; + } + + /** + * Determine if the specified amount of energy is available. + * + * @param amount in EU + * @return true if the amount is available + */ + public boolean canUseEnergy(double amount) { + return energyStored >= amount; + } + + /** + * Use the specified amount of energy, if available. + * + * @param amount amount to use + * @return true if the amount was available + */ + public boolean useEnergy(double amount) { + if (canUseEnergy(amount) && !FMLCommonHandler.instance().getEffectiveSide().isClient()) { + energyStored -= amount; + + return true; + } + return false; + } + + /** + * Discharge the supplied ItemStack into this sink's energy buffer. + * + * @param stack ItemStack to discharge (null is ignored) + * @param limit Transfer limit, values <= 0 will use the battery's limit + * @return true if energy was transferred + */ + public boolean discharge(ItemStack stack, int limit) { + if (stack == null || !Info.isIc2Available()) return false; + + double amount = capacity - energyStored; + if (amount <= 0) return false; + + if (limit > 0 && limit < amount) amount = limit; + + amount = ElectricItem.manager.discharge(stack, amount, tier, limit > 0, true, false); + + energyStored += amount; + + return amount > 0; + } + + // << methods for using this adapter + + // backwards compatibility (ignore these) >> + + @Deprecated + public void onupdate() { + update(); + } + + @Deprecated + public void onInvalidate() { + invalidate(); + } + + @Deprecated + public void onOnChunkUnload() { + onChunkUnload(); + } + + @Deprecated + public void onReadFromNbt(NBTTagCompound tag) { + readFromNBT(tag); + } + + @Deprecated + public void onWriteToNbt(NBTTagCompound tag) { + writeToNBT(tag); + } + + // << backwards compatibility + + // ****************************** + // *** Methods for use by ic2 *** + // ****************************** + + // energy net interface >> + + @Override + public boolean acceptsEnergyFrom(IEnergyEmitter emitter, EnumFacing direction) { + return true; + } + + @Override + public double getDemandedEnergy() { + return Math.max(0, capacity - energyStored); + } + + @Override + public double injectEnergy(EnumFacing directionFrom, double amount, double voltage) { + energyStored += amount; + + return 0; + } + + @Override + public int getSinkTier() { + return tier; + } + + // << energy net interface + + + public final TileEntity parent; + + protected int capacity; + protected int tier; + protected double energyStored; + protected boolean addedToEnet; +} diff --git a/dependencies/main/java/ic2/api/energy/prefab/BasicSource.java b/dependencies/main/java/ic2/api/energy/prefab/BasicSource.java new file mode 100644 index 0000000000..9715cd4bd1 --- /dev/null +++ b/dependencies/main/java/ic2/api/energy/prefab/BasicSource.java @@ -0,0 +1,376 @@ +package ic2.api.energy.prefab; + +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; + +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.FMLCommonHandler; + +import ic2.api.energy.EnergyNet; +import ic2.api.energy.event.EnergyTileLoadEvent; +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.api.energy.tile.IEnergyAcceptor; +import ic2.api.energy.tile.IEnergySource; +import ic2.api.info.Info; +import ic2.api.item.ElectricItem; + +/** + * BasicSource is a simple adapter to provide an ic2 energy source. + * + * It's designed to be attached to a tile entity as a delegate. Functionally BasicSource acts as a + * one-time configurable output energy buffer, thus providing a common use case for generators. + * + * Sub-classing BasicSource instead of using it as a delegate works as well, but isn't recommended. + * The delegate can be extended with additional functionality through a sub class though. + * + * The constraints set by BasicSource like the strict tank-like energy buffering should provide a + * more easy to use and stable interface than using IEnergySource directly while aiming for + * optimal performance. + * + * Using BasicSource involves the following steps: + * - create a BasicSource instance in your TileEntity, typically in a field + * - forward invalidate, onChunkUnload, readFromNBT, writeToNBT and updateEntity to the BasicSource + * instance. + * If you have other means of determining when the tile entity is fully loaded, notify onLoaded + * that way instead of forwarding updateEntity. + * - call addEnergy whenever appropriate, using getFreeCapacity may determine if e.g. the generator + * should run + * - optionally use getEnergyStored to display the output buffer charge level + * - optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container) + * + * Example implementation code: + * @code{.java} + * public class SomeTileEntity extends TileEntity { + * // new basic energy source, 1000 EU buffer, tier 1 (32 EU/t, LV) + * private BasicSource ic2EnergySource = new BasicSource(this, 1000, 1); + * + * @Override + * public void invalidate() { + * ic2EnergySource.invalidate(); // notify the energy source + * ... + * super.invalidate(); // this is important for mc! + * } + * + * @Override + * public void onChunkUnload() { + * ic2EnergySource.onChunkUnload(); // notify the energy source + * ... + * } + * + * @Override + * public void readFromNBT(NBTTagCompound tag) { + * super.readFromNBT(tag); + * + * ic2EnergySource.readFromNBT(tag); + * ... + * } + * + * @Override + * public void writeToNBT(NBTTagCompound tag) { + * super.writeToNBT(tag); + * + * ic2EnergySource.writeToNBT(tag); + * ... + * } + * + * @Override + * public void update() { + * ic2EnergySource.update(); // notify the energy source + * ... + * ic2EnergySource.addEnergy(5); // add 5 eu to the source's buffer this tick + * ... + * } + * + * ... + * } + * @endcode + */ +public class BasicSource extends TileEntity implements IEnergySource, ITickable { + // ********************************** + // *** Methods for use by the mod *** + // ********************************** + + /** + * Constructor for a new BasicSource delegate. + * + * @param parent1 Base TileEntity represented by this energy source. + * @param capacity1 Maximum amount of eu to store. + * @param tier1 IC2 tier, 1 = LV, 2 = MV, ... + */ + public BasicSource(TileEntity parent1, double capacity1, int tier1) { + double power = EnergyNet.instance.getPowerFromTier(tier1); + + this.parent = parent1; + this.capacity = capacity1 < power ? power : capacity1; + this.tier = tier1; + this.power = power; + } + + // in-world te forwards >> + + /** + * Forward for the base TileEntity's update(), used for creating the energy net link. + * Either updateEntity or onLoaded have to be used. + */ + @Override + public void update() { + if (!addedToEnet) onLoaded(); + } + + /** + * Notification that the base TileEntity finished loading, for advanced uses. + * Either updateEntity or onLoaded have to be used. + */ + public void onLoaded() { + if (!addedToEnet && + !parent.getWorld().isRemote && + Info.isIc2Available()) { + worldObj = parent.getWorld(); + pos = parent.getPos(); + + MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + + addedToEnet = true; + } + } + + /** + * Forward for the base TileEntity's invalidate(), used for destroying the energy net link. + * Both invalidate and onChunkUnload have to be used. + */ + @Override + public void invalidate() { + super.invalidate(); + + onChunkUnload(); + } + + /** + * Forward for the base TileEntity's onChunkUnload(), used for destroying the energy net link. + * Both invalidate and onChunkUnload have to be used. + */ + @Override + public void onChunkUnload() { + if (addedToEnet && + Info.isIc2Available()) { + MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + + addedToEnet = false; + } + } + + /** + * Forward for the base TileEntity's readFromNBT(), used for loading the state. + * + * @param tag Compound tag as supplied by TileEntity.readFromNBT() + */ + @Override + public void readFromNBT(NBTTagCompound tag) { + super.readFromNBT(tag); + + NBTTagCompound data = tag.getCompoundTag("IC2BasicSource"); + + energyStored = data.getDouble("energy"); + } + + /** + * Forward for the base TileEntity's writeToNBT(), used for saving the state. + * + * @param tag Compound tag as supplied by TileEntity.writeToNBT() + */ + @Override + public NBTTagCompound writeToNBT(NBTTagCompound tag) { + try { + super.writeToNBT(tag); + } catch (RuntimeException e) { + // happens if this is a delegate, ignore + } + + NBTTagCompound data = new NBTTagCompound(); + + data.setDouble("energy", energyStored); + + tag.setTag("IC2BasicSource", data); + + return tag; + } + + // << in-world te forwards + // methods for using this adapter >> + + /** + * Get the maximum amount of energy this source can hold in its buffer. + * + * @return Capacity in EU. + */ + public double getCapacity() { + return capacity; + } + + /** + * Set the maximum amount of energy this source can hold in its buffer. + * + * @param capacity1 Capacity in EU. + */ + public void setCapacity(double capacity1) { + if (capacity1 < power) capacity1 = power; + + this.capacity = capacity1; + } + + /** + * Get the IC2 energy tier for this source. + * + * @return IC2 Tier. + */ + public int getTier() { + return tier; + } + + /** + * Set the IC2 energy tier for this source. + * + * @param tier1 IC2 Tier. + */ + public void setTier(int tier1) { + double power = EnergyNet.instance.getPowerFromTier(tier1); + + if (capacity < power) capacity = power; + + this.tier = tier1; + this.power = power; + } + + + /** + * Determine the energy stored in the source's output buffer. + * + * @return amount in EU + */ + public double getEnergyStored() { + return energyStored; + } + + /** + * Set the stored energy to the specified amount. + * + * This is intended for server -> client synchronization, e.g. to display the stored energy in + * a GUI through getEnergyStored(). + * + * @param amount + */ + public void setEnergyStored(double amount) { + energyStored = amount; + } + + /** + * Determine the free capacity in the source's output buffer. + * + * @return amount in EU + */ + public double getFreeCapacity() { + return capacity - energyStored; + } + + /** + * Add some energy to the output buffer. + * + * @param amount maximum amount of energy to add + * @return amount added/used, NOT remaining + */ + public double addEnergy(double amount) { + if (FMLCommonHandler.instance().getEffectiveSide().isClient()) return 0; + if (amount > capacity - energyStored) amount = capacity - energyStored; + + energyStored += amount; + + return amount; + } + + /** + * Charge the supplied ItemStack from this source's energy buffer. + * + * @param stack ItemStack to charge (null is ignored) + * @return true if energy was transferred + */ + public boolean charge(ItemStack stack) { + if (stack == null || !Info.isIc2Available()) return false; + + double amount = ElectricItem.manager.charge(stack, energyStored, tier, false, false); + + energyStored -= amount; + + return amount > 0; + } + + // << methods for using this adapter + + // backwards compatibility (ignore these) >> + + @Deprecated + public void onupdate() { + update(); + } + + @Deprecated + public void onInvalidate() { + invalidate(); + } + + @Deprecated + public void onOnChunkUnload() { + onChunkUnload(); + } + + @Deprecated + public void onReadFromNbt(NBTTagCompound tag) { + readFromNBT(tag); + } + + @Deprecated + public void onWriteToNbt(NBTTagCompound tag) { + writeToNBT(tag); + } + + // << backwards compatibility + + // ****************************** + // *** Methods for use by ic2 *** + // ****************************** + + // energy net interface >> + + @Override + public boolean emitsEnergyTo(IEnergyAcceptor receiver, EnumFacing direction) { + return true; + } + + @Override + public double getOfferedEnergy() { + return Math.min(energyStored, power); + } + + @Override + public void drawEnergy(double amount) { + energyStored -= amount; + } + + @Override + public int getSourceTier() { + return tier; + } + + // << energy net interface + + + public final TileEntity parent; + + protected double capacity; + protected int tier; + protected double power; + protected double energyStored; + protected boolean addedToEnet; +} diff --git a/dependencies/main/java/ic2/api/energy/tile/IChargingSlot.java b/dependencies/main/java/ic2/api/energy/tile/IChargingSlot.java new file mode 100644 index 0000000000..2238326ea1 --- /dev/null +++ b/dependencies/main/java/ic2/api/energy/tile/IChargingSlot.java @@ -0,0 +1,16 @@ +package ic2.api.energy.tile; + +/** + * Represents a slot (or set of slots) that can have electric items in them to be charged + * + * @author Chocohead + */ +public interface IChargingSlot { + /** + * Called when the energy component is ticked to fill the slots + * + * @param amount The amount of energy available for the slot(s) + * @return The amount of energy used charging the items in the slot(s) + */ + public double charge(double amount); +} \ No newline at end of file diff --git a/dependencies/main/java/ic2/api/energy/tile/IColoredEnergyTile.java b/dependencies/main/java/ic2/api/energy/tile/IColoredEnergyTile.java new file mode 100644 index 0000000000..2ad9c42c84 --- /dev/null +++ b/dependencies/main/java/ic2/api/energy/tile/IColoredEnergyTile.java @@ -0,0 +1,21 @@ +package ic2.api.energy.tile; + +import net.minecraft.item.EnumDyeColor; +import net.minecraft.util.EnumFacing; + +/** + * Interface, that allows Blocks to be colored and have their connectivity based on that color. + * This allows for any Energy Tile to be colored. (Conductors, Sinks, Sources) + * @author Aroma1997 + */ +public interface IColoredEnergyTile extends IEnergyTile { + + /** + * This is to get a Energy Tile's color for the given side. Mainly used for checking connectivity. + * @param side The side you want to get the color from. + * @return The color of the Energy Tile at the given side or null, if it's uncolored. + */ + EnumDyeColor getColor(EnumFacing side); + + +} diff --git a/dependencies/main/java/ic2/api/energy/tile/IDischargingSlot.java b/dependencies/main/java/ic2/api/energy/tile/IDischargingSlot.java new file mode 100644 index 0000000000..64ea69bd85 --- /dev/null +++ b/dependencies/main/java/ic2/api/energy/tile/IDischargingSlot.java @@ -0,0 +1,17 @@ +package ic2.api.energy.tile; + +/** + * Represents a slot (or set of slots) that can have electric items in them to be discharged + * + * @author Chocohead + */ +public interface IDischargingSlot { + /** + * Called when the energy component is ticked to empty the slots + * + * @param space The amount of free space for energy that can be stored + * @param ignoreLimit Whether to ignore the discharge limit of the item in the slot(s) + * @return The amount of energy discharged from the items in the slot(s) + */ + public double discharge(double space, boolean ignoreLimit); +} \ No newline at end of file diff --git a/dependencies/main/java/ic2/api/energy/tile/IEnergyAcceptor.class b/dependencies/main/java/ic2/api/energy/tile/IEnergyAcceptor.class deleted file mode 100644 index 5347aea0ce9b412c900e9f5969a7629e0793de8b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 271 zcmaKny9&ZU5Jm6!ijPLY-oi#32W+h@5)cFnt?bri3>(Zw){Wq=S@;2dl(@cHiy4N? zxg6&HxZVIv(TUKE(2CF|^pw_e^rzU0OD~BlazZj%8a-uoG%W9!y*UUkK1`e&@5RlQ zRy^m%igs%6xeN@)w#*ZyjZJ6cEup#aQchiT2`-9^VS#%C+oq+{-d$wxmoafe!caD&|85flCgyDv#G4+ zhcsit@pu*Fhu_T9LJ=-gJ&>wMCD%En^KSXqONfJ8W-3qQ(`3fl5iT}#4z=dOg%IZ( sT%&pF9NUOMX!+Mh$6q??5VjBjUPYtZjqWts#cs{_g8J@#|F>}P4L6i_y#N3J diff --git a/dependencies/main/java/ic2/api/energy/tile/IEnergyEmitter.class b/dependencies/main/java/ic2/api/energy/tile/IEnergyEmitter.class deleted file mode 100644 index a7394c85565766f40b805547b16e84416096bae7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 266 zcmaKny9xq93`K8zt*!`yA0Sw1W59MRi&X@{LMyv*h|7pOE90!-uUYs3ev~*qYKw#r z&dni@=j{$)f_8*vgjR%@(2?Bub85w9*G)l~50^$ySe*>ZXUX0ig%@99s< diff --git a/dependencies/main/java/ic2/api/energy/tile/IEnergySink.class b/dependencies/main/java/ic2/api/energy/tile/IEnergySink.class deleted file mode 100644 index 0ca5330260f88a7a65adeaa373c67e5501b4e222..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 290 zcmaJ+OG*Pl5Pg+NGHT-Q1TJ(DHx^{;DliEI1Q+oFZKoV6&U8Z4BjjpXcmNM2)=Usw zxu|+j@58IF@53j6DK2x2bDZb6AY7M{3aMRK%X%IpmU}`rxi1JKV^$j8UsPguTN1_^ zHsaH-@NV)HByp`ld~|P#o1_)bLsKuD*HAtdMVoZC+BVV4LMtI$EsyRt`eEZf9N|X& zl-*8Qx&mw=!hd9DYK2_6Q1bI@+kkNUk7?$;?9w(4351?aW`AdWLLURbaEQFa6Py}j J4Q=-@`T<`6OLG7K diff --git a/dependencies/main/java/ic2/api/energy/tile/IEnergySource.class b/dependencies/main/java/ic2/api/energy/tile/IEnergySource.class deleted file mode 100644 index 41ca6cff4a692202e1cf28888067c0857dab97b1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 260 zcmaKnO%4G;5QSfvq5Ts#U}ZKsaRww-7R0{Ilt~LiI*quRg#$R0C^NCJv8bx#)%Q}b zp0E1@z!)8crb0`hP3WfV7uzj6PNo^V^hOAV(S%S>oVk9ba5#z9gqFa|N}{HYck&KcT&#`UjLCA5`y6mg>c3$FV02{@A7m>pi;) cfl!hP-*SyrC^vVz*PcJL6ERm5x zJ~P=!Kd~TFKNT#aUjmfUM^XmV1X8GqvZvjfs1NV^N$e>v>(+_(hK6(CBTWin)T2%CG)}Yaa!#!|b z@5d8Bh=q%}3y-jDFRHKd{jI4~&V-2{oCxcJyDw^`st@YQn&9|x6hs8?sCu1oBr9{@ z#J{&>V6A1&yD}Y8!d7OXNE<1*W?kGxXC(1QA*@D8RB2s^BMg(LW`woX+N07Fr^c385EPi(fKL)m0G&M$cHC42zW_xwD@Y{;7GXDsrZ5!s}fs a+BFG;nm+~90zw@D;Io0ICxo!#Xng?V0Yt0- diff --git a/dependencies/main/java/ic2/api/energy/tile/IKineticSource.class b/dependencies/main/java/ic2/api/energy/tile/IKineticSource.class deleted file mode 100644 index 05257b06fc6f622126d026067f9474aa14d0b53f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 273 zcmaivy9&ZU5Jm6!ijPLn&Q2R`9I&-k2nrVZ1M4z|)nwJU5&bm_KfsR?H>45-tATUx zg)^`B;|XAbR)9u;CZU(8TPo*FF79BgIHSc%8r?TW9|-;7(lbtcqEoeVoH-No%x1}4 zX=9`5C?s@$?FoZ_+b|zD*T*c?GB>dhI^m*lDByUnuF6XoJz;e+T$r&}5dLlw+Ig2_ gWg}i~_o7{mKq&cVfl`G~Mg{Pc`7ezCP2T_j diff --git a/dependencies/main/java/ic2/api/energy/tile/IMultiEnergySource.class b/dependencies/main/java/ic2/api/energy/tile/IMultiEnergySource.class deleted file mode 100644 index 09b4b0f78e0d75e244def583247a905c6732372c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 266 zcmX^0Z`VEs1_mPrUUmj9b_Q;C1|CKR$>P+!6yMUElFWjfRM))JqV&pu#N_PMl43>% zW)00KMh4mR)Dmn89CPza^Gd*~JQ*3dg7Zs@l2hF>b5a=@#67_pAjUx?^s*Am5*ZoP zGLwz;6ALo+Q^8j0mjKo4W2$Ck5CEyy&q>Tn*Y{7#N=*h@q=;27vL$Sc42%p+K+FvE bCld=J0}BHy0|Ss|V_*l0Ffwp}#2GjNQ=>_J diff --git a/dependencies/main/java/ic2/api/energy/tile/IOverloadHandler.class b/dependencies/main/java/ic2/api/energy/tile/IOverloadHandler.class deleted file mode 100644 index 46ed18ca7092b2cbcfdce8ea70454ea4494e3e1c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 161 zcmX^0Z`VEs1_mPrPId-%b_Nbc2Cn=(|FYDgoczQTMg|rQPt7QxSa5!6QF5wVW=<+2 zgQzD=-Xk$DB`38=FDtPuk&!_qGucQ#u^>}FH7~U&y;8pfs9GOgEhB>fNVR@WVqUtw ke^ORzatRwF10w?y&=Cv_j4X@{%nU3b76U7gWMW_g0BJ-ho&W#< diff --git a/dependencies/main/java/ic2/api/energy/tile/IOverloadHandler.java b/dependencies/main/java/ic2/api/energy/tile/IOverloadHandler.java index db2f39cafd..ebaeb9e834 100644 --- a/dependencies/main/java/ic2/api/energy/tile/IOverloadHandler.java +++ b/dependencies/main/java/ic2/api/energy/tile/IOverloadHandler.java @@ -9,9 +9,9 @@ public interface IOverloadHandler { * Called when overloaded. This will override the default explosion. * The default explosion will therefore NOT happen, when you return true here. * If you return false, you can use this as a onExplode hook, but still let the default explosion happen. - * @note Would set the block to air and cause an explosion of power 2.5 by default + * @note Will set the block to air and cause an explosion of power 2.5 if false is returned * @param tier The tier of power, that was injected into the energy sink, that caused it to explode. - * @return Whether you the default explosion should be cancelled. + * @return Whether the default explosion should be cancelled. */ boolean onOverload(int tier); } \ No newline at end of file diff --git a/dependencies/main/java/ic2/api/energy/tile/package-info.class b/dependencies/main/java/ic2/api/energy/tile/package-info.class deleted file mode 100644 index 8f2d38743c29627d37816e8054d1c7fd30eb4840..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 271 zcmYjMO-lno41H;Bx7P22f;Yjl9o?&^A_xVcMWOfUm|aqLXO@|1#lPmkAK;G?Q%~lQ zke9rdm+zm?F90P@3LF(UCX8RgCOUqUh6!h#b#J!j8}U_`tnJnkE}u6(OUp}1vTAth zeaJRT@QHB!0)-TCu}E6j!8L${@vu3FbMCSqjs~0 zk}&FG*vc!b;!pu)5w66QMu~=XvHmbw4VwS<2&X%Prm?;@^VOPNz5ob4{cjgN^#Af6 U23pT`GE}5U7-2tQjDv*3U&y0IKL7v# diff --git a/dependencies/main/java/ic2/api/energy/tile/package-info.java b/dependencies/main/java/ic2/api/energy/tile/package-info.java deleted file mode 100644 index 565a16e145..0000000000 --- a/dependencies/main/java/ic2/api/energy/tile/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.energy.tile; -import net.minecraftforge.fml.common.API; - diff --git a/dependencies/main/java/ic2/api/energy/usage.txt b/dependencies/main/java/ic2/api/energy/usage.txt index e3c9de8177..bad72a93d7 100644 --- a/dependencies/main/java/ic2/api/energy/usage.txt +++ b/dependencies/main/java/ic2/api/energy/usage.txt @@ -89,6 +89,10 @@ An energy conductor has to post the following events: Additionally the interface IEnergyConductor has to be implemented. +-- general --- +Optionally, you can implement the interface IColoredEnergyTile, which allows for some basic color-based +connectivity. This can be used for IEnergyConductors, but is not limited to them. + ------------------------------ -- Energy Network Delegates -- diff --git a/dependencies/main/java/ic2/api/info/IInfoProvider.class b/dependencies/main/java/ic2/api/info/IInfoProvider.class deleted file mode 100644 index 95ce6945f7e50185d31acf76156bea84f4c92d39..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 241 zcmaivy$ZrW5QJy_N&G{^(oQRFJg~LZKtNCkSlFHCCY;8L92db?v+x0YDDeavE1OxE znU7_julobQ4DArj5G_JCW4APHv)fkYB@>3@m0>5&+OV=RbwWEni`Yxzq&m$f3qr?3 zQOWri8T~Use the internal one not this! + *

+ * You may be asking, why would an internal interface need documenting? Well, the answer is so people can use TileEntityBlock. + * That class is the base for all IC2 tile entities, so by being able to use that you're level to IC2. + * Many methods are protected in there too, as they're only designed to be called by BlockTileEntity (which is the block all IC2 tile entities will be on), + * by being able to extend it means all those methods you can now extend and be confident they will be called correctly. + *

+ *

+ * The more observant might have noticed there was an event that allowed you to do basically the same thing called TeBlockBakeEvent. + * Whilst that event used to add your own class onto TeBlock (that wasn't ideal as you could end up using the same ID as another addon which would cause a crash), + * this allows you to completely implement your own version of TeBlock, then let IC2 take it and build the necessary structures around it. + * Both mean you no longer have to use EnumHelper and lots of reflection to mess about with TeBlock, + * just to be left with either a crash from doing it too late/wrong, or lots of code bound to IC2 (such as language keys and blockstate jsons being in IC2's assets). + *

+ *

+ * Unlike TeBlockBakeEvent, this gives you near total control of your tile entities: + *

+ * You can pick whether each of your tile entity items show up in creative, and the order in which they do.
+ * You can choose whether you use an enum or class for your implementation. + * We use (and I personally recommend) using an enum, as the values should never change, but in the end the choice is yours.
+ * There is a proper separation between each registered ITeBlock by resource location, rather than everything being inserted into a single enum. + * You also receive your own instance of BlockTileEntity and ItemBlockTileEntity rather than having to use IC2's own one.
+ * All the language keys and blockstate file are in your own assets (which you can, and in fact have to, pick). + *
+ * It is a vast improvement over TeBlockBakeEvent, which is probably important as it's gone now ;) + *

+ *
+ * The event allows you to properly register your own version of TeBlock in a way that will be as fully supported as is physically possible. + * It's not in the actual API itself as it's heavily dependent on internal classes, so you have this instead. + * This is also probably the most documented thing in the entire IC2 API. I'm too kind really. ;) + *

+ *
+ *

+ * So that's all well and good, but what you really want is an example of how to do it properly. Good idea, let's go. + *


+ *import net.minecraftforge.common.MinecraftForge;
+ *import net.minecraftforge.fml.common.Mod;
+ *import net.minecraftforge.fml.common.Mod.EventHandler;
+ *import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
+ *import net.minecraftforge.fml.common.event.FMLInitializationEvent;
+ *
+ *{@literal @}Mod(modId="ExampleIC2Addon")
+ *public class ExampleIC2Addon {
+ *	public ExampleIC2Addon() {
+ *		//You have to register before IC2 reaches Pre-Initialization, which unless you specifically load before it is unlikely you'll achieve.
+ *		//Especially if you're an addon, you'll want to be loading after IC2 not before!
+ *		//But, your mod's constructor will definitely be called before then. The issue is it's called more than once.
+ *		//If you try registering the same tile entity ID twice it will crash (more on that later), so you'll have to use a singleton instance.
+ *		//An enum works well for this, but anything will work as long as it's registered to the event bus once, and only once.
+ *		MinecraftForge.EVENT_BUS.register(TileEntityRegisterer.INSTANCE);
+ *	}
+ *
+ *	{@literal @}EventHandler
+ *	public void preInit(FMLPreInitializationEvent event) {
+ *		MyTeBlock.registerTileEntities();
+ *	}
+ *
+ *	{@literal @}EventHandler
+ *	public void preInit(FMLInitializationEvent event) {
+ *		MyTeBlock.buildDummies();
+ *	}
+ *}
+ *
+ *import ic2.api.event.TeBlockFinalCallEvent;
+ *import ic2.core.block.TeBlockRegistry;
+ *import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+ *
+ *public enum TileEntityRegisterer {
+ *	INSTANCE;
+ *
+ *	{@literal @}SubscribeEvent
+ *	public void register(TeBlockFinalCallEvent event) {
+ *		TeBlockRegistry.addAll(MyTeBlock.class, MyTeBlock.IDENTITY);
+ *	}
+ *}
+ *
+ *import ic2.core.block.BlockTileEntity;
+ *import ic2.core.block.ITeBlock;
+ *import ic2.core.block.TileEntityBlock;
+ *import ic2.core.item.block.ItemBlockTileEntity;
+ *import ic2.core.ref.TeBlock.DefaultDrop;
+ *import ic2.core.ref.TeBlock.HarvestTool;
+ *import ic2.core.ref.TeBlock.ITePlaceHandler;
+ *import ic2.core.util.Util;
+ *import net.minecraft.block.material.Material;
+ *import net.minecraft.creativetab.CreativeTabs;
+ *import net.minecraft.item.EnumRarity;
+ *import net.minecraft.item.ItemStack;
+ *import net.minecraft.tileentity.TileEntity;
+ *import net.minecraft.util.EnumFacing;
+ *import net.minecraft.util.ResourceLocation;
+ *
+ *public enum MyTeBlock implements ITeBlock {
+ *	my_machine_name(MyMachineTileEntity.class, 0, false, Util.noFacings, false, HarvestTool.Pickaxe, DefaultDrop.Machine, 5, 10, EnumRarity.UNCOMMON, Material.IRON);
+ *
+ *	private MyTeBlock(Class teClass, int ID,
+ *			boolean hasActive, Set{@literal <}EnumFacing{@literal >} possibleFacings, boolean canBeWrenched,
+ *			HarvestTool tool, DefaultDrop drop,
+ *			float hardness, float explosionResistance, EnumRarity rarity, Material material) {
+ *		this.teClass = teClass;
+ *		this.ID = ID;
+ *		this.hasActive = hasActive;
+ *		this.possibleFacings = possibleFacings;
+ *		this.canBeWrenched = canBeWrenched;
+ *		this.tool = tool;
+ *		this.drop = drop;
+ *		this.hardness = hardness;
+ *		this.explosionResistance = explosionResistance;
+ *		this.rarity = rarity;
+ *		this.material = material;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public boolean hasItem() {
+ *		return teClass != null && itemMeta != -1;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public String getName() {
+ *		return name();
+ *	}
+ *
+ *	{@literal @}Override
+ *	public ResourceLocation getIdentifier() {
+ *		return IDENTITY;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public Class getTeClass() {
+ *		return teClass;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public boolean hasActive() {
+ *		return hasActive;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public int getId() {
+ *		return ID;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public float getHardness() {
+ *		return hardness;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public HarvestTool getHarvestTool() {
+ *		return tool;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public DefaultDrop getDefaultDrop() {
+ *		return drop;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public float getExplosionResistance() {
+ *		return explosionResistance;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public boolean allowWrenchRotating() {
+ *		return canBeWrenched;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public Set{@literal <}EnumFacing{@literal >} getSupportedFacings() {
+ *		return possibleFacings;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public EnumRarity getRarity() {
+ *		return rarity;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public Material getMaterial() {
+ *		return material;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public void addSubBlocks(List{@literal <}ItemStack{@literal >} list, BlockTileEntity block, ItemBlockTileEntity item, CreativeTabs tab) {
+ *		for (MyTeBlock block : values()) {
+ *			if (type.hasItem()) {
+ *				list.add(block.getItemStack(type));
+ *			}
+ *		}
+ *	}
+ *
+ *	{@literal @}Override
+ *	public void setPlaceHandler(ITePlaceHandler handler) {
+ *		this.placeHandler = handler;
+ *	}
+ *
+ *	{@literal @}Override
+ *	public ITePlaceHandler getPlaceHandler() {
+ *		return placeHandler;
+ *	}
+ *
+ *	public static void registerTileEntities() {
+ *		for (MyTeBlock block : values()) {
+ *			if (block.teClass != null) TileEntity.addMapping(block.teClass, IDENTITY.getResourceDomain() + ':' + block.getName());
+ *		}
+ *	}
+ *
+ *	public static void buildDummies() {
+ *		for (MyTeBlock block : values()) {
+ *			//System.out.printf("Registering %s (with teClass %s)%n", block.getName(), block.teClass);
+ *			if (block.teClass != null) {
+ *				try {
+ *					block.dummyTe = block.teClass.newInstance();
+ *				} catch (Exception e) {
+ *					e.printStackTrace();
+ *				}
+ *			}
+ *		}
+ *	}
+ *
+ *	{@literal @}Override
+ *	public TileEntityBlock getDummyTe() {
+ *		return dummyTe;
+ *	}
+ *
+ *	private final Class teClass;
+ *	private final int ID;
+ *	private final boolean hasActive;
+ *	private final Set{@literal <}EnumFacing{@literal >} possibleFacings;
+ *	private final boolean canBeWrenched;
+ *	private final HarvestTool tool;
+ *	private final DefaultDrop drop;
+ *	private final float hardness;
+ *	private final float explosionResistance;
+ *	private final EnumRarity rarity;
+ *	private final Material material;
+ *	private TileEntityBlock dummyTe;
+ *	private ITePlaceHandler placeHandler;
+ *
+ *	public static final ResourceLocation IDENTITY = new ResourceLocation("ExampleIC2Addon", "machines");
+ *}
+ *  
+ * And that's it, you now have my_machine_name registered with the MyMachineTileEntity tile entity class, + * the language key to translate it's name being ExampleIC2Addon.machines.my_machine_name and + * the blockstate being in machines.json file in your mod's assets. + *

+ *
+ *

+ * But hang on, what are all the parameters of our new enum and what does ITeBlock do with them? What are dummy tile entities for? + * Don't worry, it's quite simple (once you know it at least). + *

+ *

+ * First we'll start on what {@link TeBlockFinalCallEvent} is. It's posted on the {@link MinecraftForge#EVENT_BUS} just before the blocks are built, + * after which point any further attempts to register ITeBlocks will fail, as we can't inject them late due to the model generating. + * It is best to hook into this to register your ITeBlocks, as it will be guaranteed to be posted at the right time. + *

+ * In terms of ITeBlock, there's quite a bit of information it needs in order to function. We'll go through each parameter (or getter method most cases too) in turn: + *

    + *
  • name: The name the new tile entity. This is important as the localisation and resource names depend on it, as well as some network syncing code.
  • + *
  • teClass: The class of your tile entity, it must extend TileEntityBlock otherwise it would miss critical methods to work. + * If extending that is a problem then using ITeBlock isn't what you should be doing.
  • + *
  • itemMeta: The ID of the new instance. This is utterly critical, as it's the thing used to detect which ITeBlock an item is. + * That's very important as the tile entity class is worked out by the ID when a block's being placed in ItemBlockTileEntity. + * Changing this will cause everyone's items to change and there is no stopping that if you do. + * The ID you pick should start at 0, and go up to Short.MAX_VALUE. + * Use -1 if the tile entity doesn't have an item form (or is placed using an item other than ItemBlockTileEntity).
  • + *
  • identifier: The resource location associated with the ITeBlock. + * The language keys, translations and internal mappings all use this, so it's best to store it as a static final variable and use that. + *
  • hasActive: If the tile entity has an active state too, which is based off whether TileEntityBlock#getActive() returns true or not. + * The models for that will be at name_active, you can check te.json for an example if you wish.
  • + *
  • supportedFacings: A set of EnumFacings that the block can face, used for rotating by the wrench for example. + * IC2 has some useful constants relating to that in Util (allFacings, horizontalFacings, downSideFacings and noFacings).
  • + *
  • allowWrenchRotating: Whether the tile entity can be rotated with a wrench (for {@link IWrenchable}).
  • + *
  • harvestTool: The tool used to harvest the tile entity, currently only None, Pickaxe, Shovel and Axe. + * More can be added on request, but support has to be specifically added, so there's no nice way via EnumHelper unfortunately.
  • + *
  • defaultDrop: The item(s) that will drop when the block is broken using the correct tool. Currently only Self, None, Generator, Machine, and AdvMachine. + * Like harvestTool, more can be added upon request.
  • + *
  • hardness: The hardness the block should have with the tile entity, IC2 normally uses 5.
  • + *
  • explosionResistance: The explosionResistance the block should have with the tile entity, IC2 normally uses 10.
  • + *
  • rarity: The EnumRarity that the item will have for the tile entity.
  • + *
  • material: The {@link Material} that the block representing the tile entity should have. Maximum of 16 different ones per ITeBlock registration.
  • + *
  • placeHandler: Custom placement logic, used for things like Reactor Chambers within IC2 itself. + * Returning null for this uses the default logic (placing like a normal block).
  • + *
  • dummyTe: An instance of the tile entity never registered to the world (don't try doing that) used for getting additional information about the Tile Entity. + * Mostly an internal thing, only exposed in case your Tile Entity uses a special constructor.
  • + * + *
  • addSubBlocks: Called by BlockTileEntity to add all the ITeBlocks you want to the creative menu. + * {@link BlockTileEntity#getItemStack(ITeBlock)} will be a useful method to get the item stack, a block instance is passed for that reason. + * This is only called once on a random ITeBlock for the resource location, because they are internally stored in a {@link Set} so has no order. + * Will probably be changed to a static method if/when the move is made to only Java 8 support. + *
+ * IMPORTANT THINGS TO NOTE + *
+ *
Getting your instance of BlockTileEntity and ItemBlockTileEntity
+ *
For BlockTileEntity, use {@link TeBlockRegistry#get(ResourceLocation)}.
+ * For ItemBlockTileEntity, use {@link BlockTileEntity#getItem()}.
+ *
Using a custom item model for your ITeBlock
+ *
Implement ITeBlockSpecialItem along with ITeBlock, then the item model will be what's provided rather than the block model.
+ *
+ * More will be added to this list if questions keep re-occurring, or are about a suitably important topic. + *

+ *
+ *

+ * There, that should be everything you need to utilise ITeBlock to add your own tile entities using IC2's very flexible framework. + * I'll be happy to answer any questions you have on it, your best bet is to ask me (Chocohead) on the IC2 forums, + * although if you post in the support section other people might be able to help before I see your post. + * I'll certainly take suggestions too, this is a first version of ITeBlock, so I'm sure there could be improvements made. + *
+ * Goodness I spent too long on this again... + *

+ * + * + * @see {@link TeBlockFinalCallEvent} for the event you'll need to subscribe to. + * @see {@link ic2.core.ref.TeBlock} for how all the IC2 implements {@link ITeBlock}. + * @see {@link ic2.core.ref.TeBlock.HarvestTool} for the currently available tools (you'll need this for adding new tile entities). + * @see {@link ic2.core.ref.TeBlock.DefaultDrop} for the currently available drops (you'll need this for adding new tile entities too). + * @see {@link ic2.core.ref.TeBlock.ITePlaceHandler} for making your own block placement handler (example in {@link ic2.core.item.ItemHandlers#reactorChamberPlace}). + * @see {@link ic2.core.util.Util} for the useful facings you might want for supportedFacings. + * @see {@link ic2.core.block.TileEntityBlock} for the base tile entity. + * @see {@link ic2.core.block.BlockTileEntity} for the base block (you'll never need to construct this yourself). + * @see {@link ic2.core.item.block.ItemBlockTileEntity} for the base item (you'll never need to construct this yourself either). + * @see {@link ITeBlockSpecialItem} for the interface used to have a custom item location. + * + * + * @since IC2 2.6.114 + * @version 1.2 + * + * @author Chocohead + */ +public interface ITeBlock { +} \ No newline at end of file diff --git a/dependencies/main/java/ic2/api/info/Info.class b/dependencies/main/java/ic2/api/info/Info.class deleted file mode 100644 index 54987885d9302262cfdd487de0f9ac8e25eaaacc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1267 zcmb7DYfsZq7=F&UY%S%s2_k}k0(PKO@h*stfuwP4%QlGN3psS%IM}tM>-aDJ2fm02 z5qa-XQ17XVO)9ct)!ylj^l7#Y3AfLrf2`C+SIY}s;Jc+@68 zuZ6^}$XP5%x;2d8nucLqjpC7p$CxDOW}4>tM8i`&)9@TiQ7mhCffWre@k&Dqs|ea?~|@4FHZC?rHR|*zd#^v1A?oibJ=34u$3;E*$syIf9etDQltKT zUN6|(+PBNCatr!@6p%NJ9!c7A6^3DbC)viruO-A3{jojt2S=emLoaCx`p_TB0StyR z-ja!yyn-R}t8x)Yc7VyfpmUTggCrx_HTMbZ11S+)r?WeBDi|YOYX)E(H^@>jfl2bn zWRId{vVMZdSEzKJqT@K;d4{f~GjyLIdWzV4sH104J|Z%DOtBqd{b6*GK1vrDLxSo~ w&@+ph=lv1{d5Ub{7QInKdcR|YHUQJ-$j8Ihgq%@niJY||pCN08d=bq41Zn3hF8}}l diff --git a/dependencies/main/java/ic2/api/info/package-info.class b/dependencies/main/java/ic2/api/info/package-info.class deleted file mode 100644 index 6cd21d41622a52a21beb78ed2f63d5ecead2b9af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 264 zcmYjMO-lno41LquZmnPSpy1iF9o?&^A_xV+qR{(v%r2?BnPp~L|C@o*Q2G>tQ*|sd?qpNZiVokPc8|y>c2C<9P@?I@m$7_m7IR?YK`K`eydEwCZ={N21(c<>>`SXe+efkga~aI~WVUfq+vm-ee7*z>2KrcE0}TKA0Y*A6^fFeY NNSNR-VTz-K<6mBPLwx`M diff --git a/dependencies/main/java/ic2/api/info/package-info.java b/dependencies/main/java/ic2/api/info/package-info.java deleted file mode 100644 index ecd40e27d4..0000000000 --- a/dependencies/main/java/ic2/api/info/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.info; -import net.minecraftforge.fml.common.API; - diff --git a/dependencies/main/java/ic2/api/item/ElectricItem.class b/dependencies/main/java/ic2/api/item/ElectricItem.class deleted file mode 100644 index ad45f925c74c3fe51a546f46087a4ce26455032d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1369 zcmb7E*-{fh6g{1VA<3{W3PfBGNFXo*qGBR$rB$g4_<)5aZ=J~)29pUjnYcXp9e#nY zs1FocW%=x1_#2j`o}L7fP~!5C?!I^KJ@?+zr}O2H5f5yxTIkriU_7PENWO1(8|)0MavbK$l2ziA$M)V_N=mzy;rhK&$Z1gt+jek zS|IAm=M77sJ1@daazd+=nt>qNhJsF=c5}y0)?#&XBilv%#_U zimjzsVaTWoMU-LnRA)0eBw3kgV(U( zk)ZVdz=x|UMPU5TkOEyk_L|)F`OLXw01%+{fv@y zipGQd4%JI7G(o6iS9%pHy}RkGg9c@xz}rvM<=Fy|PHvG0zK2HUa3a|v;X_0!N86Uw zb?XHyQk={QIleJ?7~hKNM>~a*MLnMX+g)#AflpfJ6A$v)cA=Z62zvZ|R516;_W0YU<~*#m?HUL(#!hrnlOYbh4!4A2)& z?Y;T=RqQb#2-RypM*<0m^ZzY@CCp;kFE~utIJ;K`RV#Bihx6Po@TVjA9T5!^)e?<4vi0X38GOVw#vp*2Zg08_sJ`36V4 diff --git a/dependencies/main/java/ic2/api/item/HudMode.java b/dependencies/main/java/ic2/api/item/HudMode.java new file mode 100644 index 0000000000..d78c602108 --- /dev/null +++ b/dependencies/main/java/ic2/api/item/HudMode.java @@ -0,0 +1,37 @@ +package ic2.api.item; + +public enum HudMode { + DISABLED("ic2.hud.disabled"), BASIC("ic2.hud.basic"), EXTENDED("ic2.hud.extended"), ADVANCED("ic2.hud.advanced"); + + private HudMode(String key) { + translationKey = key; + } + + private final String translationKey; + + public boolean shouldDisplay() { + return this != DISABLED; + } + + public boolean hasTooltip() { + return this == EXTENDED || this == ADVANCED; + } + + public String getTranslationKey() { + return translationKey; + } + + public int getID() { + return ordinal(); + } + + public static HudMode getFromID(int ID) { + return VALUES[ID % VALUES.length]; + } + + public static int getMaxMode() { + return VALUES.length - 1; + } + + private static final HudMode[] VALUES = values(); +} \ No newline at end of file diff --git a/dependencies/main/java/ic2/api/item/IBackupElectricItemManager.class b/dependencies/main/java/ic2/api/item/IBackupElectricItemManager.class deleted file mode 100644 index fc7f1ad23a6e5659818e779d524c95e50f79e38c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 241 zcmZ`!%MJlS5UgeykBdJLCtOUjS2qcXggCglwb9nBH8yMbI0ql#qr`0DBH_@LPNk~4 z>-oAr0K{l3G!&W&ErL3*+huYg^acwjUZ1QJQ}Etv>*b{90oI<)aXj1*TI=(*Ffy~5 z5W4e8;IH{K6XOeOO6igvCsK@3zA>S1O{_V$pQyibLZ>w7j9sEv+ce~bf4uG9&H TN|MG+xFt=v!#Sb=&2v(H22 diff --git a/dependencies/main/java/ic2/api/item/IBlockCuttingBlade.class b/dependencies/main/java/ic2/api/item/IBlockCuttingBlade.class deleted file mode 100644 index 6602efc17aacfd62f89fc9e20f7083383450bd02..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 188 zcmZXOI}U5)3A%KbJW%+k7R6d$!= z!ZL|Xt;$2^oVIyvWX8KfJ|tnKRV3tH{}O*1VKIopNSlkxwP57}0>SJ50pt@#@P~zQ HPY=Nt?R7Go diff --git a/dependencies/main/java/ic2/api/item/IBoxable.class b/dependencies/main/java/ic2/api/item/IBoxable.class deleted file mode 100644 index e28c75435afbbaa68311f3d877590af70bedd474..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 177 zcmXYrF$%&!5JmrJOjHmo^Z<6+xRBN^g%A)dVr4g3N7)kdE=m9Z diff --git a/dependencies/main/java/ic2/api/item/IC2Items.class b/dependencies/main/java/ic2/api/item/IC2Items.class deleted file mode 100644 index 1b24bc72000004c25fd3da777429eed2fbf044d7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1446 zcma)5YflqV5Iwgo-FCYOlsDoVaNA-R>l2HQS~O|0AO=I!ZD&Uv9bI;D4nK?7}=kL#70hF*PqZeu#3UV3bQIN@+m2m|{acC*b zWpEWG8P{-K!VMWRR0%gF++s*sZZqJnVKR*BmQm99mZe#N>1eeYot2eZnIXAgxmIwG zA+F}u7!p;lPX2wm<(kXe&bsM8 zV-m^&Tu^WqV#E|fObYJffrN^Jho~}49!goWZL`7cieZ?|<|E(te1_r9&55!y^dE*j zS>H4bl0Dxsykk4+;*B5U7RGV>91ubDLhwaQi~GGBGON%WaLWhRGWxpZT(d!&v{&kJl_(p=w{{sJ$p#%h3^>1O4Lq@VGrqd z$b5nPVjr1r`HzSRty&F^kfeYP2}_iJnfO*Pji+sm&fsDwy+l=A!W88bjiwR%g>ebf L5&<&=#Bli!0tHC5 diff --git a/dependencies/main/java/ic2/api/item/IC2Items.java b/dependencies/main/java/ic2/api/item/IC2Items.java index e79a30bec4..b0c1139819 100644 --- a/dependencies/main/java/ic2/api/item/IC2Items.java +++ b/dependencies/main/java/ic2/api/item/IC2Items.java @@ -17,7 +17,7 @@ * * Getting the associated Block/Item for an ItemStack x: Blocks: * ((ItemBlock)x.getItem).getBlock() Items: x.getItem() - * Alternatively, you can direwctly call IC2Items.instance.getItem(name) or IC2Items.instance.getBlock(name) + * Alternatively, you can directly call IC2Items.instance.getItem(name) or IC2Items.instance.getBlock(name) * * It is recommended, that you keep a reference to the Items you get here. * @@ -74,9 +74,11 @@ public static IItemAPI getItemAPI() { */ public static void setInstance(IItemAPI api) { ModContainer mc = Loader.instance().activeModContainer(); + if (mc == null || !"IC2".equals(mc.getModId())) { - throw new IllegalAccessError(); + throw new IllegalAccessError("invoked from "+mc); } + instance = api; } @@ -157,6 +159,7 @@ If you only want to access the Block, you have to use getItemAPI().getBlock() wi dust,small_silver Tiny Pile of Silver Dust dust,small_sulfur Tiny Pile of Sulfur Dust dust,small_tin Tiny Pile of Tin Dust +dust,tin_hydrated Hydrated Tin Dust ingot: ingot,alloy Mixed Metal Ingot @@ -222,6 +225,7 @@ nuclear,depleted_quad_mox Quad Fuel Rod (Depleted MOX) misc_resource,matter UU-Matter misc_resource,resin Sticky Resin misc_resource,slag Slag +misc_resource,iodine Iodine block_cutting_blade: block_cutting_blade,iron Block Cutting Blade (Iron) @@ -265,6 +269,8 @@ crafting,steel_shaft Shaft (Steel) crafting,carbon_rotor_blade Carbon Rotor Blade crafting,steam_turbine_blade Steam Turbine Blade crafting,steam_turbine Steam Turbine +crafting,jetpack_attachment_plate Jetpack Attachment Plate +crafting,coin Industrial Credit crystal_memory: crystal_memory Crystal Memory @@ -281,7 +287,7 @@ crafting,steel_shaft Shaft (Steel) crop_res,weed Weed terra_wart: -terra_wart item.terra_wart +terra_wart Terra Wart re_battery: re_battery RE-Battery @@ -361,6 +367,9 @@ crafting,steel_shaft Shaft (Steel) thick_neutron_reflector: thick_neutron_reflector Thick Neutron Reflector +iridium_reflector: +iridium_reflector Iridium Neutron Reflector + rsh_condensator: rsh_condensator RSH-Condensator @@ -423,6 +432,7 @@ lithium_fuel_rod Fuel Rod (Lithium) foam_sprayer: foam_sprayer CF Sprayer +foam_sprayer,ic2construction_foam CF Sprayer forge_hammer: forge_hammer Forge Hammer @@ -433,6 +443,9 @@ lithium_fuel_rod Fuel Rod (Lithium) meter: meter EU-Reader +remote: +remote Dynamite-O-Mote + tool_box: tool_box Tool Box @@ -454,9 +467,15 @@ lithium_fuel_rod Fuel Rod (Lithium) mug,dark_coffee Dark Coffee mug,coffee Coffee +crop_stick: +crop_stick Crop + cropnalyzer: cropnalyzer Cropnalyzer +crop_seed_bag: +crop_seed_bag * Seeds + weeding_trowel: weeding_trowel Weeding Trowel @@ -561,8 +580,11 @@ lithium_fuel_rod Fuel Rod (Lithium) upgrade,energy_storage Energy Storage Upgrade upgrade,redstone_inverter Redstone Signal Inverter Upgrade upgrade,ejector Ejector Upgrade +upgrade,advanced_ejector Advanced Ejector Upgrade upgrade,pulling Pulling Upgrade +upgrade,advanced_pulling Advanced Pulling Upgrade upgrade,fluid_ejector Fluid Ejector Upgrade +upgrade,fluid_pulling Fluid Pulling Upgrade advanced_batpack: advanced_batpack Adv.Batpack @@ -650,6 +672,9 @@ lithium_fuel_rod Fuel Rod (Lithium) filled_tin_can: filled_tin_can (Filled) Tin Can +iodine_tablet: +iodine_tablet Iodine Tablet + rotor_wood: rotor_wood Kinetic Gearbox Rotor (Wood) @@ -662,6 +687,12 @@ rotor_carbon Kinetic Gearbox Rotor (Carbon) rotor_steel: rotor_steel Kinetic Gearbox Rotor (Steel) +dynamite: +dynamite Dynamite + +dynamite_sticky: +dynamite_sticky Sticky Dynamite + ================================================= Blocks: @@ -750,6 +781,13 @@ te,chargepad_mfsu Charge Pad (MFSU) te,ev_transformer EV-Transformer te,tank Tank te,chunk_loader Chunk Loader +te,item_buffer_2 Compact Item Buffer +te,rci_rsh Reactor Coolant Injector (RSH) +te,rci_lzh Reactor Coolant Injector (LZH) +te,creative_generator Creative Generator +te,steam_repressurizer Steam Re-Pressurizer +te,industrial_workbench Industrial Workbench +te,batch_crafter Batch Crafter resource: resource,basalt Basalt @@ -791,7 +829,9 @@ te,chargepad_mfsu Charge Pad (MFSU) fence,iron Iron Fence sheet: +sheet,resin Resin Sheet sheet,rubber Rubber Sheet +sheet,wool Wool Sheet glass: glass,reinforced Reinforced Glass diff --git a/dependencies/main/java/ic2/api/item/ICustomDamageItem.class b/dependencies/main/java/ic2/api/item/ICustomDamageItem.class deleted file mode 100644 index 80020b8490b6b3dc9041520697c12ce05bad5070..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 386 zcmah_Jx>Bb5PgFu=QnC$X`+?axCt$tqRA!@3la;vaWh^P@0JTU5cz8s{s4cJaUm3N z4b6Nc@4b0%e*eCI0CaJd;v~f>p_7X~&T5^MeJ(i{!p+?vh?>#|aZ~uWo>pz(=RV{QTuU!|BOHw; zv#FD3U&L@%cJt6O)cu&}Ot|*0Yq;|3v`rM@e2Fs!huplpkHu-5KxoBp0!c#HLlOtV T{<^o3uJ!{QMntp`YYWH!kKJ$Z diff --git a/dependencies/main/java/ic2/api/item/IDebuggable.class b/dependencies/main/java/ic2/api/item/IDebuggable.class deleted file mode 100644 index 13c992baf8f97543f6017e2e6d95905ae026ca91..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 191 zcmX^0Z`VEs1_mPrZgvJvb_Om+2A<4fm(--v^z_7}oK!{zW)00KpkR7x30O2FwW5TP zK}18-Co8cmQ9ma!FI_*lq$o2l-I|esD>%QjC^^+F6QohV6Jd-VNHHUWL}s#)equqU zer8E(u0E1HP&L9h|D>$cAxI}B0x48|Ee)+^!%LbM!Lg|(}72ANWJXc2>r`NgIL|e^-!EE_vQLeS|i$~SCk(f0Tcyc3xzj?ZS>b#VrQ+p-R$JR HYY%(BR4P|o diff --git a/dependencies/main/java/ic2/api/item/IElectricItemManager.class b/dependencies/main/java/ic2/api/item/IElectricItemManager.class deleted file mode 100644 index dc89a3a67e5e78406028afd35b2ad96dc5a203f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 704 zcma))%}xR_6opR}X9Q93UzeI_WaA`kS*bvr1mXg8!LHUi7H2x76r!)@!Uyo7jCTse z#Fz}5o;11VyT4!GAD;l~IP!7eaCs>;kHSWE0d&#;Wmf9Ec}6?M7{RYH14YrLp_IE>kRpn z2Qk-C(6fe$Y%us4K}jkrceWwr>!lMTWLw2FrQ@&_OFRhWnSX>2wPfr&Vk_-N7!A K820F0!Tt~MOU$kS diff --git a/dependencies/main/java/ic2/api/item/IItemAPI.class b/dependencies/main/java/ic2/api/item/IItemAPI.class deleted file mode 100644 index 12684eb4bfed071c3ff476128237de12063a21bf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 339 zcma)&K?=e!5Jmq~ZM0T!;~jLN0k>T#A`}V=JwX~`No}i?=;2&=01qXmQWVsMn+#;~ z-u%h!ez^jeW5Cd7@CkmZOlVXQ8zJ|E)i}z;S@2wxDUVI1%QX1DnM9>BywIhRmDm}s zt$@EQ0ikQH%luFq`48hKpVUwJ6R#c^y0&*l4`AUMHqy2qQy3x)f*8; uTF$vR>LzW|Bn;mRZ<0(&;}Qst{U)H*CbZB7Z0*2(R)((a5PJ4>;5`6default blockstate for a specific block name and variant.
+ * For machines etc, you might want to make your detection a bit more fuzzy, + * because the BlockState also contains properties like the facing and the active + * state of a machine. + * @param name The name of the block. + * @param variant The variant of the block. + * @return The default state of the block with that variant. + */ + IBlockState getBlockState(String name, String variant); + /** * Get an ItemStack for a specific item name. * diff --git a/dependencies/main/java/ic2/api/item/IItemHudInfo.class b/dependencies/main/java/ic2/api/item/IItemHudInfo.class deleted file mode 100644 index 82e7f8297922343be25be779e5f6cc6beea73f8e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 281 zcmb7hZkY0Zh>i&q@AjsO4v diff --git a/dependencies/main/java/ic2/api/item/IItemHudInfo.java b/dependencies/main/java/ic2/api/item/IItemHudInfo.java index 35194f3663..112d691023 100644 --- a/dependencies/main/java/ic2/api/item/IItemHudInfo.java +++ b/dependencies/main/java/ic2/api/item/IItemHudInfo.java @@ -2,23 +2,32 @@ import java.util.List; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +/** + * An interface to allow the applied {@link Item} to override the overlay HUD text (which otherwise defaults to it's tooltip). + * + * @author Thunderdark + */ public interface IItemHudInfo { - /* - Add Info to Nano- and Quantum-Suit Helm Hud - for stack - - @Override - public List getHudInfo(ItemStack stack) { - List info = new LinkedList(); - info.add("i am a Cool Item"); - info.add("and have Cool info"); - return info; - } - - + /** + *

Adds info to {@link IItemHudProvider}s for the given stack. + * Return an empty list not null if no info is given.

+ * + *

+	 *	{@literal @}override
+	 *	public List{@literal <}String{@literal >} getHudInfo(ItemStack stack, boolean advanced) {
+	 *		List{@literal <}String{@literal >} info = new LinkedList{@literal <}String{@literal >}();
+	 *		info.add("I am a cool item");
+	 *		info.add("and have cool info.");
+	 * 		return info;
+	 * 	}
+	 *	
+ * + * @param stack The stack to get information for + * @param advanced Whether the HUD is in extended or advanced display mode + * @return A list of strings to draw in the overlay */ - - public List getHudInfo(ItemStack stack); -} + public List getHudInfo(ItemStack stack, boolean advanced); +} \ No newline at end of file diff --git a/dependencies/main/java/ic2/api/item/IItemHudProvider.java b/dependencies/main/java/ic2/api/item/IItemHudProvider.java new file mode 100644 index 0000000000..47639b3b92 --- /dev/null +++ b/dependencies/main/java/ic2/api/item/IItemHudProvider.java @@ -0,0 +1,46 @@ +package ic2.api.item; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +/** + * An interface to show that an {@link Item} can display the HUD overlay if worn. + * + * @author Chocohead + */ +public interface IItemHudProvider extends IElectricItem { + /** + * Whether the given stack should display the HUD overlay. + * + * @param stack The stack currently being worn + * @return Whether the HUD overlay should be drawn + */ + boolean doesProvideHUD(ItemStack stack); + + /** + * Gets the current {@link HudMode} of the worn stack (probably stored as NBT) + * + * @param stack The stack currently being worn + * @return The HUD overlay mode + */ + HudMode getHudMode(ItemStack stack); + + /** + *

Override the percent shown by the HUD overlay for the applied item.

+ * + *

By default, {@link IElectricItem}s have the percentage charged shown, + * damageable items have their {@link Item#getDurabilityForDisplay(ItemStack)} values shown + * and items that don't apply to either aren't shown at all.

+ * + * @author Chocohead + */ + public static interface IItemHudBarProvider { + /** + * Get the percent to show in the overlay HUD for the given stack. + * + * @param stack The stack to get the percent for. + * @return A number between 0 and 100, less than 0 will not render the item at all. + */ + int getBarPercent(ItemStack stack); + } +} \ No newline at end of file diff --git a/dependencies/main/java/ic2/api/item/IKineticRotor$GearboxType.class b/dependencies/main/java/ic2/api/item/IKineticRotor$GearboxType.class deleted file mode 100644 index 4c6ab9db614f136d3ad60d6095365e3602a6cfee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1125 zcmb7DZEw<06n-u(6iUY!FdaBwrZ{<-RB(O~varm}5D7~LvMhcowPKgjE~PB`uaqUu zXf*rmk20Ry5eHEdyiM-Sz2`aSdCp6J{QUAAKn0r-h*+2L067Us2?ZGnihSD$V?ie4 z21h&$V~L+72`WSIaJ#d6zz}_IXl~DW*Li1LgtCMR!}@$(R$Hb_TaxfANKf#a2>7pZLM(hn@B$*o z2WIdYdQmP>xPevQPNgCgXDmaY50DDQ)pLYC`sQi6D|ZRExpds|F>45u+_j027A3-0 z=_|yege06Je1?dBkwyO!4Spk&Fs1=J632+P&%ij_WpXiJM2d>Ej0_b)1BgOZ^DJd7f$+C{Gl%g5a z@F$O8!`dCK8or$AG>SVH4QrJIaJmv~v;HKI?(J#<4OV+ECh}DZ9Itm1sC@VM zp)_OvVK5=Z0%z;{SEuI$1TyaDfm~J~2M=(#gWUx4C?r@+`BI8y>^VgSm89-t+hN{0 KZMl=ZJo*CNd#hsr diff --git a/dependencies/main/java/ic2/api/item/IMetalArmor.class b/dependencies/main/java/ic2/api/item/IMetalArmor.class deleted file mode 100644 index 426278ae3f8ae70040b8b67ea394f3c7bcaa0388..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 217 zcmZ9GJqp4=6olu+n5bA-dIW7;NSn$+A*d*%vs;&^Y|J0)D&%Sw9>7D1Ne}`y!wlcR z%=`0v0SGYk;rkd6#`?BnE7PUP3Pae;wmDmo>7133XDhVjOhmQBR;p|GM>)6JR-#O0 z#YU{!bZA33KN3c9aW{(BI%UEn>V_7Hd`QAnt3b$7|5iF)x0{AYWquL+Q^Lx61cFna P2goJ#;5H8ZS{-;_nNvO= diff --git a/dependencies/main/java/ic2/api/item/ISpecialElectricItem.class b/dependencies/main/java/ic2/api/item/ISpecialElectricItem.class deleted file mode 100644 index ca93ed27787f6869d60018ba3201e86253b67b28..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 259 zcmZvXy9xq93`K9&$M|S$wX@U4fo&~CK~OCA3*r!$S!Y)nMnBHN5AdVJS+H=yB9}l; zPRQ&1cmhZtrue if this returns null. + * + * @param stack The itemstack being rendered + * @return The model location to be used + */ + ModelResourceLocation getModelLocation(ItemStack stack); +} \ No newline at end of file diff --git a/dependencies/main/java/ic2/api/item/ITerraformingBP.class b/dependencies/main/java/ic2/api/item/ITerraformingBP.class deleted file mode 100644 index dfe03a8ecdc5155c9ee8ba261aad001774c643d1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 502 zcmb7>y-ve06ot<%p=rbKz{tWz7c6znR(_;NNJJC~!Dh@Qa+}zdGC%pb~eaD=Q*M2D$rChQT=WUm_P1+$}tScYI?Mk~_ zjn}1^lvd4iTc@M@Fp*~$9%o%exLa?cwS1DPZJgo@U52O*vYQ`QZHh^LGLz4eaH!Q- z$c6q6`Zq(^Us0kAX^X3e87to>5PIPUfhZzuAPNh@Ci-oSF=*=$NgxPYL3`N#0%!1= AnE(I) diff --git a/dependencies/main/java/ic2/api/item/ITerraformingBP.java b/dependencies/main/java/ic2/api/item/ITerraformingBP.java index 8e6bc4aee1..9b27279fec 100644 --- a/dependencies/main/java/ic2/api/item/ITerraformingBP.java +++ b/dependencies/main/java/ic2/api/item/ITerraformingBP.java @@ -2,7 +2,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/dependencies/main/java/ic2/api/item/ItemWrapper.class b/dependencies/main/java/ic2/api/item/ItemWrapper.class deleted file mode 100644 index 5454f5effb4687138c583cb8d368fbacb325101c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2403 zcmb_eZBrXn7(F*HEJ>C^X`s+zTPl^j0IO6{8$^M&icL}k1Y2J(>6&ic>}HmYQ+^7+ zz%Tt`ooU4nPCMf#e}pss4QG5gce5dwG-EsC&gAZW?tSj_oafwg@8;LPe)<`}Jiba| z2yZ4Zh__OB8&{GjU{UqnNnr`^rtlt?RkNaDHH8GOD%WcouBV{m{UkoXnuZTG+z`-r z-TQLaHrIT!wkI%EthhC!>bh0iG}x`V4qvuyR(zw>uzjm0>jiLcTrWg->;FtuI*J}- z>sz!O%U=?RX0qD?u~qjDiyJHwbGcF5HN7oGlfZD%tw?)YdX}=o!I*#7B70{#s$qdU zo~+kRPnF}DRcp^Ty|6}s%b6FYB|xUg6BzHgRzM3kRp4|7q87gb>56n#%uV0*%sXq& zmh0MFBrw?%)21&g-xRX91>$?ED{!tCgr=*&K+q}4dO(wgqJ|O~Y!T7k0fB{{c{?T2 zUR6+Z#HA8QH}}WfsB&wsZ42D!nXHMtqb}3&Eq~vr+j8IZjBA0l9vA@~$=Z>U1p1m@ z0=ef8BGA8Bu|xSKH{FI;F|S)nY(q-;p@in{$#12O(-_ln62ltGI&NZJ!$&$cu&HAU zA8Xjwv4c;@vyNN1t>aUCCNT2ML#AU2mvoF^SYYhm9&NI877DP*+p_1${UWcO*5yrwRyXE~xb9Wa5H zXeDqC=flNU5oJPpJVYdyKSVT&opy|5FqcM(092gOrY|lKta@}@#LJA7P+AWoKB7;I zbLHG4#EJ~dsPPC6(I-%vIfN!~fC+Z`1)d;Lp3NO18R1ww_Tam}f6qTf;sC>WP92+w zK48Qsi2#3nY{w91Z+rVkKYmHc~jyk~6P5nv2BZ z3P;HXSC2x)1{U(kHKmEECEJ9~`WQkKJAYo>sfFu#NhvGGV0b&bF&M=Up`_d5zBZWj zDQ@|VRB^0;vecG+ZIx)bP_X}V8JzBt+0IF8pH^$~O=i8;~(H3<+us4&}nU7_Hw&-pZ)IM=J%f;zW~(n(13wr3MrJ*Si|kW+zHHG9qR@X zC>pqjvW|+5DnshHCzWvIP%&g%hx~|JBPAWHEmVV|ZF%5wHSz_+=Gkbor7LWo zzf)Gn@$C23lfX8%>1v`WU8%MiX3CX4hS-kRB}leK7haC~9pS&`9fv%*mS=NkkNYy% zN6wh)$st3jCGEP!2ht)*!g~5);CMsnx%>Y#Q=SFh?Vj#MHx$6IQocl9peG*cWmvxC z9K)h7`reT^&(FzWm}x3@v08AZiRH&%LxJOi-?YW9emmV%ZA?$dLLsWV-@@HIeOvqi|>yu1|V#Ewb zjy#RZ*&%CC6)Bo$fRUv>(3+v0hFQevo7zKmo;((vp1S7<>=^uLiEccn(V Im5{vp7i$meMF0Q* diff --git a/dependencies/main/java/ic2/api/tile/IEnergyStorage.class b/dependencies/main/java/ic2/api/tile/IEnergyStorage.class deleted file mode 100644 index 60375238491bcf122581a59c1a95c390b50117d5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 358 zcmY+Ay-ve06orpVXlTn%p%M!lQ?g*GD`RP;NJvF$VPJEeOXQL`k>eooY79I84~4i% zD-es1_30d+d;RtO@d;pxNr>|h7XpKf{K}V(Qh|dgPMFkxB#4suiIGavxh0pq3$%z` zBhJlKrL^%3+gFy2uNp6K^?Tn%9~u5-Ovct$I^Dgwa!}DkC{g z^1nr3+?r&rY$lhREot8u5a{vG0AavGA^=zq(eE_GQKy4FAMSO8EyeD*N@ E0RZ4vJ^%m! diff --git a/dependencies/main/java/ic2/api/tile/IRotorProvider.java b/dependencies/main/java/ic2/api/tile/IRotorProvider.java new file mode 100644 index 0000000000..0a3597e1e2 --- /dev/null +++ b/dependencies/main/java/ic2/api/tile/IRotorProvider.java @@ -0,0 +1,33 @@ +package ic2.api.tile; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; + +import ic2.api.item.IKineticRotor; + +/** + * Interface for {@link TileEntity}s that can have rotors, see also {@link IKineticRotor}
+ * Use the {@link RotorRegistry} to use IC2's default windmill renderer + */ +public interface IRotorProvider { + /** + * @return Radius of current rotor (in blocks), or 0 for no rotor + */ + public int getRotorDiameter(); + + /** + * @return The current direction the rotor is facing + */ + public EnumFacing getFacing(); + + /** + * @return Angle (in degrees) to render the rotor at + */ + public float getAngle(); + + /** + * @return Texture of the current rotor, called every tick so remember to store in a variable + */ + public ResourceLocation getRotorRenderTexture(); +} \ No newline at end of file diff --git a/dependencies/main/java/ic2/api/tile/IWrenchable.class b/dependencies/main/java/ic2/api/tile/IWrenchable.class deleted file mode 100644 index e9359e83cb8e8d32fd3c191d04943393b61519f7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 982 zcmdT@!Ab)$5S`T8+Ny26`3d&oK(8wv)D{*B7Aq9JrEy%-?qZULloP9pYIStLY$4z4lMpuF0a+(;oArUp$Y0=2=5iNRzSJE^!vhB_-H(w}HEO z?OOrOMM6eBoJ(^>Q9LIBw5i6{FgIBAkt4rI;#n%-WmClC+!0Kzw1mF1XPD!ndu$$k z_IS;3B~7vDmm&Oie-JFBqc&KlIYZkMY{u*YcMp~eU3drl_+ diff --git a/dependencies/main/java/ic2/api/tile/IWrenchable.java b/dependencies/main/java/ic2/api/tile/IWrenchable.java index 436e7043f9..f43067b3ab 100644 --- a/dependencies/main/java/ic2/api/tile/IWrenchable.java +++ b/dependencies/main/java/ic2/api/tile/IWrenchable.java @@ -6,13 +6,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** * Allows a block to make use of the wrench's removal and rotation functions. - * Needs to be implemented on the Block. */ public interface IWrenchable { /** diff --git a/dependencies/main/java/ic2/api/tile/RotorRegistry.java b/dependencies/main/java/ic2/api/tile/RotorRegistry.java new file mode 100644 index 0000000000..dd652f2ccc --- /dev/null +++ b/dependencies/main/java/ic2/api/tile/RotorRegistry.java @@ -0,0 +1,43 @@ +package ic2.api.tile; + +import static net.minecraftforge.fml.relauncher.Side.CLIENT; + +import net.minecraft.tileentity.TileEntity; + +import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.ModContainer; +import net.minecraftforge.fml.relauncher.SideOnly; + +/** + * Helper class for registering {@link IRotorProvider}s to provide the default windmill renderer + */ +@SideOnly(CLIENT) +public class RotorRegistry { + /** + * Method to register a tile entity with the default IC2 windmill TESH + * @param clazz {@link TileEntity} that implements {@link IRotorProvider} + * @param Type checking to ensure only {@link IRotorProvider} implementing classes are registered + */ + public static void registerRotorProvider(Class clazz) { + if (INSTANCE != null) INSTANCE.registerRotorProvider(clazz); + } + + /** + * Sets the internal Registry instance. + * ONLY IC2 CAN DO THIS!!!!!!! + */ + public static void setInstance(IRotorRegistry i) { + ModContainer mc = Loader.instance().activeModContainer(); + if (mc == null || !"IC2".equals(mc.getModId())) { + throw new IllegalAccessError("Only IC2 can set the instance"); + } else { + INSTANCE = i; + } + } + + private static IRotorRegistry INSTANCE; + + public static interface IRotorRegistry { + public void registerRotorProvider(Class clazz); + } +} \ No newline at end of file diff --git a/dependencies/main/java/ic2/api/tile/package-info.class b/dependencies/main/java/ic2/api/tile/package-info.class deleted file mode 100644 index 9cd6bac26a2270b1d2724db36d5fe4f661f76cb1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 264 zcmYjMO-lno41LquZmr)31<#)C=w3Y)K`01{LhsWtyQJ=9mYHe&Zyx*s{wOi^WDW^= z;eF)$=kp6djgtyT6^;$2uW^$+J#a?`XT9_9uBB_1CeGGw>kKYmHc~jyk~6P5nv2BZ z3P;HXSC2x)1{U(kHKmEECEJ9~`WQkKJAYo>sfFu#NhvGGV0b&bF&M=Up`_d5zBZWj zDQ@|VRB^0;vecG+ZIx(?CbR!@8JzBt+0IF8pH^$~n3q3$WBJD-cxtv;rwRcCItP6xWVyr%|rPf&*|Ugi~2& z<4^BB`ORp4e!so}U=Dc((+o}+jLBUq|Ag(WX*7e2v!zDQx1>>8@#Z;dPrl`q5-nPO zw^uKFadrO6U`p=B824Y0lUo?u2wSGk3Ax95TP1x;Ze>a=8uIcZxifMFl}LIQMjG3u zAT-|BW%nalVQQgKd?sU5nA%EQkixLjL-5xotZ=yzJHcQ^a?V9Xy!NDcN*Ux`&Xv&b r{CT}W=?4rL^umPzhJ6MH&<6-Sj2uK}k;BNN$Wi2R$IvtmZx1GaY*}Cn diff --git a/dependencies/main/java/ic2/api/util/Keys.class b/dependencies/main/java/ic2/api/util/Keys.class deleted file mode 100644 index 0e5ff7fba04b7194a7a606cf39083cbb14bde8f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 309 zcmY*UyH3ME5S(?KIG8{lG_-U;!AWUBG)PDYD-@vg>&po?GG}C;k@zesBnm!&k3#H0 znl!t!vooXJ@1M^v0CUW8^f1ma$uK1h#kYaIb%eu0?A-8+m@Y_VZf@OMS#z^GCk!sc zOSmNTj!%|^^r~K|VO)rJi|)B}%>$Q}GP9z#TrIhgIB&=_JV{G9*pAoqR+IDlx@)Yv zmT2FJ6HsA<}z659hQuP0j-i%C{p-x6SY44wY bfZi1(DufCmnIhLZ`WIkVQ4HGCnqdDIWCB0l diff --git a/dependencies/main/java/ic2/api/util/package-info.class b/dependencies/main/java/ic2/api/util/package-info.class deleted file mode 100644 index 6aa78d24c1b36f8cfd5472f09a6ff8958d92623d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 264 zcmYjM$w~u35PhAPOpIGRD0ud4TIcF12tq(GDCFL0Yle!w4Bb8P-#qvMew0}8WF4xg zSG=XZe?Gqe)HthfQsGo#`WpLW>5&~NoOi~)o0e`kG;zK)JEL&*(ucyH)|`3cXc0mz zrf>{d;rc01(Vhd@WSY{%)RJzz(>8h^gI=tb_hMl>UQ^1#Q5fFMZxu%IBT$lU`A{oN zx)gW(Mxr4=|E>A(ycr ORmKE|8B-i(9RC7jZbOd% diff --git a/dependencies/main/java/ic2/api/util/package-info.java b/dependencies/main/java/ic2/api/util/package-info.java deleted file mode 100644 index 8fe79432f3..0000000000 --- a/dependencies/main/java/ic2/api/util/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.util; -import net.minecraftforge.fml.common.API; - diff --git a/dependencies/main/java/mekanism/api/gas/Gas.java b/dependencies/main/java/mekanism/api/gas/Gas.java index 04bcf609d7..5d5a36201b 100644 --- a/dependencies/main/java/mekanism/api/gas/Gas.java +++ b/dependencies/main/java/mekanism/api/gas/Gas.java @@ -4,7 +4,7 @@ import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; +import net.minecraft.util.text.translation.I18n; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; @@ -95,7 +95,7 @@ public String getUnlocalizedName() */ public String getLocalizedName() { - return StatCollector.translateToLocal(getUnlocalizedName()); + return I18n.translateToLocal(getUnlocalizedName()); } /** diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/GalacticraftRegistry.java b/src/main/java/micdoodle8/mods/galacticraft/api/GalacticraftRegistry.java index ab5fd9b384..914dfd6f7e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/GalacticraftRegistry.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/GalacticraftRegistry.java @@ -10,10 +10,10 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import net.minecraft.world.DimensionType; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldProviderSurface; import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.fml.common.FMLLog; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -34,7 +34,7 @@ public class GalacticraftRegistry private static List astroMinerRecipes = new ArrayList(); private static Map, ResourceLocation> rocketGuiMap = new HashMap, ResourceLocation>(); private static Map> dungeonLootMap = new HashMap>(); - private static List worldProviderIDs = new ArrayList(); + private static List dimensionTypeIDs = new ArrayList(); private static List gameScreens = new ArrayList(); private static int maxScreenTypes; private static Map> gearMap = new HashMap<>(); @@ -205,47 +205,19 @@ public static List getDungeonLoot(int tier) } /*** - * Now returns a boolean to indicate whether registration of the WorldProvider type was successful. - * (If it failed, you should probably set the CelestialBody as unreachable.) - * - * @param id - * @param provider - * @param keepLoaded - * @return success - */ - public static boolean registerProvider(int id, Class provider, boolean keepLoaded, int defaultID) - { - boolean flag = DimensionManager.registerProviderType(id, provider, keepLoaded); - if (flag) - { - GalacticraftRegistry.worldProviderIDs.add(id); - return true; - } - else - { - GalacticraftRegistry.worldProviderIDs.add(defaultID); //Adding the 0 here preserves the order, important for network compatibility between GC versions - FMLLog.severe("Could not register dimension " + id + " - does it clash with another mod? Change the ID in config."); - return false; - } - } - - /** - * You should now use GalacticraftRegistry.registerProvider(int id, Class provider, boolean keepLoaded, int defaultID) - * which returns a boolean indicating if the Provider was registered OK. - * - * @param id - * @param provider - * @param keepLoaded + * Register a Galacticraft dimension */ - @Deprecated - public static void registerProvider(int id, Class provider, boolean keepLoaded) + public static DimensionType registerDimension(String name, String suffix, int id, Class provider, boolean keepLoaded) throws IllegalArgumentException { - GalacticraftRegistry.registerProvider(id, provider, keepLoaded, 0); + DimensionType type = DimensionType.register(name, suffix, id, provider, keepLoaded); + DimensionManager.registerDimension(id, type); + GalacticraftRegistry.dimensionTypeIDs.add(id); + return type; } - public static int getProviderID(int index) + public static int getDimensionTypeID(int index) { - return GalacticraftRegistry.worldProviderIDs.get(index); + return GalacticraftRegistry.dimensionTypeIDs.get(index); } /** diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/client/tabs/AbstractTab.java b/src/main/java/micdoodle8/mods/galacticraft/api/client/tabs/AbstractTab.java index 59dc3ded4d..d8d830f4fd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/client/tabs/AbstractTab.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/client/tabs/AbstractTab.java @@ -3,7 +3,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.client.renderer.RenderItem; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.FMLClientHandler; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/client/tabs/InventoryTabVanilla.java b/src/main/java/micdoodle8/mods/galacticraft/api/client/tabs/InventoryTabVanilla.java index 21ba2889cf..cbf566016f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/client/tabs/InventoryTabVanilla.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/client/tabs/InventoryTabVanilla.java @@ -7,7 +7,7 @@ public class InventoryTabVanilla extends AbstractTab { public InventoryTabVanilla() { - super(0, 0, 0, new ItemStack(Blocks.crafting_table)); + super(0, 0, 0, new ItemStack(Blocks.CRAFTING_TABLE)); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/client/tabs/TabRegistry.java b/src/main/java/micdoodle8/mods/galacticraft/api/client/tabs/TabRegistry.java index 6c4d50b110..958a09bcb0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/client/tabs/TabRegistry.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/client/tabs/TabRegistry.java @@ -3,7 +3,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiInventory; -import net.minecraft.network.play.client.C0DPacketCloseWindow; +import net.minecraft.network.play.client.CPacketCloseWindow; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.Loader; @@ -37,14 +37,14 @@ public static void addTabsToInventory (GuiContainer gui) @SubscribeEvent public void guiPostInit (GuiScreenEvent.InitGuiEvent.Post event) { - if (event.gui instanceof GuiInventory) + if (event.getGui() instanceof GuiInventory) { - int guiLeft = (event.gui.width - 176) / 2; - int guiTop = (event.gui.height - 166) / 2; + int guiLeft = (event.getGui().width - 176) / 2; + int guiTop = (event.getGui().height - 166) / 2; guiLeft += getPotionOffset(); TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabVanilla.class); - TabRegistry.addTabsToList(event.buttonList); + TabRegistry.addTabsToList(event.getButtonList()); } } @@ -53,7 +53,7 @@ public void guiPostInit (GuiScreenEvent.InitGuiEvent.Post event) public static void openInventoryGui() { - TabRegistry.mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(mc.thePlayer.openContainer.windowId)); + TabRegistry.mc.thePlayer.connection.sendPacket(new CPacketCloseWindow(mc.thePlayer.openContainer.windowId)); GuiInventory inventory = new GuiInventory(TabRegistry.mc.thePlayer); TabRegistry.mc.displayGuiScreen(inventory); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/entity/IRocketType.java b/src/main/java/micdoodle8/mods/galacticraft/api/entity/IRocketType.java index 6fa6a48148..6824878649 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/entity/IRocketType.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/entity/IRocketType.java @@ -1,16 +1,16 @@ package micdoodle8.mods.galacticraft.api.entity; -import net.minecraft.util.StatCollector; +import net.minecraft.util.text.translation.I18n; public interface IRocketType { public static enum EnumRocketType { DEFAULT(0, "", false, 2), - INVENTORY27(1, StatCollector.translateToLocal("gui.rocket_type.0"), false, 20), - INVENTORY36(2, StatCollector.translateToLocal("gui.rocket_type.1"), false, 38), - INVENTORY54(3, StatCollector.translateToLocal("gui.rocket_type.2"), false, 56), - PREFUELED(4, StatCollector.translateToLocal("gui.rocket_type.3"), true, 2); + INVENTORY27(1, I18n.translateToLocal("gui.rocket_type.0"), false, 20), + INVENTORY36(2, I18n.translateToLocal("gui.rocket_type.1"), false, 38), + INVENTORY54(3, I18n.translateToLocal("gui.rocket_type.2"), false, 56), + PREFUELED(4, I18n.translateToLocal("gui.rocket_type.3"), true, 2); private int index; private String tooltip; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/galaxies/CelestialBody.java b/src/main/java/micdoodle8/mods/galacticraft/api/galaxies/CelestialBody.java index ca831c5446..5b6fbe6644 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/galaxies/CelestialBody.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/galaxies/CelestialBody.java @@ -2,7 +2,7 @@ import micdoodle8.mods.galacticraft.api.world.IAtmosphericGas; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; +import net.minecraft.util.text.translation.I18n; import net.minecraft.world.WorldProvider; import org.apache.commons.lang3.builder.EqualsBuilder; @@ -20,8 +20,9 @@ public abstract class CelestialBody implements Comparable protected ScalableDistance relativeDistanceFromCenter = new ScalableDistance(1.0F, 1.0F); protected float relativeOrbitTime = 1.0F; protected float phaseShift = 0.0F; - protected int dimensionID = 0; + protected int dimensionID = -1; protected Class providerClass; + protected String dimensionSuffix; protected boolean autoRegisterDimension = false; protected boolean isReachable = false; protected boolean forceStaticLoad = true; @@ -60,7 +61,7 @@ public String getUnlocalizedName() public String getLocalizedName() { String s = this.getUnlocalizedName(); - s = s == null ? "" : StatCollector.translateToLocal(s); + s = s == null ? "" : I18n.translateToLocal(s); int comment = s.indexOf('#'); return (comment > 0) ? s.substring(0, comment).trim() : s; } @@ -298,4 +299,14 @@ public void setUnreachable() { this.isReachable = false; } + + public String getDimensionSuffix() + { + return dimensionSuffix; + } + + public void setDimensionSuffix(String dimensionSuffix) + { + this.dimensionSuffix = dimensionSuffix; + } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/galaxies/SolarSystem.java b/src/main/java/micdoodle8/mods/galacticraft/api/galaxies/SolarSystem.java index eeee9aa3b5..f833ad2b91 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/galaxies/SolarSystem.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/galaxies/SolarSystem.java @@ -1,7 +1,7 @@ package micdoodle8.mods.galacticraft.api.galaxies; import micdoodle8.mods.galacticraft.api.vector.Vector3; -import net.minecraft.util.StatCollector; +import net.minecraft.util.text.translation.I18n; import java.util.Locale; @@ -33,7 +33,7 @@ public final int getID() public String getLocalizedName() { String s = this.getUnlocalizedName(); - return s == null ? "" : StatCollector.translateToLocal(s); + return s == null ? "" : I18n.translateToLocal(s); } public String getUnlocalizedName() @@ -67,7 +67,7 @@ public SolarSystem setMainStar(Star star) public String getLocalizedParentGalaxyName() { String s = this.getUnlocalizedParentGalaxyName(); - return s == null ? "" : StatCollector.translateToLocal(s); + return s == null ? "" : I18n.translateToLocal(s); } public String getUnlocalizedParentGalaxyName() diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityAutoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityAutoRocket.java index 525638270e..751c9413f6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityAutoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityAutoRocket.java @@ -12,7 +12,8 @@ import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.blocks.BlockLandingPadFull; import micdoodle8.mods.galacticraft.core.client.sounds.SoundUpdaterRocket; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.event.EventLandingPadRemoval; import micdoodle8.mods.galacticraft.core.network.IPacketReceiver; import micdoodle8.mods.galacticraft.core.tile.TileEntityFuelLoader; @@ -32,7 +33,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.translation.I18n; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.MinecraftForge; @@ -105,13 +108,13 @@ public boolean checkLaunchValidity() if (!this.setFrequency()) { this.destinationFrequency = -1; - this.statusMessage = StatCollector.translateToLocal("gui.message.frequency.name") + "#" + StatCollector.translateToLocal("gui.message.not_set.name"); + this.statusMessage = I18n.translateToLocal("gui.message.frequency.name") + "#" + I18n.translateToLocal("gui.message.not_set.name"); this.statusColour = "\u00a7c"; return false; } else { - this.statusMessage = StatCollector.translateToLocal("gui.message.success.name"); + this.statusMessage = I18n.translateToLocal("gui.message.success.name"); this.statusColour = "\u00a7a"; return true; } @@ -120,7 +123,7 @@ public boolean checkLaunchValidity() else { this.destinationFrequency = -1; - this.statusMessage = StatCollector.translateToLocal("gui.message.not_enough.name") + "#" + StatCollector.translateToLocal("gui.message.fuel.name"); + this.statusMessage = I18n.translateToLocal("gui.message.not_enough.name") + "#" + I18n.translateToLocal("gui.message.fuel.name"); this.statusColour = "\u00a7c"; return false; } @@ -342,7 +345,7 @@ public void onUpdate() this.autoLaunch(); } - if (this.autoLaunchCountdown > 0 && (!(this instanceof EntityTieredRocket) || this.riddenByEntity != null)) + if (this.autoLaunchCountdown > 0 && (!(this instanceof EntityTieredRocket) || !this.getPassengers().isEmpty())) { this.autoLaunchCountdown--; @@ -352,14 +355,14 @@ public void onUpdate() } } - if (this.autoLaunchSetting == EnumAutoLaunch.ROCKET_IS_FUELED && this.fuelTank.getFluidAmount() == this.fuelTank.getCapacity() && (!(this instanceof EntityTieredRocket) || this.riddenByEntity != null)) + if (this.autoLaunchSetting == EnumAutoLaunch.ROCKET_IS_FUELED && this.fuelTank.getFluidAmount() == this.fuelTank.getCapacity() && (!(this instanceof EntityTieredRocket) || !this.getPassengers().isEmpty())) { this.autoLaunch(); } if (this.autoLaunchSetting == EnumAutoLaunch.INSTANT) { - if (this.autoLaunchCountdown == 0 && (!(this instanceof EntityTieredRocket) || this.riddenByEntity != null)) + if (this.autoLaunchCountdown == 0 && (!(this instanceof EntityTieredRocket) || !this.getPassengers().isEmpty())) { this.autoLaunch(); } @@ -659,7 +662,7 @@ public void decodePacketdata(ByteBuf buffer) if (this.worldObj.isRemote) { int shouldBeMountedId = buffer.readInt(); - if (this.riddenByEntity == null) + if (this.getPassengers().isEmpty()) { if (shouldBeMountedId > -1) { @@ -670,20 +673,20 @@ public void decodePacketdata(ByteBuf buffer) { if (e instanceof EntityPlayer) { - e = WorldUtil.forceRespawnClient(this.dimension, e.worldObj.getDifficulty().getDifficultyId(), e.worldObj.getWorldInfo().getTerrainType().getWorldTypeName(), ((EntityPlayerMP)e).theItemInWorldManager.getGameType().getID()); - e.mountEntity(this); + e = WorldUtil.forceRespawnClient(this.dimension, e.worldObj.getDifficulty().getDifficultyId(), e.worldObj.getWorldInfo().getTerrainType().getWorldTypeName(), ((EntityPlayerMP)e).interactionManager.getGameType().getID()); + e.startRiding(this); } } else - e.mountEntity(this); + e.startRiding(this); } } } - else if (this.riddenByEntity.getEntityId() != shouldBeMountedId) + else if (this.getPassengers().get(0).getEntityId() != shouldBeMountedId) { if (shouldBeMountedId == -1) { - this.riddenByEntity.mountEntity(null); + this.removePassengers(); } else { @@ -694,12 +697,12 @@ else if (this.riddenByEntity.getEntityId() != shouldBeMountedId) { if (e instanceof EntityPlayer) { - e = WorldUtil.forceRespawnClient(this.dimension, e.worldObj.getDifficulty().getDifficultyId(), e.worldObj.getWorldInfo().getTerrainType().getWorldTypeName(), ((EntityPlayerMP)e).theItemInWorldManager.getGameType().getID()); - e.mountEntity(this); + e = WorldUtil.forceRespawnClient(this.dimension, e.worldObj.getDifficulty().getDifficultyId(), e.worldObj.getWorldInfo().getTerrainType().getWorldTypeName(), ((EntityPlayerMP)e).interactionManager.getGameType().getID()); + e.startRiding(this); } } else - e.mountEntity(this); + e.startRiding(this); } } } @@ -740,7 +743,7 @@ public void getNetworkedData(ArrayList list) if (!this.worldObj.isRemote) { - list.add(this.riddenByEntity == null ? -1 : this.riddenByEntity.getEntityId()); + list.add(this.getPassengers().isEmpty() ? -1 : this.getPassengers().get(0).getEntityId()); } list.add(this.statusColour != null ? this.statusColour : ""); } @@ -796,9 +799,9 @@ public void cancelLaunch() { this.setLaunchPhase(EnumLaunchPhase.UNIGNITED); this.timeUntilLaunch = 0; - if (!this.worldObj.isRemote && this.riddenByEntity instanceof EntityPlayerMP) + if (!this.worldObj.isRemote && !this.getPassengers().isEmpty() && this.getPassengers().get(0) instanceof EntityPlayerMP) { - ((EntityPlayerMP) this.riddenByEntity).addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.nogyroscope"))); + this.getPassengers().get(0).addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.nogyroscope"))); } } @@ -829,16 +832,17 @@ public void onLaunch() if (!this.worldObj.isRemote) { - GCPlayerStats stats = null; + IStatsCapability stats = null; - if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayerMP) + if (!this.getPassengers().isEmpty() && this.getPassengers().get(0) instanceof EntityPlayerMP) { - stats = GCPlayerStats.get((EntityPlayerMP) this.riddenByEntity); + EntityPlayerMP player = (EntityPlayerMP) this.getPassengers().get(0); + stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); if (!(this.worldObj.provider instanceof IOrbitDimension)) { - stats.coordsTeleportedFromX = this.riddenByEntity.posX; - stats.coordsTeleportedFromZ = this.riddenByEntity.posZ; + stats.setCoordsTeleportedFromX(player.posX); + stats.setCoordsTeleportedFromZ(player.posZ); } } @@ -876,7 +880,7 @@ public void onLaunch() //Set the player's launchpad item for return on landing - or null if launchpads not removed if (stats != null) { - stats.launchpadStack = amountRemoved == 9 ? new ItemStack(GCBlocks.landingPad, 9, 0) : null; + stats.setLaunchpadStack(amountRemoved == 9 ? new ItemStack(GCBlocks.landingPad, 9, 0) : null); } this.playSound(SoundEvents.ENTITY_ITEM_PICKUP, 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java index a3f6195ccd..e24c3516fc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java @@ -8,7 +8,8 @@ import micdoodle8.mods.galacticraft.api.world.IExitHeight; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.client.gui.screen.GameScreenText; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.network.IPacketReceiver; import micdoodle8.mods.galacticraft.core.network.PacketDynamic; import micdoodle8.mods.galacticraft.core.tile.TileEntityTelemetry; @@ -24,9 +25,9 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityEvent; @@ -66,7 +67,20 @@ public EntitySpaceshipBase(World par1World) this.launchPhase = EnumLaunchPhase.UNIGNITED.ordinal(); this.preventEntitySpawning = true; this.ignoreFrustumCheck = true; - this.renderDistanceWeight = 5.0D; + } + + @Override + public boolean isInRangeToRenderDist(double distance) + { + double d0 = this.getEntityBoundingBox().getAverageEdgeLength(); + + if (Double.isNaN(d0)) + { + d0 = 1.0D; + } + + d0 = d0 * 64.0D * 5.0; + return distance < d0 * d0; } public abstract int getMaxFuel(); @@ -128,10 +142,7 @@ public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) if (flag || this.shipDamage > 90 && !this.worldObj.isRemote) { - if (this.riddenByEntity != null) - { - this.riddenByEntity.mountEntity(null); - } + this.removePassengers(); if (flag) { @@ -218,10 +229,10 @@ public void onUpdate() } } } - - if (this.riddenByEntity != null) + + for (Entity e : this.getPassengers()) { - this.riddenByEntity.fallDistance = 0.0F; + e.fallDistance = 0.0F; } if (this.posY > (this.worldObj.provider instanceof IExitHeight ? ((IExitHeight) this.worldObj.provider).getYCoordinateToTeleport() : 1200)) @@ -250,16 +261,21 @@ public void onUpdate() else if (this.posY > (this.worldObj.provider instanceof IExitHeight ? ((IExitHeight) this.worldObj.provider).getYCoordinateToTeleport() : 1200) + 100) { - if (this.riddenByEntity instanceof EntityPlayerMP) - { - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) this.riddenByEntity); - if (stats.usingPlanetSelectionGui) - { - this.kill(); - } - } - else - this.kill(); + for (Entity e : this.getPassengers()) + { + if (e instanceof EntityPlayerMP) + { + IStatsCapability stats = e.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + if (stats.isUsingPlanetSelectionGui()) + { + this.kill(); + } + } + else + { + this.kill(); + } + } } } @@ -282,9 +298,7 @@ public void onUpdate() this.timeUntilLaunch--; } - AxisAlignedBB box = null; - - box = this.getEntityBoundingBox().expand(0.2D, 0.2D, 0.2D); + AxisAlignedBB box = this.getEntityBoundingBox().expand(0.2D, 0.2D, 0.2D); final List var15 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box); @@ -294,7 +308,7 @@ public void onUpdate() { final Entity var17 = (Entity) var15.get(var52); - if (var17 != this.riddenByEntity) + if (this.getPassengers().contains(var17)) { var17.applyEntityCollision(this); } @@ -401,9 +415,9 @@ public void turnPitch(float f) protected void failRocket() { - if (this.riddenByEntity != null) + for (Entity passenger : this.getPassengers()) { - this.riddenByEntity.attackEntityFrom(DamageSourceGC.spaceshipCrash, (int) (4.0D * 20 + 1.0D)); + passenger.attackEntityFrom(DamageSourceGC.spaceshipCrash, (int) (4.0D * 20 + 1.0D)); } if (!ConfigManagerCore.disableSpaceshipGrief) diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java index 1c64091e31..117855b1bc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java @@ -11,7 +11,8 @@ import micdoodle8.mods.galacticraft.api.vector.BlockVec3; import micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.network.PacketSimple; import micdoodle8.mods.galacticraft.core.network.PacketSimple.EnumSimplePacket; import micdoodle8.mods.galacticraft.core.tile.TileEntityFuelLoader; @@ -22,15 +23,18 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldServer; import net.minecraftforge.fml.common.FMLCommonHandler; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.Iterator; @@ -137,15 +141,15 @@ public void onUpdate() { if (this.getWaitForPlayer()) { - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { + Entity passenger = this.getPassengers().get(0); if (this.ticks >= 40) { if (!this.worldObj.isRemote) { - Entity e = this.riddenByEntity; - e.mountEntity(null); - e.mountEntity(this); + this.removePassengers(); + passenger.startRiding(this, true); if (ConfigManagerCore.enableDebug) GCLog.info("Remounting player in rocket."); } @@ -155,7 +159,7 @@ public void onUpdate() else { this.motionX = this.motionY = this.motionZ = 0.0D; - this.riddenByEntity.motionX = this.riddenByEntity.motionY = this.riddenByEntity.motionZ = 0; + passenger.motionX = passenger.motionY = passenger.motionZ = 0; } } else @@ -235,10 +239,10 @@ else if (this.rumble < 0) this.rumble++; } - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { - this.riddenByEntity.posX += this.rumble / (37F - 5F * this.getRocketTier()); - this.riddenByEntity.posZ += this.rumble / (37F - 5F * this.getRocketTier()); + this.getPassengers().get(0).posX += this.rumble / (37F - 5F * this.getRocketTier()); + this.getPassengers().get(0).posZ += this.rumble / (37F - 5F * this.getRocketTier()); } if (this.launchPhase == EnumLaunchPhase.IGNITED.ordinal() || this.launchPhase == EnumLaunchPhase.LAUNCHED.ordinal()) @@ -330,27 +334,27 @@ public void onReachAtmosphere() if (dimensionAllowed) { - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { - WorldUtil.transferEntityToDimension(this.riddenByEntity, this.targetDimension, (WorldServer) targetDim.worldObj, false, this); + WorldUtil.transferEntityToDimension(this.getPassengers().get(0), this.targetDimension, (WorldServer) targetDim.worldObj, false, this); //Now destroy the rocket entity, the rider is switching dimensions this.setDead(); } - else { - Entity e = WorldUtil.transferEntityToDimension(this, this.targetDimension, (WorldServer)targetDim.worldObj, false, null); - if(e instanceof EntityAutoRocket) { - e.setPosition(this.targetVec.getX() + 0.5F, this.targetVec.getY() + 800, this.targetVec.getZ() + 0.5f); - ((EntityAutoRocket)e).landing = true; - ((EntityAutoRocket)e).setWaitForPlayer(false); - if(e != this) - this.setDead(); - } - else { - GCLog.info("Error: failed to recreate the unmanned rocket in landing mode on target planet."); - e.setDead(); + else { + Entity e = WorldUtil.transferEntityToDimension(this, this.targetDimension, (WorldServer)targetDim.worldObj, false, null); + if(e instanceof EntityAutoRocket) { + e.setPosition(this.targetVec.getX() + 0.5F, this.targetVec.getY() + 800, this.targetVec.getZ() + 0.5f); + ((EntityAutoRocket)e).landing = true; + ((EntityAutoRocket)e).setWaitForPlayer(false); + if(e != this) this.setDead(); - } } + else { + GCLog.info("Error: failed to recreate the unmanned rocket in landing mode on target planet."); + e.setDead(); + this.setDead(); + } + } return; } } @@ -360,7 +364,7 @@ public void onReachAtmosphere() { //Same dimension controlled rocket flight this.setPosition(this.targetVec.getX() + 0.5F, this.targetVec.getY() + 800, this.targetVec.getZ() + 0.5F); - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { this.setWaitForPlayer(true); if (ConfigManagerCore.enableDebug) GCLog.info("Rocket repositioned, waiting for player"); @@ -380,14 +384,14 @@ public void onReachAtmosphere() } //Not launch controlled - if (this.riddenByEntity != null && !this.worldObj.isRemote) + if (!this.getPassengers().isEmpty() && !this.worldObj.isRemote) { - if (this.riddenByEntity instanceof EntityPlayerMP) + if (this.getPassengers().get(0) instanceof EntityPlayerMP) { - EntityPlayerMP player = (EntityPlayerMP) this.riddenByEntity; + EntityPlayerMP player = (EntityPlayerMP) this.getPassengers().get(0); this.onTeleport(player); - GCPlayerStats stats = GCPlayerStats.get(player); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); WorldUtil.toCelestialSelection(player, stats, this.getRocketTier()); } } @@ -426,37 +430,37 @@ protected boolean shouldMoveClientSide() } @Override - public boolean interactFirst(EntityPlayer par1EntityPlayer) + public boolean processInitialInteract(EntityPlayer player, @Nullable ItemStack stack, EnumHand hand) { if (this.launchPhase == EnumLaunchPhase.LAUNCHED.ordinal()) { return false; } - if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayerMP) + if (!this.getPassengers().isEmpty() && this.getPassengers().get(0) instanceof EntityPlayerMP) { if (!this.worldObj.isRemote) { - GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_RESET_THIRD_PERSON, this.worldObj.provider.getDimension(), new Object[] { }), (EntityPlayerMP) par1EntityPlayer); - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) par1EntityPlayer); - stats.chatCooldown = 0; + GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_RESET_THIRD_PERSON, this.worldObj.provider.getDimension(), new Object[] { }), (EntityPlayerMP) player); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + stats.setChatCooldown(0); // Prevent player being dropped from the top of the rocket... float heightBefore = this.height; this.height = this.height / 2.0F; - par1EntityPlayer.mountEntity(null); + this.removePassengers(); this.height = heightBefore; } return true; } - else if (par1EntityPlayer instanceof EntityPlayerMP) + else if (player instanceof EntityPlayerMP) { if (!this.worldObj.isRemote) { - GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_DISPLAY_ROCKET_CONTROLS, this.worldObj.provider.getDimension(), new Object[] { }), (EntityPlayerMP) par1EntityPlayer); - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) par1EntityPlayer); - stats.chatCooldown = 0; - par1EntityPlayer.mountEntity(this); + GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_DISPLAY_ROCKET_CONTROLS, this.worldObj.provider.getDimension(), new Object[] { }), (EntityPlayerMP) player); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + stats.setChatCooldown(0); + player.startRiding(this); } return true; @@ -508,15 +512,6 @@ public void onWorldTransferred(World world) } } - @Override - public void updateRiderPosition() - { - if (this.riddenByEntity != null) - { - this.riddenByEntity.setPosition(this.posX, this.posY + this.getMountedYOffset() + this.riddenByEntity.getYOffset(), this.posZ); - } - } - public float getRotateOffset() { return -1.5F; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java index eabfbe8a20..06d5604e25 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/ChunkProviderSpace.java @@ -8,13 +8,11 @@ import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.IProgressUpdate; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkPrimer; -import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.gen.ChunkProviderGenerate; +import net.minecraft.world.gen.ChunkProviderOverworld; import java.util.List; import java.util.Random; @@ -22,7 +20,7 @@ /** * Do not include this prefab class in your released mod download. */ -public abstract class ChunkProviderSpace extends ChunkProviderGenerate +public abstract class ChunkProviderSpace extends ChunkProviderOverworld { protected final Random rand; @@ -102,7 +100,7 @@ public void generateTerrain(int chunkX, int chunkZ, ChunkPrimer primer) { if (y < this.MID_HEIGHT + yDev) { - primer.setBlockState(this.getIndex(x, y, z), this.getStoneBlock().getBlock().getStateFromMeta(this.getStoneBlock().getMetadata())); + primer.setBlockState(x, y, z, this.getStoneBlock().getBlock().getStateFromMeta(this.getStoneBlock().getMetadata())); // idArray[this.getIndex(x, y, z)] = this.getStoneBlock().getBlock(); // metaArray[this.getIndex(x, y, z)] = this.getStoneBlock().getMetadata(); } @@ -146,7 +144,8 @@ private double clamp(double x, double min, double max) } @Override - public void replaceBlocksForBiome(int par1, int par2, ChunkPrimer primer, Biome[] par4ArrayOfBiome) +// public void replaceBiomeBlocks(int x, int z, ChunkPrimer primer, Biome[] biomesIn) + public void replaceBiomeBlocks(int x, int z, ChunkPrimer primer, Biome[] biomesIn) { final int var5 = 20; final float var6 = 0.03125F; @@ -155,7 +154,7 @@ public void replaceBlocksForBiome(int par1, int par2, ChunkPrimer primer, Biome[ { for (int var9 = 0; var9 < 16; ++var9) { - final int var12 = (int) (this.noiseGen4.getNoise(par1 * 16 + var8, par2 * 16 + var9) / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D); + final int var12 = (int) (this.noiseGen4.getNoise(x * 16 + var8, z * 16 + var9) / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D); int var13 = -1; Block var14 = this.getGrassBlock().getBlock(); byte var14m = this.getGrassBlock().getMetadata(); @@ -168,13 +167,13 @@ public void replaceBlocksForBiome(int par1, int par2, ChunkPrimer primer, Biome[ if (var16 <= 0 + this.rand.nextInt(5)) { - primer.setBlockState(index, Blocks.bedrock.getDefaultState()); -// arrayOfIDs[index] = Blocks.bedrock; + primer.setBlockState(var8, var16, var9, Blocks.BEDROCK.getDefaultState()); +// arrayOfIDs[index] = Blocks.BEDROCK; } else { // final Block var18 = arrayOfIDs[index]; - Block var18 = primer.getBlockState(index).getBlock(); + Block var18 = primer.getBlockState(var8, var16, var9).getBlock(); if (Blocks.AIR == var18) { @@ -207,13 +206,13 @@ else if (var16 >= var5 - -16 && var16 <= var5 + 1) { // arrayOfIDs[index] = var14; // arrayOfMeta[index] = var14m; - primer.setBlockState(index, var14.getStateFromMeta(var14m)); + primer.setBlockState(var8, var16, var9, var14.getStateFromMeta(var14m)); } else { // arrayOfIDs[index] = var15; // arrayOfMeta[index] = var15m; - primer.setBlockState(index, var15.getStateFromMeta(var15m)); + primer.setBlockState(var8, var16, var9, var15.getStateFromMeta(var15m)); } } else if (var13 > 0) @@ -221,7 +220,7 @@ else if (var13 > 0) --var13; // arrayOfIDs[index] = var15; // arrayOfMeta[index] = var15m; - primer.setBlockState(index, var15.getStateFromMeta(var15m)); + primer.setBlockState(var8, var16, var9, var15.getStateFromMeta(var15m)); } } } @@ -231,16 +230,16 @@ else if (var13 > 0) } @Override - public Chunk provideChunk(int par1, int par2) + public Chunk provideChunk(int x, int z) { ChunkPrimer primer = new ChunkPrimer(); - this.rand.setSeed(par1 * 341873128712L + par2 * 132897987541L); + this.rand.setSeed(x * 341873128712L + z * 132897987541L); // final Block[] ids = new Block[32768 * 2]; // final byte[] meta = new byte[32768 * 2]; - this.generateTerrain(par1, par2, primer); - this.createCraters(par1, par2, primer); - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16); - this.replaceBlocksForBiome(par1, par2, primer, this.biomesForGeneration); + this.generateTerrain(x, z, primer); + this.createCraters(x, z, primer); + this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomes(this.biomesForGeneration, x * 16, z * 16, 16, 16); + this.replaceBiomeBlocks(x, z, primer, this.biomesForGeneration); if (this.worldGenerators == null) { @@ -249,17 +248,17 @@ public Chunk provideChunk(int par1, int par2) for (MapGenBaseMeta generator : this.worldGenerators) { - generator.generate(this, this.worldObj, par1, par2, primer); + generator.generate(this.worldObj, x, z, primer); } - this.onChunkProvide(par1, par2, primer); + this.onChunkProvide(x, z, primer); - final Chunk var4 = new Chunk(this.worldObj, primer, par1, par2); + final Chunk var4 = new Chunk(this.worldObj, primer, x, z); final byte[] var5 = var4.getBiomeArray(); for (int var6 = 0; var6 < var5.length; ++var6) { - var5[var6] = (byte) this.biomesForGeneration[var6].biomeID; + var5[var6] = (byte) Biome.getIdForBiome(this.biomesForGeneration[var6]); } var4.generateSkylightMap(); @@ -308,9 +307,9 @@ public void makeCrater(int craterX, int craterZ, int chunkX, int chunkZ, int siz int helper = 0; for (int y = 127; y > 0; y--) { - if (Blocks.AIR != primer.getBlockState(this.getIndex(x, y, z)).getBlock() && helper <= yDev) + if (Blocks.AIR != primer.getBlockState(x, y, z).getBlock() && helper <= yDev) { - primer.setBlockState(getIndex(x, y, z), Blocks.AIR.getDefaultState()); + primer.setBlockState(x, y, z, Blocks.AIR.getDefaultState()); // chunkArray[this.getIndex(x, y, z)] = Blocks.AIR; // metaArray[this.getIndex(x, y, z)] = 0; helper++; @@ -339,56 +338,32 @@ private double randFromPoint(int x, int z) return 1.0 - (n * (n * n * 15731 + 789221) + 1376312589 & 0x7fffffff) / 1073741824.0; } - @Override - public boolean chunkExists(int par1, int par2) - { - return true; - } - public void decoratePlanet(World par1World, Random par2Random, int par3, int par4) { this.getBiomeGenerator().decorate(par1World, par2Random, par3, par4); } @Override - public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) + public void populate(int x, int z) { BlockFalling.fallInstantly = true; - int var4 = par2 * 16; - int var5 = par3 * 16; - this.worldObj.getBiomeGenForCoords(new BlockPos(var4 + 16, 0, var5 + 16)); + int var4 = x * 16; + int var5 = z * 16; + this.worldObj.getBiome(new BlockPos(var4 + 16, 0, var5 + 16)); this.rand.setSeed(this.worldObj.getSeed()); final long var7 = this.rand.nextLong() / 2L * 2L + 1L; final long var9 = this.rand.nextLong() / 2L * 2L + 1L; - this.rand.setSeed(par2 * var7 + par3 * var9 ^ this.worldObj.getSeed()); + this.rand.setSeed(x * var7 + z * var9 ^ this.worldObj.getSeed()); this.decoratePlanet(this.worldObj, this.rand, var4, var5); - this.onPopulate(par1IChunkProvider, par2, par3); + this.onPopulate(x, z); BlockFalling.fallInstantly = false; } - @Override - public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) - { - return true; - } - - @Override - public boolean canSave() - { - return true; - } - - @Override - public String makeString() - { - return "RandomLevelSource"; - } - @Override public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { - Biome biomegenbase = this.worldObj.getBiomeGenForCoords(pos); + Biome biomegenbase = this.worldObj.getBiome(pos); return biomegenbase.getSpawnableList(creatureType); } @@ -471,5 +446,5 @@ public List getPossibleCreatures(EnumCreatureType creature public abstract void onChunkProvide(int cX, int cZ, ChunkPrimer primer); - public abstract void onPopulate(IChunkProvider provider, int cX, int cZ); + public abstract void onPopulate(int cX, int cZ); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java index f4e56a5197..6d66441a88 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java @@ -132,10 +132,10 @@ public IBlockState getBlockState(World world) * @param world * @return the block ID, or null if the y-coordinate is less than 0 or * greater than 256 or the x or z is outside the Minecraft worldmap. - * Returns Blocks.bedrock if the coordinates being checked are in an + * Returns Blocks.BEDROCK if the coordinates being checked are in an * unloaded chunk */ - public Block getBlockID_noChunkLoad(World world) + public IBlockState getBlockState_noChunkLoad(World world) { if (this.y < 0 || this.y >= 256 || this.x < -30000000 || this.z < -30000000 || this.x >= 30000000 || this.z >= 30000000) { @@ -146,13 +146,13 @@ public Block getBlockID_noChunkLoad(World world) int chunkz = this.z >> 4; try { - if (world.getChunkProvider().chunkExists(chunkx, chunkz)) + if (world.getChunkProvider().getLoadedChunk(chunkx, chunkz) != null) { // In a typical inner loop, 80% of the time consecutive calls to // this will be within the same chunk if (BlockVec3.chunkCacheX == chunkx && BlockVec3.chunkCacheZ == chunkz && BlockVec3.chunkCacheDim == world.provider.getDimension() && BlockVec3.chunkCached.isLoaded()) { - return BlockVec3.chunkCached.getBlock(this.x & 15, this.y, this.z & 15); + return BlockVec3.chunkCached.getBlockState(this.x & 15, this.y, this.z & 15); } else { @@ -161,11 +161,11 @@ public Block getBlockID_noChunkLoad(World world) BlockVec3.chunkCacheDim = world.provider.getDimension(); BlockVec3.chunkCacheX = chunkx; BlockVec3.chunkCacheZ = chunkz; - return chunk.getBlock(this.x & 15, this.y, this.z & 15); + return chunk.getBlockState(this.x & 15, this.y, this.z & 15); } } //Chunk doesn't exist - meaning, it is not loaded - return Blocks.bedrock; + return Blocks.BEDROCK.getDefaultState(); } catch (Throwable throwable) { @@ -176,9 +176,9 @@ public Block getBlockID_noChunkLoad(World world) } } - public Block getBlock(IBlockAccess par1iBlockAccess) + public IBlockState getBlockState(IBlockAccess par1iBlockAccess) { - return par1iBlockAccess.getBlockState(new BlockPos(this.x, this.y, this.z)).getBlock(); + return par1iBlockAccess.getBlockState(new BlockPos(this.x, this.y, this.z)); } /** @@ -188,10 +188,10 @@ public Block getBlock(IBlockAccess par1iBlockAccess) * * @param world * @return the block ID, or null if the y-coordinate is less than 0 or - * greater than 256. Returns Blocks.bedrock if the coordinates being + * greater than 256. Returns Blocks.BEDROCK if the coordinates being * checked are in an unloaded chunk */ - public Block getBlockIDsafe_noChunkLoad(World world) + public IBlockState getBlockStateSafe_noChunkLoad(World world) { if (this.y < 0 || this.y >= 256) { @@ -202,13 +202,13 @@ public Block getBlockIDsafe_noChunkLoad(World world) int chunkz = this.z >> 4; try { - if (world.getChunkProvider().chunkExists(chunkx, chunkz)) + if (world.getChunkProvider().getLoadedChunk(chunkx, chunkz) != null) { // In a typical inner loop, 80% of the time consecutive calls to // this will be within the same chunk if (BlockVec3.chunkCacheX == chunkx && BlockVec3.chunkCacheZ == chunkz && BlockVec3.chunkCacheDim == world.provider.getDimension() && BlockVec3.chunkCached.isLoaded()) { - return BlockVec3.chunkCached.getBlock(this.x & 15, this.y, this.z & 15); + return BlockVec3.chunkCached.getBlockState(this.x & 15, this.y, this.z & 15); } else { @@ -217,11 +217,11 @@ public Block getBlockIDsafe_noChunkLoad(World world) BlockVec3.chunkCacheDim = world.provider.getDimension(); BlockVec3.chunkCacheX = chunkx; BlockVec3.chunkCacheZ = chunkz; - return chunk.getBlock(this.x & 15, this.y, this.z & 15); + return chunk.getBlockState(this.x & 15, this.y, this.z & 15); } } //Chunk doesn't exist - meaning, it is not loaded - return Blocks.bedrock; + return Blocks.BEDROCK.getDefaultState(); } catch (Throwable throwable) { @@ -466,7 +466,7 @@ public boolean blockOnSideHasSolidFace(World world, int side) return false; } final BlockPos pos = new BlockPos(x, y, z); - return world.getBlockState(pos).getBlock().isSideSolid(world, pos, EnumFacing.getFront(side ^ 1)); + return world.getBlockState(pos).getBlock().isSideSolid(world.getBlockState(pos), world, pos, EnumFacing.getFront(side ^ 1)); } /** @@ -580,10 +580,10 @@ public TileEntity getTileEntityForce(World world) int chunkx = this.x >> 4; int chunkz = this.z >> 4; - if (world.getChunkProvider().chunkExists(chunkx, chunkz)) + if (world.getChunkProvider().getLoadedChunk(chunkx, chunkz) != null) return world.getTileEntity(this.toBlockPos()); - Chunk chunk = ((ChunkProviderServer) world.getChunkProvider()).originalLoadChunk(chunkx, chunkz); + Chunk chunk = ((ChunkProviderServer) world.getChunkProvider()).loadChunk(chunkx, chunkz); return chunk.getTileEntity(new BlockPos(this.x & 15, this.y, this.z & 15), Chunk.EnumCreateEntityType.IMMEDIATE); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3Dim.java b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3Dim.java index 17e97f47c9..ccd0ddd861 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3Dim.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3Dim.java @@ -91,7 +91,7 @@ public final BlockVec3Dim clone() * @return the block ID, or null if the y-coordinate is less than 0 or * greater than 256 or the x or z is outside the Minecraft worldmap. */ - public Block getBlockID() + public IBlockState getBlockState() { if (this.y < 0 || this.y >= 256 || this.x < -30000000 || this.z < -30000000 || this.x >= 30000000 || this.z >= 30000000) { @@ -109,7 +109,7 @@ public Block getBlockID() // this will be within the same chunk if (BlockVec3Dim.chunkCacheX == chunkx && BlockVec3Dim.chunkCacheZ == chunkz && BlockVec3Dim.chunkCacheDim == world.provider.getDimension() && BlockVec3Dim.chunkCached.isLoaded()) { - return BlockVec3Dim.chunkCached.getBlock(this.x & 15, this.y, this.z & 15); + return BlockVec3Dim.chunkCached.getBlockState(this.x & 15, this.y, this.z & 15); } else { @@ -119,7 +119,7 @@ public Block getBlockID() BlockVec3Dim.chunkCacheDim = world.provider.getDimension(); BlockVec3Dim.chunkCacheX = chunkx; BlockVec3Dim.chunkCacheZ = chunkz; - return chunk.getBlock(this.x & 15, this.y, this.z & 15); + return chunk.getBlockState(this.x & 15, this.y, this.z & 15); } } catch (Throwable throwable) @@ -136,10 +136,10 @@ public Block getBlockID() * * @return the block ID, or null if the y-coordinate is less than 0 or * greater than 256 or the x or z is outside the Minecraft worldmap. - * Returns Blocks.bedrock if the coordinates being checked are in an + * Returns Blocks.BEDROCK if the coordinates being checked are in an * unloaded chunk */ - public Block getBlockID_noChunkLoad() + public IBlockState getBlockState_noChunkLoad() { if (this.y < 0 || this.y >= 256 || this.x < -30000000 || this.z < -30000000 || this.x >= 30000000 || this.z >= 30000000) { @@ -153,13 +153,13 @@ public Block getBlockID_noChunkLoad() int chunkz = this.z >> 4; try { - if (world.getChunkProvider().chunkExists(chunkx, chunkz)) + if (world.getChunkProvider().getLoadedChunk(chunkx, chunkz) != null) { // In a typical inner loop, 80% of the time consecutive calls to // this will be within the same chunk if (BlockVec3Dim.chunkCacheX == chunkx && BlockVec3Dim.chunkCacheZ == chunkz && BlockVec3Dim.chunkCacheDim == world.provider.getDimension() && BlockVec3Dim.chunkCached.isLoaded()) { - return BlockVec3Dim.chunkCached.getBlock(this.x & 15, this.y, this.z & 15); + return BlockVec3Dim.chunkCached.getBlockState(this.x & 15, this.y, this.z & 15); } else { @@ -169,11 +169,11 @@ public Block getBlockID_noChunkLoad() BlockVec3Dim.chunkCacheDim = world.provider.getDimension(); BlockVec3Dim.chunkCacheX = chunkx; BlockVec3Dim.chunkCacheZ = chunkz; - return chunk.getBlock(this.x & 15, this.y, this.z & 15); + return chunk.getBlockState(this.x & 15, this.y, this.z & 15); } } //Chunk doesn't exist - meaning, it is not loaded - return Blocks.bedrock; + return Blocks.BEDROCK.getDefaultState(); } catch (Throwable throwable) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java b/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java index 596c55a381..90751f1fd0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/vector/Vector3.java @@ -8,6 +8,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -73,7 +74,7 @@ public Vector3(Vec3d par1) } - public Vector3(MovingObjectPosition par1) + public Vector3(RayTraceResult par1) { this(par1.getBlockPos()); } @@ -689,12 +690,12 @@ public static Vector3 EAST() } @Deprecated - public MovingObjectPosition rayTraceEntities(World world, float rotationYaw, float rotationPitch, boolean collisionFlag, double reachDistance) + public RayTraceResult rayTraceEntities(World world, float rotationYaw, float rotationPitch, boolean collisionFlag, double reachDistance) { return this.rayTraceEntities(world, rotationYaw, rotationPitch, reachDistance); } - public MovingObjectPosition rayTraceEntities(World world, float rotationYaw, float rotationPitch, double reachDistance) + public RayTraceResult rayTraceEntities(World world, float rotationYaw, float rotationPitch, double reachDistance) { return this.rayTraceEntities(world, Vector3.getDeltaPositionFromRotation(rotationYaw, rotationPitch).scale(reachDistance)); } @@ -707,9 +708,9 @@ public MovingObjectPosition rayTraceEntities(World world, float rotationYaw, flo * getDeltaPositionFromRotation() * @return The target hit. */ - public MovingObjectPosition rayTraceEntities(World world, Vector3 target) + public RayTraceResult rayTraceEntities(World world, Vector3 target) { - MovingObjectPosition pickedEntity = null; + RayTraceResult pickedEntity = null; Vec3d startingPosition = this.toVec3(); Vec3d look = target.toVec3(); double reachDistance = this.distance(target); @@ -731,7 +732,7 @@ public MovingObjectPosition rayTraceEntities(World world, Vector3 target) { float border = entityHit.getCollisionBorderSize(); AxisAlignedBB aabb = entityHit.getEntityBoundingBox().expand(border, border, border); - MovingObjectPosition hitMOP = aabb.calculateIntercept(startingPosition, reachPoint); + RayTraceResult hitMOP = aabb.calculateIntercept(startingPosition, reachPoint); if (hitMOP != null) { @@ -739,7 +740,7 @@ public MovingObjectPosition rayTraceEntities(World world, Vector3 target) { if (0.0D < closestEntity || closestEntity == 0.0D) { - pickedEntity = new MovingObjectPosition(entityHit); + pickedEntity = new RayTraceResult(entityHit); if (pickedEntity != null) { pickedEntity.hitVec = hitMOP.hitVec; @@ -753,7 +754,7 @@ public MovingObjectPosition rayTraceEntities(World world, Vector3 target) if (distance < closestEntity || closestEntity == 0.0D) { - pickedEntity = new MovingObjectPosition(entityHit); + pickedEntity = new RayTraceResult(entityHit); pickedEntity.hitVec = hitMOP.hitVec; closestEntity = distance; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/GCFluids.java b/src/main/java/micdoodle8/mods/galacticraft/core/GCFluids.java index 61dbb64e8c..4afa4dbc50 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/GCFluids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/GCFluids.java @@ -24,7 +24,7 @@ public class GCFluids public static Fluid fluidFuel; public static Fluid fluidOxygenGas; public static Fluid fluidHydrogenGas; - public static Material materialOil = new MaterialOleaginous(MapColor.brownColor); + public static Material materialOil = new MaterialOleaginous(MapColor.BROWN); public static void registerFluids() { @@ -68,12 +68,12 @@ public static void registerOilandFuel() GCBlocks.crudeOil = fluidOil.getBlock(); } - if (GCBlocks.crudeOil != null && Item.itemRegistry.getObject(new ResourceLocation("buildcraftenergy:items/bucketOil")) == null) + if (GCBlocks.crudeOil != null && Item.REGISTRY.getObject(new ResourceLocation("buildcraftenergy:items/bucketOil")) == null) { GCItems.bucketOil = new ItemBucketGC(GCBlocks.crudeOil); GCItems.bucketOil.setUnlocalizedName("bucket_oil"); GCItems.registerItem(GCItems.bucketOil); - FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack(oilID, FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(GCItems.bucketOil), new ItemStack(Items.bucket)); + FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack(oilID, FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(GCItems.bucketOil), new ItemStack(Items.BUCKET)); } EventHandlerGC.bucketList.put(GCBlocks.crudeOil, GCItems.bucketOil); @@ -103,12 +103,12 @@ public static void registerOilandFuel() GCBlocks.fuel = fluidFuel.getBlock(); } - if (GCBlocks.fuel != null && Item.itemRegistry.getObject(new ResourceLocation("buildcraftenergy:items/bucketFuel")) == null) + if (GCBlocks.fuel != null && Item.REGISTRY.getObject(new ResourceLocation("buildcraftenergy:items/bucketFuel")) == null) { GCItems.bucketFuel = new ItemBucketGC(GCBlocks.fuel); GCItems.bucketFuel.setUnlocalizedName("bucket_fuel"); GCItems.registerItem(GCItems.bucketFuel); - FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack(fuelID, FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(GCItems.bucketFuel), new ItemStack(Items.bucket)); + FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack(fuelID, FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(GCItems.bucketFuel), new ItemStack(Items.BUCKET)); } EventHandlerGC.bucketList.put(GCBlocks.fuel, GCItems.bucketFuel); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/GCItems.java b/src/main/java/micdoodle8/mods/galacticraft/core/GCItems.java index 58e1a2cfbd..9e1a9530e5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/GCItems.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/GCItems.java @@ -8,6 +8,8 @@ import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.core.util.StackSorted; import micdoodle8.mods.galacticraft.core.wrappers.PartialCanister; +import net.minecraft.init.SoundEvents; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; @@ -74,9 +76,8 @@ public class GCItems // public static Item cheeseBlock; public static Item prelaunchChecklist; - // public static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability) - public static ArmorMaterial ARMOR_SENSOR_GLASSES = EnumHelper.addArmorMaterial("SENSORGLASSES", "", 200, new int[] { 0, 0, 0, 0 }, 0); - public static ArmorMaterial ARMOR_STEEL = EnumHelper.addArmorMaterial("steel", "", 30, new int[] { 3, 8, 6, 3 }, 12); + public static ArmorMaterial ARMOR_SENSOR_GLASSES = EnumHelper.addArmorMaterial("SENSORGLASSES", "", 200, new int[] { 0, 0, 0, 0 }, 0, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0.0F); + public static ArmorMaterial ARMOR_STEEL = EnumHelper.addArmorMaterial("steel", "", 30, new int[] { 3, 8, 6, 3 }, 12, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0.0F); public static ToolMaterial TOOL_STEEL = EnumHelper.addToolMaterial("steel", 3, 768, 5.0F, 2, 8); public static ArrayList hiddenItems = new ArrayList(); @@ -96,10 +97,10 @@ public static void initItems() GCItems.steelHoe = new ItemHoeGC("steel_hoe"); GCItems.steelSpade = new ItemSpadeGC("steel_shovel"); GCItems.steelSword = new ItemSwordGC("steel_sword"); - GCItems.steelHelmet = new ItemArmorGC(0, "helmet"); - GCItems.steelChestplate = new ItemArmorGC(1, "chestplate"); - GCItems.steelLeggings = new ItemArmorGC(2, "leggings"); - GCItems.steelBoots = new ItemArmorGC(3, "boots"); + GCItems.steelHelmet = new ItemArmorGC(EntityEquipmentSlot.HEAD, "helmet"); + GCItems.steelChestplate = new ItemArmorGC(EntityEquipmentSlot.CHEST, "chestplate"); + GCItems.steelLeggings = new ItemArmorGC(EntityEquipmentSlot.LEGS, "leggings"); + GCItems.steelBoots = new ItemArmorGC(EntityEquipmentSlot.FEET, "boots"); GCItems.canister = new ItemCanister("canister"); GCItems.oxygenVent = new ItemBase("air_vent"); GCItems.oxygenFan = new ItemBase("air_fan"); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java index f44ea62153..e7c3a1de6d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java @@ -57,7 +57,7 @@ import java.util.Arrays; import java.util.HashMap; -@Mod(name = GalacticraftCore.NAME, version = Constants.LOCALMAJVERSION + "." + Constants.LOCALMINVERSION + "." + Constants.LOCALBUILDVERSION, useMetadata = true, modid = Constants.MOD_ID_CORE, dependencies = "required-after:Forge@[10.12.2.1147,); required-after:FML@[7.2.217.1147,); required-after:Micdoodlecore; after:IC2; after:IC2; after:MekanismAPI|gas", guiFactory = "micdoodle8.mods.galacticraft.core.client.gui.screen.ConfigGuiFactoryCore") +@Mod(name = GalacticraftCore.NAME, version = Constants.LOCALMAJVERSION + "." + Constants.LOCALMINVERSION + "." + Constants.LOCALBUILDVERSION, useMetadata = true, modid = Constants.MOD_ID_CORE, dependencies = "required-after:Forge@[10.12.2.1147,); required-after:FML@[7.2.217.1147,); required-after:Micdoodlecore; after:IC2; after:IC2", guiFactory = "micdoodle8.mods.galacticraft.core.client.gui.screen.ConfigGuiFactoryCore") public class GalacticraftCore { public static final String NAME = "Galacticraft Core"; @@ -202,8 +202,8 @@ public void init(FMLInitializationEvent event) GalaxyRegistry.registerPlanet(GalacticraftCore.planetOverworld); GalaxyRegistry.registerMoon(GalacticraftCore.moonMoon); GalaxyRegistry.registerSatellite(GalacticraftCore.satelliteSpaceStation); - GalacticraftRegistry.registerProvider(ConfigManagerCore.idDimensionOverworldOrbit, WorldProviderOrbit.class, false, 0); - GalacticraftRegistry.registerProvider(ConfigManagerCore.idDimensionOverworldOrbitStatic, WorldProviderOrbit.class, true, 0); + GalacticraftRegistry.registerDimension("Space Station", "_orbit", ConfigManagerCore.idDimensionOverworldOrbit, WorldProviderOrbit.class, false); + GalacticraftRegistry.registerDimension("Space Station", "_orbit", ConfigManagerCore.idDimensionOverworldOrbitStatic, WorldProviderOrbit.class, true); GalacticraftRegistry.registerTeleportType(WorldProviderSurface.class, new TeleportTypeOverworld()); GalacticraftRegistry.registerTeleportType(WorldProviderOrbit.class, new TeleportTypeOrbit()); GalacticraftRegistry.registerTeleportType(WorldProviderMoon.class, new TeleportTypeMoon()); @@ -333,9 +333,14 @@ public void postInit(FMLPostInitializationEvent event) { int id = Arrays.binarySearch(ConfigManagerCore.staticLoadDimensions, body.getDimensionID()); //It's important this is done in the same order as planets will be registered by WorldUtil.registerPlanet(); - if (!GalacticraftRegistry.registerProvider(body.getDimensionID(), body.getWorldProvider(), body.getForceStaticLoad() || id < 0, 0)) + try + { + GalacticraftRegistry.registerDimension(body.getLocalizedName(), body.getDimensionSuffix(), body.getDimensionID(), body.getWorldProvider(), body.getForceStaticLoad() || id < 0); + } + catch (IllegalArgumentException e) { body.setUnreachable(); + e.printStackTrace(); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java b/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java index ccfd2210b9..ac8a4a7610 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java @@ -10,7 +10,8 @@ import micdoodle8.mods.galacticraft.core.client.SkyProviderOverworld; import micdoodle8.mods.galacticraft.core.dimension.WorldProviderMoon; import micdoodle8.mods.galacticraft.core.dimension.WorldProviderZeroGravity; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsClientHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsClientCapability; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.*; import net.minecraft.client.entity.EntityPlayerSP; @@ -539,7 +540,7 @@ public static boolean shouldRenderFire(Entity entity) public static void orientCamera(float partialTicks) { EntityPlayerSP player = ClientProxyCore.mc.thePlayer; - GCPlayerStatsClient stats = GCPlayerStatsClient.get(player); + IStatsClientCapability stats = player.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); Entity viewEntity = ClientProxyCore.mc.getRenderViewEntity(); @@ -567,28 +568,28 @@ public static void orientCamera(float partialTicks) GL11.glRotatef(-pitch, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, 0.0F, 0.1F); - GL11.glRotatef(180.0F * stats.gdir.getThetaX(), 1.0F, 0.0F, 0.0F); - GL11.glRotatef(180.0F * stats.gdir.getThetaZ(), 0.0F, 0.0F, 1.0F); - GL11.glRotatef(pitch * stats.gdir.getPitchGravityX(), 1.0F, 0.0F, 0.0F); - GL11.glRotatef(pitch * stats.gdir.getPitchGravityY(), 0.0F, 1.0F, 0.0F); - GL11.glRotatef(yaw * stats.gdir.getYawGravityX(), 1.0F, 0.0F, 0.0F); - GL11.glRotatef(yaw * stats.gdir.getYawGravityY(), 0.0F, 1.0F, 0.0F); - GL11.glRotatef(yaw * stats.gdir.getYawGravityZ(), 0.0F, 0.0F, 1.0F); + GL11.glRotatef(180.0F * stats.getGdir().getThetaX(), 1.0F, 0.0F, 0.0F); + GL11.glRotatef(180.0F * stats.getGdir().getThetaZ(), 0.0F, 0.0F, 1.0F); + GL11.glRotatef(pitch * stats.getGdir().getPitchGravityX(), 1.0F, 0.0F, 0.0F); + GL11.glRotatef(pitch * stats.getGdir().getPitchGravityY(), 0.0F, 1.0F, 0.0F); + GL11.glRotatef(yaw * stats.getGdir().getYawGravityX(), 1.0F, 0.0F, 0.0F); + GL11.glRotatef(yaw * stats.getGdir().getYawGravityY(), 0.0F, 1.0F, 0.0F); + GL11.glRotatef(yaw * stats.getGdir().getYawGravityZ(), 0.0F, 0.0F, 1.0F); - if (stats.landingTicks > 0) + if (stats.getLandingTicks() > 0) { float sneakY; - if (stats.landingTicks >= 4) sneakY = (stats.landingTicks >= 5) ? 0.15F : 0.3F; + if (stats.getLandingTicks() >= 4) sneakY = (stats.getLandingTicks() >= 5) ? 0.15F : 0.3F; else - sneakY = stats.landingTicks * 0.075F; - GL11.glTranslatef(sneakY * stats.gdir.getSneakVecX(), sneakY * stats.gdir.getSneakVecY(), sneakY * stats.gdir.getSneakVecZ()); + sneakY = stats.getLandingTicks() * 0.075F; + GL11.glTranslatef(sneakY * stats.getGdir().getSneakVecX(), sneakY * stats.getGdir().getSneakVecY(), sneakY * stats.getGdir().getSneakVecZ()); } - GL11.glTranslatef(eyeHeightChange * stats.gdir.getEyeVecX(), eyeHeightChange * stats.gdir.getEyeVecY(), eyeHeightChange * stats.gdir.getEyeVecZ()); + GL11.glTranslatef(eyeHeightChange * stats.getGdir().getEyeVecX(), eyeHeightChange * stats.getGdir().getEyeVecY(), eyeHeightChange * stats.getGdir().getEyeVecZ()); - if (stats.gravityTurnRate < 1.0F) + if (stats.getGravityTurnRate() < 1.0F) { - GL11.glRotatef(90.0F * (stats.gravityTurnRatePrev + (stats.gravityTurnRate - stats.gravityTurnRatePrev) * partialTicks), stats.gravityTurnVecX, stats.gravityTurnVecY, stats.gravityTurnVecZ); + GL11.glRotatef(90.0F * (stats.getGravityTurnRatePrev() + (stats.getGravityTurnRate() - stats.getGravityTurnRatePrev()) * partialTicks), stats.getGravityTurnVecX(), stats.getGravityTurnVecY(), stats.getGravityTurnVecZ()); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java index aab006fd32..92b06c95b5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java @@ -61,7 +61,7 @@ public String getName() } } - public static final PropertyEnum AIR_LOCK_TYPE = PropertyEnum.create("airLockType", EnumAirLockType.class); + public static final PropertyEnum AIR_LOCK_TYPE = PropertyEnum.create("airlocktype", EnumAirLockType.class); public BlockAirLockFrame(String assetName) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java index d082989c37..737c4449e8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java @@ -26,7 +26,7 @@ public class BlockAluminumWire extends BlockTransmitter implements ITileEntityProvider, IShiftDescription, ISortableBlock { - public static final PropertyEnum WIRE_TYPE = PropertyEnum.create("wireType", EnumWireType.class); + public static final PropertyEnum WIRE_TYPE = PropertyEnum.create("wiretype", EnumWireType.class); public enum EnumWireType implements IStringSerializable { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java index 0862d3cacd..db1083007a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java @@ -32,7 +32,7 @@ */ public class BlockBasic extends Block implements IDetectableResource, ISortableBlock { - public static final PropertyEnum BASIC_TYPE = PropertyEnum.create("basicType", EnumBlockBasic.class); + public static final PropertyEnum BASIC_TYPE = PropertyEnum.create("basictype", EnumBlockBasic.class); public enum EnumBlockBasic implements IStringSerializable { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java index a534590143..9cda2ab917 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java @@ -33,7 +33,6 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -41,7 +40,7 @@ public class BlockBasicMoon extends Block implements IDetectableResource, IPlantableBlock, ITerraformableBlock, ISortableBlock { - public static final PropertyEnum BASIC_TYPE_MOON = PropertyEnum.create("basicTypeMoon", EnumBlockBasicMoon.class); + public static final PropertyEnum BASIC_TYPE_MOON = PropertyEnum.create("basictypemoon", EnumBlockBasicMoon.class); public enum EnumBlockBasicMoon implements IStringSerializable { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java index 731ca7db6d..d8f617f35f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java @@ -136,7 +136,7 @@ public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighb } // @Override -// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) +// public RayTraceResult collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) // { // EnumFacing side = worldIn.getBlockState(pos).getValue(FACING); // float var8 = 0.3F; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java index 4560dd59c7..cac613ae70 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java @@ -197,7 +197,7 @@ public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random ra } // @Override -// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) +// public RayTraceResult collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) // { // int l = getMetaFromState(worldIn.getBlockState(pos)) & 7; // float f = 0.15F; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java index 4c54d399ec..aaf87f0fe7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java @@ -33,7 +33,7 @@ public class BlockMulti extends BlockAdvanced implements IPartialSealableBlock, ITileEntityProvider { public static final PropertyEnum MULTI_TYPE = PropertyEnum.create("type", EnumBlockMultiType.class); - public static final PropertyInteger RENDER_TYPE = PropertyInteger.create("renderType", 0, 7); + public static final PropertyInteger RENDER_TYPE = PropertyInteger.create("rendertype", 0, 7); public enum EnumBlockMultiType implements IStringSerializable { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java index 75f3056c3a..a6ef710ae6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java @@ -74,11 +74,11 @@ public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World world // } // // @Override -// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) +// public RayTraceResult collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) // { // this.setBlockBounds(-0.0F, 0.0F, -0.0F, 1.0F, 1.4F, 1.0F); // -// final MovingObjectPosition r = super.collisionRayTrace(worldIn, pos, start, end); +// final RayTraceResult r = super.collisionRayTrace(worldIn, pos, start, end); // // this.setBlockBounds(-0.0F, 0.0F, -0.0F, 1.0F, 1.4F, 1.0F); // diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java index b713f14019..2ce76faab8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java @@ -137,7 +137,7 @@ public boolean isSealed(World worldIn, BlockPos pos, EnumFacing direction) } // @Override -// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) +// public RayTraceResult collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) // { // final int metadata = getMetaFromState(worldIn.getBlockState(pos)) & 7; // float boundsFront = 0.094F; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java index 3435be9602..4eac9a841f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java @@ -157,8 +157,8 @@ public EnumSortCategoryBlock getCategory(int meta) public enum BlockType implements IStringSerializable { - TIN_SLAB_1(0, "tin_slab"), - TIN_SLAB_2(1, "tin_slab"), + TIN_SLAB_1(0, "tin_slab_1"), + TIN_SLAB_2(1, "tin_slab_2"), MOON_STONE_SLAB(2, "moon_slab"), MOON_DUNGEON_BRICK_SLAB(3, "moon_bricks_slab"), MARS_COBBLESTONE_SLAB(4, "mars_slab"), @@ -183,7 +183,7 @@ public String toString() @Override public String getName() { - return this.name(); + return this.langName; } public int getMetadata() diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java index bfee2fb8de..245b488a62 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java @@ -190,7 +190,7 @@ private boolean dropTorchIfCantStay(World worldIn, BlockPos pos) } // @Override -// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) +// public RayTraceResult collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) // { // float var8 = 0.3F; // diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java index 46a1585ae1..1ce921444b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java @@ -272,7 +272,7 @@ private void checkOxygen(World world, BlockPos pos) * returning a ray trace hit. Args: world, x, y, z, startVec, endVec */ // @Override -// public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) +// public RayTraceResult collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) // { // EnumFacing enumfacing = worldIn.getBlockState(pos).getValue(FACING); // float f = 0.15F; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java index 72875a2aa5..962f2e70a5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java @@ -185,12 +185,19 @@ public EnumSortCategoryBlock getCategory(int meta) public enum BlockType implements IStringSerializable { - TIN_1_WALL, - TIN_2_WALL, - MOON_STONE_WALL, - MOON_DUNGEON_BRICK_WALL, - MARS_COBBLESTONE_WALL, - MARS_DUNGEON_BRICK_WALL; + TIN_1_WALL("tin_1_wall"), + TIN_2_WALL("tin_2_wall"), + MOON_STONE_WALL("moon_stone_wall"), + MOON_DUNGEON_BRICK_WALL("moon_dungeon_brick_wall"), + MARS_COBBLESTONE_WALL("mars_cobblestone_wall"), + MARS_DUNGEON_BRICK_WALL("mars_dungeon_brick_wall"); + + private String name; + + BlockType(String name) + { + this.name = name; + } @Override public String toString() @@ -201,7 +208,7 @@ public String toString() @Override public String getName() { - return this.name(); + return this.name; } } } \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/sounds/GCSounds.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/sounds/GCSounds.java index 1831b2e3ee..7dfc484671 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/sounds/GCSounds.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/sounds/GCSounds.java @@ -15,6 +15,10 @@ public class GCSounds public static SoundEvent astroMiner; public static SoundEvent shuttle; public static SoundEvent parachute; + public static SoundEvent openAirLock; + public static SoundEvent closeAirLock; + public static SoundEvent singleDrip; + public static SoundEvent scaryScape; public static SoundEvent music; @@ -28,6 +32,10 @@ public static void registerSounds() astroMiner = registerSound("entity.astrominer"); shuttle = registerSound("shuttle.shuttle"); parachute = registerSound("player.parachute"); + openAirLock = registerSound("player.openairlock"); + closeAirLock = registerSound("player.closeairlock"); + singleDrip = registerSound("ambience.singledrip"); + scaryScape = registerSound("ambience.scaryscape"); music = registerSound("galacticraft.musicSpace"); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/energy/item/ItemElectricBase.java b/src/main/java/micdoodle8/mods/galacticraft/core/energy/item/ItemElectricBase.java index b32aed2c47..a1d8047d3c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/energy/item/ItemElectricBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/energy/item/ItemElectricBase.java @@ -211,9 +211,9 @@ public static boolean isElectricItemEmpty(ItemStack itemstack) if (EnergyConfigHandler.isIndustrialCraft2Loaded()) { - if (item instanceof ic2.api.item.ISpecialElectricItem) + if (item instanceof ic2.api.item.IElectricItem) { - return !((ic2.api.item.ISpecialElectricItem) item).canProvideEnergy(itemstack); + return !((ic2.api.item.IElectricItem) item).canProvideEnergy(itemstack); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseUniversalElectrical.java b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseUniversalElectrical.java index 3d2b6d80a5..79a8535c6a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseUniversalElectrical.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseUniversalElectrical.java @@ -190,13 +190,14 @@ else if (EnergyConfigHandler.isMekanismLoaded() && item instanceof IEnergizedIte } else if (EnergyConfigHandler.isIndustrialCraft2Loaded()) { - if (item instanceof ISpecialElectricItem) + if (item instanceof ISpecialElectricItem && item instanceof IElectricItem) { - ISpecialElectricItem electricItem = (ISpecialElectricItem) item; + IElectricItem electricItem = (IElectricItem) item; + ISpecialElectricItem specialElectricItem = (ISpecialElectricItem) item; if (electricItem.canProvideEnergy(itemStack)) { double energyDischargeIC2 = energyToDischarge / EnergyConfigHandler.IC2_RATIO; - double result = electricItem.getManager(itemStack).discharge(itemStack, energyDischargeIC2, 4, false, false, false); + double result = specialElectricItem.getManager(itemStack).discharge(itemStack, energyDischargeIC2, 4, false, false, false); float energyDischarged = (float) result * EnergyConfigHandler.IC2_RATIO; this.storage.receiveEnergyGC(energyDischarged); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java index bb4413779d..d45710465b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java @@ -1268,7 +1268,7 @@ public void onPlayerUpdate(EntityPlayerMP player) /* if (isInGCDimension || player.usingPlanetSelectionGui) { - player.playerNetServerHandler.ticksForFloatKick = 0; + player.connection.ticksForFloatKick = 0; } */ if (stats.getDamageCounter() > 0) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java index b067e1c165..3cc9492338 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/fluid/ThreadFindSeal.java @@ -139,12 +139,12 @@ public void check() this.currentLayer.add(this.head); if (this.head.x < -29990000 || this.head.z < -29990000 || this.head.x >= 29990000 || this.head.z >= 29990000) { - Block b = this.head.getBlockID_noChunkLoad(this.world); - if (Blocks.AIR == b) + IBlockState state = this.head.getBlockState_noChunkLoad(this.world); + if (Blocks.AIR == state.getBlock()) { this.airToReplace.add(this.head.clone()); } - else if (b == GCBlocks.brightAir) + else if (state.getBlock() == GCBlocks.brightAir) { this.airToReplaceBright.add(this.head.clone()); } @@ -152,12 +152,12 @@ else if (b == GCBlocks.brightAir) } else { - Block headblock = this.head.getBlockIDsafe_noChunkLoad(this.world); - if (Blocks.AIR == headblock) + IBlockState headState = this.head.getBlockStateSafe_noChunkLoad(this.world); + if (Blocks.AIR == headState.getBlock()) { this.airToReplace.add(this.head.clone()); } - else if (headblock == GCBlocks.brightAir) + else if (headState.getBlock() == GCBlocks.brightAir) { this.airToReplaceBright.add(this.head.clone()); } @@ -374,23 +374,24 @@ private void makeSealGood(boolean ambientThermal) { List changeList = new LinkedList(); Block breatheableAirID = GCBlocks.breatheableAir; - int metadata = 0; - if (ambientThermal) - { - metadata = 1; - } +// int metadata = 0; +// if (ambientThermal) +// { +// metadata = 1; +// } + // TODO Replace getDefaultState() below with thermal state if ambientThermal is true for (BlockVec3 checkedVec : this.airToReplace) { //No block update for performance reasons; deal with unlit torches separately - changeList.add(new ScheduledBlockChange(checkedVec.clone(), breatheableAirID, metadata, 2)); + changeList.add(new ScheduledBlockChange(checkedVec.clone(), breatheableAirID.getDefaultState(), 2)); } for (BlockVec3 checkedVec : this.airToReplaceBright) { - changeList.add(new ScheduledBlockChange(checkedVec.clone(), GCBlocks.brightBreatheableAir, metadata, 2)); + changeList.add(new ScheduledBlockChange(checkedVec.clone(), GCBlocks.brightBreatheableAir.getDefaultState(), 2)); } for (BlockVec3 checkedVec : this.ambientThermalTracked) { - changeList.add(new ScheduledBlockChange(checkedVec.clone(), checkedVec.getBlock(world), metadata, 3)); + changeList.add(new ScheduledBlockChange(checkedVec.clone(), checkedVec.getBlockState(world), 3)); } TickHandlerServer.scheduleNewBlockChange(this.world.provider.getDimension(), changeList); @@ -408,11 +409,11 @@ private void makeSealBad() List changeList = new LinkedList(); for (BlockVec3 checkedVec : this.breatheableToReplace) { - changeList.add(new ScheduledBlockChange(checkedVec.clone(), Blocks.AIR, 0, 2)); + changeList.add(new ScheduledBlockChange(checkedVec.clone(), Blocks.AIR.getDefaultState(), 2)); } for (BlockVec3 checkedVec : this.breatheableToReplaceBright) { - changeList.add(new ScheduledBlockChange(checkedVec.clone(), GCBlocks.brightAir, 0, 2)); + changeList.add(new ScheduledBlockChange(checkedVec.clone(), GCBlocks.brightAir.getDefaultState(), 2)); } TickHandlerServer.scheduleNewBlockChange(this.world.provider.getDimension(), changeList); } @@ -448,27 +449,27 @@ private void unseal() if (!checkedLocal.contains(sideVec)) { - Block id = sideVec.getBlockIDsafe_noChunkLoad(world); + IBlockState state = sideVec.getBlockStateSafe_noChunkLoad(world); - if (id == breatheableAirID) + if (state.getBlock() == breatheableAirID) { this.breatheableToReplace.add(sideVec); nextLayer.add(sideVec); checkedLocal.add(sideVec); } - else if (id == breatheableAirIDBright) + else if (state.getBlock() == breatheableAirIDBright) { this.breatheableToReplaceBright.add(sideVec); nextLayer.add(sideVec); checkedLocal.add(sideVec); } - else if (id == fireBlock) + else if (state.getBlock() == fireBlock) { this.breatheableToReplace.add(sideVec); nextLayer.add(sideVec); checkedLocal.add(sideVec); } - else if (id == oxygenSealerID) + else if (state.getBlock() == oxygenSealerID) { TileEntityOxygenSealer sealer = this.sealersAround.get(sideVec); @@ -490,7 +491,7 @@ else if (id == oxygenSealerID) else { checkedLocal.add(sideVec); - if (id != null && Blocks.AIR != id && id != GCBlocks.brightAir && this.canBlockPassAirCheck(id, sideVec, EnumFacing.getFront(side))) + if (Blocks.AIR != state.getBlock() && state.getBlock() != GCBlocks.brightAir && this.canBlockPassAirCheck(state.getBlock(), sideVec, EnumFacing.getFront(side))) { //Look outbound through partially sealable blocks in case there is breatheableAir to clear beyond nextLayer.add(sideVec); @@ -535,27 +536,27 @@ private void unsealNearMapEdge() if (!checkedLocal.contains(sideVec)) { - Block id = sideVec.getBlockID_noChunkLoad(this.world); + IBlockState state = sideVec.getBlockState_noChunkLoad(this.world); - if (id == breatheableAirID) + if (state.getBlock() == breatheableAirID) { this.breatheableToReplace.add(sideVec); nextLayer.add(sideVec); checkedLocal.add(sideVec); } - else if (id == breatheableAirIDBright) + else if (state.getBlock() == breatheableAirIDBright) { this.breatheableToReplaceBright.add(sideVec); nextLayer.add(sideVec); checkedLocal.add(sideVec); } - else if (id == fireBlock) + else if (state.getBlock() == fireBlock) { nextLayer.add(sideVec); this.breatheableToReplace.add(sideVec); checkedLocal.add(sideVec); } - else if (id == oxygenSealerID) + else if (state.getBlock() == oxygenSealerID) { TileEntityOxygenSealer sealer = this.sealersAround.get(sideVec); @@ -577,7 +578,7 @@ else if (id == oxygenSealerID) else { checkedLocal.add(sideVec); - if (id != null && Blocks.AIR != id && id != GCBlocks.brightAir && this.canBlockPassAirCheck(id, sideVec, EnumFacing.getFront(side))) + if (state.getBlock() != null && Blocks.AIR != state.getBlock() && state.getBlock() != GCBlocks.brightAir && this.canBlockPassAirCheck(state.getBlock(), sideVec, EnumFacing.getFront(side))) { //Look outbound through partially sealable blocks in case there is breatheableAir to clear beyond nextLayer.add(sideVec); @@ -631,29 +632,29 @@ private void doLayer() checkedLocal.add(sideVec); // GCLog.debug("Checking vec " + sideVec.toString() + " : " + (sideVec.sideDoneBits >> 6) + " @ " + this.checkCount); - Block id = sideVec.getBlockIDsafe_noChunkLoad(world); + IBlockState state = sideVec.getBlockStateSafe_noChunkLoad(world); // The most likely case - if (id == breatheableAirID) + if (state.getBlock() == breatheableAirID) { nextLayer.add(sideVec); this.ambientThermalTracked.add(sideVec); } - else if (id == airID) + else if (state.getBlock() == airID) { nextLayer.add(sideVec); this.airToReplace.add(sideVec); } - else if (id == breatheableAirIDBright) + else if (state.getBlock() == breatheableAirIDBright) { nextLayer.add(sideVec); this.ambientThermalTracked.add(sideVec); } - else if (id == airIDBright) + else if (state.getBlock() == airIDBright) { nextLayer.add(sideVec); this.airToReplaceBright.add(sideVec); } - else if (id == null) + else if (state.getBlock() == null) { // Broken through to the void or the // stratosphere (above y==255) - set @@ -662,11 +663,11 @@ else if (id == null) this.sealed = false; return; } - else if (this.canBlockPassAirCheck(id, sideVec, EnumFacing.getFront(side))) + else if (this.canBlockPassAirCheck(state.getBlock(), sideVec, EnumFacing.getFront(side))) { nextLayer.add(sideVec); } - else if (id == oxygenSealerID) + else if (state.getBlock() == oxygenSealerID) { TileEntityOxygenSealer sealer = this.sealersAround.get(sideVec); @@ -688,17 +689,17 @@ else if (id == oxygenSealerID) } } } - //If the chunk was unloaded, BlockVec3.getBlockID returns Blocks.bedrock + //If the chunk was unloaded, BlockVec3.getBlockID returns Blocks.BEDROCK //which is a solid block, so the loop will treat that as a sealed edge //and not iterate any further in that direction } // the if (this.isSealed) check here is unnecessary because of the returns else { - Block id = sideVec.getBlockIDsafe_noChunkLoad(this.world); + IBlockState state = sideVec.getBlockStateSafe_noChunkLoad(this.world); // id == null means the void or height y>255, both // of which are unsealed obviously - if (id == null || id == airID || id == breatheableAirID || id == airIDBright || id == breatheableAirIDBright || this.canBlockPassAirCheck(id, sideVec, EnumFacing.getFront(side))) + if (state.getBlock() == airID || state.getBlock() == breatheableAirID || state.getBlock() == airIDBright || state.getBlock() == breatheableAirIDBright || this.canBlockPassAirCheck(state.getBlock(), sideVec, EnumFacing.getFront(side))) { this.sealed = false; if (this.sealers.size() > 0) @@ -759,29 +760,29 @@ private void doLayerNearMapEdge() this.checkCount--; checkedLocal.add(sideVec); - Block id = sideVec.getBlockID_noChunkLoad(this.world); + IBlockState state = sideVec.getBlockState_noChunkLoad(this.world); // The most likely case - if (id == breatheableAirID) + if (state.getBlock() == breatheableAirID) { nextLayer.add(sideVec); this.ambientThermalTracked.add(sideVec); } - else if (id == airID) + else if (state.getBlock() == airID) { nextLayer.add(sideVec); this.airToReplace.add(sideVec); } - else if (id == breatheableAirIDBright) + else if (state.getBlock() == breatheableAirIDBright) { nextLayer.add(sideVec); this.ambientThermalTracked.add(sideVec); } - else if (id == airIDBright) + else if (state.getBlock() == airIDBright) { nextLayer.add(sideVec); this.airToReplaceBright.add(sideVec); } - else if (id == null) + else if (state.getBlock() == null) { // Broken through to the void or the // stratosphere (above y==255) - set @@ -790,11 +791,11 @@ else if (id == null) this.sealed = false; return; } - else if (this.canBlockPassAirCheck(id, sideVec, EnumFacing.getFront(side))) + else if (this.canBlockPassAirCheck(state.getBlock(), sideVec, EnumFacing.getFront(side))) { nextLayer.add(sideVec); } - else if (id == oxygenSealerID) + else if (state.getBlock() == oxygenSealerID) { TileEntityOxygenSealer sealer = this.sealersAround.get(sideVec); @@ -816,17 +817,17 @@ else if (id == oxygenSealerID) } } } - //If the chunk was unloaded, BlockVec3.getBlockID returns Blocks.bedrock + //If the chunk was unloaded, BlockVec3.getBlockID returns Blocks.BEDROCK //which is a solid block, so the loop will treat that as a sealed edge //and not iterate any further in that direction } // the if (this.isSealed) check here is unnecessary because of the returns else { - Block id = sideVec.getBlockID_noChunkLoad(this.world); + IBlockState state = sideVec.getBlockState_noChunkLoad(this.world); // id == null means the void or height y>255, both // of which are unsealed obviously - if (id == null || id == airID || id == breatheableAirID || id == airIDBright || id == breatheableAirIDBright || this.canBlockPassAirCheck(id, sideVec, EnumFacing.getFront(side))) + if (state.getBlock() == airID || state.getBlock() == breatheableAirID || state.getBlock() == airIDBright || state.getBlock() == breatheableAirIDBright || this.canBlockPassAirCheck(state.getBlock(), sideVec, EnumFacing.getFront(side))) { this.sealed = false; return; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/nei/BuggyRecipeHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/nei/BuggyRecipeHandler.java index bbc667b0c3..6feb0fb74b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/nei/BuggyRecipeHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/nei/BuggyRecipeHandler.java @@ -1,9 +1,9 @@ package micdoodle8.mods.galacticraft.core.nei; import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.util.NEIServerUtils; import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.item.ItemStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/nei/CircuitFabricatorRecipeHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/nei/CircuitFabricatorRecipeHandler.java index 0702b376eb..9ccbe0462e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/nei/CircuitFabricatorRecipeHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/nei/CircuitFabricatorRecipeHandler.java @@ -1,9 +1,9 @@ package micdoodle8.mods.galacticraft.core.nei; import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.util.NEIServerUtils; import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.item.ItemStack; @@ -13,7 +13,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; public class CircuitFabricatorRecipeHandler extends TemplateRecipeHandler @@ -32,11 +31,11 @@ public int recipiesPerPage() return 1; } - public Set, PositionedStack>> getRecipes() + public Set, PositionedStack>> getRecipes() { HashMap, PositionedStack> recipes = new HashMap, PositionedStack>(); - for (Entry, PositionedStack> stack : NEIGalacticraftConfig.getCircuitFabricatorRecipes()) + for (Map.Entry, PositionedStack> stack : NEIGalacticraftConfig.getCircuitFabricatorRecipes()) { ArrayList inputStacks = new ArrayList(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/nei/ElectricIngotCompressorRecipeHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/nei/ElectricIngotCompressorRecipeHandler.java index a81f9aad26..22a456df4b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/nei/ElectricIngotCompressorRecipeHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/nei/ElectricIngotCompressorRecipeHandler.java @@ -1,9 +1,9 @@ package micdoodle8.mods.galacticraft.core.nei; import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.util.NEIServerUtils; import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.item.ItemStack; @@ -13,7 +13,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; public class ElectricIngotCompressorRecipeHandler extends TemplateRecipeHandler @@ -33,11 +32,11 @@ public int recipiesPerPage() return 1; } - public Set, PositionedStack>> getRecipes() + public Set, PositionedStack>> getRecipes() { HashMap, PositionedStack> recipes = new HashMap, PositionedStack>(); - for (Entry, PositionedStack> stack : NEIGalacticraftConfig.getIngotCompressorRecipes()) + for (Map.Entry, PositionedStack> stack : NEIGalacticraftConfig.getIngotCompressorRecipes()) { ArrayList inputStacks = new ArrayList(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/nei/GCNEIHighlightHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/nei/GCNEIHighlightHandler.java index f65fcbb359..a759988d7f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/nei/GCNEIHighlightHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/nei/GCNEIHighlightHandler.java @@ -13,9 +13,9 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidTankInfo; @@ -24,7 +24,7 @@ public class GCNEIHighlightHandler implements IHighlightHandler { @Override - public List handleTextData(ItemStack stack, World world, EntityPlayer player, MovingObjectPosition mop, List currenttip, ItemInfo.Layout layout) + public List handleTextData(ItemStack stack, World world, EntityPlayer player, RayTraceResult mop, List currenttip, ItemInfo.Layout layout) { if (stack.getItem() == Item.getItemFromBlock(GCBlocks.fluidTank)) { @@ -70,7 +70,7 @@ else if (stack.getItem() == Item.getItemFromBlock(GCBlocks.oxygenPipe) || stack. } @Override - public ItemStack identifyHighlight(World world, EntityPlayer player, MovingObjectPosition mop) + public ItemStack identifyHighlight(World world, EntityPlayer player, RayTraceResult mop) { BlockPos pos = mop.getBlockPos(); IBlockState state = world.getBlockState(pos); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/nei/IngotCompressorRecipeHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/nei/IngotCompressorRecipeHandler.java index 1b53aaaee0..b910ca1f53 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/nei/IngotCompressorRecipeHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/nei/IngotCompressorRecipeHandler.java @@ -2,10 +2,10 @@ import codechicken.lib.gui.GuiDraw; import codechicken.nei.ItemList; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import codechicken.nei.recipe.FurnaceRecipeHandler.FuelPair; import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.util.NEIServerUtils; import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.block.Block; @@ -162,11 +162,11 @@ public PositionedStack getResultStack(int recipe) private static void removeFuels() { IngotCompressorRecipeHandler.efuels = new TreeSet(); - IngotCompressorRecipeHandler.efuels.add(Block.getIdFromBlock(Blocks.brown_mushroom)); - IngotCompressorRecipeHandler.efuels.add(Block.getIdFromBlock(Blocks.brown_mushroom_block)); - IngotCompressorRecipeHandler.efuels.add(Block.getIdFromBlock(Blocks.wall_sign)); - IngotCompressorRecipeHandler.efuels.add(Block.getIdFromBlock(Blocks.standing_sign)); - IngotCompressorRecipeHandler.efuels.add(Block.getIdFromBlock(Blocks.trapped_chest)); + IngotCompressorRecipeHandler.efuels.add(Block.getIdFromBlock(Blocks.BROWN_MUSHROOM)); + IngotCompressorRecipeHandler.efuels.add(Block.getIdFromBlock(Blocks.BROWN_MUSHROOM_BLOCK)); + IngotCompressorRecipeHandler.efuels.add(Block.getIdFromBlock(Blocks.WALL_SIGN)); + IngotCompressorRecipeHandler.efuels.add(Block.getIdFromBlock(Blocks.STANDING_SIGN)); + IngotCompressorRecipeHandler.efuels.add(Block.getIdFromBlock(Blocks.TRAPPED_CHEST)); } private static void findFuels() diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/nei/NEIGalacticraftConfig.java b/src/main/java/micdoodle8/mods/galacticraft/core/nei/NEIGalacticraftConfig.java index 7c8ff14630..02f7d7de36 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/nei/NEIGalacticraftConfig.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/nei/NEIGalacticraftConfig.java @@ -1,9 +1,9 @@ package micdoodle8.mods.galacticraft.core.nei; -import codechicken.nei.PositionedStack; import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; import codechicken.nei.api.ItemInfo; +import codechicken.nei.api.stack.PositionedStack; import micdoodle8.mods.galacticraft.api.recipe.CompressorRecipes; import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.GCBlocks; @@ -20,7 +20,7 @@ import net.minecraftforge.oredict.ShapelessOreRecipe; import java.util.HashMap; -import java.util.Map.Entry; +import java.util.Map; import java.util.Set; public class NEIGalacticraftConfig implements IConfigureNEI @@ -106,27 +106,27 @@ public void registerRefineryRecipe(PositionedStack input, PositionedStack output NEIGalacticraftConfig.refineryRecipes.put(input, output); } - public static Set, PositionedStack>> getIngotCompressorRecipes() + public static Set, PositionedStack>> getIngotCompressorRecipes() { return NEIGalacticraftConfig.ingotCompressorRecipes.entrySet(); } - public static Set, PositionedStack>> getCircuitFabricatorRecipes() + public static Set, PositionedStack>> getCircuitFabricatorRecipes() { return NEIGalacticraftConfig.circuitFabricatorRecipes.entrySet(); } - public static Set, PositionedStack>> getRocketBenchRecipes() + public static Set, PositionedStack>> getRocketBenchRecipes() { return NEIGalacticraftConfig.rocketBenchRecipes.entrySet(); } - public static Set, PositionedStack>> getBuggyBenchRecipes() + public static Set, PositionedStack>> getBuggyBenchRecipes() { return NEIGalacticraftConfig.buggyBenchRecipes.entrySet(); } - public static Set> getRefineryRecipes() + public static Set> getRefineryRecipes() { return NEIGalacticraftConfig.refineryRecipes.entrySet(); } @@ -220,43 +220,43 @@ private void addRocketRecipes() this.registerRocketBenchRecipe(input1, new PositionedStack(new ItemStack(GCItems.rocketTier1, 1, 0), 139, 92)); HashMap input2 = new HashMap(input1); - input2.put(14, new PositionedStack(new ItemStack(Blocks.chest), 90, 8)); + input2.put(14, new PositionedStack(new ItemStack(Blocks.CHEST), 90, 8)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(GCItems.rocketTier1, 1, 1), 139, 92)); input2 = new HashMap(input1); - input2.put(15, new PositionedStack(new ItemStack(Blocks.chest), 116, 8)); + input2.put(15, new PositionedStack(new ItemStack(Blocks.CHEST), 116, 8)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(GCItems.rocketTier1, 1, 1), 139, 92)); input2 = new HashMap(input1); - input2.put(16, new PositionedStack(new ItemStack(Blocks.chest), 142, 8)); + input2.put(16, new PositionedStack(new ItemStack(Blocks.CHEST), 142, 8)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(GCItems.rocketTier1, 1, 1), 139, 92)); input2 = new HashMap(input1); - input2.put(14, new PositionedStack(new ItemStack(Blocks.chest), 90, 8)); - input2.put(15, new PositionedStack(new ItemStack(Blocks.chest), 116, 8)); + input2.put(14, new PositionedStack(new ItemStack(Blocks.CHEST), 90, 8)); + input2.put(15, new PositionedStack(new ItemStack(Blocks.CHEST), 116, 8)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(GCItems.rocketTier1, 1, 2), 139, 92)); input2 = new HashMap(input1); - input2.put(15, new PositionedStack(new ItemStack(Blocks.chest), 116, 8)); - input2.put(16, new PositionedStack(new ItemStack(Blocks.chest), 142, 8)); + input2.put(15, new PositionedStack(new ItemStack(Blocks.CHEST), 116, 8)); + input2.put(16, new PositionedStack(new ItemStack(Blocks.CHEST), 142, 8)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(GCItems.rocketTier1, 1, 2), 139, 92)); input2 = new HashMap(input1); - input2.put(14, new PositionedStack(new ItemStack(Blocks.chest), 90, 8)); - input2.put(16, new PositionedStack(new ItemStack(Blocks.chest), 142, 8)); + input2.put(14, new PositionedStack(new ItemStack(Blocks.CHEST), 90, 8)); + input2.put(16, new PositionedStack(new ItemStack(Blocks.CHEST), 142, 8)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(GCItems.rocketTier1, 1, 2), 139, 92)); input2 = new HashMap(input1); - input2.put(14, new PositionedStack(new ItemStack(Blocks.chest), 90, 8)); - input2.put(15, new PositionedStack(new ItemStack(Blocks.chest), 116, 8)); - input2.put(16, new PositionedStack(new ItemStack(Blocks.chest), 142, 8)); + input2.put(14, new PositionedStack(new ItemStack(Blocks.CHEST), 90, 8)); + input2.put(15, new PositionedStack(new ItemStack(Blocks.CHEST), 116, 8)); + input2.put(16, new PositionedStack(new ItemStack(Blocks.CHEST), 142, 8)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(GCItems.rocketTier1, 1, 3), 139, 92)); } private void addCircuitFabricatorRecipes() { HashMap input1 = new HashMap(); - input1.put(0, new PositionedStack(new ItemStack(Items.diamond), 10, 22)); + input1.put(0, new PositionedStack(new ItemStack(Items.DIAMOND), 10, 22)); int siliconCount = OreDictionary.getOres(ConfigManagerCore.otherModsSilicon).size(); ItemStack[] silicons = new ItemStack[siliconCount + 1]; silicons[0] = new ItemStack(GCItems.basicItem, 1, 2); @@ -266,8 +266,8 @@ private void addCircuitFabricatorRecipes() } input1.put(1, new PositionedStack(silicons, 69, 51)); input1.put(2, new PositionedStack(silicons, 69, 69)); - input1.put(3, new PositionedStack(new ItemStack(Items.redstone), 117, 51)); - input1.put(4, new PositionedStack(new ItemStack(Blocks.redstone_torch), 140, 25)); + input1.put(3, new PositionedStack(new ItemStack(Items.REDSTONE), 117, 51)); + input1.put(4, new PositionedStack(new ItemStack(Blocks.REDSTONE_TORCH), 140, 25)); this.registerCircuitFabricatorRecipe(input1, new PositionedStack(new ItemStack(GCItems.basicItem, ConfigManagerCore.quickMode ? 5 : 3, 13), 147, 91)); HashMap input2 = new HashMap(input1); @@ -275,7 +275,7 @@ private void addCircuitFabricatorRecipes() this.registerCircuitFabricatorRecipe(input2, new PositionedStack(new ItemStack(GCItems.basicItem, 9, 12), 147, 91)); input2 = new HashMap(input1); - input2.put(4, new PositionedStack(new ItemStack(Items.repeater), 140, 25)); + input2.put(4, new PositionedStack(new ItemStack(Items.REPEATER), 140, 25)); this.registerCircuitFabricatorRecipe(input2, new PositionedStack(new ItemStack(GCItems.basicItem, ConfigManagerCore.quickMode ? 2 : 1, 14), 147, 91)); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/nei/RefineryRecipeHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/nei/RefineryRecipeHandler.java index a9140b440b..7c64ca9e2e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/nei/RefineryRecipeHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/nei/RefineryRecipeHandler.java @@ -1,9 +1,9 @@ package micdoodle8.mods.galacticraft.core.nei; import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.util.NEIServerUtils; import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/nei/RocketT1RecipeHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/nei/RocketT1RecipeHandler.java index f367830447..586e12620c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/nei/RocketT1RecipeHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/nei/RocketT1RecipeHandler.java @@ -1,9 +1,9 @@ package micdoodle8.mods.galacticraft.core.nei; import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.util.NEIServerUtils; import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.item.ItemStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/ConnectionEvents.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/ConnectionEvents.java index 8cbf6abdb2..8905e9a753 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/ConnectionEvents.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/ConnectionEvents.java @@ -40,7 +40,7 @@ public class ConnectionEvents protected static EnumConnectionState registerPacket(EnumPacketDirection direction, Class> packetClass) { - BiMap>> bimap = (BiMap) EnumConnectionState.PLAY.directionMaps.get(direction); + BiMap>> bimap = (BiMap) EnumConnectionState.PLAY.directionMaps.get(direction); if (bimap == null) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java index e12a137c62..1985b84b17 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/recipe/RecipeManagerGC.java @@ -1,13 +1,11 @@ package micdoodle8.mods.galacticraft.core.recipe; -import buildcraft.api.recipes.BuildcraftRecipeRegistry; import micdoodle8.mods.galacticraft.api.GalacticraftRegistry; import micdoodle8.mods.galacticraft.api.recipe.CircuitFabricatorRecipes; import micdoodle8.mods.galacticraft.api.recipe.CompressorRecipes; import micdoodle8.mods.galacticraft.api.recipe.SpaceStationRecipe; import micdoodle8.mods.galacticraft.api.world.SpaceStationType; import micdoodle8.mods.galacticraft.core.GCBlocks; -import micdoodle8.mods.galacticraft.core.GCFluids; import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.blocks.BlockEnclosed; @@ -24,8 +22,6 @@ import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapelessOreRecipe; @@ -389,7 +385,7 @@ private static void addUniversalRecipes() RecipeUtil.addRecipe(new ItemStack(GCBlocks.airLockFrame, 1, 1), new Object[] { "YYY", "WZW", "YYY", 'W', meteoricIronPlate, 'Y', "compressedSteel", 'Z', new ItemStack(GCItems.basicItem, 1, 13) }); // Disable oil extractor: - // RecipeUtil.addRecipe(new ItemStack(GCItems.oilExtractor), new Object[] { "X ", " XY", "ZYY", 'X', "compressedSteel", 'Y', "compressedBronze", 'Z', Items.redstone }); + // RecipeUtil.addRecipe(new ItemStack(GCItems.oilExtractor), new Object[] { "X ", " XY", "ZYY", 'X', "compressedSteel", 'Y', "compressedBronze", 'Z', Items.REDSTONE }); RecipeUtil.addRecipe(new ItemStack(GCItems.basicItem, 1, 20), new Object[] { "WVW", "YXY", "YZY", 'X', "compressedSteel", 'Y', "compressedBronze", 'Z', "waferBasic", 'W', Items.REDSTONE, 'V', GCItems.oxygenVent }); @@ -562,7 +558,7 @@ private static void addBuildCraftCraftingRecipes() boolean refineryDone = false; try { - BuildcraftRecipeRegistry.refinery.addRecipe("buildcraft:fuel", new FluidStack(GCFluids.fluidOil, 1), new FluidStack(FluidRegistry.getFluid("fuel"), 1), 120, 1); +// BuildcraftRecipeRegistry.refinery.addRecipe("buildcraft:fuel", new FluidStack(GCFluids.fluidOil, 1), new FluidStack(FluidRegistry.getFluid("fuel"), 1), 120, 1); refineryDone = true; } catch (Exception e) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java index ce6dd126ca..e907d448b8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerServer.java @@ -538,7 +538,7 @@ public void onWorldTick(WorldTickEvent event) //Only replace blocks of type BlockAir or fire - this is to prevent accidents where other mods have moved blocks if (changePosition != null && (block instanceof BlockAir || block == Blocks.FIRE)) { - world.setBlockState(changePosition, change.getChangeID().getStateFromMeta(change.getChangeMeta()), change.getChangeUpdateFlag()); + world.setBlockState(changePosition, change.getChangeState(), change.getChangeUpdateFlag()); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAirLockController.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAirLockController.java index 7da2b5692c..d47f9ce291 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAirLockController.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAirLockController.java @@ -1,13 +1,15 @@ package micdoodle8.mods.galacticraft.core.tile; import micdoodle8.mods.galacticraft.api.vector.Vector3; -import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.GCBlocks; +import micdoodle8.mods.galacticraft.core.client.sounds.GCSounds; import micdoodle8.mods.miccore.Annotations.NetworkedField; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; @@ -150,7 +152,8 @@ else if (!this.active && this.lastActive || this.otherAirLocks == null && this.l if (this.active != this.lastActive) { - this.worldObj.notifyBlockUpdate(this.getPos()); + IBlockState state = this.worldObj.getBlockState(this.getPos()); + this.worldObj.notifyBlockUpdate(this.getPos(), state, state, 3); } this.lastActive = this.active; @@ -169,7 +172,7 @@ public void sealAirLock() if (this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock() != GCBlocks.airLockSeal) { - this.worldObj.playSoundEffect(x, y, z, Constants.TEXTURE_PREFIX + "player.openairlock", 1.0F, 1.0F); + this.worldObj.playSound(null, x, y, z, GCSounds.openAirLock, SoundCategory.BLOCKS, 1.0F, 1.0F); } if (this.horizontalModeEnabled) @@ -180,9 +183,10 @@ public void sealAirLock() { for (z = this.protocol.minZ + 1; z <= this.protocol.maxZ - 1; z++) { - Block blockAt = this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock(); + BlockPos pos = new BlockPos(x, y, z); + Block blockAt = this.worldObj.getBlockState(pos).getBlock(); - if (blockAt.isAir(this.worldObj, new BlockPos(x, y, z))) + if (blockAt.isAir(this.worldObj.getBlockState(pos), this.worldObj, pos)) { this.worldObj.setBlockState(new BlockPos(x, this.protocol.minY, z), GCBlocks.airLockSeal.getDefaultState(), 3); } @@ -198,9 +202,10 @@ public void sealAirLock() { for (y = this.protocol.minY + 1; y <= this.protocol.maxY - 1; y++) { - Block blockAt = this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock(); + BlockPos pos = new BlockPos(x, y, z); + Block blockAt = this.worldObj.getBlockState(pos).getBlock(); - if (blockAt.isAir(this.worldObj, new BlockPos(x, y, z))) + if (blockAt.isAir(this.worldObj.getBlockState(pos), this.worldObj, pos)) { this.worldObj.setBlockState(new BlockPos(x, y, this.protocol.minZ), GCBlocks.airLockSeal.getDefaultState(), 3); } @@ -213,9 +218,10 @@ else if (this.protocol.minZ != this.protocol.maxZ) { for (y = this.protocol.minY + 1; y <= this.protocol.maxY - 1; y++) { - Block blockAt = this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock(); + BlockPos pos = new BlockPos(x, y, z); + Block blockAt = this.worldObj.getBlockState(pos).getBlock(); - if (blockAt.isAir(this.worldObj, new BlockPos(x, y, z))) + if (blockAt.isAir(this.worldObj.getBlockState(pos), this.worldObj, pos)) { this.worldObj.setBlockState(new BlockPos(this.protocol.minX, y, z), GCBlocks.airLockSeal.getDefaultState(), 3); } @@ -236,9 +242,13 @@ public void unsealAirLock() int y = this.lastProtocol.minY + (this.lastProtocol.maxY - this.lastProtocol.minY) / 2; int z = this.lastProtocol.minZ + (this.lastProtocol.maxZ - this.lastProtocol.minZ) / 2; - if (this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock().getMaterial() != Material.AIR) + BlockPos pos = new BlockPos(x, y, z); + IBlockState state = this.worldObj.getBlockState(pos); + Block blockAt = state.getBlock(); + + if (state.getBlock().getMaterial(state) != Material.AIR) { - this.worldObj.playSoundEffect(x, y, z, Constants.TEXTURE_PREFIX + "player.closeairlock", 1.0F, 1.0F); + this.worldObj.playSound(null, x, y, z, GCSounds.closeAirLock, SoundCategory.BLOCKS, 1.0F, 1.0F); } if (this.lastHorizontalModeEnabled) @@ -249,7 +259,7 @@ public void unsealAirLock() { for (z = this.protocol.minZ + 1; z <= this.protocol.maxZ - 1; z++) { - Block blockAt = this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock(); + blockAt = this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock(); if (blockAt == GCBlocks.airLockSeal) { @@ -267,7 +277,7 @@ public void unsealAirLock() { for (y = this.lastProtocol.minY + 1; y <= this.lastProtocol.maxY - 1; y++) { - Block blockAt = this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock(); + blockAt = this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock(); if (blockAt == GCBlocks.airLockSeal) { @@ -282,7 +292,7 @@ else if (this.lastProtocol.minZ != this.lastProtocol.maxZ) { for (y = this.lastProtocol.minY + 1; y <= this.lastProtocol.maxY - 1; y++) { - Block blockAt = this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock(); + blockAt = this.worldObj.getBlockState(new BlockPos(x, y, z)).getBlock(); if (blockAt == GCBlocks.airLockSeal) { @@ -324,6 +334,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) nbt.setBoolean("active", this.active); nbt.setBoolean("lastActive", this.lastActive); nbt.setBoolean("HorizontalModeEnabled", this.horizontalModeEnabled); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAluminumWire.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAluminumWire.java index 1e21225124..63c87b872c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAluminumWire.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityAluminumWire.java @@ -34,6 +34,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setInteger("tier", this.tier); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java index 0e9e7fcf94..5be33eca9b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityArclamp.java @@ -8,6 +8,7 @@ import micdoodle8.mods.galacticraft.core.util.RedstoneUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockAir; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.ai.RandomPositionGenerator; @@ -17,10 +18,10 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.pathfinding.PathNavigate; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ITickable; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.ITickable; -import net.minecraft.util.Vec3d; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import java.util.HashSet; @@ -132,7 +133,7 @@ else if (!this.isActive) if (this.worldObj.rand.nextInt(20) == 0) { - List moblist = this.worldObj.getEntitiesInAABBexcluding(null, this.thisAABB, IMob.mobSelector); + List moblist = this.worldObj.getEntitiesInAABBexcluding(null, this.thisAABB, IMob.MOB_SELECTOR); if (!moblist.isEmpty()) { @@ -226,8 +227,8 @@ public void lightArea() if (i != sideskip1 && i != sideskip2 && i != (sideskip1 ^ 1) && i != (sideskip2 ^ 1)) { BlockVec3 onEitherSide = thisvec.newVecSide(i); - Block b = onEitherSide.getBlockIDsafe_noChunkLoad(world); - if (b != null && b.getLightOpacity() < 15) + IBlockState state = onEitherSide.getBlockStateSafe_noChunkLoad(world); + if (state.getBlock().getLightOpacity(state) < 15) { currentLayer.add(onEitherSide); } @@ -237,8 +238,8 @@ public void lightArea() for (int i = 0; i < 5; i++) { inFront = inFront.newVecSide(this.facingSide).newVecSide(sideskip1 ^ 1); - Block b = inFront.getBlockIDsafe_noChunkLoad(world); - if (b != null && b.getLightOpacity() < 15) + IBlockState state = inFront.getBlockStateSafe_noChunkLoad(world); + if (state.getBlock().getLightOpacity(state) < 15) { currentLayer.add(inFront); } @@ -266,8 +267,8 @@ public void lightArea() { checked.add(sideVec); - Block b = sideVec.getBlockIDsafe_noChunkLoad(world); - if (b instanceof BlockAir) + IBlockState state = sideVec.getBlockStateSafe_noChunkLoad(world); + if (state.getBlock() instanceof BlockAir) { if (side != sideskip1 && side != sideskip2) { @@ -277,7 +278,7 @@ public void lightArea() else { allAir = false; - if (b != null && b.getLightOpacity(world, sideVecPos) == 0) + if (state.getBlock().getLightOpacity(state, world, sideVecPos) == 0) { if (side != sideskip1 && side != sideskip2) { @@ -293,16 +294,16 @@ public void lightArea() if (!allAir) { - Block id = vec.getBlockIDsafe_noChunkLoad(world); - if (id.isAir(world, vec.toBlockPos())) + IBlockState state = vec.getBlockStateSafe_noChunkLoad(world); + if (state.getBlock().isAir(state, world, vec.toBlockPos())) { - if (Blocks.AIR == id) + if (Blocks.AIR == state.getBlock()) { world.setBlockState(vec.toBlockPos(), brightAir.getDefaultState(), 2); this.airToRestore.add(vec); this.markDirty(); } - else if (id == breatheableAirID) + else if (state.getBlock() == breatheableAirID) { world.setBlockState(vec.toBlockPos(), brightBreatheableAir.getDefaultState(), 2); this.airToRestore.add(vec); @@ -359,6 +360,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) airBlocks.appendTag(tag); } nbt.setTag("AirBlocks", airBlocks); + return nbt; } public void facingChanged() @@ -382,12 +384,12 @@ private void revertAir() Block brightBreatheableAir = GCBlocks.brightBreatheableAir; for (BlockVec3 vec : this.airToRestore) { - Block b = vec.getBlock(this.worldObj); - if (b == brightAir) + IBlockState b = vec.getBlockState(this.worldObj); + if (b.getBlock() == brightAir) { this.worldObj.setBlockState(vec.toBlockPos(), Blocks.AIR.getDefaultState(), 2); } - else if (b == brightBreatheableAir) + else if (b.getBlock() == brightBreatheableAir) { this.worldObj.setBlockState(vec.toBlockPos(), GCBlocks.breatheableAir.getDefaultState(), 2); //No block update - not necessary for changing air to air, also must not trigger a sealer edge check diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoLoader.java index 35e7500c43..637f80a927 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoLoader.java @@ -14,7 +14,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.IBlockAccess; import net.minecraftforge.fml.relauncher.Side; @@ -114,17 +118,18 @@ else if (pad != null && pad instanceof ICargoEntity) } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) + public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(par1NBTTagCompound); - this.containingItems = this.readStandardItemsFromNBT(par1NBTTagCompound); + super.readFromNBT(nbt); + this.containingItems = this.readStandardItemsFromNBT(nbt); } @Override - public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(par1NBTTagCompound); - this.writeStandardItemsToNBT(par1NBTTagCompound); + super.writeToNBT(nbt); + this.writeStandardItemsToNBT(nbt); + return nbt; } @Override @@ -148,7 +153,7 @@ public boolean hasCustomName() @Override public ITextComponent getDisplayName() { - return (this.hasCustomName() ? new TextComponentString(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); + return (this.hasCustomName() ? new TextComponentString(this.getName()) : new TextComponentTranslation(this.getName(), new Object[0])); } // ISidedInventory Implementation: diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java index 1a61e1371f..ebf52f71f5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoUnloader.java @@ -115,17 +115,18 @@ else if (pad != null && pad instanceof ICargoEntity) } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) + public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(par1NBTTagCompound); - this.containingItems = this.readStandardItemsFromNBT(par1NBTTagCompound); + super.readFromNBT(nbt); + this.containingItems = this.readStandardItemsFromNBT(nbt); } @Override - public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(par1NBTTagCompound); - this.writeStandardItemsToNBT(par1NBTTagCompound); + super.writeToNBT(nbt); + this.writeStandardItemsToNBT(nbt); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCircuitFabricator.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCircuitFabricator.java index 07d76a66cf..95046d3d39 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCircuitFabricator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCircuitFabricator.java @@ -11,10 +11,12 @@ import micdoodle8.mods.galacticraft.planets.mars.blocks.BlockMachineMars; import micdoodle8.mods.miccore.Annotations.NetworkedField; import net.minecraft.entity.item.EntityItem; +import net.minecraft.init.SoundEvents; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.SoundCategory; import net.minecraft.util.text.ITextComponent; import net.minecraftforge.fml.relauncher.Side; @@ -55,7 +57,7 @@ public void update() if (this.processTicks == TileEntityCircuitFabricator.PROCESS_TIME_REQUIRED) { - this.worldObj.playSoundEffect(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), "random.anvil_land", 0.2F, 0.5F); + this.worldObj.playSound(null, this.getPos(), SoundEvents.BLOCK_ANVIL_LAND, SoundCategory.BLOCKS, 0.3F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); this.processTicks = 0; this.compressItems(); updateInv = true; @@ -165,19 +167,20 @@ else if (this.containingItems[6].isItemEqual(resultItemStack)) } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) + public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(par1NBTTagCompound); - this.processTicks = par1NBTTagCompound.getInteger("smeltingTicks"); - this.containingItems = this.readStandardItemsFromNBT(par1NBTTagCompound); + super.readFromNBT(nbt); + this.processTicks = nbt.getInteger("smeltingTicks"); + this.containingItems = this.readStandardItemsFromNBT(nbt); } @Override - public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(par1NBTTagCompound); - par1NBTTagCompound.setInteger("smeltingTicks", this.processTicks); - this.writeStandardItemsToNBT(par1NBTTagCompound); + super.writeToNBT(nbt); + nbt.setInteger("smeltingTicks", this.processTicks); + this.writeStandardItemsToNBT(nbt); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCoalGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCoalGenerator.java index 831c96bf1f..fcec3ff10b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCoalGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCoalGenerator.java @@ -85,12 +85,12 @@ public void update() if (this.itemCookTime <= 0 && this.containingItems[0] != null) { - if (this.containingItems[0].getItem() == Items.coal && this.containingItems[0].stackSize > 0) + if (this.containingItems[0].getItem() == Items.COAL && this.containingItems[0].stackSize > 0) { this.itemCookTime = 320; this.decrStackSize(0, 1); } - else if (this.containingItems[0].getItem() == Item.getItemFromBlock(Blocks.coal_block) && this.containingItems[0].stackSize > 0) + else if (this.containingItems[0].getItem() == Item.getItemFromBlock(Blocks.COAL_BLOCK) && this.containingItems[0].stackSize > 0) { this.itemCookTime = 320 * 10; this.decrStackSize(0, 1); @@ -118,16 +118,13 @@ public void closeInventory(EntityPlayer player) { } - /** - * Reads a tile entity from NBT. - */ @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) + public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(par1NBTTagCompound); - this.itemCookTime = par1NBTTagCompound.getInteger("itemCookTime"); - this.heatGJperTick = par1NBTTagCompound.getInteger("generateRateInt"); - NBTTagList var2 = par1NBTTagCompound.getTagList("Items", 10); + super.readFromNBT(nbt); + this.itemCookTime = nbt.getInteger("itemCookTime"); + this.heatGJperTick = nbt.getInteger("generateRateInt"); + NBTTagList var2 = nbt.getTagList("Items", 10); this.containingItems = new ItemStack[this.getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) @@ -142,15 +139,12 @@ public void readFromNBT(NBTTagCompound par1NBTTagCompound) } } - /** - * Writes a tile entity to NBT. - */ @Override - public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(par1NBTTagCompound); - par1NBTTagCompound.setInteger("itemCookTime", this.itemCookTime); - par1NBTTagCompound.setFloat("generateRate", this.heatGJperTick); + super.writeToNBT(nbt); + nbt.setInteger("itemCookTime", this.itemCookTime); + nbt.setFloat("generateRate", this.heatGJperTick); NBTTagList var2 = new NBTTagList(); for (int var3 = 0; var3 < this.containingItems.length; ++var3) @@ -164,7 +158,8 @@ public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) } } - par1NBTTagCompound.setTag("Items", var2); + nbt.setTag("Items", var2); + return nbt; } @Override @@ -263,7 +258,7 @@ public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) @Override public boolean isItemValidForSlot(int slotID, ItemStack itemstack) { - return itemstack.getItem() == Items.coal || itemstack.getItem() == Item.getItemFromBlock(Blocks.coal_block); + return itemstack.getItem() == Items.COAL || itemstack.getItem() == Item.getItemFromBlock(Blocks.COAL_BLOCK); } // @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java index cd4800f566..1a67ebbc37 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java @@ -15,9 +15,9 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.EnumFacing; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; @@ -94,11 +94,12 @@ else if (celestialAngle > 150) this.currentAngle += difference / 20.0F; } -// @Override TODO -// public boolean onActivated(EntityPlayer entityPlayer) -// { + @Override + public boolean onActivated(EntityPlayer entityPlayer) + { + return false; // TODO // return this.getBlockType().onBlockActivated(this.worldObj, this.getPos(), this.worldObj.getBlockState(this.getPos()), entityPlayer, EnumFacing.DOWN, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); -// } + } @Override public void onCreate(World world, BlockPos placedPosition) @@ -204,6 +205,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) } nbt.setTag("Items", list); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java index fa64c18d85..07b6f07ab6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java @@ -238,6 +238,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) nbt.setInteger("chestY", this.chestPos.getY()); nbt.setInteger("chestZ", this.chestPos.getZ()); } + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricFurnace.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricFurnace.java index 36c697a67d..6684cab06a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricFurnace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricFurnace.java @@ -205,9 +205,9 @@ else if (this.containingItems[2].isItemEqual(resultItemStack)) } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) + public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(par1NBTTagCompound); + super.readFromNBT(nbt); if (this.storage.getEnergyStoredGC() > EnergyStorageTile.STANDARD_CAPACITY) { this.setTier2(); @@ -217,20 +217,21 @@ public void readFromNBT(NBTTagCompound par1NBTTagCompound) { this.initialised = false; } - this.processTicks = par1NBTTagCompound.getInteger("smeltingTicks"); - this.containingItems = this.readStandardItemsFromNBT(par1NBTTagCompound); + this.processTicks = nbt.getInteger("smeltingTicks"); + this.containingItems = this.readStandardItemsFromNBT(nbt); } @Override - public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { if (this.tierGC == 1 && this.storage.getEnergyStoredGC() > EnergyStorageTile.STANDARD_CAPACITY) { this.storage.setEnergyStored(EnergyStorageTile.STANDARD_CAPACITY); } - super.writeToNBT(par1NBTTagCompound); - par1NBTTagCompound.setInteger("smeltingTicks", this.processTicks); - this.writeStandardItemsToNBT(par1NBTTagCompound); + super.writeToNBT(nbt); + nbt.setInteger("smeltingTicks", this.processTicks); + this.writeStandardItemsToNBT(nbt); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricIngotCompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricIngotCompressor.java index 3797779ead..b13f78fd0b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricIngotCompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricIngotCompressor.java @@ -12,12 +12,14 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; +import net.minecraft.init.SoundEvents; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; +import net.minecraft.util.SoundCategory; import net.minecraft.util.text.ITextComponent; import net.minecraftforge.fml.relauncher.Side; @@ -61,7 +63,7 @@ public void update() if (this.processTicks >= this.processTimeRequired) { - this.worldObj.playSoundEffect(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), "random.anvil_land", 0.2F, 0.5F); + this.worldObj.playSound(null, this.getPos(), SoundEvents.BLOCK_ANVIL_LAND, SoundCategory.BLOCKS, 0.3F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); this.processTicks = 0; this.compressItems(); updateInv = true; @@ -186,9 +188,9 @@ else if (this.containingItems[slot].isItemEqual(resultItemStack)) for (int i = 0; i < this.compressingCraftMatrix.getSizeInventory(); i++) { - if (this.compressingCraftMatrix.getStackInSlot(i) != null && this.compressingCraftMatrix.getStackInSlot(i).getItem() == Items.water_bucket) + if (this.compressingCraftMatrix.getStackInSlot(i) != null && this.compressingCraftMatrix.getStackInSlot(i).getItem() == Items.WATER_BUCKET) { - this.compressingCraftMatrix.setInventorySlotContentsNoUpdate(i, new ItemStack(Items.bucket)); + this.compressingCraftMatrix.setInventorySlotContentsNoUpdate(i, new ItemStack(Items.BUCKET)); } else { @@ -201,11 +203,11 @@ else if (this.containingItems[slot].isItemEqual(resultItemStack)) } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) + public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(par1NBTTagCompound); - this.processTicks = par1NBTTagCompound.getInteger("smeltingTicks"); - NBTTagList var2 = par1NBTTagCompound.getTagList("Items", 10); + super.readFromNBT(nbt); + this.processTicks = nbt.getInteger("smeltingTicks"); + NBTTagList var2 = nbt.getTagList("Items", 10); this.containingItems = new ItemStack[this.getSizeInventory() - this.compressingCraftMatrix.getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) @@ -227,10 +229,10 @@ else if (var5 < this.containingItems.length + this.compressingCraftMatrix.getSiz } @Override - public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(par1NBTTagCompound); - par1NBTTagCompound.setInteger("smeltingTicks", this.processTicks); + super.writeToNBT(nbt); + nbt.setInteger("smeltingTicks", this.processTicks); NBTTagList var2 = new NBTTagList(); int var3; @@ -256,7 +258,8 @@ public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) } } - par1NBTTagCompound.setTag("Items", var2); + nbt.setTag("Items", var2); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityEnergyStorageModule.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityEnergyStorageModule.java index d02f735b81..112d7372b4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityEnergyStorageModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityEnergyStorageModule.java @@ -128,13 +128,10 @@ public void closeInventory(EntityPlayer player) { } - /** - * Reads a tile entity from NBT. - */ @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) + public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(par1NBTTagCompound); + super.readFromNBT(nbt); if (this.storage.getEnergyStoredGC() > BASE_CAPACITY) { this.setTier2(); @@ -145,7 +142,7 @@ public void readFromNBT(NBTTagCompound par1NBTTagCompound) this.initialised = false; } - NBTTagList var2 = par1NBTTagCompound.getTagList("Items", 10); + NBTTagList var2 = nbt.getTagList("Items", 10); this.containingItems = new ItemStack[this.getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) @@ -160,18 +157,15 @@ public void readFromNBT(NBTTagCompound par1NBTTagCompound) } } - /** - * Writes a tile entity to NBT. - */ @Override - public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { if (this.tierGC == 1 && this.storage.getEnergyStoredGC() > BASE_CAPACITY) { this.storage.setEnergyStored(BASE_CAPACITY); } - super.writeToNBT(par1NBTTagCompound); + super.writeToNBT(nbt); NBTTagList var2 = new NBTTagList(); for (int var3 = 0; var3 < this.containingItems.length; ++var3) @@ -185,7 +179,8 @@ public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) } } - par1NBTTagCompound.setTag("Items", var2); + nbt.setTag("Items", var2); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFallenMeteor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFallenMeteor.java index f6b5e2659b..d8a6547fad 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFallenMeteor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFallenMeteor.java @@ -68,6 +68,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setInteger("MeteorHeatLevel", this.heatLevel); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidPipe.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidPipe.java index 6a13bc8e59..f487e2f091 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidPipe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidPipe.java @@ -147,7 +147,8 @@ public byte getColor(IBlockState state) @Override public void onAdjacentColorChanged(EnumFacing direction) { - this.worldObj.notifyBlockUpdate(this.getPos()); + IBlockState state = this.worldObj.getBlockState(this.getPos()); + this.worldObj.notifyBlockUpdate(this.getPos(), state, state, 3); if (!this.worldObj.isRemote) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java index 5258e89771..ca5382e535 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java @@ -7,11 +7,10 @@ import micdoodle8.mods.galacticraft.core.util.DelayTimer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fluids.*; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.network.ByteBufUtils; @@ -222,31 +221,32 @@ public TileEntityFluidTank getPreviousTank(BlockPos current) } @Override - public void readFromNBT(NBTTagCompound compound) + public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(compound); + super.readFromNBT(nbt); - if (compound.hasKey("fuelTank")) + if (nbt.hasKey("fuelTank")) { - this.fluidTank.readFromNBT(compound.getCompoundTag("fuelTank")); + this.fluidTank.readFromNBT(nbt.getCompoundTag("fuelTank")); } this.updateClient = true; } @Override - public NBTTagCompound writeToNBT(NBTTagCompound compound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(compound); + super.writeToNBT(nbt); if (this.fluidTank.getFluid() != null) { - compound.setTag("fuelTank", this.fluidTank.writeToNBT(new NBTTagCompound())); + nbt.setTag("fuelTank", this.fluidTank.writeToNBT(new NBTTagCompound())); } + return nbt; } @Override - public Packet getDescriptionPacket() + public SPacketUpdateTileEntity getUpdatePacket() { NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("net-type", "desc-packet"); @@ -256,12 +256,12 @@ public Packet getDescriptionPacket() byte[] bytes = new byte[buf.readableBytes()]; buf.readBytes(bytes); nbt.setByteArray("net-data", bytes); - S35PacketUpdateTileEntity tileUpdate = new S35PacketUpdateTileEntity(getPos(), 0, nbt); + SPacketUpdateTileEntity tileUpdate = new SPacketUpdateTileEntity(getPos(), 0, nbt); return tileUpdate; } @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) + public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) { if (!worldObj.isRemote) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java index 97ca9aafb3..989ae721c1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java @@ -93,7 +93,7 @@ public void update() { this.fuelTank.fill(new FluidStack(GCFluids.fluidFuel, (amount - 1) * FluidContainerRegistry.BUCKET_VOLUME), true); } - this.containingItems[1] = new ItemStack(Items.bucket, amount); + this.containingItems[1] = new ItemStack(Items.BUCKET, amount); } else { @@ -164,15 +164,16 @@ public void readFromNBT(NBTTagCompound par1NBTTagCompound) } @Override - public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(par1NBTTagCompound); - this.writeStandardItemsToNBT(par1NBTTagCompound); + super.writeToNBT(nbt); + this.writeStandardItemsToNBT(nbt); if (this.fuelTank.getFluid() != null) { - par1NBTTagCompound.setTag("fuelTank", this.fuelTank.writeToNBT(new NBTTagCompound())); + nbt.setTag("fuelTank", this.fuelTank.writeToNBT(new NBTTagCompound())); } + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityIngotCompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityIngotCompressor.java index 79124461a0..f09dc071e6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityIngotCompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityIngotCompressor.java @@ -9,6 +9,7 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; +import net.minecraft.init.SoundEvents; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; @@ -18,6 +19,7 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.EnumFacing; +import net.minecraft.util.SoundCategory; import net.minecraft.util.text.ITextComponent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.oredict.OreDictionary; @@ -84,7 +86,7 @@ public void update() if (this.processTicks % 40 == 0 && this.processTicks > TileEntityIngotCompressor.PROCESS_TIME_REQUIRED / 2) { - this.worldObj.playSoundEffect(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), "random.anvil_land", 0.2F, 0.5F); + this.worldObj.playSound(null, this.getPos(), SoundEvents.BLOCK_ANVIL_LAND, SoundCategory.BLOCKS, 0.3F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); } if (this.processTicks == TileEntityIngotCompressor.PROCESS_TIME_REQUIRED) @@ -259,9 +261,9 @@ else if (this.containingItems[1].isItemEqual(resultItemStack)) for (int i = 0; i < this.compressingCraftMatrix.getSizeInventory(); i++) { - if (this.compressingCraftMatrix.getStackInSlot(i) != null && this.compressingCraftMatrix.getStackInSlot(i).getItem() == Items.water_bucket) + if (this.compressingCraftMatrix.getStackInSlot(i) != null && this.compressingCraftMatrix.getStackInSlot(i).getItem() == Items.WATER_BUCKET) { - this.compressingCraftMatrix.setInventorySlotContentsNoUpdate(i, new ItemStack(Items.bucket)); + this.compressingCraftMatrix.setInventorySlotContentsNoUpdate(i, new ItemStack(Items.BUCKET)); } else { @@ -299,10 +301,10 @@ else if (var5 < this.containingItems.length + this.compressingCraftMatrix.getSiz } @Override - public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(par1NBTTagCompound); - par1NBTTagCompound.setInteger("smeltingTicks", this.processTicks); + super.writeToNBT(nbt); + nbt.setInteger("smeltingTicks", this.processTicks); NBTTagList var2 = new NBTTagList(); int var3; @@ -328,7 +330,8 @@ public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) } } - par1NBTTagCompound.setTag("Items", var2); + nbt.setTag("Items", var2); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityMulti.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityMulti.java index 32f3af2b3f..fa80cc765e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityMulti.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityMulti.java @@ -121,6 +121,8 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) tag.setInteger("z", this.mainBlockPosition.getZ()); nbt.setTag("mainBlockPosition", tag); } + + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygen.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygen.java index eeda55b5e8..7b84268d8f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygen.java @@ -102,6 +102,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); this.tank.writeToNBT(nbt); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java index bdc6d34698..b3fc03a1ca 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java @@ -7,16 +7,16 @@ import micdoodle8.mods.galacticraft.core.energy.item.ItemElectricBase; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.miccore.Annotations.NetworkedField; -import net.minecraft.block.Block; import net.minecraft.block.BlockAir; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.common.EnumPlantType; @@ -158,13 +158,14 @@ public void update() // chunk.getBlockID is like world.getBlock // but faster - needs to be given // intra-chunk coordinates though - final Block block = chunk.getBlock(intrachunkx, y, z & 15); + final IBlockState state = chunk.getBlockState(intrachunkx, y, z & 15); // Test for the two most common blocks (air // and breatheable air) without looking up // in the blocksList - if (!(block instanceof BlockAir)) + if (!(state.getBlock() instanceof BlockAir)) { - if (block.isLeaves(this.worldObj, new BlockPos(x, y, z)) || block instanceof IPlantable && ((IPlantable) block).getPlantType(this.worldObj, new BlockPos(x, y, z)) == EnumPlantType.Crop) + BlockPos pos = new BlockPos(x, y, z); + if (state.getBlock().isLeaves(state, this.worldObj, pos) || state.getBlock() instanceof IPlantable && ((IPlantable) state.getBlock()).getPlantType(this.worldObj, pos) == EnumPlantType.Crop) { nearbyLeaves += 0.075F * 10F; } @@ -194,11 +195,11 @@ public void update() } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) + public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(par1NBTTagCompound); + super.readFromNBT(nbt); - final NBTTagList var2 = par1NBTTagCompound.getTagList("Items", 10); + final NBTTagList var2 = nbt.getTagList("Items", 10); this.containingItems = new ItemStack[this.getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) @@ -214,9 +215,9 @@ public void readFromNBT(NBTTagCompound par1NBTTagCompound) } @Override - public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(par1NBTTagCompound); + super.writeToNBT(nbt); final NBTTagList list = new NBTTagList(); @@ -231,7 +232,8 @@ public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) } } - par1NBTTagCompound.setTag("Items", list); + nbt.setTag("Items", list); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCompressor.java index d1c5ae3aea..6ac47fdfc8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCompressor.java @@ -71,11 +71,11 @@ public void update() } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) + public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(par1NBTTagCompound); + super.readFromNBT(nbt); - final NBTTagList var2 = par1NBTTagCompound.getTagList("Items", 10); + final NBTTagList var2 = nbt.getTagList("Items", 10); this.containingItems = new ItemStack[this.getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) @@ -91,9 +91,9 @@ public void readFromNBT(NBTTagCompound par1NBTTagCompound) } @Override - public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(par1NBTTagCompound); + super.writeToNBT(nbt); final NBTTagList list = new NBTTagList(); @@ -108,7 +108,8 @@ public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) } } - par1NBTTagCompound.setTag("Items", list); + nbt.setTag("Items", list); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDecompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDecompressor.java index 9bcebad7d9..9e4fcc3793 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDecompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDecompressor.java @@ -52,11 +52,11 @@ public void update() } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) + public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(par1NBTTagCompound); + super.readFromNBT(nbt); - final NBTTagList var2 = par1NBTTagCompound.getTagList("Items", 10); + final NBTTagList var2 = nbt.getTagList("Items", 10); this.containingItems = new ItemStack[this.getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) @@ -72,9 +72,9 @@ public void readFromNBT(NBTTagCompound par1NBTTagCompound) } @Override - public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(par1NBTTagCompound); + super.writeToNBT(nbt); final NBTTagList list = new NBTTagList(); @@ -89,7 +89,8 @@ public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) } } - par1NBTTagCompound.setTag("Items", list); + nbt.setTag("Items", list); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java index 9e90993c09..44f203f98c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java @@ -17,8 +17,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -103,7 +106,7 @@ public void addExtraNetworkedData(List networkedList) // { // networkedList.add(this.oxygenBubble.getEntityId()); // } - if (MinecraftServer.getServer().isDedicatedServer()) + if (this.worldObj.getMinecraftServer().isDedicatedServer()) { networkedList.add(loadedTiles.size()); //TODO: Limit this to ones in the same dimension as this tile? @@ -317,6 +320,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) } nbt.setTag("Items", list); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java index 6b8e683a42..2805b36bf8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java @@ -10,15 +10,15 @@ import micdoodle8.mods.galacticraft.core.util.FluidUtil; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.miccore.Annotations.NetworkedField; -import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -107,8 +107,8 @@ public int getFindSealChecks() return 0; } BlockPos posAbove = new BlockPos(this.getPos().getX(), this.getPos().getY() + 1, this.getPos().getZ()); - Block blockAbove = this.worldObj.getBlockState(posAbove).getBlock(); - if (!(blockAbove.isAir(this.worldObj, posAbove)) && !OxygenPressureProtocol.canBlockPassAir(this.worldObj, blockAbove, this.getPos().up(), EnumFacing.UP)) + IBlockState stateAbove = this.worldObj.getBlockState(posAbove); + if (!(stateAbove.getBlock().isAir(stateAbove, this.worldObj, posAbove)) && !OxygenPressureProtocol.canBlockPassAir(this.worldObj, stateAbove.getBlock(), this.getPos().up(), EnumFacing.UP)) { // The vent is blocked return 0; @@ -197,11 +197,11 @@ else if (!TileEntityOxygenSealer.sealerCheckedThisTick) } @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) + public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(par1NBTTagCompound); + super.readFromNBT(nbt); - final NBTTagList var2 = par1NBTTagCompound.getTagList("Items", 10); + final NBTTagList var2 = nbt.getTagList("Items", 10); this.containingItems = new ItemStack[this.getSizeInventory()]; for (int var3 = 0; var3 < var2.tagCount(); ++var3) @@ -217,9 +217,9 @@ public void readFromNBT(NBTTagCompound par1NBTTagCompound) } @Override - public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(par1NBTTagCompound); + super.writeToNBT(nbt); final NBTTagList list = new NBTTagList(); @@ -234,7 +234,8 @@ public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) } } - par1NBTTagCompound.setTag("Items", list); + nbt.setTag("Items", list); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenStorageModule.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenStorageModule.java index 1592af0701..c48a032217 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenStorageModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenStorageModule.java @@ -133,9 +133,9 @@ public void readFromNBT(NBTTagCompound par1NBTTagCompound) } @Override - public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(par1NBTTagCompound); + super.writeToNBT(nbt); final NBTTagList list = new NBTTagList(); @@ -150,7 +150,8 @@ public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) } } - par1NBTTagCompound.setTag("Items", list); + nbt.setTag("Items", list); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java index 9f4a7531dc..bfa414ad41 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java @@ -12,10 +12,12 @@ import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.miccore.Annotations.NetworkedField; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.SoundEvents; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.text.ITextComponent; import net.minecraftforge.fluids.FluidTank; @@ -217,6 +219,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) } nbt.setInteger("color", this.color.getDyeDamage()); + return nbt; } @Override @@ -271,7 +274,7 @@ public void update() double d1 = this.getPos().getX() + 0.5D; d0 = this.getPos().getZ() + 0.5D; - this.worldObj.playSoundEffect(d1, this.getPos().getY() + 0.5D, d0, "random.chestopen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + this.worldObj.playSound(null, d1, this.getPos().getY() + 0.5D, d0, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); } if (this.numUsingPlayers == 0 && this.lidAngle > 0.0F || this.numUsingPlayers > 0 && this.lidAngle < 1.0F) @@ -299,7 +302,7 @@ public void update() d0 = this.getPos().getX() + 0.5D; double d2 = this.getPos().getZ() + 0.5D; - this.worldObj.playSoundEffect(d0, this.getPos().getY() + 0.5D, d2, "random.chestclosed", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + this.worldObj.playSound(null, d0, this.getPos().getY() + 0.5D, d2, SoundEvents.BLOCK_CHEST_CLOSE, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); } if (this.lidAngle < 0.0F) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityRefinery.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityRefinery.java index d8435f69be..a84e521f7a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityRefinery.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityRefinery.java @@ -79,7 +79,7 @@ public void update() { this.oilTank.fill(new FluidStack(GCFluids.fluidOil, (amount - 1) * FluidContainerRegistry.BUCKET_VOLUME), true); } - this.containingItems[1] = new ItemStack(Items.bucket, amount); + this.containingItems[1] = new ItemStack(Items.BUCKET, amount); } else { @@ -208,6 +208,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) { nbt.setTag("fuelTank", this.fuelTank.writeToNBT(new NBTTagCompound())); } + return nbt; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityScreen.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityScreen.java index 7ae372ce34..0add5e3bda 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityScreen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityScreen.java @@ -404,6 +404,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) nbt.setInteger("connectionsLeft", this.connectionsLeft); nbt.setInteger("connectionsRight", this.connectionsRight); nbt.setBoolean("multiscreen", this.isMultiscreen); + return nbt; } public void checkScreenSize() diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java index 35a2e931a5..db39c7f689 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java @@ -14,7 +14,6 @@ import micdoodle8.mods.galacticraft.core.network.IPacketReceiver; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.miccore.Annotations.NetworkedField; -import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; @@ -24,8 +23,10 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; @@ -136,9 +137,9 @@ public void update() for (int y = this.getPos().getY() + 3; y < 256; y++) { - Block block = this.worldObj.getBlockState(new BlockPos(this.getPos().getX() + x, y, this.getPos().getZ() + z)).getBlock(); + IBlockState state = this.worldObj.getBlockState(new BlockPos(this.getPos().getX() + x, y, this.getPos().getZ() + z)); - if (block.isOpaqueCube()) + if (state.getBlock().isOpaqueCube(state)) { valid = false; break; @@ -159,9 +160,9 @@ public void update() for (double d = 0.0D; d < distance; d++) { BlockVec3 blockAt = blockVec.clone().translate((int) (d * sinA), (int) (d * cosA), 0); - Block block = blockAt.getBlock(this.worldObj); + IBlockState state = blockAt.getBlockState(this.worldObj); - if (block.isOpaqueCube()) + if (state.getBlock().isOpaqueCube(state)) { valid = false; break; @@ -258,11 +259,12 @@ public float getSolarBoost() return (float) (this.worldObj.provider instanceof ISolarLevel ? ((ISolarLevel) this.worldObj.provider).getSolarEnergyMultiplier() : 1.0F); } -// @Override TODO -// public boolean onActivated(EntityPlayer entityPlayer) -// { + @Override + public boolean onActivated(EntityPlayer entityPlayer) + { + return false; // TODO // return this.getBlockType().onBlockActivated(this.worldObj, this.getPos(), this.worldObj.getBlockState(getPos()), entityPlayer, EnumFacing.DOWN, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); -// } + } // @Override // public boolean canUpdate() @@ -314,7 +316,7 @@ public void onDestroy(TileEntity callingBlock) { BlockMulti.EnumBlockMultiType type = (BlockMulti.EnumBlockMultiType) stateAt.getValue(BlockMulti.MULTI_TYPE); if ((type == BlockMulti.EnumBlockMultiType.SOLAR_PANEL_0 || type == BlockMulti.EnumBlockMultiType.SOLAR_PANEL_1) && - ((x == 0 && z == 0) || (stateBelow.getBlock().isAir(this.worldObj, pos.down())))) + ((x == 0 && z == 0) || (stateBelow.getBlock().isAir(this.worldObj.getBlockState(pos.down()), this.worldObj, pos.down())))) { if (this.worldObj.isRemote && this.worldObj.rand.nextDouble() < 0.1D) { @@ -382,6 +384,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) } nbt.setTag("Items", list); + return nbt; } /*@Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySpaceStationBase.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySpaceStationBase.java index 0f7fc70678..c824437e76 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySpaceStationBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySpaceStationBase.java @@ -18,17 +18,18 @@ public TileEntitySpaceStationBase() public String ownerUsername = "bobby"; @Override - public void readFromNBT(NBTTagCompound par1NBTTagCompound) + public void readFromNBT(NBTTagCompound nbt) { - super.readFromNBT(par1NBTTagCompound); - this.ownerUsername = par1NBTTagCompound.getString("ownerUsername"); + super.readFromNBT(nbt); + this.ownerUsername = nbt.getString("ownerUsername"); } @Override - public NBTTagCompound writeToNBT(NBTTagCompound par1NBTTagCompound) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - super.writeToNBT(par1NBTTagCompound); - par1NBTTagCompound.setString("ownerUsername", this.ownerUsername); + super.writeToNBT(nbt); + nbt.setString("ownerUsername", this.ownerUsername); + return nbt; } public void setOwner(String username) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTelemetry.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTelemetry.java index 56bb354da6..ce7008d855 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTelemetry.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTelemetry.java @@ -6,7 +6,8 @@ import micdoodle8.mods.galacticraft.api.vector.BlockVec3; import micdoodle8.mods.galacticraft.api.vector.BlockVec3Dim; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.network.PacketSimple; import micdoodle8.mods.galacticraft.core.network.PacketSimple.EnumSimplePacket; import micdoodle8.mods.galacticraft.core.util.GCLog; @@ -21,8 +22,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.ITickable; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.WorldProvider; import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; @@ -93,11 +94,11 @@ public void update() { if (linkedEntity instanceof EntityPlayerMP) { - name = "$" + ((EntityPlayerMP) linkedEntity).getName(); + name = "$" + linkedEntity.getName(); } else { - name = (String) EntityList.classToStringMapping.get(linkedEntity.getClass()); + name = EntityList.CLASS_TO_NAME.get(linkedEntity.getClass()); } if (name == null) @@ -150,8 +151,8 @@ else if (data[2] > 1) if (eLiving instanceof EntityPlayerMP) { data[3] = ((EntityPlayerMP) eLiving).getFoodStats().getFoodLevel() * 5; - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) eLiving); - data[4] = stats.airRemaining * 4096 + stats.airRemaining2; + IStatsCapability stats = eLiving.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + data[4] = stats.getAirRemaining() * 4096 + stats.getAirRemaining2(); UUID uuid = ((EntityPlayerMP) eLiving).getUniqueID(); if (uuid != null) { @@ -222,6 +223,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) nbt.setLong("entityUUIDMost", this.linkedEntity.getUniqueID().getMostSignificantBits()); nbt.setLong("entityUUIDLeast", this.linkedEntity.getUniqueID().getLeastSignificantBits()); } + return nbt; } public void addTrackedEntity(UUID uuid) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/ConfigManagerCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/ConfigManagerCore.java index 26b842befc..494ae5f628 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/ConfigManagerCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/ConfigManagerCore.java @@ -158,37 +158,37 @@ public static void syncConfig(boolean load) } prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Enable Debug Messages", false); - prop.comment = "If this is enabled, debug messages will appear in the console. This is useful for finding bugs in the mod."; + prop.setComment("If this is enabled, debug messages will appear in the console. This is useful for finding bugs in the mod."); prop.setLanguageKey("gc.configgui.enableDebug"); enableDebug = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "idDimensionOverworld", 0); - prop.comment = "Dimension ID for the Overworld (as seen in the Celestial Map)"; + prop.setComment("Dimension ID for the Overworld (as seen in the Celestial Map)"); prop.setLanguageKey("gc.configgui.idDimensionOverworld").setRequiresMcRestart(true); idDimensionOverworld = prop.getInt(); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "idDimensionMoon", -28); - prop.comment = "Dimension ID for the Moon"; + prop.setComment("Dimension ID for the Moon"); prop.setLanguageKey("gc.configgui.idDimensionMoon").setRequiresMcRestart(true); idDimensionMoon = prop.getInt(); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "idDimensionOverworldOrbit", -27); - prop.comment = "WorldProvider ID for Overworld Space Stations (advanced: do not change unless you have conflicts)"; + prop.setComment("WorldProvider ID for Overworld Space Stations (advanced: do not change unless you have conflicts)"); prop.setLanguageKey("gc.configgui.idDimensionOverworldOrbit").setRequiresMcRestart(true); idDimensionOverworldOrbit = prop.getInt(); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "idDimensionOverworldOrbitStatic", -26); - prop.comment = "WorldProvider ID for Static Space Stations (advanced: do not change unless you have conflicts)"; + prop.setComment("WorldProvider ID for Static Space Stations (advanced: do not change unless you have conflicts)"); prop.setLanguageKey("gc.configgui.idDimensionOverworldOrbitStatic").setRequiresMcRestart(true); idDimensionOverworldOrbitStatic = prop.getInt(); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "biomeIDBase", 102); - prop.comment = "Biome ID for Moon (Mars will be this + 1, Asteroids + 2 etc). Allowed range 40-250."; + prop.setComment("Biome ID for Moon (Mars will be this + 1, Asteroids + 2 etc). Allowed range 40-250."); prop.setLanguageKey("gc.configgui.biomeIDBase").setRequiresMcRestart(true); biomeIDbase = prop.getInt(); if (biomeIDbase < 40 || biomeIDbase > 250) @@ -198,26 +198,26 @@ public static void syncConfig(boolean load) propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "Static Loaded Dimensions", ConfigManagerCore.staticLoadDimensions); - prop.comment = "IDs to load at startup, and keep loaded until server stops. Can be added via /gckeeploaded"; + prop.setComment("IDs to load at startup, and keep loaded until server stops. Can be added via /gckeeploaded"); prop.setLanguageKey("gc.configgui.staticLoadedDimensions"); staticLoadDimensions = prop.getIntList(); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "Dimensions where rockets cannot launch", new String[] { "1", "-1" }); - prop.comment = "IDs of dimensions where rockets should not launch - this should always include the Nether."; + prop.setComment("IDs of dimensions where rockets should not launch - this should always include the Nether."); prop.setLanguageKey("gc.configgui.rocketDisabledDimensions"); disableRocketLaunchDimensions = prop.getIntList(); disableRocketLaunchAllNonGC = searchAsterisk(prop.getStringList()); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "Disable rockets from returning to Overworld", false); - prop.comment = "If true, rockets will be unable to reach the Overworld (only use this in special modpacks!)"; + prop.setComment("If true, rockets will be unable to reach the Overworld (only use this in special modpacks!)"); prop.setLanguageKey("gc.configgui.rocketDisableOverworldReturn"); disableRocketsToOverworld = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Force Overworld Spawn", false); - prop.comment = "By default, you will respawn on galacticraft dimensions if you die. If you set this to true, you will respawn back on earth."; + prop.setComment("By default, you will respawn on galacticraft dimensions if you die. If you set this to true, you will respawn back on earth."); prop.setLanguageKey("gc.configgui.forceOverworldRespawn"); forceOverworldRespawn = prop.getBoolean(false); propOrder.add(prop.getName()); @@ -225,19 +225,19 @@ public static void syncConfig(boolean load) // prop = config.get(Constants.CONFIG_CATEGORY_SCHEMATIC, "idSchematicRocketT1", 0); - prop.comment = "Schematic ID for Tier 1 Rocket, must be unique."; + prop.setComment("Schematic ID for Tier 1 Rocket, must be unique."); prop.setLanguageKey("gc.configgui.idSchematicRocketT1"); idSchematicRocketT1 = prop.getInt(0); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_SCHEMATIC, "idSchematicMoonBuggy", 1); - prop.comment = "Schematic ID for Moon Buggy, must be unique."; + prop.setComment("Schematic ID for Moon Buggy, must be unique."); prop.setLanguageKey("gc.configgui.idSchematicMoonBuggy"); idSchematicMoonBuggy = prop.getInt(1); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_SCHEMATIC, "idSchematicAddSchematic", Integer.MAX_VALUE); - prop.comment = "Schematic ID for \"Add Schematic\" Page, must be unique"; + prop.setComment("Schematic ID for \"Add Schematic\" Page, must be unique"); prop.setLanguageKey("gc.configgui.idSchematicAddSchematic"); idSchematicAddSchematic = prop.getInt(Integer.MAX_VALUE); propOrder.add(prop.getName()); @@ -245,7 +245,7 @@ public static void syncConfig(boolean load) // prop = config.get(Constants.CONFIG_CATEGORY_ACHIEVEMENTS, "idAchievBase", 1784); - prop.comment = "Base Achievement ID. All achievement IDs will start at this number."; + prop.setComment("Base Achievement ID. All achievement IDs will start at this number."); prop.setLanguageKey("gc.configgui.idAchievBase"); idAchievBase = prop.getInt(1784); propOrder.add(prop.getName()); @@ -253,31 +253,31 @@ public static void syncConfig(boolean load) //Client side prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "More Stars", true); - prop.comment = "Setting this to false will revert night skies back to default minecraft star count"; + prop.setComment("Setting this to false will revert night skies back to default minecraft star count"); prop.setLanguageKey("gc.configgui.moreStars"); moreStars = prop.getBoolean(true); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Disable Spaceship Particles", false); - prop.comment = "If you have FPS problems, setting this to true will help if rocket particles are in your sights"; + prop.setComment("If you have FPS problems, setting this to true will help if rocket particles are in your sights"); prop.setLanguageKey("gc.configgui.disableSpaceshipParticles"); disableSpaceshipParticles = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Disable Vehicle Third-Person and Zoom", false); - prop.comment = "If you're using this mod in virtual reality, or if you don't want the camera changes when entering a Galacticraft vehicle, set this to true."; + prop.setComment("If you're using this mod in virtual reality, or if you don't want the camera changes when entering a Galacticraft vehicle, set this to true."); prop.setLanguageKey("gc.configgui.disableVehicleCameraChanges"); disableVehicleCameraChanges = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Minimap Left", false); - prop.comment = "If true, this will move the Oxygen Indicator to the left side. You can combine this with \"Minimap Bottom\""; + prop.setComment("If true, this will move the Oxygen Indicator to the left side. You can combine this with \"Minimap Bottom\""); prop.setLanguageKey("gc.configgui.oxygenIndicatorLeft"); oxygenIndicatorLeft = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Minimap Bottom", false); - prop.comment = "If true, this will move the Oxygen Indicator to the bottom. You can combine this with \"Minimap Left\""; + prop.setComment("If true, this will move the Oxygen Indicator to the bottom. You can combine this with \"Minimap Left\""); prop.setLanguageKey("gc.configgui.oxygenIndicatorBottom"); oxygenIndicatorBottom = prop.getBoolean(false); propOrder.add(prop.getName()); @@ -285,115 +285,115 @@ public static void syncConfig(boolean load) //World gen prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Oil Generation Factor", 1.8); - prop.comment = "Increasing this will increase amount of oil that will generate in each chunk."; + prop.setComment("Increasing this will increase amount of oil that will generate in each chunk."); prop.setLanguageKey("gc.configgui.oilGenFactor"); oilGenFactor = prop.getDouble(1.8); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Oil gen in external dimensions", new int[] { 0 }); - prop.comment = "List of non-galacticraft dimension IDs to generate oil in."; + prop.setComment("List of non-galacticraft dimension IDs to generate oil in."); prop.setLanguageKey("gc.configgui.externalOilGen"); externalOilGen = prop.getIntList(); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Retro Gen of GC Oil in existing map chunks", false); - prop.comment = "If this is enabled, GC oil will be added to existing Overworld maps where possible."; + prop.setComment("If this is enabled, GC oil will be added to existing Overworld maps where possible."); prop.setLanguageKey("gc.configgui.enableRetrogenOil"); retrogenOil = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Enable Copper Ore Gen", true); - prop.comment = "If this is enabled, copper ore will generate on the overworld."; + prop.setComment("If this is enabled, copper ore will generate on the overworld."); prop.setLanguageKey("gc.configgui.enableCopperOreGen").setRequiresMcRestart(true); enableCopperOreGen = prop.getBoolean(true); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Enable Tin Ore Gen", true); - prop.comment = "If this is enabled, tin ore will generate on the overworld."; + prop.setComment("If this is enabled, tin ore will generate on the overworld."); prop.setLanguageKey("gc.configgui.enableTinOreGen").setRequiresMcRestart(true); enableTinOreGen = prop.getBoolean(true); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Enable Aluminum Ore Gen", true); - prop.comment = "If this is enabled, aluminum ore will generate on the overworld."; + prop.setComment("If this is enabled, aluminum ore will generate on the overworld."); prop.setLanguageKey("gc.configgui.enableAluminumOreGen").setRequiresMcRestart(true); enableAluminumOreGen = prop.getBoolean(true); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Enable Silicon Ore Gen", true); - prop.comment = "If this is enabled, silicon ore will generate on the overworld."; + prop.setComment("If this is enabled, silicon ore will generate on the overworld."); prop.setLanguageKey("gc.configgui.enableSiliconOreGen").setRequiresMcRestart(true); enableSiliconOreGen = prop.getBoolean(true); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Disable Cheese Ore Gen on Moon", false); - prop.comment = "Disable Cheese Ore Gen on Moon."; + prop.setComment("Disable Cheese Ore Gen on Moon."); prop.setLanguageKey("gc.configgui.disableCheeseMoon"); disableCheeseMoon = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Disable Tin Ore Gen on Moon", false); - prop.comment = "Disable Tin Ore Gen on Moon."; + prop.setComment("Disable Tin Ore Gen on Moon."); prop.setLanguageKey("gc.configgui.disableTinMoon"); disableTinMoon = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Disable Copper Ore Gen on Moon", false); - prop.comment = "Disable Copper Ore Gen on Moon."; + prop.setComment("Disable Copper Ore Gen on Moon."); prop.setLanguageKey("gc.configgui.disableCopperMoon"); disableCopperMoon = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Disable Sapphire Ore Gen on Moon", false); - prop.comment = "Disable Sapphire Ore Gen on Moon."; + prop.setComment("Disable Sapphire Ore Gen on Moon."); prop.setLanguageKey("gc.configgui.disableSapphireMoon"); disableSapphireMoon = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Disable Moon Village Gen", false); - prop.comment = "If true, moon villages will not generate."; + prop.setComment("If true, moon villages will not generate."); prop.setLanguageKey("gc.configgui.disableMoonVillageGen"); disableMoonVillageGen = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Generate all other mods features on planets", false); - prop.comment = "If this is enabled, other mods' standard ores and all other features (eg. plants) can generate on the Moon and planets. Apart from looking wrong, this make cause 'Already Decorating!' type crashes. NOT RECOMMENDED! See Wiki."; + prop.setComment("If this is enabled, other mods' standard ores and all other features (eg. plants) can generate on the Moon and planets. Apart from looking wrong, this make cause 'Already Decorating!' type crashes. NOT RECOMMENDED! See Wiki."); prop.setLanguageKey("gc.configgui.enableOtherModsFeatures"); enableOtherModsFeatures = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Whitelist CoFHCore worldgen to generate its ores and lakes on planets", false); - prop.comment = "If generate other mods features is disabled as recommended, this setting can whitelist CoFHCore custom worldgen on planets."; + prop.setComment("If generate other mods features is disabled as recommended, this setting can whitelist CoFHCore custom worldgen on planets."); prop.setLanguageKey("gc.configgui.whitelistCoFHCoreGen"); whitelistCoFHCoreGen = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Generate ThaumCraft wild nodes on planetary surfaces", true); - prop.comment = "If ThaumCraft is installed, ThaumCraft wild nodes can generate on the Moon and planets."; + prop.setComment("If ThaumCraft is installed, ThaumCraft wild nodes can generate on the Moon and planets."); prop.setLanguageKey("gc.configgui.enableThaumCraftNodes"); enableThaumCraftNodes = prop.getBoolean(true); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Other mods ores for GC to generate on the Moon and planets", new String[] {}); - prop.comment = "Enter IDs of other mods' ores here for Galacticraft to generate them on the Moon and other planets. Format is BlockName or BlockName:metadata. Use optional parameters at end of each line: /RARE /UNCOMMON or /COMMON for rarity in a chunk; /DEEP /SHALLOW or /BOTH for height; /SINGLE /STANDARD or /LARGE for clump size; /XTRARANDOM for ores sometimes there sometimes not at all. /ONLYMOON or /ONLYMARS if wanted on one planet only. If nothing specified, defaults are /COMMON, /BOTH and /STANDARD. Repeat lines to generate a huge quantity of ores."; + prop.setComment("Enter IDs of other mods' ores here for Galacticraft to generate them on the Moon and other planets. Format is BlockName or BlockName:metadata. Use optional parameters at end of each line: /RARE /UNCOMMON or /COMMON for rarity in a chunk; /DEEP /SHALLOW or /BOTH for height; /SINGLE /STANDARD or /LARGE for clump size; /XTRARANDOM for ores sometimes there sometimes not at all. /ONLYMOON or /ONLYMARS if wanted on one planet only. If nothing specified, defaults are /COMMON, /BOTH and /STANDARD. Repeat lines to generate a huge quantity of ores."); prop.setLanguageKey("gc.configgui.otherModOreGenIDs"); oregenIDs = prop.getStringList(); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Use legacy oilgc fluid registration", false); - prop.comment = "Set to true to make Galacticraft oil register as oilgc, for backwards compatibility with previously generated worlds."; + prop.setComment("Set to true to make Galacticraft oil register as oilgc, for backwards compatibility with previously generated worlds."); prop.setLanguageKey("gc.configgui.useOldOilFluidID"); useOldOilFluidID = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Use legacy fuelgc fluid registration", false); - prop.comment = "Set to true to make Galacticraft fuel register as fuelgc, for backwards compatibility with previously generated worlds."; + prop.setComment("Set to true to make Galacticraft fuel register as fuelgc, for backwards compatibility with previously generated worlds."); prop.setLanguageKey("gc.configgui.useOldFuelFluidID"); useOldFuelFluidID = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Disable lander on Moon and other planets", false); - prop.comment = "If this is true, the player will parachute onto the Moon instead - use only in debug situations."; + prop.setComment("If this is true, the player will parachute onto the Moon instead - use only in debug situations."); prop.setLanguageKey("gc.configgui.disableLander"); disableLander = prop.getBoolean(false); propOrder.add(prop.getName()); @@ -401,39 +401,39 @@ public static void syncConfig(boolean load) //Server side prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Disable Spaceship Explosion", false); - prop.comment = "Spaceships will not explode on contact if set to true."; + prop.setComment("Spaceships will not explode on contact if set to true."); prop.setLanguageKey("gc.configgui.disableSpaceshipGrief"); disableSpaceshipGrief = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Space Stations Require Permission", true); - prop.comment = "While true, space stations require you to invite other players using /ssinvite "; + prop.setComment("While true, space stations require you to invite other players using /ssinvite "); prop.setLanguageKey("gc.configgui.spaceStationsRequirePermission"); spaceStationsRequirePermission = prop.getBoolean(true); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Disable Space Station creation", false); - prop.comment = "If set to true on a server, players will be completely unable to create space stations."; + prop.setComment("If set to true on a server, players will be completely unable to create space stations."); prop.setLanguageKey("gc.configgui.disableSpaceStationCreation"); disableSpaceStationCreation = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Override Capes", true); - prop.comment = "By default, Galacticraft will override capes with the mod's donor cape. Set to false to disable."; + prop.setComment("By default, Galacticraft will override capes with the mod's donor cape. Set to false to disable."); prop.setLanguageKey("gc.configgui.overrideCapes"); overrideCapes = prop.getBoolean(true); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Space Station Solar Energy Multiplier", 2.0); - prop.comment = "Solar panels will work (default 2x) more effective on space stations."; + prop.setComment("Solar panels will work (default 2x) more effective on space stations."); prop.setLanguageKey("gc.configgui.spaceStationEnergyScalar"); spaceStationEnergyScalar = prop.getDouble(2.0); propOrder.add(prop.getName()); try { - prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "External Sealable IDs", new String[] { GameData.getBlockRegistry().getNameForObject(Blocks.glass_pane) + ":0" }); - prop.comment = "List non-opaque blocks from other mods (for example, special types of glass) that the Oxygen Sealer should recognize as solid seals. Format is BlockName or BlockName:metadata"; + prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "External Sealable IDs", new String[] { GameData.getBlockRegistry().getNameForObject(Blocks.GLASS_PANE) + ":0" }); + prop.setComment("List non-opaque blocks from other mods (for example, special types of glass) that the Oxygen Sealer should recognize as solid seals. Format is BlockName or BlockName:metadata"); prop.setLanguageKey("gc.configgui.sealableIDs").setRequiresMcRestart(true); sealableIDs = prop.getStringList(); propOrder.add(prop.getName()); @@ -444,50 +444,50 @@ public static void syncConfig(boolean load) } prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "External Detectable IDs", new String[] { - ((ResourceLocation) GameData.getBlockRegistry().getNameForObject(Blocks.coal_ore)).getResourcePath(), - ((ResourceLocation) GameData.getBlockRegistry().getNameForObject(Blocks.diamond_ore)).getResourcePath(), - ((ResourceLocation) GameData.getBlockRegistry().getNameForObject(Blocks.gold_ore)).getResourcePath(), - ((ResourceLocation) GameData.getBlockRegistry().getNameForObject(Blocks.iron_ore)).getResourcePath(), - ((ResourceLocation) GameData.getBlockRegistry().getNameForObject(Blocks.lapis_ore)).getResourcePath(), - ((ResourceLocation) GameData.getBlockRegistry().getNameForObject(Blocks.redstone_ore)).getResourcePath(), - ((ResourceLocation) GameData.getBlockRegistry().getNameForObject(Blocks.lit_redstone_ore)).getResourcePath() }); - prop.comment = "List blocks from other mods that the Sensor Glasses should recognize as solid blocks. Format is BlockName or BlockName:metadata."; + ((ResourceLocation) GameData.getBlockRegistry().getNameForObject(Blocks.COAL_ORE)).getResourcePath(), + ((ResourceLocation) GameData.getBlockRegistry().getNameForObject(Blocks.DIAMOND_ORE)).getResourcePath(), + ((ResourceLocation) GameData.getBlockRegistry().getNameForObject(Blocks.GOLD_ORE)).getResourcePath(), + ((ResourceLocation) GameData.getBlockRegistry().getNameForObject(Blocks.IRON_ORE)).getResourcePath(), + ((ResourceLocation) GameData.getBlockRegistry().getNameForObject(Blocks.LAPIS_ORE)).getResourcePath(), + ((ResourceLocation) GameData.getBlockRegistry().getNameForObject(Blocks.REDSTONE_ORE)).getResourcePath(), + ((ResourceLocation) GameData.getBlockRegistry().getNameForObject(Blocks.LIT_REDSTONE_ORE)).getResourcePath() }); + prop.setComment("List blocks from other mods that the Sensor Glasses should recognize as solid blocks. Format is BlockName or BlockName:metadata."); prop.setLanguageKey("gc.configgui.detectableIDs").setRequiresMcRestart(true); detectableIDs = prop.getStringList(); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Suffocation Cooldown", 100); - prop.comment = "Lower/Raise this value to change time between suffocation damage ticks"; + prop.setComment("Lower/Raise this value to change time between suffocation damage ticks"); prop.setLanguageKey("gc.configgui.suffocationCooldown"); suffocationCooldown = prop.getInt(100); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Suffocation Damage", 2); - prop.comment = "Change this value to modify the damage taken per suffocation tick"; + prop.setComment("Change this value to modify the damage taken per suffocation tick"); prop.setLanguageKey("gc.configgui.suffocationDamage"); suffocationDamage = prop.getInt(2); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Dungeon Boss Health Modifier", 1.0); - prop.comment = "Change this if you wish to balance the mod (if you have more powerful weapon mods)."; + prop.setComment("Change this if you wish to balance the mod (if you have more powerful weapon mods)."); prop.setLanguageKey("gc.configgui.dungeonBossHealthMod"); dungeonBossHealthMod = prop.getDouble(1.0); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Harder Difficulty", false); - prop.comment = "Set this to true for increased difficulty in modpacks (see forum for more info)."; + prop.setComment("Set this to true for increased difficulty in modpacks (see forum for more info)."); prop.setLanguageKey("gc.configgui.hardMode"); hardMode = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Quick Game Mode", false); - prop.comment = "Set this to true for less metal use in Galacticraft recipes (makes the game easier)."; + prop.setComment("Set this to true for less metal use in Galacticraft recipes (makes the game easier)."); prop.setLanguageKey("gc.configgui.quickMode"); quickMode = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Adventure Game Mode", false); - prop.comment = "Set this to true for a challenging adventure where the player starts the game stranded in the Asteroids dimension with low resources (only effective if Galacticraft Planets installed)."; + prop.setComment("Set this to true for a challenging adventure where the player starts the game stranded in the Asteroids dimension with low resources (only effective if Galacticraft Planets installed)."); prop.setLanguageKey("gc.configgui.asteroidsStart"); challengeMode = prop.getBoolean(false); if (!GalacticraftCore.isPlanetsLoaded) @@ -497,132 +497,132 @@ public static void syncConfig(boolean load) propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Adventure Game Mode Recipes", false); - prop.comment = "Set this to true to just enable the compressor recipes from Adventure Mode (regardless of whether the game mode is enabled)."; + prop.setComment("Set this to true to just enable the compressor recipes from Adventure Mode (regardless of whether the game mode is enabled)."); prop.setLanguageKey("gc.configgui.asteroidsRecipes"); challengeRecipes = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Adventure Game Mode Mob Drops and Spawning", false); - prop.comment = "Set this to true to just enable the mob drops and mob spawning additions from Adventure Mode (regardless of whether the game mode is enabled)."; + prop.setComment("Set this to true to just enable the mob drops and mob spawning additions from Adventure Mode (regardless of whether the game mode is enabled)."); prop.setLanguageKey("gc.configgui.asteroidsMobDropsAndSpawning"); challengeMobDropsAndSpawning = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Adventure Game Mode Spawn Handling", false); - prop.comment = "Set this to true to just enable players spawning in entry pods in the asteroids dimension like they would in Adventure Mode (regardless of whether the game mode is enabled, but only effective if Galacticraft Planets is installed)."; + prop.setComment("Set this to true to just enable players spawning in entry pods in the asteroids dimension like they would in Adventure Mode (regardless of whether the game mode is enabled, but only effective if Galacticraft Planets is installed)."); prop.setLanguageKey("gc.configgui.asteroidsSpawnHandling"); challengeSpawnHandling = prop.getBoolean(false); if (!GalacticraftCore.isPlanetsLoaded) challengeSpawnHandling = false; propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Adventure Game Mode Asteroid Population", false); - prop.comment = "Set this to true to just enable trees being placed in all hollow asteroids in the asteroids dimension like they would in Adventure Mode (regardless of whether the game mode is enabled, but only effective if Galacticraft Planets is installed)."; + prop.setComment("Set this to true to just enable trees being placed in all hollow asteroids in the asteroids dimension like they would in Adventure Mode (regardless of whether the game mode is enabled, but only effective if Galacticraft Planets is installed)."); prop.setLanguageKey("gc.configgui.asteroidsAsteroidPopulation"); challengeAsteroidPopulation = prop.getBoolean(false); if (!GalacticraftCore.isPlanetsLoaded) challengeAsteroidPopulation = false; propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Enable Sealed edge checks", true); - prop.comment = "If this is enabled, areas sealed by Oxygen Sealers will run a seal check when the player breaks or places a block (or on block updates). This should be enabled for a 100% accurate sealed status, but can be disabled on servers for performance reasons."; + prop.setComment("If this is enabled, areas sealed by Oxygen Sealers will run a seal check when the player breaks or places a block (or on block updates). This should be enabled for a 100% accurate sealed status, but can be disabled on servers for performance reasons."); prop.setLanguageKey("gc.configgui.enableSealerEdgeChecks"); enableSealerEdgeChecks = prop.getBoolean(true); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Alternate recipe for canisters", false); - prop.comment = "Enable this if the standard canister recipe causes a conflict."; + prop.setComment("Enable this if the standard canister recipe causes a conflict."); prop.setLanguageKey("gc.configgui.alternateCanisterRecipe").setRequiresMcRestart(true); alternateCanisterRecipe = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "OreDict name of other mod's silicon usable in Galacticraft", "itemSilicon"); - prop.comment = "This needs to match the OreDictionary name used in the other mod. Set a nonsense name to disable."; + prop.setComment("This needs to match the OreDictionary name used in the other mod. Set a nonsense name to disable."); prop.setLanguageKey("gc.configgui.oreDictSilicon").setRequiresMcRestart(true); otherModsSilicon = prop.getString(); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Force the use of Galacticraft's own Meteoric Iron, Desh, Titanium etc in recipes (not their OreDict equivalents)", true); - prop.comment = "Should normally be true. If you set this to false, in a modpack with other mods with the same metals, players may be able to craft advanced GC items without travelling to Moon, Mars, Asteroids etc."; + prop.setComment("Should normally be true. If you set this to false, in a modpack with other mods with the same metals, players may be able to craft advanced GC items without travelling to Moon, Mars, Asteroids etc."); prop.setLanguageKey("gc.configgui.disableOreDictSpaceMetals").setRequiresMcRestart(true); recipesRequireGCAdvancedMetals = prop.getBoolean(true); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Open Galaxy Map", "KEY_M"); - prop.comment = "Leave 'KEY_' value, adding the intended keyboard character to replace the letter. Values 0-9 and A-Z are accepted"; + prop.setComment("Leave 'KEY_' value, adding the intended keyboard character to replace the letter. Values 0-9 and A-Z are accepted"); prop.setLanguageKey("gc.configgui.overrideMap").setRequiresMcRestart(true); keyOverrideMap = prop.getString(); keyOverrideMapI = parseKeyValue(keyOverrideMap); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Open Fuel GUI", "KEY_F"); - prop.comment = "Leave 'KEY_' value, adding the intended keyboard character to replace the letter. Values 0-9 and A-Z are accepted"; + prop.setComment("Leave 'KEY_' value, adding the intended keyboard character to replace the letter. Values 0-9 and A-Z are accepted"); prop.setLanguageKey("gc.configgui.keyOverrideFuelLevel").setRequiresMcRestart(true); keyOverrideFuelLevel = prop.getString(); keyOverrideFuelLevelI = parseKeyValue(keyOverrideFuelLevel); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Toggle Advanced Goggles", "KEY_K"); - prop.comment = "Leave 'KEY_' value, adding the intended keyboard character to replace the letter. Values 0-9 and A-Z are accepted"; + prop.setComment("Leave 'KEY_' value, adding the intended keyboard character to replace the letter. Values 0-9 and A-Z are accepted"); prop.setLanguageKey("gc.configgui.keyOverrideToggleAdvGoggles").setRequiresMcRestart(true); keyOverrideToggleAdvGoggles = prop.getString(); keyOverrideToggleAdvGogglesI = parseKeyValue(keyOverrideToggleAdvGoggles); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Rocket fuel factor", 1); - prop.comment = "The normal factor is 1. Increase this to 2 - 5 if other mods with a lot of oil (e.g. BuildCraft) are installed to increase GC rocket fuel requirement."; + prop.setComment("The normal factor is 1. Increase this to 2 - 5 if other mods with a lot of oil (e.g. BuildCraft) are installed to increase GC rocket fuel requirement."); prop.setLanguageKey("gc.configgui.rocketFuelFactor"); rocketFuelFactor = prop.getInt(1); propOrder.add(prop.getName()); // prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Map factor", 1); -// prop.comment = "Allowed values 1-4 etc"; +// prop.setComment("Allowed values 1-4 etc"; // prop.setLanguageKey("gc.configgui.mapFactor"); // mapfactor = prop.getInt(1); // propOrder.add(prop.getName()); // // prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Map size", 400); -// prop.comment = "Suggested value 400"; +// prop.setComment("Suggested value 400"; // prop.setLanguageKey("gc.configgui.mapSize"); // mapsize = prop.getInt(400); // propOrder.add(prop.getName()); // prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Map Scroll Mouse Sensitivity", 1.0); - prop.comment = "Increase to make the mouse drag scroll more sensitive, decrease to lower sensitivity."; + prop.setComment("Increase to make the mouse drag scroll more sensitive, decrease to lower sensitivity."); prop.setLanguageKey("gc.configgui.mapScrollSensitivity"); mapMouseScrollSensitivity = (float) prop.getDouble(1.0); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Map Scroll Mouse Invert", false); - prop.comment = "Set to true to invert the mouse scroll feature on the galaxy map."; + prop.setComment("Set to true to invert the mouse scroll feature on the galaxy map."); prop.setLanguageKey("gc.configgui.mapScrollInvert"); invertMapMouseScroll = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Meteor Spawn Modifier", 1.0); - prop.comment = "Set to a value between 0.0 and 1.0 to decrease meteor spawn chance (all dimensions)."; + prop.setComment("Set to a value between 0.0 and 1.0 to decrease meteor spawn chance (all dimensions)."); prop.setLanguageKey("gc.configgui.meteorSpawnMod"); meteorSpawnMod = prop.getDouble(1.0); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Meteor Block Damage Enabled", true); - prop.comment = "Set to false to stop meteors from breaking blocks on contact."; + prop.setComment("Set to false to stop meteors from breaking blocks on contact."); prop.setLanguageKey("gc.configgui.meteorBlockDamage"); meteorBlockDamageEnabled = prop.getBoolean(true); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Disable Update Check", false); - prop.comment = "Update check will not run if this is set to true."; + prop.setComment("Update check will not run if this is set to true."); prop.setLanguageKey("gc.configgui.disableUpdateCheck"); disableUpdateCheck = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Disable Biome Type Registrations", false); - prop.comment = "Biome Types will not be registered in the BiomeDictionary if this is set to true. Ignored (always true) for MC 1.7.2."; + prop.setComment("Biome Types will not be registered in the BiomeDictionary if this is set to true. Ignored (always true) for MC 1.7.2."); prop.setLanguageKey("gc.configgui.disableBiomeTypeRegistrations"); disableBiomeTypeRegistrations = prop.getBoolean(false); propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "Enable Space Race Manager Popup", false); - prop.comment = "Space Race Manager will show on-screen after login, if enabled."; + prop.setComment("Space Race Manager will show on-screen after login, if enabled."); prop.setLanguageKey("gc.configgui.enableSpaceRaceManagerPopup"); enableSpaceRaceManagerPopup = prop.getBoolean(false); propOrder.add(prop.getName()); @@ -672,7 +672,7 @@ public static boolean setLoaded(int newID) } Property prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "Static Loaded Dimensions", ConfigManagerCore.staticLoadDimensions); - prop.comment = "IDs to load at startup, and keep loaded until server stops. Can be added via /gckeeploaded"; + prop.setComment("IDs to load at startup, and keep loaded until server stops. Can be added via /gckeeploaded"); prop.setLanguageKey("gc.configgui.staticLoadedDimensions"); prop.set(values); @@ -715,7 +715,7 @@ public static boolean setUnloaded(int idToRemove) } Property prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "Static Loaded Dimensions", ConfigManagerCore.staticLoadDimensions); - prop.comment = "IDs to load at startup, and keep loaded until server stops. Can be added via /gckeeploaded"; + prop.setComment("IDs to load at startup, and keep loaded until server stops. Can be added via /gckeeploaded"); prop.setLanguageKey("gc.configgui.staticLoadedDimensions"); prop.set(values); @@ -792,7 +792,7 @@ public static BlockTuple stringToBlock(String s, String caller, boolean logging) Block block = Block.getBlockFromName(name); if (block == null) { - Item item = (Item) Item.itemRegistry.getObject(new ResourceLocation(name)); + Item item = (Item) Item.REGISTRY.getObject(new ResourceLocation(name)); if (item instanceof ItemBlock) { block = ((ItemBlock) item).block; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/CreativeTabGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/CreativeTabGC.java index 47a6de71eb..3835837b01 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/CreativeTabGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/CreativeTabGC.java @@ -56,9 +56,9 @@ public void setMetaForTab(int metaForTab) } @Override - public void displayAllReleventItems(List list) + public void displayAllRelevantItems(List list) { - super.displayAllReleventItems(list); + super.displayAllRelevantItems(list); if (this.tabSorter != null) { Collections.sort(list, tabSorter); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java index a820be2f66..a0233dde62 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java @@ -394,7 +394,7 @@ public static ItemStack getUsedContainer(ItemStack container) { if (FluidContainerRegistry.isBucket(container) && FluidContainerRegistry.isFilledContainer(container)) { - return new ItemStack(Items.bucket, container.stackSize); + return new ItemStack(Items.BUCKET, container.stackSize); } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/GCCoreUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/GCCoreUtil.java index 9938ec5477..563cff55b0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/GCCoreUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/GCCoreUtil.java @@ -17,11 +17,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.launchwrapper.Launch; -import net.minecraft.util.StatCollector; -import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraft.util.text.translation.I18n; import net.minecraftforge.fml.common.registry.EntityRegistry; -import net.minecraftforge.fml.common.registry.LanguageRegistry; -import net.minecraftforge.fml.relauncher.Side; import java.util.Arrays; import java.util.List; @@ -56,7 +53,7 @@ public static void openBuggyInv(EntityPlayerMP player, IInventory buggyInv, int GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_OPEN_PARACHEST_GUI, player.worldObj.provider.getDimension(), new Object[] { id, 0, 0 }), player); player.openContainer = new ContainerBuggy(player.inventory, buggyInv, type, player); player.openContainer.windowId = id; - player.openContainer.onCraftGuiOpened(player); + player.openContainer.addListener(player); } public static void openParachestInv(EntityPlayerMP player, EntityLanderBase landerInv) @@ -67,7 +64,7 @@ public static void openParachestInv(EntityPlayerMP player, EntityLanderBase land GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_OPEN_PARACHEST_GUI, player.worldObj.provider.getDimension(), new Object[] { windowId, 1, landerInv.getEntityId() }), player); player.openContainer = new ContainerParaChest(player.inventory, landerInv, player); player.openContainer.windowId = windowId; - player.openContainer.onCraftGuiOpened(player); + player.openContainer.addListener(player); } public static int nextInternalID() @@ -76,19 +73,19 @@ public static int nextInternalID() return GCCoreUtil.nextID - 1; } - public static void registerGalacticraftCreature(Class var0, String var1, int back, int fore) + public static void registerGalacticraftCreature(Class clazz, String name, int back, int fore) { - registerGalacticraftNonMobEntity(var0, var1, 80, 3, true); - int nextEggID = getNextValidEggID(); + registerGalacticraftNonMobEntity(clazz, name, 80, 3, true); + int nextEggID = getNextValidID(); if (nextEggID < 65536) { - EntityList.idToClassMapping.put(nextEggID, var0); - EntityList.classToIDMapping.put(var0, nextEggID); - EntityList.entityEggs.put(nextEggID, new EntityList.EntityEggInfo(nextEggID, back, fore)); + EntityList.ID_TO_CLASS.put(nextEggID, clazz); + EntityList.CLASS_TO_ID.put(clazz, nextEggID); + EntityList.ENTITY_EGGS.put(name, new EntityList.EntityEggInfo(name, back, fore)); } } - public static int getNextValidEggID() + public static int getNextValidID() { int eggID = 255; @@ -106,11 +103,6 @@ public static int getNextValidEggID() public static void registerGalacticraftNonMobEntity(Class var0, String var1, int trackingDistance, int updateFreq, boolean sendVel) { - if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) - { - LanguageRegistry.instance().addStringLocalization("entity.galacticraftcore." + var1 + ".name", "en_US", GCCoreUtil.translate("entity." + var1 + ".name")); - LanguageRegistry.instance().addStringLocalization("entity.GalacticraftCore." + var1 + ".name", GCCoreUtil.translate("entity." + var1 + ".name")); - } EntityRegistry.registerModEntity(var0, var1, nextInternalID(), GalacticraftCore.instance, trackingDistance, updateFreq, sendVel); } @@ -146,7 +138,7 @@ public static void registerGalacticraftBlock(String key, ItemStack stack) public static String translate(String key) { - String result = StatCollector.translateToLocal(key); + String result = I18n.translateToLocal(key); int comment = result.indexOf('#'); String ret = (comment > 0) ? result.substring(0, comment).trim() : result; for (int i = 0; i < key.length(); ++i) @@ -170,7 +162,7 @@ public static List translateWithSplit(String key) public static String translateWithFormat(String key, Object... values) { - String result = StatCollector.translateToLocalFormatted(key, values); + String result = I18n.translateToLocalFormatted(key, values); int comment = result.indexOf('#'); String ret = (comment > 0) ? result.substring(0, comment).trim() : result; for (int i = 0; i < key.length(); ++i) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java index 876620a728..f67c90361d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java @@ -5,20 +5,17 @@ import micdoodle8.mods.galacticraft.core.network.PacketSimple.EnumSimplePacket; import micdoodle8.mods.galacticraft.core.world.gen.layer_mapping.GenLayerGCMap; import micdoodle8.mods.galacticraft.core.world.gen.layer_mapping.IntCache; -import net.minecraft.crash.CrashReport; -import net.minecraft.crash.CrashReportCategory; -import net.minecraft.server.MinecraftServer; +import net.minecraft.init.Biomes; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.ReportedException; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.WorldType; -import net.minecraft.world.biome.BiomeCache; import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.biome.BiomeCache; +import net.minecraft.world.biome.BiomeProvider; import net.minecraft.world.gen.NoiseGeneratorOctaves; import net.minecraft.world.gen.layer.GenLayer; - +import net.minecraftforge.fml.common.FMLCommonHandler; import org.apache.commons.io.FileUtils; import java.io.File; @@ -28,7 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean; @SuppressWarnings("unused") -public class MapGen extends WorldChunkManager implements Runnable +public class MapGen extends BiomeProvider implements Runnable { public boolean mapNeedsCalculating = false; public AtomicBoolean finishedCalculating = new AtomicBoolean(); @@ -46,7 +43,6 @@ public class MapGen extends WorldChunkManager implements Runnable private int biomeMapCz; private int biomeMapFactor; - private Biome[] biomeList; private BiomeCache biomeCache; private GenLayer genBiomes; private GenLayer biomeIndexLayer; @@ -99,7 +95,6 @@ public MapGen(World world, int sx, int sz, int cx, int cz, int scale, File file) this.ix = 0; this.iz = 0; long seed = world.getSeed(); - this.biomeList = Biome.getBiomeGenArray(); this.biomeCache = new BiomeCache(this); this.worldType = world.getWorldInfo().getTerrainType(); GenLayerGCMap[] agenlayerOrig = GenLayerGCMap.initializeAllBiomeGenerators(seed, worldType, world.getWorldInfo().getGeneratorOptions()); @@ -163,7 +158,7 @@ private void sendToClient(byte[] toSend) { try { - for (WorldServer server : MinecraftServer.getServer().worldServers) + for (WorldServer server : FMLCommonHandler.instance().getMinecraftServerInstance().worldServers) { GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(EnumSimplePacket.C_SEND_OVERWORLD_IMAGE, server.provider.getDimension(), new Object[] { this.biomeMapCx << 4, this.biomeMapCz << 4, toSend }), server.provider.getDimension()); } @@ -418,7 +413,7 @@ private void func_147423_a(int cx, int cy, int cz) float f = 0.0F; float f1 = 0.0F; float f2 = 0.0F; - float theMinHeight = biomesGridHeights[xx + 22 + zz * 10].minHeight; + float theMinHeight = biomesGridHeights[xx + 22 + zz * 10].getBaseHeight(); for (int x = -2; x <= 2; ++x) { @@ -426,8 +421,8 @@ private void func_147423_a(int cx, int cy, int cz) for (int z = -2; z <= 2; ++z) { Biome biomegenbase1 = biomesGridHeights[baseIndex + z * 10]; - float f3 = biomegenbase1.minHeight; - float f4 = biomegenbase1.maxHeight; + float f3 = biomegenbase1.getBaseHeight(); + float f4 = biomegenbase1.getBaseHeight(); if (amplified && f3 > 0.0F) { @@ -437,7 +432,7 @@ private void func_147423_a(int cx, int cy, int cz) float f5 = parabolicField[x + 12 + z * 5] / (f3 + 2.0F); - if (biomegenbase1.minHeight > theMinHeight) + if (biomegenbase1.getBaseHeight() > theMinHeight) { f5 /= 2.0F; } @@ -519,21 +514,17 @@ public Biome[] getBiomesForGeneration(Biome[] biomes, int x, int z, int width, i int[] aint = this.genBiomes.getInts(x, z, width, height); int size = width * height; - if (biomes == null || biomes.length < size) + if (biomes.length < size) { biomes = new Biome[size]; } for (int i = 0; i < size; ++i) { int biomeId = aint[i]; - Biome biomegenbase = null; - if (biomeId >= 0 && biomeId <= biomeList.length) - { - biomegenbase = biomeList[biomeId]; - } + Biome biomegenbase = Biome.getBiome(biomeId, Biomes.DEFAULT); // else // System.err.println("MapGen: Biome ID is out of bounds: " + biomeId + ", defaulting to 0 (Ocean)"); - biomes[i] = biomegenbase == null ? Biome.ocean : biomegenbase; + biomes[i] = biomegenbase == null ? Biomes.OCEAN : biomegenbase; } return biomes; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java index 7d97b89908..e763a0e2de 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapUtil.java @@ -8,7 +8,6 @@ import micdoodle8.mods.galacticraft.core.network.PacketSimple; import micdoodle8.mods.galacticraft.core.network.PacketSimple.EnumSimplePacket; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; -import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -17,24 +16,21 @@ import net.minecraft.client.resources.IResourceManager; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.fml.client.FMLClientHandler; +import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; - import org.apache.commons.io.FileUtils; import javax.imageio.*; import javax.imageio.stream.FileImageOutputStream; import javax.imageio.stream.ImageInputStream; import javax.imageio.stream.ImageOutputStream; - import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; @@ -142,21 +138,19 @@ public static void getLocalMap(World world, int chunkXPos, int chunkZPos, Buffer for (int x = 0; x < 16; x++) { int l4 = chunk.getHeight(new BlockPos(x, 0, z)) + 1; - Block block = Blocks.AIR; - IBlockState i5 = null; + IBlockState state = Blocks.AIR.getDefaultState(); if (l4 > 1) { do { --l4; - block = chunk.getBlock(x, l4, z); - i5 = chunk.getBlockState(new BlockPos(x, l4, z)); + state = chunk.getBlockState(x, l4, z); } - while (block.getMapColor(i5) == MapColor.airColor && l4 > 0); + while (state.getBlock().getMapColor(state) == MapColor.AIR && l4 > 0); } - int col = block.getMapColor(i5).colorValue; + int col = state.getBlock().getMapColor(state).colorValue; image.setRGB(x + (x0 + 12) * 16, z + (z0 + 12) * 16, col); } } @@ -178,7 +172,7 @@ public static void makeOverworldTexture() return; } - File baseFolder = new File(MinecraftServer.getServer().worldServerForDimension(0).getChunkSaveLocation(), "galacticraft/overworldMap"); + File baseFolder = new File(world.getMinecraftServer().worldServerForDimension(0).getChunkSaveLocation(), "galacticraft/overworldMap"); if (!baseFolder.exists() && !baseFolder.mkdirs()) { GCLog.severe("Base folder(s) could not be created: " + baseFolder.getAbsolutePath()); @@ -202,7 +196,7 @@ public static void sendOverworldToClient(EntityPlayerMP client) { try { - File baseFolder = new File(MinecraftServer.getServer().worldServerForDimension(0).getChunkSaveLocation(), "galacticraft/overworldMap"); + File baseFolder = new File(client.worldObj.getMinecraftServer().worldServerForDimension(0).getChunkSaveLocation(), "galacticraft/overworldMap"); if (!baseFolder.exists()) { GCLog.severe("Base folder missing: " + baseFolder.getAbsolutePath()); @@ -231,7 +225,7 @@ public static void sendOrCreateMap(World world, int cx, int cz, EntityPlayerMP c { try { - File baseFolder = new File(MinecraftServer.getServer().worldServerForDimension(0).getChunkSaveLocation(), "galacticraft/overworldMap"); + File baseFolder = new File(client.worldObj.getMinecraftServer().worldServerForDimension(0).getChunkSaveLocation(), "galacticraft/overworldMap"); if (!baseFolder.exists()) { GCLog.severe("Base folder missing: " + baseFolder.getAbsolutePath()); @@ -276,7 +270,7 @@ else if (largeMap.length < 2000000) */ public static boolean buildMaps(World world, int x, int z) { - File baseFolder = new File(MinecraftServer.getServer().worldServerForDimension(0).getChunkSaveLocation(), "galacticraft/overworldMap"); + File baseFolder = new File(world.getMinecraftServer().worldServerForDimension(0).getChunkSaveLocation(), "galacticraft/overworldMap"); if (!baseFolder.exists() && !baseFolder.mkdirs()) { GCLog.severe("Base folder(s) could not be created: " + baseFolder.getAbsolutePath()); @@ -916,13 +910,9 @@ private static File makeFileName(File folder, int cx, int cz) private static int getBiomeBaseColour(int biomeId) { - Biome[] biomeList = Biome.getBiomeGenArray(); - Biome biomegenbase = null; - if (biomeId >= 0 && biomeId <= biomeList.length) - { - biomegenbase = biomeList[biomeId]; - } - return biomegenbase == null ? Biome.ocean.color : biomegenbase.color; + Biome biomegenbase = Biome.REGISTRY.getObjectById(biomeId); +// return biomegenbase == null ? Biomes.OCEAN.color : biomegenbase.color; TODO Fix vanilla biome colors + return 0; } public static int convertBiomeColour(int in, int height) @@ -968,7 +958,7 @@ public static int convertBiomeColour(int in, int height) { if (MapUtil.rand.nextInt(8) > 98 - height) { - rv = Material.snow.getMaterialMapColor().colorValue; + rv = Material.SNOW.getMaterialMapColor().colorValue; } } float factor = (height - 68F) / 114F; @@ -982,7 +972,7 @@ private static void setupColours() //plains = Plains(1) colour(9286496) "Plains" MapUtil.biomeColours.add(new BlockVec3(0x497436, 0, 0)); //desert = Desert(2) colour(16421912) "Desert" - MapUtil.biomeColours.add(new BlockVec3(0xd4cd98, Material.cactus.getMaterialMapColor().colorValue, 3)); + MapUtil.biomeColours.add(new BlockVec3(0xd4cd98, Material.CACTUS.getMaterialMapColor().colorValue, 3)); //extremeHills = Hills(3, false) colour(6316128) "Extreme Hills" MapUtil.biomeColours.add(new BlockVec3(0x4d654c, Material.ROCK.getMaterialMapColor().colorValue, 15)); //forest = Forest(4, 0) colour(353825) "Forest" @@ -996,19 +986,19 @@ private static void setupColours() MapUtil.biomeColours.add(new BlockVec3(0, 0, 0)); MapUtil.biomeColours.add(new BlockVec3(0, 0, 0)); //frozenOcean = Ocean(10) colour(9474208) "FrozenOcean" - MapUtil.biomeColours.add(new BlockVec3(Material.ice.getMaterialMapColor().colorValue, 0, 0)); + MapUtil.biomeColours.add(new BlockVec3(Material.ICE.getMaterialMapColor().colorValue, 0, 0)); //frozenRiver = River(11) colour(10526975) "FrozenRiver" - MapUtil.biomeColours.add(new BlockVec3(Material.ice.getMaterialMapColor().colorValue, 0, 0)); + MapUtil.biomeColours.add(new BlockVec3(Material.ICE.getMaterialMapColor().colorValue, 0, 0)); //icePlains = Snow(12, false) colour(16777215) "Ice Plains" - MapUtil.biomeColours.add(new BlockVec3(Material.snow.getMaterialMapColor().colorValue, 0x497436, 3)); + MapUtil.biomeColours.add(new BlockVec3(Material.SNOW.getMaterialMapColor().colorValue, 0x497436, 3)); //iceMountains = Snow(13, false) colour(10526880) "Ice Mountains" - MapUtil.biomeColours.add(new BlockVec3(Material.snow.getMaterialMapColor().colorValue, Material.ice.getMaterialMapColor().colorValue, 5)); + MapUtil.biomeColours.add(new BlockVec3(Material.SNOW.getMaterialMapColor().colorValue, Material.ICE.getMaterialMapColor().colorValue, 5)); //mushroomIsland = MushroomIsland(14) colour(16711935) "MushroomIsland" MapUtil.biomeColours.add(new BlockVec3(0x63565f, 0x7c1414, 10)); //mushroomIslandShore = MushroomIsland(15) colour(10486015) "MushroomIslandShore" MapUtil.biomeColours.add(new BlockVec3(0x6a6066, 0, 0)); //beach = Beach(16) colour(16440917) "Beach" - MapUtil.biomeColours.add(new BlockVec3(Material.sand.getMaterialMapColor().colorValue, 0, 0)); + MapUtil.biomeColours.add(new BlockVec3(Material.SAND.getMaterialMapColor().colorValue, 0, 0)); //desertHills = Desert(17) colour(13786898) "DesertHills" MapUtil.biomeColours.add(new BlockVec3(0xd4cd98, 0, 0)); //forestHills = Forest(18, 0) colour(2250012) "ForestHills" @@ -1028,7 +1018,7 @@ private static void setupColours() //stoneBeach = StoneBeach(25) colour(10658436) "Stone Beach" MapUtil.biomeColours.add(new BlockVec3(Material.ROCK.getMaterialMapColor().colorValue, 0, 0)); //coldBeach = Beach(26) colour(16445632) "Cold Beach" - MapUtil.biomeColours.add(new BlockVec3(Material.sand.getMaterialMapColor().colorValue, Material.snow.getMaterialMapColor().colorValue, 75)); + MapUtil.biomeColours.add(new BlockVec3(Material.SAND.getMaterialMapColor().colorValue, Material.SNOW.getMaterialMapColor().colorValue, 75)); //birchForest = Forest(27, 2)) colour(3175492) "Birch Forest" MapUtil.biomeColours.add(new BlockVec3(0x516b36, 0x497436, 65)); //birchForestHills = Forest(28, 2)) colour(2055986) "Birch Forest Hills" @@ -1036,9 +1026,9 @@ private static void setupColours() //roofedForest = Forest(29, 3) colour(4215066) "Roofed Forest" MapUtil.biomeColours.add(new BlockVec3(0x9c2424, 0x1e2e18, 98)); //coldTaiga = Taiga(30, 0) colour(3233098) "Cold Taiga" - MapUtil.biomeColours.add(new BlockVec3(Material.snow.getMaterialMapColor().colorValue, 0x172a17, 12)); + MapUtil.biomeColours.add(new BlockVec3(Material.SNOW.getMaterialMapColor().colorValue, 0x172a17, 12)); //coldTaigaHills = Taiga(31, 0) colour(2375478) "Cold Taiga Hills" - MapUtil.biomeColours.add(new BlockVec3(Material.snow.getMaterialMapColor().colorValue, 0x172a17, 12)); + MapUtil.biomeColours.add(new BlockVec3(Material.SNOW.getMaterialMapColor().colorValue, 0x172a17, 12)); //megaTaiga = Taiga(32, 1) colour(5858897) "Mega Taiga" MapUtil.biomeColours.add(new BlockVec3(0x172a17, 0x6e4e35, 12)); //megaTaigaHills = Taiga(33, 1) colour(4542270) "Mega Taiga Hills" @@ -1063,7 +1053,7 @@ public static void makeVanillaMap(int dim, int chunkXPos, int chunkZPos, File ba { for (int z0 = -12; z0 <= 12; z0++) { - Chunk chunk = MinecraftServer.getServer().worldServerForDimension(dim).getChunkFromChunkCoords(chunkXPos + x0, chunkZPos + z0); + Chunk chunk = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(dim).getChunkFromChunkCoords(chunkXPos + x0, chunkZPos + z0); if (chunk != null) { @@ -1072,8 +1062,7 @@ public static void makeVanillaMap(int dim, int chunkXPos, int chunkZPos, File ba for (int x = 0; x < 16; x++) { int l4 = chunk.getHeightValue(x, z) + 1; - Block block = Blocks.AIR; - IBlockState i5 = block.getDefaultState(); + IBlockState state = Blocks.AIR.getDefaultState(); if (l4 > 1) { @@ -1081,13 +1070,12 @@ public static void makeVanillaMap(int dim, int chunkXPos, int chunkZPos, File ba { --l4; BlockPos pos = new BlockPos(x, l4, z); - block = chunk.getBlock(pos); - i5 = chunk.getBlockState(pos); + state = chunk.getBlockState(pos); } - while (block.getMapColor(i5) == MapColor.airColor && l4 > 0); + while (state.getBlock().getMapColor(state) == MapColor.AIR && l4 > 0); } - int col = block.getMapColor(i5).colorValue; + int col = state.getBlock().getMapColor(state).colorValue; image.setRGB(x + (x0 + 12) * 16, z + (z0 + 12) * 16, col); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java index e3fd1c7dc9..ca6616b475 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java @@ -11,7 +11,8 @@ import micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider; import micdoodle8.mods.galacticraft.core.GCBlocks; import micdoodle8.mods.galacticraft.core.energy.EnergyConfigHandler; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.fluid.OxygenPressureProtocol; import micdoodle8.mods.galacticraft.core.items.ItemCanisterOxygenInfinite; import micdoodle8.mods.galacticraft.core.items.ItemOxygenGear; @@ -28,9 +29,9 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.EnumFacing; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; @@ -103,7 +104,7 @@ public static boolean isAABBInBreathableAirBlock(World world, AxisAlignedBB bb, if (testThermal) { - return OxygenUtil.isInOxygenAndThermalBlock(world, bb.contract(0.001D, 0.001D, 0.001D)); + return OxygenUtil.isInOxygenAndThermalBlock(world, bb.contract(0.001D)); } if (OxygenUtil.inOxygenBubble(world, avgX, avgY, avgZ)) @@ -111,7 +112,7 @@ public static boolean isAABBInBreathableAirBlock(World world, AxisAlignedBB bb, return true; } - return OxygenUtil.isInOxygenBlock(world, bb.contract(0.001D, 0.001D, 0.001D)); + return OxygenUtil.isInOxygenBlock(world, bb.contract(0.001D)); } public static boolean isInOxygenBlock(World world, AxisAlignedBB bb) @@ -194,8 +195,8 @@ public static boolean checkTorchHasOxygen(World world, BlockPos pos) for (int side = 0; side < 6; side++) { BlockVec3 sidevec = vec.newVecSide(side); - Block newblock = sidevec.getBlockID_noChunkLoad(world); - if (OxygenUtil.testContactWithBreathableAir(world, newblock, sidevec.toBlockPos(), 1) >= 0) + IBlockState state = sidevec.getBlockState_noChunkLoad(world); + if (OxygenUtil.testContactWithBreathableAir(world, state.getBlock(), sidevec.toBlockPos(), 1) >= 0) { return true; } @@ -219,18 +220,19 @@ private static int testContactWithBreathableAir(World world, Block block, BlockP return block.getMetaFromState(world.getBlockState(pos)); } - if (block == null || block.getMaterial() == Material.AIR) + IBlockState state = world.getBlockState(pos); + if (block == null || block.getMaterial(state) == Material.AIR) { return -1; } //Test for non-sided permeable or solid blocks first boolean permeableFlag = false; - if (!(block instanceof BlockLeavesBase)) + if (!(block instanceof BlockLeaves)) { - if (block.isOpaqueCube()) + if (block.isOpaqueCube(state)) { - if (block instanceof BlockGravel || block.getMaterial() == Material.CLOTH || block instanceof BlockSponge) + if (block instanceof BlockGravel || block.getMaterial(state) == Material.CLOTH || block instanceof BlockSponge) { permeableFlag = true; } @@ -250,7 +252,6 @@ else if (block instanceof BlockLiquid) else if (OxygenPressureProtocol.nonPermeableBlocks.containsKey(block)) { ArrayList metaList = OxygenPressureProtocol.nonPermeableBlocks.get(block); - IBlockState state = world.getBlockState(pos); if (metaList.contains(Integer.valueOf(-1)) || metaList.contains(state.getBlock().getMetaFromState(state))) { return -1; @@ -312,7 +313,7 @@ private static boolean canBlockPassAirOnSide(World world, Block block, BlockPos if (block instanceof BlockPistonBase) { IBlockState state = world.getBlockState(vec); - if (((Boolean) state.getValue(BlockPistonBase.EXTENDED)).booleanValue()) + if ((Boolean) state.getValue(BlockPistonBase.EXTENDED)) { int meta0 = state.getBlock().getMetaFromState(state); EnumFacing facing = BlockPistonBase.getFacing(meta0); @@ -321,7 +322,7 @@ private static boolean canBlockPassAirOnSide(World world, Block block, BlockPos return false; } - return !block.isSideSolid(world, vec, EnumFacing.getFront(side.getIndex() ^ 1)); + return !block.isSideSolid(world.getBlockState(vec), world, vec, EnumFacing.getFront(side.getIndex() ^ 1)); } public static int getDrainSpacing(ItemStack tank, ItemStack tank2) @@ -341,9 +342,9 @@ public static boolean hasValidOxygenSetup(EntityPlayerMP player) { boolean missingComponent = false; - GCPlayerStats stats = GCPlayerStats.get(player); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); - if (stats.extendedInventory.getStackInSlot(0) == null || !OxygenUtil.isItemValidForPlayerTankInv(0, stats.extendedInventory.getStackInSlot(0))) + if (stats.getExtendedInventory().getStackInSlot(0) == null || !OxygenUtil.isItemValidForPlayerTankInv(0, stats.getExtendedInventory().getStackInSlot(0))) { boolean handled = false; @@ -369,7 +370,7 @@ public static boolean hasValidOxygenSetup(EntityPlayerMP player) } } - if (stats.extendedInventory.getStackInSlot(1) == null || !OxygenUtil.isItemValidForPlayerTankInv(1, stats.extendedInventory.getStackInSlot(1))) + if (stats.getExtendedInventory().getStackInSlot(1) == null || !OxygenUtil.isItemValidForPlayerTankInv(1, stats.getExtendedInventory().getStackInSlot(1))) { boolean handled = false; @@ -395,7 +396,7 @@ public static boolean hasValidOxygenSetup(EntityPlayerMP player) } } - if ((stats.extendedInventory.getStackInSlot(2) == null || !OxygenUtil.isItemValidForPlayerTankInv(2, stats.extendedInventory.getStackInSlot(2))) && (stats.extendedInventory.getStackInSlot(3) == null || !OxygenUtil.isItemValidForPlayerTankInv(3, stats.extendedInventory.getStackInSlot(3)))) + if ((stats.getExtendedInventory().getStackInSlot(2) == null || !OxygenUtil.isItemValidForPlayerTankInv(2, stats.getExtendedInventory().getStackInSlot(2))) && (stats.getExtendedInventory().getStackInSlot(3) == null || !OxygenUtil.isItemValidForPlayerTankInv(3, stats.getExtendedInventory().getStackInSlot(3)))) { boolean handled = false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/PlayerUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/PlayerUtil.java index ba22a82f32..a2907f3168 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/PlayerUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/PlayerUtil.java @@ -7,6 +7,7 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraftforge.fml.client.FMLClientHandler; +import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -21,13 +22,13 @@ public class PlayerUtil public static EntityPlayerMP getPlayerForUsernameVanilla(MinecraftServer server, String username) { - return server.getConfigurationManager().getPlayerByUsername(username); + return server.getPlayerList().getPlayerByUsername(username); // return VersionUtil.getPlayerForUsername(server, username); } public static EntityPlayerMP getPlayerBaseServerFromPlayerUsername(String username, boolean ignoreCase) { - MinecraftServer server = MinecraftServer.getServer(); + MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); if (server != null) { @@ -37,7 +38,7 @@ public static EntityPlayerMP getPlayerBaseServerFromPlayerUsername(String userna } else { - Iterator iterator = server.getConfigurationManager().playerEntityList.iterator(); + Iterator iterator = server.getPlayerList().getPlayerList().iterator(); EntityPlayerMP entityplayermp; do @@ -122,7 +123,7 @@ public static GameProfile makeOtherPlayerProfile(String strName, String strUUID) public static EntityPlayerMP getPlayerByUUID(UUID theUUID) { - List players = MinecraftServer.getServer().getConfigurationManager().playerEntityList; + List players = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList(); EntityPlayerMP entityplayermp; for (int i = players.size() - 1; i >= 0; --i) { @@ -139,6 +140,6 @@ public static EntityPlayerMP getPlayerByUUID(UUID theUUID) public static boolean isPlayerOnline(EntityPlayerMP player) { - return MinecraftServer.getServer().getConfigurationManager().playerEntityList.contains(player); + return player.worldObj.getMinecraftServer().getPlayerList().getPlayerList().contains(player); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/RedstoneUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/RedstoneUtil.java index e1a6dfd7c0..8f6846ceaa 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/RedstoneUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/RedstoneUtil.java @@ -43,7 +43,7 @@ public static boolean isBlockReceivingRedstone(World w, BlockPos pos) */ public static int isBlockProvidingPowerTo(World w, BlockPos pos, EnumFacing side) { - return w.getBlockState(pos).getBlock().getStrongPower(w, pos, w.getBlockState(pos), side); + return w.getBlockState(pos).getBlock().getStrongPower(w.getBlockState(pos), w, pos, side); } public static int isBlockProvidingPowerTo_NoChunkLoad(World w, BlockPos pos, EnumFacing side) @@ -52,6 +52,6 @@ public static int isBlockProvidingPowerTo_NoChunkLoad(World w, BlockPos pos, Enu { return 0; } - return w.getBlockState(pos).getBlock().getStrongPower(w, pos, w.getBlockState(pos), side); + return w.getBlockState(pos).getBlock().getStrongPower(w.getBlockState(pos), w, pos, side); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/ThreadVersionCheck.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/ThreadVersionCheck.java index 0a6f022ef0..9d0a248fe9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/ThreadVersionCheck.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/ThreadVersionCheck.java @@ -1,7 +1,7 @@ package micdoodle8.mods.galacticraft.core.util; import micdoodle8.mods.galacticraft.core.Constants; -import net.minecraft.util.TextComponentString; +import net.minecraft.util.text.TextComponentString; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java index dfec3c01ac..59ebde2263 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java @@ -20,8 +20,8 @@ import micdoodle8.mods.galacticraft.core.dimension.SpaceStationWorldData; import micdoodle8.mods.galacticraft.core.dimension.WorldProviderZeroGravity; import micdoodle8.mods.galacticraft.core.entities.EntityCelestialFake; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerHandler; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.items.ItemParaChute; import micdoodle8.mods.galacticraft.core.network.PacketSimple; @@ -30,7 +30,6 @@ import micdoodle8.mods.galacticraft.core.tile.TileEntityTelemetry; import micdoodle8.mods.galacticraft.planets.venus.dimension.WorldProviderVenus; import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.player.EntityPlayer; @@ -38,13 +37,14 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.play.server.S07PacketRespawn; -import net.minecraft.network.play.server.S1DPacketEntityEffect; -import net.minecraft.network.play.server.S1FPacketSetExperience; +import net.minecraft.network.play.server.SPacketEntityEffect; +import net.minecraft.network.play.server.SPacketRespawn; +import net.minecraft.network.play.server.SPacketSetExperience; import net.minecraft.potion.PotionEffect; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.*; import net.minecraft.world.chunk.Chunk; @@ -159,7 +159,7 @@ public static WorldProvider getProviderForNameClient(String par1String) public static void initialiseDimensionNames() { WorldProvider provider = WorldUtil.getProviderForDimensionServer(ConfigManagerCore.idDimensionOverworld); - WorldUtil.dimNames.put(ConfigManagerCore.idDimensionOverworld, provider.getDimensionName()); + WorldUtil.dimNames.put(ConfigManagerCore.idDimensionOverworld, provider.getDimensionType().getName()); } /** @@ -208,7 +208,7 @@ public static List getPossibleDimensionsForSpaceshipTier(int tier, Enti { final SpaceStationWorldData data = SpaceStationWorldData.getStationData(playerBase.worldObj, element, null); - if (!ConfigManagerCore.spaceStationsRequirePermission || data.getAllowedAll() || data.getAllowedPlayers().contains(playerBase.getGameProfile().getName()) || ArrayUtils.contains(playerBase.mcServer.getConfigurationManager().getOppedPlayerNames(), playerBase.getName())) + if (!ConfigManagerCore.spaceStationsRequirePermission || data.getAllowedAll() || data.getAllowedPlayers().contains(playerBase.getGameProfile().getName()) || ArrayUtils.contains(playerBase.mcServer.getPlayerList().getOppedPlayerNames(), playerBase.getName())) { //Satellites always reachable from their own homeworld or from its other satellites if (playerBase != null) @@ -328,7 +328,7 @@ public static WorldProvider getProviderForDimensionClient(int id) { return ws.provider; } - return WorldProvider.getProviderForDimension(id); + return DimensionManager.createProviderFor(id); } /** @@ -468,13 +468,13 @@ public static void registerSpaceStations(File spaceStationList) { if (id >= 0) { - DimensionManager.registerDimension(registeredID, worldDataTemp.getDimensionIdStatic()); + DimensionManager.registerDimension(registeredID, DimensionType.getById(worldDataTemp.getDimensionIdStatic())); WorldUtil.registeredSpaceStations.put(registeredID, worldDataTemp.getDimensionIdStatic()); theServer.worldServerForDimension(registeredID); } else { - DimensionManager.registerDimension(registeredID, worldDataTemp.getDimensionIdDynamic()); + DimensionManager.registerDimension(registeredID, DimensionType.getById(worldDataTemp.getDimensionIdDynamic())); WorldUtil.registeredSpaceStations.put(registeredID, worldDataTemp.getDimensionIdDynamic()); } WorldUtil.dimNames.put(registeredID, "Space Station " + registeredID); @@ -523,10 +523,10 @@ public static void registerSpaceStations(File spaceStationList) * If you do not do this, you must find your own way to register the dimension in DimensionManager * and you must find your own way to include the cached provider name in WorldUtil.dimNames *

- * IMPORTANT: GalacticraftRegistry.registerProvider() must always be called in parallel with this + * IMPORTANT: GalacticraftRegistry.registerDimension() must always be called in parallel with this * meaning the CelestialBodies are iterated in the same order when registered there and here. */ - public static boolean registerPlanet(DimensionType type, boolean initialiseDimensionAtServerInit, int defaultID) + public static boolean registerPlanet(int id, boolean initialiseDimensionAtServerInit, int defaultID) { if (WorldUtil.registeredPlanets == null) { @@ -535,26 +535,26 @@ public static boolean registerPlanet(DimensionType type, boolean initialiseDimen if (initialiseDimensionAtServerInit) { - if (!DimensionManager.isDimensionRegistered(type.getId())) + if (!DimensionManager.isDimensionRegistered(id)) { - DimensionManager.registerDimension(type.getId(), type); - GCLog.info("Registered Dimension: " + type); - WorldUtil.registeredPlanets.add(type.getId()); + DimensionManager.registerDimension(id, DimensionType.getById(id)); + GCLog.info("Registered Dimension: " + id); + WorldUtil.registeredPlanets.add(id); } else { - GCLog.severe("Dimension already registered to another mod: unable to register planet dimension " + type); + GCLog.severe("Dimension already registered to another mod: unable to register planet dimension " + id); //Add 0 to the list to preserve the correct order of the other planets (e.g. if server/client initialise with different dimension IDs in configs, the order becomes important for figuring out what is going on) WorldUtil.registeredPlanets.add(defaultID); return false; } - World w = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(type.getId()); - WorldUtil.dimNames.put(type.getId(), getDimensionName(w.provider)); + World w = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(id); + WorldUtil.dimNames.put(id, getDimensionName(w.provider)); return true; } //Not to be initialised - still add to the registered planets list (for hotloading later?) - WorldUtil.registeredPlanets.add(type.getId()); + WorldUtil.registeredPlanets.add(id); return true; } @@ -573,25 +573,11 @@ public static void unregisterPlanets() WorldUtil.dimNames.clear(); } - /** - * You should now use WorldUtil.registerPlanet(int planetID, boolean initialiseDimensionAtServerInit, int defaultID) - * which returns a boolean indicating that the dimension could be successfully created (if initialiseDimensionAtServerInit is true). - * Always returns true if if initialiseDimensionAtServerInit is false. - * - * @param planetID - * @param initialiseDimensionAtServerInit - */ - @Deprecated - public static void registerPlanet(int planetID, boolean initialiseDimensionAtServerInit) - { - WorldUtil.registerPlanet(planetID, initialiseDimensionAtServerInit, 0); - } - public static void registerPlanetClient(Integer dimID, int providerIndex) { - int providerID = GalacticraftRegistry.getProviderID(providerIndex); + int typeID = GalacticraftRegistry.getDimensionTypeID(providerIndex); - if (providerID == 0) + if (typeID == 0) { GCLog.severe("Server dimension " + dimID + " has no match on client due to earlier registration problem."); } @@ -600,7 +586,7 @@ public static void registerPlanetClient(Integer dimID, int providerIndex) if (!WorldUtil.registeredPlanets.contains(dimID)) { WorldUtil.registeredPlanets.add(dimID); - DimensionManager.registerDimension(dimID, providerID); + DimensionManager.registerDimension(dimID, DimensionType.getById(typeID)); } else { @@ -628,9 +614,9 @@ public static SpaceStationWorldData bindSpaceStationToNewDimension(World world, int newID = DimensionManager.getNextFreeDimId(); SpaceStationWorldData data = WorldUtil.createSpaceStation(world, newID, homePlanetID, dynamicProviderID, staticProviderID, player); dimNames.put(newID, "Space Station " + newID); - GCPlayerStats stats = GCPlayerStats.get(player); - stats.spaceStationDimensionData.put(homePlanetID, newID); - GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_SPACESTATION_CLIENT_ID, player.worldObj.provider.getDimension(), new Object[] { WorldUtil.spaceStationDataToString(stats.spaceStationDimensionData) }), player); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + stats.getSpaceStationDimensionData().put(homePlanetID, newID); + GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_SPACESTATION_CLIENT_ID, player.worldObj.provider.getDimension(), new Object[] { WorldUtil.spaceStationDataToString(stats.getSpaceStationDimensionData()) }), player); return data; } @@ -642,12 +628,12 @@ public static SpaceStationWorldData createSpaceStation(World world, int dimID, i { if (id >= 0) { - DimensionManager.registerDimension(dimID, staticProviderID); + DimensionManager.registerDimension(dimID, DimensionType.getById(staticProviderID)); WorldUtil.registeredSpaceStations.put(dimID, staticProviderID); } else { - DimensionManager.registerDimension(dimID, dynamicProviderID); + DimensionManager.registerDimension(dimID, DimensionType.getById(dynamicProviderID)); WorldUtil.registeredSpaceStations.put(dimID, dynamicProviderID); } } @@ -656,7 +642,7 @@ public static SpaceStationWorldData createSpaceStation(World world, int dimID, i GCLog.severe("Dimension already registered to another mod: unable to register space station dimension " + dimID); } - for (WorldServer server : MinecraftServer.getServer().worldServers) + for (WorldServer server : world.getMinecraftServer().worldServers) { GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(EnumSimplePacket.C_UPDATE_SPACESTATION_LIST, server.provider.getDimension(), WorldUtil.getSpaceStationList()), server.provider.getDimension()); } @@ -704,12 +690,12 @@ private static Entity teleportEntity(World worldNew, Entity entity, int dimID, I { if (entity.getRidingEntity() instanceof EntitySpaceshipBase) { - entity.mountEntity(entity.getRidingEntity()); + entity.startRiding(entity.getRidingEntity()); } else if (entity.getRidingEntity() instanceof EntityCelestialFake) { + entity.getRidingEntity().removePassengers(); entity.getRidingEntity().setDead(); - entity.mountEntity(null); } } @@ -724,7 +710,7 @@ else if (entity.getRidingEntity() instanceof EntityCelestialFake) ArrayList tList = ridingRocket.getTelemetry(); NBTTagCompound nbt = new NBTTagCompound(); ridingRocket.isDead = false; - ridingRocket.riddenByEntity = null; + ridingRocket.removePassengers(); ridingRocket.writeToNBTOptional(nbt); ((WorldServer) ridingRocket.worldObj).getEntityTracker().untrackEntity(ridingRocket); @@ -775,15 +761,15 @@ else if (entity.getRidingEntity() instanceof EntityCelestialFake) } player.closeScreen(); - GCPlayerStats stats = GCPlayerStats.get(player); - stats.usingPlanetSelectionGui = false; + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + stats.setUsingPlanetSelectionGui(false); player.dimension = dimID; if (ConfigManagerCore.enableDebug) { GCLog.info("DEBUG: Sending respawn packet to player for dim " + dimID); } - player.playerNetServerHandler.sendPacket(new S07PacketRespawn(dimID, player.worldObj.getDifficulty(), player.worldObj.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType())); + player.connection.sendPacket(new SPacketRespawn(dimID, player.worldObj.getDifficulty(), player.worldObj.getWorldInfo().getTerrainType(), player.interactionManager.getGameType())); if (worldNew.provider instanceof WorldProviderZeroGravity) { @@ -798,7 +784,7 @@ else if (entity.getRidingEntity() instanceof EntityCelestialFake) worldOld.playerEntities.remove(player); worldOld.updateAllPlayersSleepingFlag(); - if (player.addedToChunk && worldOld.getChunkProvider().chunkExists(player.chunkCoordX, player.chunkCoordZ)) + if (player.addedToChunk && worldOld.getChunkProvider().getLoadedChunk(player.chunkCoordX, player.chunkCoordZ) != null) { Chunk chunkOld = worldOld.getChunkFromChunkCoords(player.chunkCoordX, player.chunkCoordZ); chunkOld.removeEntity(player); @@ -815,33 +801,33 @@ else if (entity.getRidingEntity() instanceof EntityCelestialFake) entity.setWorld(worldNew); spawnPos = type.getPlayerSpawnLocation((WorldServer) entity.worldObj, player); - ChunkCoordIntPair pair = worldNew.getChunkFromChunkCoords(spawnPos.intX(), spawnPos.intZ()).getChunkCoordIntPair(); + ChunkPos pair = worldNew.getChunkFromChunkCoords(spawnPos.intX(), spawnPos.intZ()).getChunkCoordIntPair(); if (ConfigManagerCore.enableDebug) { GCLog.info("DEBUG: Loading first chunk in new dimension."); } - ((WorldServer) worldNew).theChunkProviderServer.loadChunk(pair.chunkXPos, pair.chunkZPos); + ((WorldServer) worldNew).getChunkProvider().loadChunk(pair.chunkXPos, pair.chunkZPos); //entity.setLocationAndAngles(spawnPos.x, spawnPos.y, spawnPos.z, entity.rotationYaw, entity.rotationPitch); worldNew.updateEntityWithOptionalForce(entity, false); entity.setLocationAndAngles(spawnPos.x, spawnPos.y, spawnPos.z, entity.rotationYaw, entity.rotationPitch); - player.mcServer.getConfigurationManager().preparePlayer(player, (WorldServer) worldNew); - player.playerNetServerHandler.setPlayerLocation(spawnPos.x, spawnPos.y, spawnPos.z, entity.rotationYaw, entity.rotationPitch); + player.mcServer.getPlayerList().preparePlayer(player, (WorldServer) worldNew); + player.connection.setPlayerLocation(spawnPos.x, spawnPos.y, spawnPos.z, entity.rotationYaw, entity.rotationPitch); //worldNew.updateEntityWithOptionalForce(entity, false); GCLog.info("Server attempting to transfer player " + player.getGameProfile().getName() + " to dimension " + worldNew.provider.getDimension()); - player.theItemInWorldManager.setWorld((WorldServer) worldNew); - player.mcServer.getConfigurationManager().updateTimeAndWeatherForPlayer(player, (WorldServer) worldNew); - player.mcServer.getConfigurationManager().syncPlayerInventory(player); + player.interactionManager.setWorld((WorldServer) worldNew); + player.mcServer.getPlayerList().updateTimeAndWeatherForPlayer(player, (WorldServer) worldNew); + player.mcServer.getPlayerList().syncPlayerInventory(player); for (Object o : player.getActivePotionEffects()) { PotionEffect var10 = (PotionEffect) o; - player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), var10)); + player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), var10)); } - player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel)); + player.connection.sendPacket(new SPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel)); } else //Non-player entity transfer i.e. it's an EntityCargoRocket @@ -889,8 +875,8 @@ else if (entity.getRidingEntity() instanceof EntityCelestialFake) { player = (EntityPlayerMP) entity; player.closeScreen(); - GCPlayerStats stats = GCPlayerStats.get(player); - stats.usingPlanetSelectionGui = false; + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + stats.setUsingPlanetSelectionGui(false); if (worldNew.provider instanceof WorldProviderZeroGravity) { @@ -899,7 +885,7 @@ else if (entity.getRidingEntity() instanceof EntityCelestialFake) worldNew.updateEntityWithOptionalForce(entity, false); spawnPos = type.getPlayerSpawnLocation((WorldServer) entity.worldObj, (EntityPlayerMP) entity); - player.playerNetServerHandler.setPlayerLocation(spawnPos.x, spawnPos.y, spawnPos.z, entity.rotationYaw, entity.rotationPitch); + player.connection.setPlayerLocation(spawnPos.x, spawnPos.y, spawnPos.z, entity.rotationYaw, entity.rotationPitch); entity.setLocationAndAngles(spawnPos.x, spawnPos.y, spawnPos.z, entity.rotationYaw, entity.rotationPitch); worldNew.updateEntityWithOptionalForce(entity, false); @@ -912,8 +898,8 @@ else if (entity.getRidingEntity() instanceof EntityCelestialFake) //Update PlayerStatsGC if (player != null) { - GCPlayerStats playerStats = GCPlayerStats.get(player); - if (ridingRocket == null && type.useParachute() && playerStats.extendedInventory.getStackInSlot(4) != null && playerStats.extendedInventory.getStackInSlot(4).getItem() instanceof ItemParaChute) + IStatsCapability playerStats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + if (ridingRocket == null && type.useParachute() && playerStats.getExtendedInventory().getStackInSlot(4) != null && playerStats.getExtendedInventory().getStackInSlot(4).getItem() instanceof ItemParaChute) { GCPlayerHandler.setUsingParachute(player, playerStats, true); } @@ -922,39 +908,39 @@ else if (entity.getRidingEntity() instanceof EntityCelestialFake) GCPlayerHandler.setUsingParachute(player, playerStats, false); } - if (playerStats.rocketStacks != null && playerStats.rocketStacks.length > 0) + if (playerStats.getRocketStacks() != null && playerStats.getRocketStacks().length > 0) { - for (int stack = 0; stack < playerStats.rocketStacks.length; stack++) + for (int stack = 0; stack < playerStats.getRocketStacks().length; stack++) { if (transferInv) { - if (playerStats.rocketStacks[stack] == null) + if (playerStats.getRocketStacks()[stack] == null) { - if (stack == playerStats.rocketStacks.length - 1) + if (stack == playerStats.getRocketStacks().length - 1) { - if (playerStats.rocketItem != null) + if (playerStats.getRocketItem() != null) { - playerStats.rocketStacks[stack] = new ItemStack(playerStats.rocketItem, 1, playerStats.rocketType); + playerStats.getRocketStacks()[stack] = new ItemStack(playerStats.getRocketItem(), 1, playerStats.getRocketType()); } } - else if (stack == playerStats.rocketStacks.length - 2) + else if (stack == playerStats.getRocketStacks().length - 2) { - playerStats.rocketStacks[stack] = playerStats.launchpadStack; - playerStats.launchpadStack = null; + playerStats.getRocketStacks()[stack] = playerStats.getLaunchpadStack(); + playerStats.setLaunchpadStack(null); } } } else { - playerStats.rocketStacks[stack] = null; + playerStats.getRocketStacks()[stack] = null; } } } - if (transferInv && playerStats.chestSpawnCooldown == 0) + if (transferInv && playerStats.getChestSpawnCooldown() == 0) { - playerStats.chestSpawnVector = type.getParaChestSpawnLocation((WorldServer) entity.worldObj, player, new Random()); - playerStats.chestSpawnCooldown = 200; + playerStats.setChestSpawnVector(type.getParaChestSpawnLocation((WorldServer) entity.worldObj, player, new Random())); + playerStats.setChestSpawnCooldown(200); } } @@ -968,7 +954,7 @@ else if (stack == playerStats.rocketStacks.length - 2) ridingRocket.setWorld(worldNew); worldNew.updateEntityWithOptionalForce(ridingRocket, true); - entity.mountEntity(ridingRocket); + entity.startRiding(ridingRocket); } else if (spawnPos != null) { @@ -1002,8 +988,8 @@ public static WorldServer getStartWorld(WorldServer worldOld) @SideOnly(Side.CLIENT) public static EntityPlayer forceRespawnClient(int dimID, int par2, String par3, int par4) { - S07PacketRespawn fakePacket = new S07PacketRespawn(dimID, EnumDifficulty.getDifficultyEnum(par2), WorldType.parseWorldType(par3), WorldSettings.GameType.getByID(par4)); - Minecraft.getMinecraft().getNetHandler().handleRespawn(fakePacket); + SPacketRespawn fakePacket = new SPacketRespawn(dimID, EnumDifficulty.getDifficultyEnum(par2), WorldType.parseWorldType(par3), WorldSettings.getGameTypeById(par4)); + FMLClientHandler.instance().getClient().thePlayer.connection.handleRespawn(fakePacket); return FMLClientHandler.instance().getClientPlayerEntity(); } @@ -1018,7 +1004,7 @@ private static void removeEntityFromWorld(World var0, Entity var1, boolean direc final int var3 = var1.chunkCoordX; final int var4 = var1.chunkCoordZ; - if (var1.addedToChunk && var0.getChunkProvider().chunkExists(var3, var4)) + if (var1.addedToChunk && var0.getChunkProvider().getLoadedChunk(var3, var4) != null) { var0.getChunkFromChunkCoords(var3, var4).removeEntity(var1); var0.getChunkFromChunkCoords(var3, var4).setChunkModified(); @@ -1117,17 +1103,17 @@ else if (data.get(0) instanceof Integer[]) WorldProvider dimMoon = WorldUtil.getProviderForNameClient("moon.moon"); if (dimMoon != null) { - GCLog.debug("Crosscheck: Moon is " + dimMoon.getDimensionId()); + GCLog.debug("Crosscheck: Moon is " + dimMoon.getDimension()); } WorldProvider dimMars = WorldUtil.getProviderForNameClient("planet.mars"); if (dimMars != null) { - GCLog.debug("Crosscheck: Mars is " + dimMars.getDimensionId()); + GCLog.debug("Crosscheck: Mars is " + dimMars.getDimension()); } WorldProvider dimAst = WorldUtil.getProviderForNameClient("planet.asteroids"); if (dimAst != null) { - GCLog.debug("Crosscheck: Asteroids is " + dimAst.getDimensionId()); + GCLog.debug("Crosscheck: Asteroids is " + dimAst.getDimension()); } } } @@ -1217,7 +1203,7 @@ private static void registerSSdim(Integer dimID, Integer providerKey) if (!DimensionManager.isDimensionRegistered(dimID)) { WorldUtil.registeredSpaceStations.put(dimID, providerKey); - DimensionManager.registerDimension(dimID, providerKey); + DimensionManager.registerDimension(dimID, DimensionType.getById(providerKey)); } else { @@ -1259,7 +1245,7 @@ public static Vector3 getFootprintPosition(World world, float rotation, Vector3 BlockPos posMain = new BlockPos(mainPosX, mainPosY, mainPosZ); // If the footprint is hovering over air... - if (world.getBlockState(posMain).getBlock().isAir(world, posMain)) + if (world.getBlockState(posMain).getBlock().isAir(world.getBlockState(posMain), world, posMain)) { position.x += (playerCenter.x - mainPosX); position.z += (playerCenter.z - mainPosZ); @@ -1267,14 +1253,14 @@ public static Vector3 getFootprintPosition(World world, float rotation, Vector3 BlockPos pos1 = new BlockPos(position.intX(), position.intY(), position.intZ()); // If the footprint is still over air.... Block b2 = world.getBlockState(pos1).getBlock(); - if (b2 != null && b2.isAir(world, pos1)) + if (b2 != null && b2.isAir(world.getBlockState(pos1), world, pos1)) { for (EnumFacing direction : EnumFacing.values()) { BlockPos offsetPos = posMain.offset(direction); if (direction != EnumFacing.DOWN && direction != EnumFacing.UP) { - if (!world.getBlockState(offsetPos).getBlock().isAir(world, offsetPos)) + if (!world.getBlockState(offsetPos).getBlock().isAir(world.getBlockState(offsetPos), world, offsetPos)) { position.x += direction.getFrontOffsetX(); position.z += direction.getFrontOffsetZ(); @@ -1369,12 +1355,12 @@ public static String getDimensionName(WorldProvider wp) } } - if (wp.getDimensionId() == ConfigManagerCore.idDimensionOverworld) + if (wp.getDimension() == ConfigManagerCore.idDimensionOverworld) { return "Overworld"; } - return wp.getDimensionName(); + return wp.getDimensionType().getName(); } public static Map> getAllChecklistKeys() diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/ChunkLoadingCallback.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/ChunkLoadingCallback.java index ca81000a88..a6c4ba2c31 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/ChunkLoadingCallback.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/ChunkLoadingCallback.java @@ -3,10 +3,9 @@ import micdoodle8.mods.galacticraft.core.util.GCLog; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.util.math.ChunkPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.DimensionManager; @@ -111,7 +110,7 @@ public static void addToList(World world, int x, int y, int z, String playerName public static void forceChunk(Ticket ticket, World world, int x, int y, int z, String playerName) { ChunkLoadingCallback.addToList(world, x, y, z, playerName); - ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x >> 4, z >> 4); + ChunkPos chunkPos = new ChunkPos(x >> 4, z >> 4); ForgeChunkManager.forceChunk(ticket, chunkPos); // // TileEntity tile = world.getTileEntity(x, y, z); @@ -327,7 +326,7 @@ public static void onPlayerLogin(EntityPlayer player) if (ChunkLoadingCallback.loadOnLogin) { - MinecraftServer.getServer().worldServerForDimension(dimID); + player.worldObj.getMinecraftServer().worldServerForDimension(dimID); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java index b1cd05ffb9..d62f7acf2e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeDecoratorMoon.java @@ -5,12 +5,12 @@ import micdoodle8.mods.galacticraft.core.blocks.BlockBasicMoon; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import net.minecraft.block.state.IBlockState; -import net.minecraft.block.state.pattern.BlockHelper; +import net.minecraft.block.state.pattern.BlockMatcher; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.gen.feature.WorldGenerator; import net.minecraftforge.common.MinecraftForge; @@ -45,7 +45,7 @@ public void decorate(World worldIn, Random random, Biome p_180292_3_, BlockPos p { this.worldObj = worldIn; this.randomGenerator = random; - this.field_180294_c = pos; + this.chunkPos = pos; this.generateMoon(); this.worldObj = null; this.randomGenerator = null; @@ -56,14 +56,14 @@ private void genStandardOre(int amountPerChunk, WorldGenerator worldGenerator, i { for (int var5 = 0; var5 < amountPerChunk; ++var5) { - BlockPos blockpos = this.field_180294_c.add(this.randomGenerator.nextInt(16), this.randomGenerator.nextInt(maxY - minY) + minY, this.randomGenerator.nextInt(16)); + BlockPos blockpos = this.chunkPos.add(this.randomGenerator.nextInt(16), this.randomGenerator.nextInt(maxY - minY) + minY, this.randomGenerator.nextInt(16)); worldGenerator.generate(this.worldObj, this.randomGenerator, blockpos); } } private void generateMoon() { - MinecraftForge.EVENT_BUS.post(new GCCoreEventPopulate.Pre(this.worldObj, this.randomGenerator, field_180294_c)); + MinecraftForge.EVENT_BUS.post(new GCCoreEventPopulate.Pre(this.worldObj, this.randomGenerator, chunkPos)); this.genStandardOre(20, this.dirtGen, 0, 200); if (!ConfigManagerCore.disableCopperMoon) { @@ -82,16 +82,16 @@ private void generateMoon() int count = 3 + this.randomGenerator.nextInt(6); for (int i = 0; i < count; i++) { - BlockPos blockpos = this.field_180294_c.add(this.randomGenerator.nextInt(16), this.randomGenerator.nextInt(28) + 4, this.randomGenerator.nextInt(16)); + BlockPos blockpos = this.chunkPos.add(this.randomGenerator.nextInt(16), this.randomGenerator.nextInt(28) + 4, this.randomGenerator.nextInt(16)); IBlockState toReplace = worldObj.getBlockState(blockpos); - if (toReplace.getBlock() == GCBlocks.blockMoon && toReplace.getBlock().isReplaceableOreGen(worldObj, blockpos, BlockHelper.forBlock(Blocks.stone))) + if (toReplace.getBlock() == GCBlocks.blockMoon && toReplace.getBlock().isReplaceableOreGen(toReplace, worldObj, blockpos, BlockMatcher.forBlock(Blocks.STONE))) { worldObj.setBlockState(blockpos, GCBlocks.blockMoon.getDefaultState().withProperty(BlockBasicMoon.BASIC_TYPE_MOON, BlockBasicMoon.EnumBlockBasicMoon.ORE_SAPPHIRE), 2); } } } - MinecraftForge.EVENT_BUS.post(new GCCoreEventPopulate.Post(this.worldObj, this.randomGenerator, field_180294_c)); + MinecraftForge.EVENT_BUS.post(new GCCoreEventPopulate.Post(this.worldObj, this.randomGenerator, chunkPos)); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenFlatMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeFlatMoon.java similarity index 68% rename from src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenFlatMoon.java rename to src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeFlatMoon.java index f408e08b29..f5ce827281 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenFlatMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeFlatMoon.java @@ -3,13 +3,11 @@ import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import net.minecraftforge.common.BiomeDictionary; -public class BiomeGenFlatMoon extends BiomeMoon +public class BiomeFlatMoon extends BiomeMoon { - public BiomeGenFlatMoon(int par1) + public BiomeFlatMoon(BiomeProperties properties) { - super(par1); - this.setColor(11111111); - this.setHeight(new Height(1.5F, 0.4F)); + super(properties); if (!ConfigManagerCore.disableBiomeTypeRegistrations) { BiomeDictionary.registerBiomeType(this, BiomeDictionary.Type.COLD, BiomeDictionary.Type.DRY, BiomeDictionary.Type.DEAD); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenBaseMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeMoon.java similarity index 77% rename from src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenBaseMoon.java rename to src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeMoon.java index f7fbbbb67f..8347ee78a6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenBaseMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeMoon.java @@ -4,17 +4,16 @@ import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSkeleton; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSpider; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedZombie; -import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; -import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.BiomeDecorator; public class BiomeMoon extends Biome { - public static final Biome moonFlat = new BiomeGenFlatMoon(ConfigManagerCore.biomeIDbase).setBiomeName("Moon"); + public static final Biome moonFlat = new BiomeFlatMoon(new BiomeProperties("Moon").setBaseHeight(1.5F).setHeightVariation(0.4F).setRainfall(0.0F)); - BiomeMoon(int var1) + BiomeMoon(BiomeProperties properties) { - super(var1); + super(properties); this.spawnableMonsterList.clear(); this.spawnableWaterCreatureList.clear(); this.spawnableCreatureList.clear(); @@ -23,7 +22,6 @@ public class BiomeMoon extends Biome this.spawnableMonsterList.add(new SpawnListEntry(EntityEvolvedSpider.class, 8, 2, 3)); this.spawnableMonsterList.add(new SpawnListEntry(EntityEvolvedSkeleton.class, 8, 2, 3)); this.spawnableMonsterList.add(new SpawnListEntry(EntityEvolvedCreeper.class, 8, 2, 3)); - this.rainfall = 0F; } @Override @@ -32,12 +30,6 @@ public BiomeDecorator createBiomeDecorator() return getModdedBiomeDecorator(new BiomeDecoratorMoon()); } - @Override - public BiomeMoon setColor(int var1) - { - return (BiomeMoon) super.setColor(var1); - } - @Override public float getSpawningChance() { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenBaseOrbit.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeOrbit.java similarity index 67% rename from src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenBaseOrbit.java rename to src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeOrbit.java index 8d7440ad0c..6a3774c251 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeGenBaseOrbit.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/BiomeOrbit.java @@ -2,30 +2,22 @@ import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSpider; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedZombie; -import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import net.minecraft.world.biome.Biome; public class BiomeOrbit extends Biome { - public static final Biome space = new BiomeOrbit(ConfigManagerCore.biomeIDbase + 3).setBiomeName("Space"); + public static final Biome space = new BiomeOrbit(new BiomeProperties("Space").setRainfall(0.0F)); @SuppressWarnings("unchecked") - private BiomeOrbit(int var1) + private BiomeOrbit(BiomeProperties properties) { - super(var1); + super(properties); this.spawnableMonsterList.clear(); this.spawnableWaterCreatureList.clear(); this.spawnableCreatureList.clear(); this.spawnableCaveCreatureList.clear(); this.spawnableMonsterList.add(new SpawnListEntry(EntityEvolvedZombie.class, 10, 4, 4)); this.spawnableMonsterList.add(new SpawnListEntry(EntityEvolvedSpider.class, 10, 4, 4)); - this.rainfall = 0F; - } - - @Override - public BiomeOrbit setColor(int var1) - { - return (BiomeOrbit) super.setColor(var1); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java index 41df5d04bc..70535f230e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java @@ -166,21 +166,19 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime if (xfactorSq + zfactorSq < 1.0D) { - final int coords = (localX * 16 + localZ) * 256 + localY; - if (yfactor > -0.7D && xfactorSq + yfactorSq + zfactorSq < 1.0D) { - IBlockState state = primer.getBlockState(coords); + IBlockState state = primer.getBlockState(localX, localY, localZ); if (state.getBlock() == GCBlocks.blockMoon) { if (state.getBlock().getMetaFromState(state) == 3 || state.getBlock().getMetaFromState(state) == 4) { - primer.setBlockState(coords, Blocks.AIR.getDefaultState()); + primer.setBlockState(localX, localY, localZ, Blocks.AIR.getDefaultState()); // blockIdArray[coords] = Blocks.AIR; } else if (state.getBlock().getMetaFromState(state) == 5) { - primer.setBlockState(coords, Blocks.AIR.getDefaultState()); + primer.setBlockState(localX, localY, localZ, Blocks.AIR.getDefaultState()); // blockIdArray[coords] = Blocks.AIR; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java index 4c1c82c351..f1d1b44e18 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java @@ -2,11 +2,13 @@ import micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider; import net.minecraft.block.Block; -import net.minecraft.block.state.pattern.BlockHelper; +import net.minecraft.block.state.IBlockState; +import net.minecraft.block.state.pattern.BlockMatcher; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; import net.minecraftforge.fml.common.IWorldGenerator; @@ -32,7 +34,7 @@ public OverworldGenerator(Block oreBlock, int metadata, int amountPerChunk, int } @Override - public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) + public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) { if (!(world.provider instanceof IGalacticraftWorldProvider)) { @@ -87,8 +89,9 @@ private boolean generateOre(World par1World, Random par2Random, int par3, int pa { double var45 = (var44 + 0.5D - var24) / (var28 / 2.0D); - Block block = par1World.getBlockState(new BlockPos(var38, var41, var44)).getBlock(); - if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && block.isReplaceableOreGen(par1World, new BlockPos(var38, var41, var44), BlockHelper.forBlock(Blocks.stone))) + BlockPos pos = new BlockPos(var38, var41, var44); + IBlockState state = par1World.getBlockState(pos); + if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && state.getBlock().isReplaceableOreGen(state, par1World, pos, BlockMatcher.forBlock(Blocks.STONE))) { par1World.setBlockState(new BlockPos(var38, var41, var44), this.oreBlock.getStateFromMeta(this.metadata), 2); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentGC.java index ffe2ce8e41..e6f0b87960 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentGC.java @@ -43,9 +43,9 @@ protected void placeSpawnerAtCurrentPosition(World var1, Random var2, int var3, final int var10 = this.getZWithOffset(var3, var5); BlockPos pos = new BlockPos(var8, var9, var10); - if (var7.isVecInside(pos) && var1.getBlockState(pos).getBlock() != Blocks.mob_spawner) + if (var7.isVecInside(pos) && var1.getBlockState(pos).getBlock() != Blocks.MOB_SPAWNER) { - var1.setBlockState(pos, Blocks.mob_spawner.getDefaultState(), 2); + var1.setBlockState(pos, Blocks.MOB_SPAWNER.getDefaultState(), 2); final TileEntityMobSpawner var11 = (TileEntityMobSpawner) var1.getTileEntity(pos); if (var11 != null) @@ -65,20 +65,20 @@ protected int[] offsetTowerCoords(int var1, int var2, int var3, int var4, int va public int[] getOffsetAsIfRotated(int[] var1, EnumFacing var2) { - final EnumFacing var3 = coordBaseMode; + final EnumFacing var3 = getCoordBaseMode(); final int[] var4 = new int[3]; - this.coordBaseMode = var2; + this.setCoordBaseMode(var2); var4[0] = this.getXWithOffset(var1[0], var1[2]); var4[1] = this.getYWithOffset(var1[1]); var4[2] = this.getZWithOffset(var1[0], var1[2]); - this.coordBaseMode = var3; + this.setCoordBaseMode(var3); return var4; } @Override protected int getXWithOffset(int var1, int var2) { - switch (coordBaseMode.getHorizontalIndex()) + switch (getCoordBaseMode().getHorizontalIndex()) { case 0: return this.boundingBox.minX + var1; @@ -100,7 +100,7 @@ protected int getXWithOffset(int var1, int var2) @Override protected int getZWithOffset(int var1, int var2) { - switch (coordBaseMode.getHorizontalIndex()) + switch (getCoordBaseMode().getHorizontalIndex()) { case 0: return this.boundingBox.minZ + var2; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java index 9bbf193b20..f9d467a33b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentMoon.java @@ -50,9 +50,9 @@ protected TileEntityMobSpawner placeSpawnerAtCurrentPosition(World var1, Random final int var10 = this.getYWithOffset(var4); final int var11 = this.getZWithOffset(var3, var5); - if (var7.isVecInside(new BlockPos(var9, var10, var11)) && var1.getBlockState(new BlockPos(var9, var10, var11)).getBlock() != Blocks.mob_spawner) + if (var7.isVecInside(new BlockPos(var9, var10, var11)) && var1.getBlockState(new BlockPos(var9, var10, var11)).getBlock() != Blocks.MOB_SPAWNER) { - var1.setBlockState(new BlockPos(var9, var10, var11), Blocks.mob_spawner.getDefaultState(), 2); + var1.setBlockState(new BlockPos(var9, var10, var11), Blocks.MOB_SPAWNER.getDefaultState(), 2); var8 = (TileEntityMobSpawner) var1.getTileEntity(new BlockPos(var9, var10, var11)); if (var8 != null) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java index 8c6fc2b6b1..d2b86bc11a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java @@ -90,17 +90,17 @@ protected int getAverageGroundLevel(World world, StructureBoundingBox boundingBo { int i = 0; int j = 0; - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); for (int k = this.boundingBox.minZ; k <= this.boundingBox.maxZ; ++k) { for (int l = this.boundingBox.minX; l <= this.boundingBox.maxX; ++l) { - blockpos$mutableblockpos.set(l, 64, k); + mutableBlockPos.setPos(l, 64, k); - if (boundingBox.isVecInside(blockpos$mutableblockpos)) + if (boundingBox.isVecInside(mutableBlockPos)) { - i += world.getTopSolidOrLiquidBlock(blockpos$mutableblockpos).getY(); + i += world.getTopSolidOrLiquidBlock(mutableBlockPos).getY(); ++j; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField.java index bdcf70bb1d..ce02078090 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField.java @@ -22,7 +22,7 @@ public StructureComponentVillageField() public StructureComponentVillageField(StructureComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, EnumFacing par5) { super(par1ComponentVillageStartPiece, par2); - this.coordBaseMode = par5; + this.setCoordBaseMode(par5); this.boundingBox = par4StructureBoundingBox; } @@ -65,17 +65,17 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo } this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 12, 4, 8, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 2, 0, 7, Blocks.dirt.getDefaultState(), Blocks.dirt.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 1, 5, 0, 7, Blocks.dirt.getDefaultState(), Blocks.dirt.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 0, 1, 8, 0, 7, Blocks.dirt.getDefaultState(), Blocks.dirt.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 10, 0, 1, 11, 0, 7, Blocks.dirt.getDefaultState(), Blocks.dirt.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 0, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 0, 0, 6, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 0, 0, 12, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 0, 11, 0, 0, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 8, 11, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 0, 1, 3, 0, 7, Blocks.flowing_water.getDefaultState(), Blocks.flowing_water.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 0, 1, 9, 0, 7, Blocks.flowing_water.getDefaultState(), Blocks.flowing_water.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 2, 0, 7, Blocks.DIRT.getDefaultState(), Blocks.DIRT.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 1, 5, 0, 7, Blocks.DIRT.getDefaultState(), Blocks.DIRT.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 0, 1, 8, 0, 7, Blocks.DIRT.getDefaultState(), Blocks.DIRT.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 10, 0, 1, 11, 0, 7, Blocks.DIRT.getDefaultState(), Blocks.DIRT.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 0, 0, 8, Blocks.LOG.getDefaultState(), Blocks.LOG.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 0, 0, 6, 0, 8, Blocks.LOG.getDefaultState(), Blocks.LOG.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 0, 0, 12, 0, 8, Blocks.LOG.getDefaultState(), Blocks.LOG.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 0, 11, 0, 0, Blocks.LOG.getDefaultState(), Blocks.LOG.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 8, 11, 0, 8, Blocks.LOG.getDefaultState(), Blocks.LOG.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 0, 1, 3, 0, 7, Blocks.FLOWING_WATER.getDefaultState(), Blocks.FLOWING_WATER.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 0, 1, 9, 0, 7, Blocks.FLOWING_WATER.getDefaultState(), Blocks.FLOWING_WATER.getDefaultState(), false); int var4; for (var4 = 1; var4 <= 7; ++var4) @@ -86,7 +86,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo { if (par2Random.nextInt(3) == 0) { - this.setBlockState(par1World, Blocks.sapling.getStateFromMeta(MathHelper.getRandomIntegerInRange(par2Random, 0, 2)), i, 1, var4, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.SAPLING.getStateFromMeta(MathHelper.getRandomIntegerInRange(par2Random, 0, 2)), i, 1, var4, par3StructureBoundingBox); } } } @@ -97,7 +97,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo for (int var5 = 0; var5 < 13; ++var5) { this.clearCurrentPositionBlocksUpwards(par1World, var5, 4, var4, par3StructureBoundingBox); - this.replaceAirAndLiquidDownwards(par1World, Blocks.dirt.getDefaultState(), var5, -1, var4, par3StructureBoundingBox); + this.replaceAirAndLiquidDownwards(par1World, Blocks.DIRT.getDefaultState(), var5, -1, var4, par3StructureBoundingBox); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField2.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField2.java index c91974d3cf..af49092d7f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField2.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageField2.java @@ -28,7 +28,7 @@ public StructureComponentVillageField2() public StructureComponentVillageField2(StructureComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, EnumFacing par5) { super(par1ComponentVillageStartPiece, par2); - this.coordBaseMode = par5; + this.setCoordBaseMode(par5); this.boundingBox = par4StructureBoundingBox; this.cropTypeA = this.getRandomCrop(par3Random); this.cropTypeB = this.getRandomCrop(par3Random); @@ -65,11 +65,11 @@ private Block getRandomCrop(Random par1Random) switch (par1Random.nextInt(5)) { case 0: - return Blocks.carrots; + return Blocks.CARROTS; case 1: - return Blocks.potatoes; + return Blocks.POTATOES; default: - return Blocks.wheat; + return Blocks.WHEAT; } } @@ -100,17 +100,17 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo } this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 1, 0, 12, 4, 8, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 2, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 1, 5, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 0, 1, 8, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 10, 0, 1, 11, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 0, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 0, 0, 6, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 0, 0, 12, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 0, 11, 0, 0, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 8, 11, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 0, 1, 3, 0, 7, Blocks.flowing_water.getDefaultState(), Blocks.flowing_water.getDefaultState(), false); - this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 0, 1, 9, 0, 7, Blocks.flowing_water.getDefaultState(), Blocks.flowing_water.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 2, 0, 7, Blocks.FARMLAND.getDefaultState(), Blocks.FARMLAND.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 4, 0, 1, 5, 0, 7, Blocks.FARMLAND.getDefaultState(), Blocks.FARMLAND.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 7, 0, 1, 8, 0, 7, Blocks.FARMLAND.getDefaultState(), Blocks.FARMLAND.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 10, 0, 1, 11, 0, 7, Blocks.FARMLAND.getDefaultState(), Blocks.FARMLAND.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 0, 0, 8, Blocks.LOG.getDefaultState(), Blocks.LOG.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 6, 0, 0, 6, 0, 8, Blocks.LOG.getDefaultState(), Blocks.LOG.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 12, 0, 0, 12, 0, 8, Blocks.LOG.getDefaultState(), Blocks.LOG.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 0, 11, 0, 0, Blocks.LOG.getDefaultState(), Blocks.LOG.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 8, 11, 0, 8, Blocks.LOG.getDefaultState(), Blocks.LOG.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 3, 0, 1, 3, 0, 7, Blocks.FLOWING_WATER.getDefaultState(), Blocks.FLOWING_WATER.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 9, 0, 1, 9, 0, 7, Blocks.FLOWING_WATER.getDefaultState(), Blocks.FLOWING_WATER.getDefaultState(), false); int i; for (i = 1; i <= 7; ++i) @@ -130,7 +130,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo for (int j = 0; j < 13; ++j) { this.clearCurrentPositionBlocksUpwards(par1World, j, 4, i, par3StructureBoundingBox); - this.replaceAirAndLiquidDownwards(par1World, Blocks.dirt.getDefaultState(), j, -1, i, par3StructureBoundingBox); + this.replaceAirAndLiquidDownwards(par1World, Blocks.DIRT.getDefaultState(), j, -1, i, par3StructureBoundingBox); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java index 3a3f9acc1f..b34bb5f8fc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageHouse.java @@ -23,7 +23,7 @@ public StructureComponentVillageHouse() public StructureComponentVillageHouse(StructureComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, EnumFacing par5) { super(par1ComponentVillageStartPiece, par2); - this.coordBaseMode = par5; + this.setCoordBaseMode(par5); this.boundingBox = par4StructureBoundingBox; } @@ -449,7 +449,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo { if (i >= 7 && i <= 9 && j >= 7 && j <= 9) { - this.setBlockState(par1World, Blocks.glass.getDefaultState(), i, yLevel, j, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.GLASS.getDefaultState(), i, yLevel, j, par3StructureBoundingBox); } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java index 399694d859..8cc2d3e49b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillagePathGen.java @@ -26,7 +26,7 @@ public StructureComponentVillagePathGen() public StructureComponentVillagePathGen(StructureComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, EnumFacing par5) { super(par1ComponentVillageStartPiece, par2); - this.coordBaseMode = par5; + this.setCoordBaseMode(par5); this.boundingBox = par4StructureBoundingBox; this.averageGroundLevel = Math.max(par4StructureBoundingBox.getXSize(), par4StructureBoundingBox.getZSize()); } @@ -137,7 +137,7 @@ public static StructureBoundingBox func_74933_a(StructureComponentVillageStartPi @Override public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { - final Block var4 = Blocks.planks; + final Block var4 = Blocks.PLANKS; for (int var5 = this.boundingBox.minX; var5 <= this.boundingBox.maxX; ++var5) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageStartPiece.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageStartPiece.java index 8265e2932b..2893ff9e43 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageStartPiece.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageStartPiece.java @@ -1,14 +1,14 @@ package micdoodle8.mods.galacticraft.core.world.gen; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.biome.BiomeProvider; import java.util.ArrayList; import java.util.Random; public class StructureComponentVillageStartPiece extends StructureComponentVillageWell { - public WorldChunkManager worldChunkMngr; + public BiomeProvider biomeProvider; public int terrainType; public StructureVillagePieceWeightMoon structVillagePieceWeight; public ArrayList structureVillageWeightedPieceList; @@ -19,10 +19,10 @@ public StructureComponentVillageStartPiece() { } - public StructureComponentVillageStartPiece(WorldChunkManager par1WorldChunkManager, int par2, Random par3Random, int par4, int par5, ArrayList par6ArrayList, int par7) + public StructureComponentVillageStartPiece(BiomeProvider biomeProvider, int par2, Random par3Random, int par4, int par5, ArrayList par6ArrayList, int par7) { - super((StructureComponentVillageStartPiece) null, 0, par3Random, par4, par5); - this.worldChunkMngr = par1WorldChunkManager; + super(null, 0, par3Random, par4, par5); + this.biomeProvider = biomeProvider; this.structureVillageWeightedPieceList = par6ArrayList; this.terrainType = par7; this.startPiece = this; @@ -44,8 +44,8 @@ protected void readStructureFromNBT(NBTTagCompound nbt) this.terrainType = nbt.getInteger("TerrainType"); } - public WorldChunkManager getWorldChunkManager() + public BiomeProvider getBiomeProvider() { - return this.worldChunkMngr; + return this.biomeProvider; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java index ea5ccc8cfa..0a6689d257 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageTorch.java @@ -23,7 +23,7 @@ public StructureComponentVillageTorch() public StructureComponentVillageTorch(StructureComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, EnumFacing par5) { super(par1ComponentVillageStartPiece, par2); - this.coordBaseMode = par5; + this.setCoordBaseMode(par5); this.boundingBox = par4StructureBoundingBox; } @@ -70,10 +70,10 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo } this.fillWithBlocks(par1World, par3StructureBoundingBox, 0, 0, 0, 2, 3, 1, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); - this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 0, 0, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 1, 0, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 2, 0, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.wool.getStateFromMeta(15), 1, 3, 0, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.DARK_OAK_FENCE.getDefaultState(), 1, 0, 0, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.DARK_OAK_FENCE.getDefaultState(), 1, 1, 0, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.DARK_OAK_FENCE.getDefaultState(), 1, 2, 0, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.WOOL.getStateFromMeta(15), 1, 3, 0, par3StructureBoundingBox); boolean flag = this.getCoordBaseMode() == EnumFacing.EAST || this.getCoordBaseMode() == EnumFacing.NORTH; this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.getCoordBaseMode().rotateY()), flag ? 2 : 0, 3, 0, par3StructureBoundingBox); this.setBlockState(par1World, GCBlocks.glowstoneTorch.getDefaultState().withProperty(BlockGlowstoneTorch.FACING, this.getCoordBaseMode()), 1, 3, 1, par3StructureBoundingBox); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java index a0e495ac61..dc162b26f5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWell.java @@ -23,7 +23,7 @@ public StructureComponentVillageWell() public StructureComponentVillageWell(StructureComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, int par4, int par5) { super(par1ComponentVillageStartPiece, par2); - this.getCoordBaseMode() = EnumFacing.getFront(par3Random.nextInt(4)); + this.setCoordBaseMode(EnumFacing.getFront(par3Random.nextInt(4))); switch (this.getCoordBaseMode().getHorizontalIndex()) { @@ -77,19 +77,19 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 3, 0); } - this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 4, 12, 4, GCBlocks.basicBlock.getStateFromMeta(4), Blocks.flowing_water.getDefaultState(), false); + this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 0, 1, 4, 12, 4, GCBlocks.basicBlock.getStateFromMeta(4), Blocks.FLOWING_WATER.getDefaultState(), false); this.setBlockState(par1World, Blocks.AIR.getDefaultState(), 2, 12, 2, par3StructureBoundingBox); this.setBlockState(par1World, Blocks.AIR.getDefaultState(), 3, 12, 2, par3StructureBoundingBox); this.setBlockState(par1World, Blocks.AIR.getDefaultState(), 2, 12, 3, par3StructureBoundingBox); this.setBlockState(par1World, Blocks.AIR.getDefaultState(), 3, 12, 3, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 13, 1, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 14, 1, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 4, 13, 1, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 4, 14, 1, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 13, 4, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 1, 14, 4, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 4, 13, 4, par3StructureBoundingBox); - this.setBlockState(par1World, Blocks.dark_oak_fence.getDefaultState(), 4, 14, 4, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.DARK_OAK_FENCE.getDefaultState(), 1, 13, 1, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.DARK_OAK_FENCE.getDefaultState(), 1, 14, 1, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.DARK_OAK_FENCE.getDefaultState(), 4, 13, 1, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.DARK_OAK_FENCE.getDefaultState(), 4, 14, 1, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.DARK_OAK_FENCE.getDefaultState(), 1, 13, 4, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.DARK_OAK_FENCE.getDefaultState(), 1, 14, 4, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.DARK_OAK_FENCE.getDefaultState(), 4, 13, 4, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.DARK_OAK_FENCE.getDefaultState(), 4, 14, 4, par3StructureBoundingBox); this.fillWithBlocks(par1World, par3StructureBoundingBox, 1, 15, 1, 4, 15, 4, GCBlocks.basicBlock.getStateFromMeta(4), GCBlocks.basicBlock.getStateFromMeta(4), false); for (int var4 = 0; var4 <= 5; ++var4) @@ -98,7 +98,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo { if (var5 == 0 || var5 == 5 || var4 == 0 || var4 == 5) { - this.setBlockState(par1World, Blocks.planks.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.SPRUCE), var5, 11, var4, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.PLANKS.getDefaultState().withProperty(BlockPlanks.VARIANT, BlockPlanks.EnumType.SPRUCE), var5, 11, var4, par3StructureBoundingBox); this.clearCurrentPositionBlocksUpwards(par1World, var5, 12, var4, par3StructureBoundingBox); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java index b126a68fce..2eda2b8e42 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillageWoodHut.java @@ -23,7 +23,7 @@ public StructureComponentVillageWoodHut() public StructureComponentVillageWoodHut(StructureComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, EnumFacing par5) { super(par1ComponentVillageStartPiece, par2); - this.coordBaseMode = par5; + this.setCoordBaseMode(par5); this.boundingBox = par4StructureBoundingBox; } @@ -448,7 +448,7 @@ public boolean addComponentParts(World par1World, Random par2Random, StructureBo { if (i >= 7 && i <= 9 && j >= 7 && j <= 9) { - this.setBlockState(par1World, Blocks.glass.getDefaultState(), i, yLevel, j, par3StructureBoundingBox); + this.setBlockState(par1World, Blocks.GLASS.getDefaultState(), i, yLevel, j, par3StructureBoundingBox); } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureVillageStartMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureVillageStartMoon.java index 8b08735b3b..90aa481966 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureVillageStartMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureVillageStartMoon.java @@ -20,7 +20,7 @@ public StructureVillageStartMoon(World par1World, Random par2Random, int par3, i super(par3, par4); final ArrayList var6 = StructureVillagePiecesMoon.getStructureVillageWeightedPieceList(par2Random, par5); - final StructureComponentVillageStartPiece var7 = new StructureComponentVillageStartPiece(par1World.getWorldChunkManager(), 0, par2Random, (par3 << 4) + 2, (par4 << 4) + 2, var6, par5); + final StructureComponentVillageStartPiece var7 = new StructureComponentVillageStartPiece(par1World.getBiomeProvider(), 0, par2Random, (par3 << 4) + 2, (par4 << 4) + 2, var6, par5); this.components.add(var7); var7.buildComponent(var7, this.components, par2Random); final ArrayList var8 = var7.field_74930_j; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java index d00d5b6c06..998b7a82ee 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java @@ -2,7 +2,7 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.block.state.pattern.BlockHelper; +import net.minecraft.block.state.pattern.BlockMatcher; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; @@ -26,7 +26,7 @@ public class WorldGenMinableMeta extends WorldGenMinable public WorldGenMinableMeta(Block placeBlock, int blockCount, int placeMeta, boolean metaActive, Block replaceBlock, int replaceMeta) { - super(placeBlock.getStateFromMeta(placeMeta), blockCount, BlockHelper.forBlock(replaceBlock)); + super(placeBlock.getStateFromMeta(placeMeta), blockCount, BlockMatcher.forBlock(replaceBlock)); this.minableBlockId = placeBlock; this.numberOfBlocks = blockCount; this.metadata = placeMeta; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenSpaceStation.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenSpaceStation.java index a4f7098da9..e72b0800f3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenSpaceStation.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenSpaceStation.java @@ -135,8 +135,8 @@ public boolean generate(World world, Random rand, BlockPos pos) world.setBlockState(pos.add(8, 1, 6), GCBlocks.basicBlock.getStateFromMeta(4), 2); world.setBlockState(pos.add(8, 2, 0), GCBlocks.basicBlock.getStateFromMeta(4), 2); world.setBlockState(pos.add(8, 2, 6), GCBlocks.basicBlock.getStateFromMeta(4), 2); - world.setBlockState(pos.add(8, 3, 0), Blocks.glass_pane.getDefaultState(), 3); - world.setBlockState(pos.add(8, 3, 6), Blocks.glass_pane.getDefaultState(), 3); + world.setBlockState(pos.add(8, 3, 0), Blocks.GLASS_PANE.getDefaultState(), 3); + world.setBlockState(pos.add(8, 3, 6), Blocks.GLASS_PANE.getDefaultState(), 3); world.setBlockState(pos.add(8, 4, 0), GCBlocks.basicBlock.getStateFromMeta(4), 2); world.setBlockState(pos.add(8, 4, 6), GCBlocks.basicBlock.getStateFromMeta(4), 2); world.setBlockState(pos.add(8, 5, 0), GCBlocks.basicBlock.getStateFromMeta(4), 2); @@ -208,8 +208,8 @@ public boolean generate(World world, Random rand, BlockPos pos) world.setBlockState(pos.add(12, 1, 6), GCBlocks.basicBlock.getStateFromMeta(4), 2); world.setBlockState(pos.add(12, 2, 0), GCBlocks.basicBlock.getStateFromMeta(4), 2); world.setBlockState(pos.add(12, 2, 6), GCBlocks.basicBlock.getStateFromMeta(4), 2); - world.setBlockState(pos.add(12, 3, 0), Blocks.glass_pane.getDefaultState(), 3); - world.setBlockState(pos.add(12, 3, 6), Blocks.glass_pane.getDefaultState(), 3); + world.setBlockState(pos.add(12, 3, 0), Blocks.GLASS_PANE.getDefaultState(), 3); + world.setBlockState(pos.add(12, 3, 6), Blocks.GLASS_PANE.getDefaultState(), 3); world.setBlockState(pos.add(12, 4, 0), GCBlocks.basicBlock.getStateFromMeta(4), 2); world.setBlockState(pos.add(12, 4, 6), GCBlocks.basicBlock.getStateFromMeta(4), 2); world.setBlockState(pos.add(12, 5, 0), GCBlocks.basicBlock.getStateFromMeta(4), 2); @@ -233,8 +233,8 @@ public boolean generate(World world, Random rand, BlockPos pos) world.setBlockState(pos.add(13, 2, 5), GCBlocks.basicBlock.getStateFromMeta(4), 2); world.setBlockState(pos.add(13, 2, 6), GCBlocks.basicBlock.getStateFromMeta(4), 2); world.setBlockState(pos.add(13, 3, 0), GCBlocks.basicBlock.getStateFromMeta(4), 2); - world.setBlockState(pos.add(13, 3, 1), Blocks.glass_pane.getDefaultState(), 3); - world.setBlockState(pos.add(13, 3, 5), Blocks.glass_pane.getDefaultState(), 3); + world.setBlockState(pos.add(13, 3, 1), Blocks.GLASS_PANE.getDefaultState(), 3); + world.setBlockState(pos.add(13, 3, 5), Blocks.GLASS_PANE.getDefaultState(), 3); world.setBlockState(pos.add(13, 3, 6), GCBlocks.basicBlock.getStateFromMeta(4), 2); world.setBlockState(pos.add(13, 4, 0), GCBlocks.basicBlock.getStateFromMeta(4), 2); world.setBlockState(pos.add(13, 4, 1), GCBlocks.basicBlock.getStateFromMeta(4), 2); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/Corridor.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/Corridor.java index c70e29afbd..d75e5aeb92 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/Corridor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/Corridor.java @@ -19,7 +19,7 @@ public Corridor() public Corridor(DungeonConfiguration configuration, Random rand, int blockPosX, int blockPosZ, int sizeX, int sizeY, int sizeZ, EnumFacing direction) { super(configuration, sizeX, sizeY, sizeZ, direction); - this.coordBaseMode = EnumFacing.SOUTH; + this.setCoordBaseMode(EnumFacing.SOUTH); this.boundingBox = new StructureBoundingBox(blockPosX, configuration.getYPosition(), blockPosZ, blockPosX + sizeX, configuration.getYPosition() + sizeY, blockPosZ + sizeZ); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/DungeonConfiguration.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/DungeonConfiguration.java index 6a1aa5c4eb..17750b4c83 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/DungeonConfiguration.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/DungeonConfiguration.java @@ -42,6 +42,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) tagCompound.setInteger("roomHeight", this.roomHeight); tagCompound.setString("bossRoom", this.bossRoom.getName()); tagCompound.setString("treasureRoom", this.treasureRoom.getName()); + return tagCompound; } public void readFromNBT(NBTTagCompound tagCompound) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomBoss.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomBoss.java index 0a1257151f..2fef642867 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomBoss.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomBoss.java @@ -29,7 +29,7 @@ public RoomBoss(DungeonConfiguration configuration, Random rand, int blockPosX, public RoomBoss(DungeonConfiguration configuration, Random rand, int blockPosX, int blockPosZ, int sizeX, int sizeY, int sizeZ, EnumFacing entranceDir) { super(configuration, sizeX, sizeY, sizeZ, entranceDir.getOpposite()); - this.coordBaseMode = EnumFacing.SOUTH; + this.setCoordBaseMode(EnumFacing.SOUTH); this.sizeX = sizeX; this.sizeZ = sizeZ; this.sizeY = sizeY; @@ -93,12 +93,12 @@ else if (getDirection() == EnumFacing.WEST && i == this.sizeX) } else if ((i == 1 && k == 1) || (i == 1 && k == this.sizeZ - 1) || (i == this.sizeX - 1 && k == 1) || (i == this.sizeX - 1 && k == this.sizeZ - 1)) { - this.setBlockState(worldIn, Blocks.flowing_lava.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.FLOWING_LAVA.getDefaultState(), i, j, k, boundingBox); } else if (j % 3 == 0 && j >= 2 && ((i == 1 || i == this.sizeX - 1 || k == 1 || k == this.sizeZ - 1) || (i == 2 && k == 2) || (i == 2 && k == this.sizeZ - 2) || (i == this.sizeX - 2 && k == 2) || (i == this.sizeX - 2 && k == this.sizeZ - 2))) { // Horizontal bars - this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.IRON_BARS.getDefaultState(), i, j, k, boundingBox); } else if ((i == 1 && k == 2) || (i == 2 && k == 1) || (i == 1 && k == this.sizeZ - 2) || (i == 2 && k == this.sizeZ - 1) || @@ -106,7 +106,7 @@ else if ((i == 1 && k == 2) || (i == 2 && k == 1) || (i == this.sizeX - 1 && k == this.sizeZ - 2) || (i == this.sizeX - 2 && k == this.sizeZ - 1)) { // Vertical bars - this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.IRON_BARS.getDefaultState(), i, j, k, boundingBox); } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java index 41b63d6f89..eae39585b8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java @@ -4,12 +4,11 @@ import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; -import net.minecraftforge.common.ChestGenHooks; +import net.minecraft.world.storage.loot.LootTableList; import java.util.Random; @@ -32,22 +31,14 @@ public boolean addComponentParts(World worldIn, Random rand, StructureBoundingBo int chestX = this.sizeX / 2; int chestY = 1; int chestZ = this.sizeZ / 2; - this.setBlockState(worldIn, Blocks.chest.getDefaultState().withProperty(BlockT1TreasureChest.FACING, this.getDirection().getOpposite()), chestX, chestY, chestZ, boundingBox); + this.setBlockState(worldIn, Blocks.CHEST.getDefaultState().withProperty(BlockT1TreasureChest.FACING, this.getDirection().getOpposite()), chestX, chestY, chestZ, boundingBox); BlockPos blockpos = new BlockPos(this.getXWithOffset(chestX, chestZ), this.getYWithOffset(chestY), this.getZWithOffset(chestX, chestZ)); TileEntityChest chest = (TileEntityChest) worldIn.getTileEntity(blockpos); if (chest != null) { - for (int i = 0; i < chest.getSizeInventory(); ++i) - { - // Clear contents - chest.setInventorySlotContents(i, null); - } - - ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); - - WeightedRandomChestContent.generateChestContents(rand, info.getItems(rand), chest, info.getCount(rand)); + chest.setLootTable(LootTableList.CHESTS_SIMPLE_DUNGEON, rand.nextLong()); } return true; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEmpty.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEmpty.java index 05e02c57d6..ead1492eb5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEmpty.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEmpty.java @@ -16,7 +16,7 @@ public RoomEmpty() public RoomEmpty(DungeonConfiguration configuration, Random rand, int blockPosX, int blockPosZ, int sizeX, int sizeY, int sizeZ, EnumFacing entranceDir) { super(configuration, sizeX, sizeY, sizeZ, entranceDir.getOpposite()); - this.coordBaseMode = EnumFacing.SOUTH; + this.setCoordBaseMode(EnumFacing.SOUTH); this.sizeX = sizeX; this.sizeY = sizeY; this.sizeZ = sizeZ; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEntrance.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEntrance.java index 94d06f3fb7..944cf813cd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEntrance.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomEntrance.java @@ -20,7 +20,7 @@ public RoomEntrance() public RoomEntrance(World world, DungeonConfiguration configuration, Random rand, int blockPosX, int blockPosZ) { super(configuration, rand.nextInt(4) + 6, rand.nextInt(2) + 5, rand.nextInt(4) + 6, EnumFacing.Plane.HORIZONTAL.random(rand)); - this.coordBaseMode = EnumFacing.SOUTH; + this.setCoordBaseMode(EnumFacing.SOUTH); this.boundingBox = new StructureBoundingBox(blockPosX - range, configuration.getYPosition(), blockPosZ - range, blockPosX + range, 150, blockPosZ + range); System.out.println("Generating dungeon at " + blockPosX + " " + configuration.getYPosition() + " " + blockPosZ); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java index dc8b350e04..1924b4c330 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java @@ -34,14 +34,14 @@ public boolean addComponentParts(World worldIn, Random random, StructureBounding { if (random.nextFloat() < 0.05F) { - this.setBlockState(worldIn, Blocks.web.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.WEB.getDefaultState(), i, j, k, boundingBox); } } } } - this.setBlockState(worldIn, Blocks.mob_spawner.getDefaultState(), 1, 0, 1, boundingBox); - this.setBlockState(worldIn, Blocks.mob_spawner.getDefaultState(), this.sizeX - 1, 0, this.sizeZ - 1, boundingBox); + this.setBlockState(worldIn, Blocks.MOB_SPAWNER.getDefaultState(), 1, 0, 1, boundingBox); + this.setBlockState(worldIn, Blocks.MOB_SPAWNER.getDefaultState(), this.sizeX - 1, 0, this.sizeZ - 1, boundingBox); BlockPos blockpos = new BlockPos(this.getXWithOffset(1, 1), this.getYWithOffset(0), this.getZWithOffset(1, 1)); TileEntityMobSpawner spawner = (TileEntityMobSpawner) worldIn.getTileEntity(blockpos); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddMushroomIsland.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddMushroomIsland.java index bd0ef1c86f..9c3509ba4a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddMushroomIsland.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddMushroomIsland.java @@ -1,5 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; +import net.minecraft.init.Biomes; import net.minecraft.world.biome.Biome; public class GenLayerAddMushroomIsland extends GenLayerGCMap @@ -36,7 +37,7 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) if (k2 == 0 && k1 == 0 && l1 == 0 && i2 == 0 && j2 == 0 && this.nextInt(100) == 0) { - aint1[j1 + i1 * areaWidth] = Biome.mushroomIsland.biomeID; + aint1[j1 + i1 * areaWidth] = Biome.getIdForBiome(Biomes.MUSHROOM_ISLAND); } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiome.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiome.java index f0940eb52b..e56ffdd460 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiome.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiome.java @@ -1,5 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; +import net.minecraft.init.Biomes; import net.minecraft.world.WorldType; import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.ChunkProviderSettings; @@ -27,24 +28,24 @@ public GenLayerBiome(long p_i45560_1_, GenLayerGCMap p_i45560_3_, WorldType p_i4 int desertIdx = net.minecraftforge.common.BiomeManager.BiomeType.DESERT.ordinal(); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.desert, 30)); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.savanna, 20)); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.plains, 10)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.DESERT, 30)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.SAVANNA, 20)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.PLAINS, 10)); if (p_i45560_4_ == WorldType.DEFAULT_1_1) { biomes[desertIdx].clear(); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.desert, 10)); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.forest, 10)); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.extremeHills, 10)); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.swampland, 10)); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.plains, 10)); - biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biome.taiga, 10)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.DESERT, 10)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.FOREST, 10)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.EXTREME_HILLS, 10)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.SWAMPLAND, 10)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.PLAINS, 10)); + biomes[desertIdx].add(new net.minecraftforge.common.BiomeManager.BiomeEntry(Biomes.TAIGA, 10)); this.field_175973_g = null; } else if (p_i45560_4_ == WorldType.CUSTOMIZED) { - this.field_175973_g = ChunkProviderSettings.Factory.jsonToFactory(p_i45560_5_).func_177864_b(); + this.field_175973_g = ChunkProviderSettings.Factory.jsonToFactory(p_i45560_5_).build(); } else { @@ -78,7 +79,7 @@ else if (isBiomeOceanic(k)) { aint1[j + i * areaWidth] = k; } - else if (k == Biome.mushroomIsland.biomeID) + else if (k == Biome.getIdForBiome(Biomes.MUSHROOM_ISLAND)) { aint1[j + i * areaWidth] = k; } @@ -88,47 +89,47 @@ else if (k == 1) { if (this.nextInt(3) == 0) { - aint1[j + i * areaWidth] = Biome.mesaPlateau.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(Biomes.MESA_CLEAR_ROCK); } else { - aint1[j + i * areaWidth] = Biome.mesaPlateau_F.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(Biomes.MESA_ROCK); } } else { - aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.DESERT).biome); } } else if (k == 2) { if (l > 0) { - aint1[j + i * areaWidth] = Biome.jungle.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(Biomes.JUNGLE); } else { - aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM).biome.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.WARM).biome); } } else if (k == 3) { if (l > 0) { - aint1[j + i * areaWidth] = Biome.megaTaiga.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(Biomes.REDWOOD_TAIGA); } else { - aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL).biome.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.COOL).biome); } } else if (k == 4) { - aint1[j + i * areaWidth] = getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY).biome.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(getWeightedBiomeEntry(net.minecraftforge.common.BiomeManager.BiomeType.ICY).biome); } else { - aint1[j + i * areaWidth] = Biome.mushroomIsland.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(Biomes.MUSHROOM_ISLAND); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiomeEdge.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiomeEdge.java index 80c7266a3e..d2c758481f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiomeEdge.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiomeEdge.java @@ -1,5 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; +import net.minecraft.init.Biomes; import net.minecraft.world.biome.Biome; public class GenLayerBiomeEdge extends GenLayerGCMap @@ -26,45 +27,45 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) this.initChunkSeed((long)(j + areaX), (long)(i + areaY)); int k = aint[j + 1 + (i + 1) * (areaWidth + 2)]; - if (!this.replaceBiomeEdgeIfNecessary(aint, aint1, j, i, areaWidth, k, Biome.extremeHills.biomeID, Biome.extremeHillsEdge.biomeID) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, Biome.mesaPlateau_F.biomeID, Biome.mesa.biomeID) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, Biome.mesaPlateau.biomeID, Biome.mesa.biomeID) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, Biome.megaTaiga.biomeID, Biome.taiga.biomeID)) + if (!this.replaceBiomeEdgeIfNecessary(aint, aint1, j, i, areaWidth, k, Biome.getIdForBiome(Biomes.EXTREME_HILLS), Biome.getIdForBiome(Biomes.EXTREME_HILLS_EDGE)) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, Biome.getIdForBiome(Biomes.MESA_ROCK), Biome.getIdForBiome(Biomes.MESA)) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, Biome.getIdForBiome(Biomes.MESA_CLEAR_ROCK), Biome.getIdForBiome(Biomes.MESA)) && !this.replaceBiomeEdge(aint, aint1, j, i, areaWidth, k, Biome.getIdForBiome(Biomes.REDWOOD_TAIGA), Biome.getIdForBiome(Biomes.TAIGA))) { - if (k == Biome.desert.biomeID) + if (k == Biome.getIdForBiome(Biomes.DESERT)) { int l1 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; int i2 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; int j2 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)]; int k2 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)]; - if (l1 != Biome.icePlains.biomeID && i2 != Biome.icePlains.biomeID && j2 != Biome.icePlains.biomeID && k2 != Biome.icePlains.biomeID) + if (l1 != Biome.getIdForBiome(Biomes.ICE_PLAINS) && i2 != Biome.getIdForBiome(Biomes.ICE_PLAINS) && j2 != Biome.getIdForBiome(Biomes.ICE_PLAINS) && k2 != Biome.getIdForBiome(Biomes.ICE_PLAINS)) { aint1[j + i * areaWidth] = k; } else { - aint1[j + i * areaWidth] = Biome.extremeHillsPlus.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(Biomes.EXTREME_HILLS_WITH_TREES); } } - else if (k == Biome.swampland.biomeID) + else if (k == Biome.getIdForBiome(Biomes.SWAMPLAND)) { int l = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; int i1 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; int j1 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)]; int k1 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)]; - if (l != Biome.desert.biomeID && i1 != Biome.desert.biomeID && j1 != Biome.desert.biomeID && k1 != Biome.desert.biomeID && l != Biome.coldTaiga.biomeID && i1 != Biome.coldTaiga.biomeID && j1 != Biome.coldTaiga.biomeID && k1 != Biome.coldTaiga.biomeID && l != Biome.icePlains.biomeID && i1 != Biome.icePlains.biomeID && j1 != Biome.icePlains.biomeID && k1 != Biome.icePlains.biomeID) + if (l != Biome.getIdForBiome(Biomes.DESERT) && i1 != Biome.getIdForBiome(Biomes.DESERT) && j1 != Biome.getIdForBiome(Biomes.DESERT) && k1 != Biome.getIdForBiome(Biomes.DESERT) && l != Biome.getIdForBiome(Biomes.COLD_TAIGA) && i1 != Biome.getIdForBiome(Biomes.COLD_TAIGA) && j1 != Biome.getIdForBiome(Biomes.COLD_TAIGA) && k1 != Biome.getIdForBiome(Biomes.COLD_TAIGA) && l != Biome.getIdForBiome(Biomes.ICE_PLAINS) && i1 != Biome.getIdForBiome(Biomes.ICE_PLAINS) && j1 != Biome.getIdForBiome(Biomes.ICE_PLAINS) && k1 != Biome.getIdForBiome(Biomes.ICE_PLAINS)) { - if (l != Biome.jungle.biomeID && k1 != Biome.jungle.biomeID && i1 != Biome.jungle.biomeID && j1 != Biome.jungle.biomeID) + if (l != Biome.getIdForBiome(Biomes.JUNGLE) && k1 != Biome.getIdForBiome(Biomes.JUNGLE) && i1 != Biome.getIdForBiome(Biomes.JUNGLE) && j1 != Biome.getIdForBiome(Biomes.JUNGLE)) { aint1[j + i * areaWidth] = k; } else { - aint1[j + i * areaWidth] = Biome.jungleEdge.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(Biomes.JUNGLE_EDGE); } } else { - aint1[j + i * areaWidth] = Biome.plains.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(Biomes.PLAINS); } } else diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerDeepOcean.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerDeepOcean.java index d2edae99f2..550f190eb8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerDeepOcean.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerDeepOcean.java @@ -1,5 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; +import net.minecraft.init.Biomes; import net.minecraft.world.biome.Biome; public class GenLayerDeepOcean extends GenLayerGCMap @@ -56,7 +57,7 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) if (k2 == 0 && l2 > 3) { - aint1[j1 + i1 * areaWidth] = Biome.deepOcean.biomeID; + aint1[j1 + i1 * areaWidth] = Biome.getIdForBiome(Biomes.DEEP_OCEAN); } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerGCMap.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerGCMap.java index ecb5dbbdbb..32e55db13c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerGCMap.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerGCMap.java @@ -1,14 +1,15 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; -import java.util.concurrent.Callable; - import net.minecraft.crash.CrashReport; import net.minecraft.crash.CrashReportCategory; +import net.minecraft.init.Biomes; import net.minecraft.util.ReportedException; import net.minecraft.world.WorldType; import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.ChunkProviderSettings; +import java.util.concurrent.Callable; + public abstract class GenLayerGCMap extends net.minecraft.world.gen.layer.GenLayer { /** seed from World#getWorldSeed that is used in the LCG prng */ @@ -50,7 +51,7 @@ public static GenLayerGCMap[] initializeAllBiomeGenerators(long seed, WorldType if (p_180781_2_ == WorldType.CUSTOMIZED && p_180781_3_.length() > 0) { - chunkprovidersettings = ChunkProviderSettings.Factory.jsonToFactory(p_180781_3_).func_177864_b(); + chunkprovidersettings = ChunkProviderSettings.Factory.jsonToFactory(p_180781_3_).build(); i = chunkprovidersettings.biomeSize; j = chunkprovidersettings.riverSize; } @@ -182,14 +183,14 @@ protected static boolean biomesEqualOrMesaPlateau(int biomeIDA, int biomeIDB) { return true; } - else if (biomeIDA != Biome.mesaPlateau_F.biomeID && biomeIDA != Biome.mesaPlateau.biomeID) + else if (biomeIDA != Biome.getIdForBiome(Biomes.MESA_ROCK) && biomeIDA != Biome.getIdForBiome(Biomes.MESA_CLEAR_ROCK)) { - final Biome biomegenbase = Biome.getBiome(biomeIDA); - final Biome biomegenbase1 = Biome.getBiome(biomeIDB); + final Biome biome = Biome.getBiome(biomeIDA); + final Biome biome1 = Biome.getBiome(biomeIDB); try { - return biomegenbase != null && biomegenbase1 != null ? biomegenbase.isEqualTo(biomegenbase1) : false; + return (biome != null && biome1 != null) && biome == biome1; } catch (Throwable throwable) { @@ -197,18 +198,18 @@ else if (biomeIDA != Biome.mesaPlateau_F.biomeID && biomeIDA != Biome.mesaPlatea CrashReportCategory crashreportcategory = crashreport.makeCategory("Biomes being compared"); crashreportcategory.addCrashSection("Biome A ID", Integer.valueOf(biomeIDA)); crashreportcategory.addCrashSection("Biome B ID", Integer.valueOf(biomeIDB)); - crashreportcategory.addCrashSectionCallable("Biome A", new Callable() + crashreportcategory.addCrashSection("Biome A", new Object() { - public String call() throws Exception + public String toString() { - return String.valueOf((Object)biomegenbase); + return String.valueOf((Object)biome); } }); - crashreportcategory.addCrashSectionCallable("Biome B", new Callable() + crashreportcategory.addCrashSection("Biome B", new Object() { - public String call() throws Exception + public String toString() { - return String.valueOf((Object)biomegenbase1); + return String.valueOf((Object)biome1); } }); throw new ReportedException(crashreport); @@ -216,7 +217,7 @@ public String call() throws Exception } else { - return biomeIDB == Biome.mesaPlateau_F.biomeID || biomeIDB == Biome.mesaPlateau.biomeID; + return biomeIDB == Biome.getIdForBiome(Biomes.MESA_ROCK) || biomeIDB == Biome.getIdForBiome(Biomes.MESA_CLEAR_ROCK); } } @@ -263,7 +264,7 @@ public static int getModdedBiomeSize(WorldType worldType, int original) { net.minecraftforge.event.terraingen.WorldTypeEvent.BiomeSize event = new net.minecraftforge.event.terraingen.WorldTypeEvent.BiomeSize(worldType, original); net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event); - return event.newSize; + return event.getNewSize(); } /* ========================================= FORGE END ======================================*/ } \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerHills.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerHills.java index c75dfa697c..370494ab69 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerHills.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerHills.java @@ -1,5 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; +import net.minecraft.init.Biomes; import net.minecraft.world.biome.Biome; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -42,7 +43,7 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) if (k != 0 && l >= 2 && (l - 2) % 29 == 1 && k < 128) { - if (Biome.getBiome(k + 128) != null) + if (Biome.getBiomeForId(k + 128) != null) { aint2[j + i * areaWidth] = k + 128; } @@ -59,86 +60,86 @@ else if (this.nextInt(3) != 0 && !flag) { int i1 = k; - if (k == Biome.desert.biomeID) + if (k == Biome.getIdForBiome(Biomes.DESERT)) { - i1 = Biome.desertHills.biomeID; + i1 = Biome.getIdForBiome(Biomes.DESERT_HILLS); } - else if (k == Biome.forest.biomeID) + else if (k == Biome.getIdForBiome(Biomes.FOREST)) { - i1 = Biome.forestHills.biomeID; + i1 = Biome.getIdForBiome(Biomes.FOREST_HILLS); } - else if (k == Biome.birchForest.biomeID) + else if (k == Biome.getIdForBiome(Biomes.BIRCH_FOREST)) { - i1 = Biome.birchForestHills.biomeID; + i1 = Biome.getIdForBiome(Biomes.BIRCH_FOREST_HILLS); } - else if (k == Biome.roofedForest.biomeID) + else if (k == Biome.getIdForBiome(Biomes.ROOFED_FOREST)) { - i1 = Biome.plains.biomeID; + i1 = Biome.getIdForBiome(Biomes.PLAINS); } - else if (k == Biome.taiga.biomeID) + else if (k == Biome.getIdForBiome(Biomes.TAIGA)) { - i1 = Biome.taigaHills.biomeID; + i1 = Biome.getIdForBiome(Biomes.TAIGA_HILLS); } - else if (k == Biome.megaTaiga.biomeID) + else if (k == Biome.getIdForBiome(Biomes.REDWOOD_TAIGA)) { - i1 = Biome.megaTaigaHills.biomeID; + i1 = Biome.getIdForBiome(Biomes.REDWOOD_TAIGA_HILLS); } - else if (k == Biome.coldTaiga.biomeID) + else if (k == Biome.getIdForBiome(Biomes.COLD_TAIGA)) { - i1 = Biome.coldTaigaHills.biomeID; + i1 = Biome.getIdForBiome(Biomes.COLD_TAIGA_HILLS); } - else if (k == Biome.plains.biomeID) + else if (k == Biome.getIdForBiome(Biomes.PLAINS)) { if (this.nextInt(3) == 0) { - i1 = Biome.forestHills.biomeID; + i1 = Biome.getIdForBiome(Biomes.FOREST_HILLS); } else { - i1 = Biome.forest.biomeID; + i1 = Biome.getIdForBiome(Biomes.FOREST); } } - else if (k == Biome.icePlains.biomeID) + else if (k == Biome.getIdForBiome(Biomes.ICE_PLAINS)) { - i1 = Biome.iceMountains.biomeID; + i1 = Biome.getIdForBiome(Biomes.ICE_MOUNTAINS); } - else if (k == Biome.jungle.biomeID) + else if (k == Biome.getIdForBiome(Biomes.JUNGLE)) { - i1 = Biome.jungleHills.biomeID; + i1 = Biome.getIdForBiome(Biomes.JUNGLE_HILLS); } - else if (k == Biome.ocean.biomeID) + else if (k == Biome.getIdForBiome(Biomes.OCEAN)) { - i1 = Biome.deepOcean.biomeID; + i1 = Biome.getIdForBiome(Biomes.DEEP_OCEAN); } - else if (k == Biome.extremeHills.biomeID) + else if (k == Biome.getIdForBiome(Biomes.EXTREME_HILLS)) { - i1 = Biome.extremeHillsPlus.biomeID; + i1 = Biome.getIdForBiome(Biomes.EXTREME_HILLS_WITH_TREES); } - else if (k == Biome.savanna.biomeID) + else if (k == Biome.getIdForBiome(Biomes.SAVANNA)) { - i1 = Biome.savannaPlateau.biomeID; + i1 = Biome.getIdForBiome(Biomes.SAVANNA_PLATEAU); } - else if (biomesEqualOrMesaPlateau(k, Biome.mesaPlateau_F.biomeID)) + else if (biomesEqualOrMesaPlateau(k, Biome.getIdForBiome(Biomes.MESA_ROCK))) { - i1 = Biome.mesa.biomeID; + i1 = Biome.getIdForBiome(Biomes.MESA); } - else if (k == Biome.deepOcean.biomeID && this.nextInt(3) == 0) + else if (k == Biome.getIdForBiome(Biomes.DEEP_OCEAN) && this.nextInt(3) == 0) { int j1 = this.nextInt(2); if (j1 == 0) { - i1 = Biome.plains.biomeID; + i1 = Biome.getIdForBiome(Biomes.PLAINS); } else { - i1 = Biome.forest.biomeID; + i1 = Biome.getIdForBiome(Biomes.FOREST); } } if (flag && i1 != k) { - if (Biome.getBiome(i1 + 128) != null) + if (Biome.getBiomeForId(i1 + 128) != null) { i1 += 128; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRareBiome.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRareBiome.java index c3e19fc891..165613333e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRareBiome.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRareBiome.java @@ -1,5 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; +import net.minecraft.init.Biomes; import net.minecraft.world.biome.Biome; public class GenLayerRareBiome extends GenLayerGCMap @@ -28,9 +29,9 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) if (this.nextInt(57) == 0) { - if (k == Biome.plains.biomeID) + if (k == Biome.getIdForBiome(Biomes.PLAINS)) { - aint1[j + i * areaWidth] = Biome.plains.biomeID + 128; + aint1[j + i * areaWidth] = Biome.getIdForBiome(Biomes.PLAINS) + 128; } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiver.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiver.java index 386a5584cb..bf21cb3b45 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiver.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiver.java @@ -1,5 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; +import net.minecraft.init.Biomes; import net.minecraft.world.biome.Biome; public class GenLayerRiver extends GenLayerGCMap @@ -39,7 +40,7 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) } else { - aint1[j1 + i1 * areaWidth] = Biome.river.biomeID; + aint1[j1 + i1 * areaWidth] = Biome.getIdForBiome(Biomes.RIVER); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverMix.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverMix.java index d533e0146f..283c32f811 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverMix.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverMix.java @@ -1,5 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; +import net.minecraft.init.Biomes; import net.minecraft.world.biome.Biome; public class GenLayerRiverMix extends GenLayerGCMap @@ -37,21 +38,21 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) for (int i = 0; i < areaWidth * areaHeight; ++i) { - if (aint[i] != Biome.ocean.biomeID && aint[i] != Biome.deepOcean.biomeID) + if (aint[i] != Biome.getIdForBiome(Biomes.OCEAN) && aint[i] != Biome.getIdForBiome(Biomes.DEEP_OCEAN)) { - if (aint1[i] == Biome.river.biomeID) + if (aint1[i] == Biome.getIdForBiome(Biomes.RIVER)) { - if (aint[i] == Biome.icePlains.biomeID) + if (aint[i] == Biome.getIdForBiome(Biomes.ICE_PLAINS)) { - aint2[i] = Biome.frozenRiver.biomeID; + aint2[i] = Biome.getIdForBiome(Biomes.FROZEN_RIVER); } - else if (aint[i] != Biome.mushroomIsland.biomeID && aint[i] != Biome.mushroomIslandShore.biomeID) + else if (aint[i] != Biome.getIdForBiome(Biomes.MUSHROOM_ISLAND) && aint[i] != Biome.getIdForBiome(Biomes.MUSHROOM_ISLAND_SHORE)) { aint2[i] = aint1[i] & 255; } else { - aint2[i] = Biome.mushroomIslandShore.biomeID; + aint2[i] = Biome.getIdForBiome(Biomes.MUSHROOM_ISLAND_SHORE); } } else diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerShore.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerShore.java index 7c24191ace..e92969ea84 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerShore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerShore.java @@ -1,8 +1,9 @@ package micdoodle8.mods.galacticraft.core.world.gen.layer_mapping; +import net.minecraft.init.Biomes; import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.BiomeGenJungle; -import net.minecraft.world.biome.BiomeGenMesa; +import net.minecraft.world.biome.BiomeJungle; +import net.minecraft.world.biome.BiomeMesa; public class GenLayerShore extends GenLayerGCMap { @@ -27,25 +28,25 @@ public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { this.initChunkSeed((long)(j + areaX), (long)(i + areaY)); int k = aint[j + 1 + (i + 1) * (areaWidth + 2)]; - Biome biomegenbase = Biome.getBiome(k); + Biome biomegenbase = Biome.getBiomeForId(k); - if (k == Biome.mushroomIsland.biomeID) + if (k == Biome.getIdForBiome(Biomes.MUSHROOM_ISLAND)) { int j2 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; int i3 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; int l3 = aint[j + 1 - 1 + (i + 1) * (areaWidth + 2)]; int k4 = aint[j + 1 + (i + 1 + 1) * (areaWidth + 2)]; - if (j2 != Biome.ocean.biomeID && i3 != Biome.ocean.biomeID && l3 != Biome.ocean.biomeID && k4 != Biome.ocean.biomeID) + if (j2 != Biome.getIdForBiome(Biomes.OCEAN) && i3 != Biome.getIdForBiome(Biomes.OCEAN) && l3 != Biome.getIdForBiome(Biomes.OCEAN) && k4 != Biome.getIdForBiome(Biomes.OCEAN)) { aint1[j + i * areaWidth] = k; } else { - aint1[j + i * areaWidth] = Biome.mushroomIslandShore.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(Biomes.MUSHROOM_ISLAND_SHORE); } } - else if (biomegenbase != null && biomegenbase.getBiomeClass() == BiomeGenJungle.class) + else if (biomegenbase != null && biomegenbase.getBiomeClass() == BiomeJungle.class) { int i2 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; int l2 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; @@ -60,23 +61,23 @@ else if (biomegenbase != null && biomegenbase.getBiomeClass() == BiomeGenJungle. } else { - aint1[j + i * areaWidth] = Biome.beach.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(Biomes.BEACH); } } else { - aint1[j + i * areaWidth] = Biome.jungleEdge.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(Biomes.JUNGLE_EDGE); } } - else if (k != Biome.extremeHills.biomeID && k != Biome.extremeHillsPlus.biomeID && k != Biome.extremeHillsEdge.biomeID) + else if (k != Biome.getIdForBiome(Biomes.EXTREME_HILLS) && k != Biome.getIdForBiome(Biomes.EXTREME_HILLS_WITH_TREES) && k != Biome.getIdForBiome(Biomes.EXTREME_HILLS_EDGE)) { if (biomegenbase != null && biomegenbase.isSnowyBiome()) { - this.func_151632_a(aint, aint1, j, i, areaWidth, k, Biome.coldBeach.biomeID); + this.func_151632_a(aint, aint1, j, i, areaWidth, k, Biome.getIdForBiome(Biomes.COLD_BEACH)); } - else if (k != Biome.mesa.biomeID && k != Biome.mesaPlateau_F.biomeID) + else if (k != Biome.getIdForBiome(Biomes.MESA) && k != Biome.getIdForBiome(Biomes.MESA_ROCK)) { - if (k != Biome.ocean.biomeID && k != Biome.deepOcean.biomeID && k != Biome.river.biomeID && k != Biome.swampland.biomeID) + if (k != Biome.getIdForBiome(Biomes.OCEAN) && k != Biome.getIdForBiome(Biomes.DEEP_OCEAN) && k != Biome.getIdForBiome(Biomes.RIVER) && k != Biome.getIdForBiome(Biomes.SWAMPLAND)) { int l1 = aint[j + 1 + (i + 1 - 1) * (areaWidth + 2)]; int k2 = aint[j + 1 + 1 + (i + 1) * (areaWidth + 2)]; @@ -89,7 +90,7 @@ else if (k != Biome.mesa.biomeID && k != Biome.mesaPlateau_F.biomeID) } else { - aint1[j + i * areaWidth] = Biome.beach.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(Biomes.BEACH); } } else @@ -112,7 +113,7 @@ else if (k != Biome.mesa.biomeID && k != Biome.mesaPlateau_F.biomeID) } else { - aint1[j + i * areaWidth] = Biome.desert.biomeID; + aint1[j + i * areaWidth] = Biome.getIdForBiome(Biomes.DESERT); } } else @@ -123,7 +124,7 @@ else if (k != Biome.mesa.biomeID && k != Biome.mesaPlateau_F.biomeID) } else { - this.func_151632_a(aint, aint1, j, i, areaWidth, k, Biome.stoneBeach.biomeID); + this.func_151632_a(aint, aint1, j, i, areaWidth, k, Biome.getIdForBiome(Biomes.STONE_BEACH)); } } } @@ -157,11 +158,11 @@ private void func_151632_a(int[] p_151632_1_, int[] p_151632_2_, int p_151632_3_ private boolean func_151631_c(int p_151631_1_) { - return Biome.getBiome(p_151631_1_) != null && Biome.getBiome(p_151631_1_).getBiomeClass() == BiomeGenJungle.class ? true : p_151631_1_ == Biome.jungleEdge.biomeID || p_151631_1_ == Biome.jungle.biomeID || p_151631_1_ == Biome.jungleHills.biomeID || p_151631_1_ == Biome.forest.biomeID || p_151631_1_ == Biome.taiga.biomeID || isBiomeOceanic(p_151631_1_); + return Biome.getBiomeForId(p_151631_1_) != null && Biome.getBiomeForId(p_151631_1_).getBiomeClass() == BiomeJungle.class || (p_151631_1_ == Biome.getIdForBiome(Biomes.JUNGLE_EDGE) || p_151631_1_ == Biome.getIdForBiome(Biomes.JUNGLE) || p_151631_1_ == Biome.getIdForBiome(Biomes.JUNGLE_HILLS) || p_151631_1_ == Biome.getIdForBiome(Biomes.FOREST) || p_151631_1_ == Biome.getIdForBiome(Biomes.TAIGA) || isBiomeOceanic(p_151631_1_)); } private boolean func_151633_d(int p_151633_1_) { - return Biome.getBiome(p_151633_1_) instanceof BiomeGenMesa; + return Biome.getBiomeForId(p_151633_1_) instanceof BiomeMesa; } } \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ScheduledBlockChange.java b/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ScheduledBlockChange.java index 11ead514aa..2050f4eb0f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ScheduledBlockChange.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/wrappers/ScheduledBlockChange.java @@ -1,26 +1,24 @@ package micdoodle8.mods.galacticraft.core.wrappers; import micdoodle8.mods.galacticraft.api.vector.BlockVec3; -import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.BlockPos; public class ScheduledBlockChange { private BlockPos changePosition; - private Block change; - private int changeMeta; + private IBlockState change; private int changeUpdateFlag; - public ScheduledBlockChange(BlockVec3 changePosition, Block change, int changeMeta) + public ScheduledBlockChange(BlockVec3 changePosition, IBlockState change) { - this(changePosition, change, changeMeta, 3); + this(changePosition, change, 3); } - public ScheduledBlockChange(BlockVec3 changePosition, Block change, int changeMeta, int changeUpdateFlag) + public ScheduledBlockChange(BlockVec3 changePosition, IBlockState change, int changeUpdateFlag) { this.changePosition = changePosition.toBlockPos(); this.change = change; - this.changeMeta = changeMeta; this.changeUpdateFlag = changeUpdateFlag; } @@ -34,26 +32,16 @@ public void setChangePosition(BlockPos changePosition) this.changePosition = changePosition; } - public Block getChangeID() + public IBlockState getChangeState() { return this.change; } - public void setChangeID(Block change) + public void setChangeState(IBlockState change) { this.change = change; } - public int getChangeMeta() - { - return this.changeMeta; - } - - public void setChangeMeta(int changeMeta) - { - this.changeMeta = changeMeta; - } - public int getChangeUpdateFlag() { return changeUpdateFlag; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/GCPlanetDimensions.java b/src/main/java/micdoodle8/mods/galacticraft/planets/GCPlanetDimensions.java new file mode 100644 index 0000000000..a6372e53ac --- /dev/null +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/GCPlanetDimensions.java @@ -0,0 +1,16 @@ +package micdoodle8.mods.galacticraft.planets; + +import micdoodle8.mods.galacticraft.planets.asteroids.ConfigManagerAsteroids; +import micdoodle8.mods.galacticraft.planets.asteroids.dimension.WorldProviderAsteroids; +import micdoodle8.mods.galacticraft.planets.mars.ConfigManagerMars; +import micdoodle8.mods.galacticraft.planets.mars.dimension.WorldProviderMars; +import micdoodle8.mods.galacticraft.planets.venus.ConfigManagerVenus; +import micdoodle8.mods.galacticraft.planets.venus.dimension.WorldProviderVenus; +import net.minecraft.world.DimensionType; + +public class GCPlanetDimensions +{ + public static DimensionType ASTEROIDS = DimensionType.register("Asteroids", "asteroids", ConfigManagerAsteroids.dimensionIDAsteroids, WorldProviderAsteroids.class, false); + public static DimensionType MARS = DimensionType.register("Mars", "mars", ConfigManagerMars.dimensionIDMars, WorldProviderMars.class, false); + public static DimensionType VENUS = DimensionType.register("Venus", "venus", ConfigManagerVenus.dimensionIDVenus, WorldProviderVenus.class, false); +} diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/GalacticraftPlanets.java b/src/main/java/micdoodle8/mods/galacticraft/planets/GalacticraftPlanets.java index ba494af2d3..a1280fd74b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/GalacticraftPlanets.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/GalacticraftPlanets.java @@ -149,7 +149,7 @@ public static List getConfigElements() @SubscribeEvent public void onConfigChanged(ConfigChangedEvent event) { - if (event.modID.equals(Constants.MOD_ID_PLANETS)) + if (event.getModID().equals(Constants.MOD_ID_PLANETS)) { for (IPlanetsModule module : GalacticraftPlanets.commonModules) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/PlanetsProxyClient.java b/src/main/java/micdoodle8/mods/galacticraft/planets/PlanetsProxyClient.java index 7a22342284..10aee721f9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/PlanetsProxyClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/PlanetsProxyClient.java @@ -21,7 +21,7 @@ public class PlanetsProxyClient extends PlanetsProxy @Override public void preInit(FMLPreInitializationEvent event) { - OBJLoader.instance.addDomain(GalacticraftPlanets.ASSET_PREFIX); + OBJLoader.INSTANCE.addDomain(GalacticraftPlanets.ASSET_PREFIX); GalacticraftPlanets.clientModules.add(new MarsModuleClient()); GalacticraftPlanets.clientModules.add(new AsteroidsModuleClient()); GalacticraftPlanets.clientModules.add(new VenusModuleClient()); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java index 826b1ab6b8..87fa0606e7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java @@ -179,45 +179,45 @@ public void init(FMLInitializationEvent event) GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 0), input)); HashMap input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.chest)); + input2.put(19, new ItemStack(Blocks.CHEST)); input2.put(20, null); input2.put(21, null); GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 1), input2)); input2 = new HashMap(input); input2.put(19, null); - input2.put(20, new ItemStack(Blocks.chest)); + input2.put(20, new ItemStack(Blocks.CHEST)); input2.put(21, null); GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 1), input2)); input2 = new HashMap(input); input2.put(19, null); input2.put(20, null); - input2.put(21, new ItemStack(Blocks.chest)); + input2.put(21, new ItemStack(Blocks.CHEST)); GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 1), input2)); input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.chest)); - input2.put(20, new ItemStack(Blocks.chest)); + input2.put(19, new ItemStack(Blocks.CHEST)); + input2.put(20, new ItemStack(Blocks.CHEST)); input2.put(21, null); GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 2), input2)); input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.chest)); + input2.put(19, new ItemStack(Blocks.CHEST)); input2.put(20, null); - input2.put(21, new ItemStack(Blocks.chest)); + input2.put(21, new ItemStack(Blocks.CHEST)); GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 2), input2)); input2 = new HashMap(input); input2.put(19, null); - input2.put(20, new ItemStack(Blocks.chest)); - input2.put(21, new ItemStack(Blocks.chest)); + input2.put(20, new ItemStack(Blocks.CHEST)); + input2.put(21, new ItemStack(Blocks.CHEST)); GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 2), input2)); input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.chest)); - input2.put(20, new ItemStack(Blocks.chest)); - input2.put(21, new ItemStack(Blocks.chest)); + input2.put(19, new ItemStack(Blocks.CHEST)); + input2.put(20, new ItemStack(Blocks.CHEST)); + input2.put(21, new ItemStack(Blocks.CHEST)); GalacticraftRegistry.addT3RocketRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.tier3Rocket, 1, 3), input2)); input = new HashMap(); @@ -231,8 +231,8 @@ public void init(FMLInitializationEvent event) input.put(10, new ItemStack(AsteroidsItems.orionDrive)); input.put(12, new ItemStack(AsteroidsItems.orionDrive)); input.put(6, new ItemStack(GCItems.basicItem, 1, 14)); - input.put(7, new ItemStack(Blocks.chest)); - input.put(8, new ItemStack(Blocks.chest)); + input.put(7, new ItemStack(Blocks.CHEST)); + input.put(8, new ItemStack(Blocks.CHEST)); input.put(13, new ItemStack(AsteroidsItems.basicItem, 1, 8)); input.put(14, new ItemStack(GCItems.flagPole)); GalacticraftRegistry.addAstroMinerRecipe(new NasaWorkbenchRecipe(new ItemStack(AsteroidsItems.astroMiner, 1, 0), input)); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java index d6d4bf47bb..4757f9636b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java @@ -29,23 +29,23 @@ import micdoodle8.mods.galacticraft.planets.asteroids.tile.TileEntityShortRangeTelepad; import micdoodle8.mods.galacticraft.planets.mars.client.fx.EntityCryoFX; import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.block.model.ItemTransformVec3f; +import net.minecraft.client.renderer.block.model.ModelBakery; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.event.TextureStitchEvent; -import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry; @@ -147,7 +147,7 @@ public void loadTextures(TextureStitchEvent.Pre event) private void registerTexture(TextureStitchEvent.Pre event, String texture) { - event.map.registerSprite(new ResourceLocation(GalacticraftPlanets.TEXTURE_PREFIX + "blocks/" + texture)); + event.getMap().registerSprite(new ResourceLocation(GalacticraftPlanets.TEXTURE_PREFIX + "blocks/" + texture)); } @Override @@ -261,7 +261,7 @@ public void spawnParticle(String particleID, Vector3 position, Vector3 motion, O double dX = mc.getRenderViewEntity().posX - position.x; double dY = mc.getRenderViewEntity().posY - position.y; double dZ = mc.getRenderViewEntity().posZ - position.z; - EntityFX particle = null; + Particle particle = null; double viewDistance = 64.0D; if (dX * dX + dY * dY + dZ * dZ < viewDistance * viewDistance) @@ -278,9 +278,6 @@ else if (particleID.equals("cryoFreeze")) if (particle != null) { - particle.prevPosX = particle.posX; - particle.prevPosY = particle.posY; - particle.prevPosZ = particle.posZ; mc.effectRenderer.addEffect(particle); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/ConfigManagerAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/ConfigManagerAsteroids.java index 2d30dfa961..c60720e72d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/ConfigManagerAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/ConfigManagerAsteroids.java @@ -66,11 +66,11 @@ public static void syncConfig(boolean load, boolean update) } prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "dimensionIDAsteroids", -30); - prop.comment = "Dimension ID for Asteroids"; + prop.setComment("Dimension ID for Asteroids"); prop.setLanguageKey("gc.configgui.dimensionIDAsteroids").setRequiresMcRestart(true); if (update) { - propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, prop.getName(), prop.getInt(), prop.comment); + propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, prop.getName(), prop.getInt(), prop.getComment()); propCopy.setLanguageKey(prop.getLanguageKey()); propCopy.setRequiresMcRestart(prop.requiresMcRestart()); } @@ -79,65 +79,65 @@ public static void syncConfig(boolean load, boolean update) // prop = config.get(Constants.CONFIG_CATEGORY_SCHEMATIC, "idSchematicRocketT3", 4); - prop.comment = "Schematic ID for Tier 3 Rocket, must be unique."; + prop.setComment("Schematic ID for Tier 3 Rocket, must be unique."); prop.setLanguageKey("gc.configgui.idSchematicRocketT3"); if (update) { - propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_SCHEMATIC, prop.getName(), prop.getInt(), prop.comment); + propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_SCHEMATIC, prop.getName(), prop.getInt(), prop.getComment()); propCopy.setLanguageKey(prop.getLanguageKey()); } idSchematicRocketT3 = prop.getInt(4); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "disableGalacticraftHelium", false); - prop.comment = "Option to disable Helium gas in Galacticraft (because it will be registered by another mod eg GregTech)."; + prop.setComment("Option to disable Helium gas in Galacticraft (because it will be registered by another mod eg GregTech)."); prop.setLanguageKey("gc.configgui.disableGalacticraftHelium"); if (update) { - propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_GENERAL, prop.getName(), prop.getBoolean(), prop.comment); + propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_GENERAL, prop.getName(), prop.getBoolean(), prop.getComment()); propCopy.setLanguageKey(prop.getLanguageKey()); } disableGalacticraftHelium = prop.getBoolean(false); ConfigManagerMars.propOrder.add(prop.getName()); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "maximumAstroMiners", 6); - prop.comment = "Maximum number of Astro Miners each player is allowed to have active (default 4)."; + prop.setComment("Maximum number of Astro Miners each player is allowed to have active (default 4)."); prop.setLanguageKey("gc.configgui.astroMinersMax"); if (update) { - propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_GENERAL, prop.getName(), prop.getInt(), prop.comment); + propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_GENERAL, prop.getName(), prop.getInt(), prop.getComment()); propCopy.setLanguageKey(prop.getLanguageKey()); } astroMinerMax = prop.getInt(6); ConfigManagerMars.propOrder.add(prop.getName()); prop = config.get(update ? Constants.CONFIG_CATEGORY_GENERAL : Constants.CONFIG_CATEGORY_WORLDGEN, "Disable Iron Ore Gen on Asteroids", false); - prop.comment = "Disable Iron Ore Gen on Asteroids."; + prop.setComment("Disable Iron Ore Gen on Asteroids."); prop.setLanguageKey("gc.configgui.disableIronGenAsteroids"); if (update) { - propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_WORLDGEN, prop.getName(), prop.getBoolean(), prop.comment); + propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_WORLDGEN, prop.getName(), prop.getBoolean(), prop.getComment()); propCopy.setLanguageKey(prop.getLanguageKey()); } disableIronGen = prop.getBoolean(false); ConfigManagerMars.propOrder.add(prop.getName()); prop = config.get(update ? Constants.CONFIG_CATEGORY_GENERAL : Constants.CONFIG_CATEGORY_WORLDGEN, "Disable Aluminum Ore Gen on Asteroids", false); - prop.comment = "Disable Aluminum Ore Gen on Asteroids."; + prop.setComment("Disable Aluminum Ore Gen on Asteroids."); prop.setLanguageKey("gc.configgui.disableAluminumGenAsteroids"); if (update) { - propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_WORLDGEN, prop.getName(), prop.getBoolean(), prop.comment); + propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_WORLDGEN, prop.getName(), prop.getBoolean(), prop.getComment()); propCopy.setLanguageKey(prop.getLanguageKey()); } disableAluminumGen = prop.getBoolean(false); ConfigManagerMars.propOrder.add(prop.getName()); prop = config.get(update ? Constants.CONFIG_CATEGORY_GENERAL : Constants.CONFIG_CATEGORY_WORLDGEN, "Disable Ilmenite Ore Gen on Asteroids", false); - prop.comment = "Disable Ilmenite Ore Gen on Asteroids."; + prop.setComment("Disable Ilmenite Ore Gen on Asteroids."); prop.setLanguageKey("gc.configgui.disableIlmeniteGenAsteroids"); if (update) { - propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_WORLDGEN, prop.getName(), prop.getBoolean(), prop.comment); + propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_WORLDGEN, prop.getName(), prop.getBoolean(), prop.getComment()); propCopy.setLanguageKey(prop.getLanguageKey()); } disableIlmeniteGen = prop.getBoolean(false); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBasicAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBasicAsteroids.java index b587b394c0..0f0b90fe2a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBasicAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBasicAsteroids.java @@ -32,7 +32,7 @@ public class BlockBasicAsteroids extends Block implements IDetectableResource, IPlantableBlock, ITerraformableBlock, ISortableBlock { - public static final PropertyEnum BASIC_TYPE = PropertyEnum.create("basicTypeAsteroids", EnumBlockBasic.class); + public static final PropertyEnum BASIC_TYPE = PropertyEnum.create("basictypeasteroids", EnumBlockBasic.class); public enum EnumBlockBasic implements IStringSerializable { @@ -162,7 +162,7 @@ public boolean isValueable(IBlockState state) } @Override - public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) + public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) { return false; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java index 17a55a370d..feb016aeea 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java @@ -14,18 +14,19 @@ import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyDirection; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.TextComponentString; +import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; @@ -91,48 +92,48 @@ public void onBlockAdded(World world, BlockPos pos, IBlockState state) } } - @Override - public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos) - { - int meta = getMetaFromState(world.getBlockState(pos)); - - if (meta != -1) - { - EnumFacing dir = EnumFacing.getFront(meta); - - switch (dir) - { - case UP: - this.setBlockBounds(0.3F, 0.3F, 0.3F, 0.7F, 1.0F, 0.7F); - break; - case DOWN: - this.setBlockBounds(0.2F, 0.0F, 0.2F, 0.8F, 0.42F, 0.8F); - break; - case EAST: - this.setBlockBounds(0.58F, 0.2F, 0.2F, 1.0F, 0.8F, 0.8F); - break; - case WEST: - this.setBlockBounds(0.0F, 0.2F, 0.2F, 0.42F, 0.8F, 0.8F); - break; - case NORTH: - this.setBlockBounds(0.2F, 0.2F, 0.0F, 0.8F, 0.8F, 0.42F); - break; - case SOUTH: - this.setBlockBounds(0.2F, 0.2F, 0.58F, 0.8F, 0.8F, 1.0F); - break; - default: - break; - } - } - } - - @SuppressWarnings("rawtypes") - @Override - public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) - { - this.setBlockBoundsBasedOnState(worldIn, pos); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); - } +// @Override +// public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos) +// { +// int meta = getMetaFromState(world.getBlockState(pos)); +// +// if (meta != -1) +// { +// EnumFacing dir = EnumFacing.getFront(meta); +// +// switch (dir) +// { +// case UP: +// this.setBlockBounds(0.3F, 0.3F, 0.3F, 0.7F, 1.0F, 0.7F); +// break; +// case DOWN: +// this.setBlockBounds(0.2F, 0.0F, 0.2F, 0.8F, 0.42F, 0.8F); +// break; +// case EAST: +// this.setBlockBounds(0.58F, 0.2F, 0.2F, 1.0F, 0.8F, 0.8F); +// break; +// case WEST: +// this.setBlockBounds(0.0F, 0.2F, 0.2F, 0.42F, 0.8F, 0.8F); +// break; +// case NORTH: +// this.setBlockBounds(0.2F, 0.2F, 0.0F, 0.8F, 0.8F, 0.42F); +// break; +// case SOUTH: +// this.setBlockBounds(0.2F, 0.2F, 0.58F, 0.8F, 0.8F, 1.0F); +// break; +// default: +// break; +// } +// } +// } +// +// @SuppressWarnings("rawtypes") +// @Override +// public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) +// { +// this.setBlockBoundsBasedOnState(worldIn, pos); +// super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); +// } private int getMetadataFromAngle(World world, BlockPos pos, EnumFacing side) { @@ -227,7 +228,7 @@ public boolean isFullCube(IBlockState state) @Override public EnumBlockRenderType getRenderType(IBlockState state) { - return -1; + return EnumBlockRenderType.INVISIBLE; } @Override @@ -251,13 +252,13 @@ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List } @Override - public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityPlayer, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onMachineActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityBeamReceiver) { - return ((TileEntityBeamReceiver) tile).onMachineActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ); + return ((TileEntityBeamReceiver) tile).onMachineActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ); } return false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java index bc4b9e2c33..63bac75fe0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java @@ -7,19 +7,18 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.planets.asteroids.tile.TileEntityBeamReflector; -import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; +import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; -import net.minecraft.world.IBlockAccess; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -57,22 +56,22 @@ public boolean isFullCube(IBlockState state) @Override public EnumBlockRenderType getRenderType(IBlockState state) { - return -1; + return EnumBlockRenderType.INVISIBLE; } - @Override - public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) - { - this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.8F, 0.75F); - } - - @SuppressWarnings("rawtypes") - @Override - public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) - { - this.setBlockBoundsBasedOnState(worldIn, pos); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); - } +// @Override +// public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) +// { +// this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.8F, 0.75F); +// } +// +// @SuppressWarnings("rawtypes") +// @Override +// public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) +// { +// this.setBlockBoundsBasedOnState(worldIn, pos); +// super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); +// } @Override public TileEntity createTileEntity(World world, IBlockState state) @@ -89,13 +88,13 @@ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List } @Override - public boolean onSneakMachineActivated(World world, BlockPos pos, EntityPlayer entityPlayer, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onSneakMachineActivated(World world, BlockPos pos, EntityPlayer entityPlayer, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityBeamReflector) { - return ((TileEntityBeamReflector) tile).onMachineActivated(world, pos, world.getBlockState(pos), entityPlayer, side, hitX, hitY, hitZ); + return ((TileEntityBeamReflector) tile).onMachineActivated(world, pos, world.getBlockState(pos), entityPlayer, hand, heldItem, side, hitX, hitY, hitZ); } return false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockIceAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockIceAsteroids.java index bdb3347e9c..4877670a1d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockIceAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockIceAsteroids.java @@ -6,6 +6,7 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockBreakable; +import net.minecraft.block.SoundType; import net.minecraft.block.material.EnumPushReaction; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; @@ -13,12 +14,13 @@ import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.init.Enchantments; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -33,19 +35,19 @@ public class BlockIceAsteroids extends BlockBreakable implements ISortableBlock { public BlockIceAsteroids(String assetName) { - super(Material.ice, false); + super(Material.ICE, false); this.slipperiness = 0.98F; this.setTickRandomly(true); this.setHardness(0.5F); this.setUnlocalizedName(assetName); - this.setStepSound(soundTypeGlass); + this.setSoundType(SoundType.GLASS); } @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer() + public BlockRenderLayer getBlockLayer() { - return EnumWorldBlockLayer.TRANSLUCENT; + return BlockRenderLayer.TRANSLUCENT; } @SideOnly(Side.CLIENT) @@ -59,16 +61,16 @@ public CreativeTabs getCreativeTabToDisplayOn() @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { - return super.shouldSideBeRendered(world, pos, EnumFacing.getFront(1 - side.getIndex())); + return super.shouldSideBeRendered(blockState, blockAccess, pos, EnumFacing.getFront(1 - side.getIndex())); } @Override - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack stack) { - player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1); + player.addStat(StatList.getBlockStats(this)); player.addExhaustion(0.025F); - if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player)) + if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, player.getHeldItem(player.swingingHand)) > 0) { ArrayList items = new ArrayList(); ItemStack itemstack = this.createStackedBlock(state); @@ -92,15 +94,16 @@ public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBloc return; } - int i1 = EnchantmentHelper.getFortuneModifier(player); + int i1 = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, player.getHeldItem(player.swingingHand)); harvesters.set(player); this.dropBlockAsItem(worldIn, pos, state, i1); harvesters.set(null); - Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial(); + IBlockState state1 = worldIn.getBlockState(pos.down()); + Material material = state1.getBlock().getMaterial(state1); if (material.blocksMovement() || material.isLiquid()) { - worldIn.setBlockState(pos, Blocks.flowing_water.getDefaultState()); + worldIn.setBlockState(pos, Blocks.FLOWING_WATER.getDefaultState()); } } } @@ -114,7 +117,7 @@ public int quantityDropped(Random rand) @Override public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { - if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11 - this.getLightOpacity()) + if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11 - this.getLightOpacity(state)) { if (worldIn.provider.getDimension() == -1 || worldIn.provider instanceof IGalacticraftWorldProvider) { @@ -123,7 +126,7 @@ public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random ra } this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0); - worldIn.setBlockState(pos, Blocks.water.getDefaultState()); + worldIn.setBlockState(pos, Blocks.WATER.getDefaultState()); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java index ab7aadf81d..eeaf755478 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java @@ -7,6 +7,7 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.planets.asteroids.tile.TileEntityMinerBaseSingle; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; @@ -29,8 +30,7 @@ public BlockMinerBase(String assetName) super(Material.ROCK); this.blockHardness = 3.0F; this.setUnlocalizedName(assetName); - this.setCreativeTab(CreativeTabs.tabBlock); - this.setStepSound(soundTypeMetal); + this.setSoundType(SoundType.METAL); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java index cae04c747e..f30c0cc654 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java @@ -2,6 +2,7 @@ import micdoodle8.mods.galacticraft.core.blocks.BlockTileGC; import micdoodle8.mods.galacticraft.planets.asteroids.tile.TileEntityMinerBase; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; @@ -9,10 +10,12 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.EnumFacing; import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -29,13 +32,13 @@ public BlockMinerBaseFull(String assetName) super(Material.ROCK); this.blockHardness = 3.0F; this.setUnlocalizedName(assetName); - this.setStepSound(soundTypeMetal); + this.setSoundType(SoundType.METAL); } @Override public EnumBlockRenderType getRenderType(IBlockState state) { - return -1; + return EnumBlockRenderType.INVISIBLE; } @Override @@ -98,7 +101,7 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) } @Override - public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityPlayer, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onMachineActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntity tileEntity = worldIn.getTileEntity(pos); if (tileEntity instanceof TileEntityMinerBase) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java index 66d650d028..bbaaaf9c5f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java @@ -12,26 +12,24 @@ import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import micdoodle8.mods.galacticraft.planets.asteroids.dimension.ShortRangeTelepadHandler; import micdoodle8.mods.galacticraft.planets.asteroids.tile.TileEntityShortRangeTelepad; -import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.TextComponentString; +import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; -import net.minecraft.world.IBlockAccess; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; import java.util.Random; public class BlockShortRangeTelepad extends BlockTileGC implements IShiftDescription, ISortableBlock @@ -54,7 +52,7 @@ public CreativeTabs getCreativeTabToDisplayOn() @Override public EnumBlockRenderType getRenderType(IBlockState state) { - return -1; + return EnumBlockRenderType.INVISIBLE; } @Override @@ -75,19 +73,19 @@ public TileEntity createNewTileEntity(World world, int meta) return new TileEntityShortRangeTelepad(); } - @Override - public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) - { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.45F, 1.0F); - } +// @Override +// public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) +// { +// this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.45F, 1.0F); +// } - @SuppressWarnings("rawtypes") - @Override - public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) - { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.45F, 1.0F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); - } +// @SuppressWarnings("rawtypes") +// @Override +// public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) +// { +// this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.45F, 1.0F); +// super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); +// } @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) @@ -106,9 +104,9 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti { if (!(x == 0 && y == 0 && z == 0)) { - Block blockAt = worldIn.getBlockState(pos.add(x, y, z)).getBlock(); + IBlockState stateAt = worldIn.getBlockState(pos.add(x, y, z)); - if (!blockAt.getMaterial().isReplaceable()) + if (!stateAt.getBlock().getMaterial(stateAt).isReplaceable()) { validSpot = false; } @@ -141,7 +139,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti } @Override - public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityPlayer, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onMachineActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { return ((IMultiBlock) worldIn.getTileEntity(pos)).onActivated(playerIn); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java index 48b7f1811d..a18dc04f4a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java @@ -6,27 +6,25 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockDirectional; import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.SoundType; import net.minecraft.block.properties.PropertyBool; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.particle.EffectRenderer; +import net.minecraft.client.particle.ParticleManager; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; import java.util.Random; public class BlockTelepadFake extends BlockAdvancedTile implements ITileEntityProvider @@ -50,54 +48,54 @@ public boolean isOpaqueCube(IBlockState state) return false; } - @Override - public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos) - { - IBlockState state = world.getBlockState(pos); - boolean top = state.getValue(TOP); - - if (top) - { - this.setBlockBounds(0.0F, 0.55F, 0.0F, 1.0F, 1.0F, 1.0F); - } - else - { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.2F, 1.0F); - } - } - - @SuppressWarnings("rawtypes") - @Override - public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) - { - boolean top = state.getValue(TOP); - - if (top) - { - this.setBlockBounds(0.0F, 0.55F, 0.0F, 1.0F, 1.0F, 1.0F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); - } - else - { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.2F, 1.0F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); - } - } - - @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) - { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getCollisionBoundingBox(worldIn, pos, state); - } - - @Override - @SideOnly(Side.CLIENT) - public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) - { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getSelectedBoundingBox(worldIn, pos); - } +// @Override +// public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos) +// { +// IBlockState state = world.getBlockState(pos); +// boolean top = state.getValue(TOP); +// +// if (top) +// { +// this.setBlockBounds(0.0F, 0.55F, 0.0F, 1.0F, 1.0F, 1.0F); +// } +// else +// { +// this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.2F, 1.0F); +// } +// } + +// @SuppressWarnings("rawtypes") +// @Override +// public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) +// { +// boolean top = state.getValue(TOP); +// +// if (top) +// { +// this.setBlockBounds(0.0F, 0.55F, 0.0F, 1.0F, 1.0F, 1.0F); +// super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); +// } +// else +// { +// this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.2F, 1.0F); +// super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); +// } +// } +// +// @Override +// public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) +// { +// this.setBlockBoundsBasedOnState(worldIn, pos); +// return super.getCollisionBoundingBox(worldIn, pos, state); +// } +// +// @Override +// @SideOnly(Side.CLIENT) +// public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) +// { +// this.setBlockBoundsBasedOnState(worldIn, pos); +// return super.getSelectedBoundingBox(worldIn, pos); +// } @Override public boolean canDropFromExplosion(Explosion par1Explosion) @@ -122,7 +120,7 @@ public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos po if (mainBlockPosition != null) { - return worldIn.getBlockState(mainBlockPosition).getBlock().getBlockHardness(worldIn, mainBlockPosition); + return worldIn.getBlockState(mainBlockPosition).getBlock().getBlockHardness(worldIn.getBlockState(mainBlockPosition), worldIn, mainBlockPosition); } } @@ -158,7 +156,7 @@ public int quantityDropped(Random par1Random) @Override public EnumBlockRenderType getRenderType(IBlockState state) { - return -1; + return EnumBlockRenderType.INVISIBLE; } @Override @@ -190,7 +188,7 @@ public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World wo if (Blocks.AIR != mainBlockID) { - return mainBlockID.getPickBlock(target, world, mainBlockPosition, player); + return mainBlockID.getPickBlock(world.getBlockState(mainBlockPosition), target, world, mainBlockPosition, player); } } @@ -198,31 +196,31 @@ public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World wo } @Override - public EnumFacing getBedDirection(IBlockAccess world, BlockPos pos) + public EnumFacing getBedDirection(IBlockState state, IBlockAccess world, BlockPos pos) { TileEntity tileEntity = world.getTileEntity(pos); BlockPos mainBlockPosition = ((TileEntityTelepadFake) tileEntity).mainBlockPosition; if (mainBlockPosition != null) { - return world.getBlockState(pos).getBlock().getBedDirection(world, mainBlockPosition); + return world.getBlockState(pos).getBlock().getBedDirection(world.getBlockState(mainBlockPosition), world, mainBlockPosition); } - return (EnumFacing) getActualState(world.getBlockState(pos), world, pos).getValue(BlockDirectional.FACING); + return getActualState(world.getBlockState(pos), world, pos).getValue(BlockDirectional.FACING); } @Override - public boolean isBed(IBlockAccess world, BlockPos pos, Entity player) + public boolean isBed(IBlockState state, IBlockAccess world, BlockPos pos, Entity player) { TileEntity tileEntity = world.getTileEntity(pos); BlockPos mainBlockPosition = ((TileEntityTelepadFake) tileEntity).mainBlockPosition; if (mainBlockPosition != null) { - return world.getBlockState(pos).getBlock().isBed(world, mainBlockPosition, player); + return world.getBlockState(pos).getBlock().isBed(world.getBlockState(mainBlockPosition), world, mainBlockPosition, player); } - return super.isBed(world, pos, player); + return super.isBed(state, world, pos, player); } @Override @@ -242,8 +240,7 @@ public void setBedOccupied(IBlockAccess world, BlockPos pos, EntityPlayer player } @Override - @SideOnly(Side.CLIENT) - public boolean addHitEffects(World worldObj, MovingObjectPosition target, EffectRenderer effectRenderer) + public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, ParticleManager manager) { TileEntity tileEntity = worldObj.getTileEntity(target.getBlockPos()); @@ -253,18 +250,11 @@ public boolean addHitEffects(World worldObj, MovingObjectPosition target, Effect if (mainBlockPosition != null) { - effectRenderer.addBlockHitEffects(mainBlockPosition, target); + manager.addBlockHitEffects(mainBlockPosition, target); } } - return super.addHitEffects(worldObj, target, effectRenderer); - } - - @Override - @SideOnly(Side.CLIENT) - public boolean addDestroyEffects(World world, BlockPos pos, EffectRenderer effectRenderer) - { - return super.addDestroyEffects(world, pos, effectRenderer); + return super.addHitEffects(state, worldObj, target, manager); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java index cfdd3ebc8b..b4cfa15f0e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java @@ -12,18 +12,20 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.core.util.OxygenUtil; -import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -117,9 +119,10 @@ public boolean isFullCube(IBlockState state) return false; } - public boolean isNormalCube(Block block) + @Override + public boolean isNormalCube(IBlockState state) { - return block.getMaterial().blocksMovement() && block.isFullCube(); + return state.getBlock().getMaterial(state).blocksMovement() && state.getBlock().isFullCube(state); } @Override @@ -154,122 +157,122 @@ public NetworkType getNetworkType(IBlockState state) return null; } - @Override - public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) - { - TileEntity tileEntity = worldIn.getTileEntity(pos); - TileEntity[] connectable = new TileEntity[6]; - - if (tileEntity != null) - { - IBlockState state = worldIn.getBlockState(pos); - if (this.getNetworkType(state) != null) - { - switch (this.getNetworkType(state)) - { - case FLUID: - connectable = OxygenUtil.getAdjacentFluidConnections(tileEntity); - break; - case POWER: - connectable = EnergyUtil.getAdjacentPowerConnections(tileEntity); - break; - default: - break; - } - } - - float minX = 0.0F; - float minY = 0.32F; - float minZ = 0.0F; - float maxX = 1.0F; - float maxY = 1.0F; - float maxZ = 1.0F; - - if (connectable[0] != null) - { - minY = 0.0F; - } - - this.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ); - } - } - - private void addCollisionBox(World worldIn, BlockPos pos, AxisAlignedBB aabb, List list) - { - AxisAlignedBB mask1 = this.getCollisionBoundingBox(worldIn, pos, worldIn.getBlockState(pos)); - - if (mask1 != null && aabb.intersectsWith(mask1)) - { - list.add(mask1); - } - } - - @SuppressWarnings("rawtypes") - @Override - public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) - { - TileEntity tileEntity = worldIn.getTileEntity(pos); - TileEntity[] connectable = new TileEntity[6]; - - if (this.getNetworkType(state) != null) - { - switch (this.getNetworkType(state)) - { - case FLUID: - connectable = OxygenUtil.getAdjacentFluidConnections(tileEntity); - break; - case POWER: - connectable = EnergyUtil.getAdjacentPowerConnections(tileEntity); - break; - default: - break; - } - } - - this.setBlockBounds((float) this.minVector.x, (float) this.minVector.y, (float) this.minVector.z, (float) this.maxVector.x, (float) this.maxVector.y, (float) this.maxVector.z); - this.addCollisionBox(worldIn, pos, mask, list); - - this.setBlockBounds(0.0F, 0.9F, 0.0F, 1.0F, 1.0F, 1.0F); - this.addCollisionBox(worldIn, pos, mask, list); - - if (connectable[4] != null) - { - this.setBlockBounds(0, (float) this.minVector.y, (float) this.minVector.z, (float) this.maxVector.x, (float) this.maxVector.y, (float) this.maxVector.z); - this.addCollisionBox(worldIn, pos, mask, list); - } - - if (connectable[5] != null) - { - this.setBlockBounds((float) this.minVector.x, (float) this.minVector.y, (float) this.minVector.z, 1, (float) this.maxVector.y, (float) this.maxVector.z); - this.addCollisionBox(worldIn, pos, mask, list); - } - - if (connectable[0] != null) - { - this.setBlockBounds((float) this.minVector.x, 0, (float) this.minVector.z, (float) this.maxVector.x, (float) this.maxVector.y, (float) this.maxVector.z); - this.addCollisionBox(worldIn, pos, mask, list); - } - - if (connectable[1] != null) - { - this.setBlockBounds((float) this.minVector.x, (float) this.minVector.y, (float) this.minVector.z, (float) this.maxVector.x, 1, (float) this.maxVector.z); - this.addCollisionBox(worldIn, pos, mask, list); - } - - if (connectable[2] != null) - { - this.setBlockBounds((float) this.minVector.x, (float) this.minVector.y, 0, (float) this.maxVector.x, (float) this.maxVector.y, (float) this.maxVector.z); - this.addCollisionBox(worldIn, pos, mask, list); - } - - if (connectable[3] != null) - { - this.setBlockBounds((float) this.minVector.x, (float) this.minVector.y, (float) this.minVector.z, (float) this.maxVector.x, (float) this.maxVector.y, 1); - this.addCollisionBox(worldIn, pos, mask, list); - } - - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } +// @Override +// public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) +// { +// TileEntity tileEntity = worldIn.getTileEntity(pos); +// TileEntity[] connectable = new TileEntity[6]; +// +// if (tileEntity != null) +// { +// IBlockState state = worldIn.getBlockState(pos); +// if (this.getNetworkType(state) != null) +// { +// switch (this.getNetworkType(state)) +// { +// case FLUID: +// connectable = OxygenUtil.getAdjacentFluidConnections(tileEntity); +// break; +// case POWER: +// connectable = EnergyUtil.getAdjacentPowerConnections(tileEntity); +// break; +// default: +// break; +// } +// } +// +// float minX = 0.0F; +// float minY = 0.32F; +// float minZ = 0.0F; +// float maxX = 1.0F; +// float maxY = 1.0F; +// float maxZ = 1.0F; +// +// if (connectable[0] != null) +// { +// minY = 0.0F; +// } +// +// this.setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ); +// } +// } + +// private void addCollisionBox(World worldIn, BlockPos pos, AxisAlignedBB aabb, List list) +// { +// AxisAlignedBB mask1 = this.getCollisionBoundingBox(worldIn, pos, worldIn.getBlockState(pos)); +// +// if (mask1 != null && aabb.intersectsWith(mask1)) +// { +// list.add(mask1); +// } +// } + +// @SuppressWarnings("rawtypes") +// @Override +// public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity) +// { +// TileEntity tileEntity = worldIn.getTileEntity(pos); +// TileEntity[] connectable = new TileEntity[6]; +// +// if (this.getNetworkType(state) != null) +// { +// switch (this.getNetworkType(state)) +// { +// case FLUID: +// connectable = OxygenUtil.getAdjacentFluidConnections(tileEntity); +// break; +// case POWER: +// connectable = EnergyUtil.getAdjacentPowerConnections(tileEntity); +// break; +// default: +// break; +// } +// } +// +// this.setBlockBounds((float) this.minVector.x, (float) this.minVector.y, (float) this.minVector.z, (float) this.maxVector.x, (float) this.maxVector.y, (float) this.maxVector.z); +// this.addCollisionBox(worldIn, pos, mask, list); +// +// this.setBlockBounds(0.0F, 0.9F, 0.0F, 1.0F, 1.0F, 1.0F); +// this.addCollisionBox(worldIn, pos, mask, list); +// +// if (connectable[4] != null) +// { +// this.setBlockBounds(0, (float) this.minVector.y, (float) this.minVector.z, (float) this.maxVector.x, (float) this.maxVector.y, (float) this.maxVector.z); +// this.addCollisionBox(worldIn, pos, mask, list); +// } +// +// if (connectable[5] != null) +// { +// this.setBlockBounds((float) this.minVector.x, (float) this.minVector.y, (float) this.minVector.z, 1, (float) this.maxVector.y, (float) this.maxVector.z); +// this.addCollisionBox(worldIn, pos, mask, list); +// } +// +// if (connectable[0] != null) +// { +// this.setBlockBounds((float) this.minVector.x, 0, (float) this.minVector.z, (float) this.maxVector.x, (float) this.maxVector.y, (float) this.maxVector.z); +// this.addCollisionBox(worldIn, pos, mask, list); +// } +// +// if (connectable[1] != null) +// { +// this.setBlockBounds((float) this.minVector.x, (float) this.minVector.y, (float) this.minVector.z, (float) this.maxVector.x, 1, (float) this.maxVector.z); +// this.addCollisionBox(worldIn, pos, mask, list); +// } +// +// if (connectable[2] != null) +// { +// this.setBlockBounds((float) this.minVector.x, (float) this.minVector.y, 0, (float) this.maxVector.x, (float) this.maxVector.y, (float) this.maxVector.z); +// this.addCollisionBox(worldIn, pos, mask, list); +// } +// +// if (connectable[3] != null) +// { +// this.setBlockBounds((float) this.minVector.x, (float) this.minVector.y, (float) this.minVector.z, (float) this.maxVector.x, (float) this.maxVector.y, 1); +// this.addCollisionBox(worldIn, pos, mask, list); +// } +// +// this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); +// } @Override public String getShiftDescription(int meta) @@ -316,11 +319,12 @@ public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, Block if (state.getValue(WALKWAY_TYPE) == EnumWalkwayType.WALKWAY) { - Block block = worldIn.getBlockState(pos.offset(direction)).getBlock(); + BlockPos pos1 = pos.offset(direction); + IBlockState state1 = worldIn.getBlockState(pos1); - if (!block.isAir(worldIn, pos.offset(direction))) + if (!state1.getBlock().isAir(state1, worldIn, pos1)) { - connectable[direction.ordinal()] = block; + connectable[direction.ordinal()] = state1.getBlock(); } } else if (state.getValue(WALKWAY_TYPE) == EnumWalkwayType.WALKWAY_PIPE) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/SkyProviderAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/SkyProviderAsteroids.java index 113ea75bff..2f175cf19e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/SkyProviderAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/SkyProviderAsteroids.java @@ -11,9 +11,9 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3d; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; import net.minecraftforge.client.IRenderHandler; import net.minecraftforge.fml.client.FMLClientHandler; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/fx/EntityFXTeleport.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/fx/EntityFXTeleport.java index cd5e8114eb..e25832a684 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/fx/EntityFXTeleport.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/fx/EntityFXTeleport.java @@ -2,7 +2,7 @@ import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.planets.asteroids.tile.TileEntityShortRangeTelepad; -import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.entity.Entity; import net.minecraft.world.World; @@ -12,7 +12,7 @@ import java.lang.ref.WeakReference; @SideOnly(Side.CLIENT) -public class EntityFXTeleport extends EntityFX +public class EntityFXTeleport extends Particle { private float portalParticleScale; private double portalPosX; @@ -32,7 +32,8 @@ public EntityFXTeleport(World par1World, Vector3 position, Vector3 motion, TileE this.portalPosZ = this.posZ = position.z; this.portalParticleScale = this.particleScale = this.rand.nextFloat() * 0.2F + 0.5F; this.particleMaxAge = (int) (Math.random() * 10.0D) + 40; - this.noClip = true; + this.canCollide = false; + this.canCollide = false; this.setParticleTextureIndex((int) (Math.random() * 8.0D)); this.telepad = new WeakReference(telepad); this.direction = direction; @@ -68,14 +69,14 @@ public int getBrightnessForRender(float par1) return j | k << 16; } - @Override - public float getBrightness(float par1) - { - float f1 = super.getBrightness(par1); - float f2 = (float) this.particleAge / (float) this.particleMaxAge; - f2 = f2 * f2 * f2 * f2; - return f1 * (1.0F - f2) + f2; - } +// @Override +// public float getBrightness(float par1) +// { +// float f1 = super.getBrightness(par1); +// float f2 = (float) this.particleAge / (float) this.particleMaxAge; +// f2 = f2 * f2 * f2 * f2; +// return f1 * (1.0F - f2) + f2; +// } @Override public void onUpdate() @@ -103,7 +104,7 @@ public void onUpdate() if (this.particleAge++ >= this.particleMaxAge) { - this.setDead(); + this.setExpired(); } } } \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderGrapple.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderGrapple.java index 8dd1bddb8d..32b468c4bb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderGrapple.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderGrapple.java @@ -7,7 +7,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3d; +import net.minecraft.util.math.Vec3d; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderTier3Rocket.java index 98ce919243..1f26c811fe 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderTier3Rocket.java @@ -12,13 +12,13 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.resources.model.ModelResourceLocation; -import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.client.model.pipeline.LightUtil; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; @@ -100,13 +100,7 @@ public void doRender(EntityTier3Rocket entity, double par2, double par4, double GL11.glScalef(-1.0F, -1.0F, 1.0F); GL11.glScalef(0.8F, 0.8F, 0.8F); - Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer worldrenderer = tessellator.getBuffer(); - - worldrenderer.begin(GL11.GL_QUADS, rocketModel.getFormat()); - ClientUtil.drawBakedModel(rocketModel); - tessellator.draw(); Vector3 teamColor = ClientUtil.updateTeamColor(FMLClientHandler.instance().getClient().thePlayer.getName(), true); if (teamColor != null) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java index 52303a59af..c99be15843 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java @@ -2,8 +2,8 @@ import micdoodle8.mods.galacticraft.core.util.ClientUtil; import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.resources.model.IBakedModel; import javax.vecmath.Matrix4f; import javax.vecmath.Vector3f; @@ -46,7 +46,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.FIRST_PERSON) + if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) { Vector3f trans = new Vector3f(0.5F, -0.2F, -1.1F); Matrix4f ret = new Matrix4f(); @@ -70,7 +70,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.THIRD_PERSON) + if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) { Vector3f trans = new Vector3f(-0.2F, -0.0F, 0.7F); Matrix4f ret = new Matrix4f(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReceiver.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReceiver.java index 648e32b6b2..14c4996913 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReceiver.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReceiver.java @@ -1,8 +1,8 @@ package micdoodle8.mods.galacticraft.planets.asteroids.client.render.item; import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.resources.model.IBakedModel; import javax.vecmath.Matrix4f; import javax.vecmath.Vector3f; @@ -31,7 +31,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.FIRST_PERSON) + if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) { Matrix4f ret = new Matrix4f(); ret.setIdentity(); @@ -45,7 +45,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.THIRD_PERSON) + if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) { Matrix4f ret = new Matrix4f(); ret.setIdentity(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReflector.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReflector.java index 4a00a89ee3..419f884acd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReflector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReflector.java @@ -1,8 +1,8 @@ package micdoodle8.mods.galacticraft.planets.asteroids.client.render.item; import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.resources.model.IBakedModel; import javax.vecmath.Matrix4f; import javax.vecmath.Vector3f; @@ -28,7 +28,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.FIRST_PERSON) + if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) { Matrix4f ret = new Matrix4f(); ret.setIdentity(); @@ -42,7 +42,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.THIRD_PERSON) + if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) { Matrix4f ret = new Matrix4f(); ret.setIdentity(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java index 5d0bafe083..8f996d3d92 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java @@ -2,8 +2,8 @@ import micdoodle8.mods.galacticraft.core.util.ClientUtil; import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.resources.model.IBakedModel; import javax.vecmath.Matrix4f; import javax.vecmath.Vector3f; @@ -52,7 +52,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.FIRST_PERSON) + if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) { Vector3f trans = new Vector3f(0.5F, 0.5F, -1.5F); Matrix4f ret = new Matrix4f(); @@ -79,7 +79,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.THIRD_PERSON) + if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) { Vector3f trans = new Vector3f(0.3F, -0.5F, -0.8F); Matrix4f ret = new Matrix4f(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java index 63dc98c230..80a47863b1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java @@ -1,8 +1,8 @@ package micdoodle8.mods.galacticraft.planets.asteroids.client.render.item; import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.resources.model.IBakedModel; import javax.vecmath.Matrix4f; import javax.vecmath.Vector3f; @@ -34,7 +34,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.THIRD_PERSON) + if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) { Matrix4f ret = new Matrix4f(); ret.setIdentity(); @@ -52,7 +52,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.FIRST_PERSON) + if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) { Matrix4f ret = new Matrix4f(); ret.setIdentity(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java index 882233c435..ebb3deefd4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java @@ -2,8 +2,8 @@ import micdoodle8.mods.galacticraft.core.util.ClientUtil; import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.resources.model.IBakedModel; import javax.vecmath.Matrix4f; import javax.vecmath.Vector3f; @@ -52,7 +52,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.FIRST_PERSON) + if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) { Vector3f trans = new Vector3f(0.5F, 0.5F, -1.2F); Matrix4f ret = new Matrix4f(); @@ -76,7 +76,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.THIRD_PERSON) + if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) { Vector3f trans = new Vector3f(0.0F, -0.4F, -0.3F); Matrix4f ret = new Matrix4f(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelTelepad.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelTelepad.java index 7d2303e440..d90e29e112 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelTelepad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelTelepad.java @@ -1,8 +1,8 @@ package micdoodle8.mods.galacticraft.planets.asteroids.client.render.item; import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.resources.model.IBakedModel; import javax.vecmath.Matrix4f; import javax.vecmath.Vector3f; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/tile/TileEntityMinerBaseRenderer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/tile/TileEntityMinerBaseRenderer.java index 1b7134f9c2..09fb41878c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/tile/TileEntityMinerBaseRenderer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/tile/TileEntityMinerBaseRenderer.java @@ -9,16 +9,16 @@ import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.resources.model.IBakedModel; import net.minecraft.util.ResourceLocation; import net.minecraft.world.EnumSkyBlock; import net.minecraftforge.client.model.ModelLoaderRegistry; -import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.client.model.obj.OBJModel; +import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.opengl.GL11; @@ -109,7 +109,7 @@ public void renderTileEntityAt(TileEntityMinerBase tile, double x, double y, dou Tessellator tessellator = Tessellator.getInstance(); tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); GlStateManager.translate(-tile.getPos().getX(), -tile.getPos().getY(), -tile.getPos().getZ()); - Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModel(tile.getWorld(), getBakedModel(), tile.getWorld().getBlockState(tile.getPos()), tile.getPos(), tessellator.getBuffer()); + Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModel(tile.getWorld(), getBakedModel(), tile.getWorld().getBlockState(tile.getPos()), tile.getPos(), tessellator.getBuffer(), false); tessellator.draw(); RenderHelper.enableStandardItemLighting(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/sounds/SoundUpdaterMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/sounds/SoundUpdaterMiner.java index 016482f712..e5ed71454f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/sounds/SoundUpdaterMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/sounds/SoundUpdaterMiner.java @@ -1,11 +1,11 @@ package micdoodle8.mods.galacticraft.planets.asteroids.client.sounds; -import micdoodle8.mods.galacticraft.core.Constants; +import micdoodle8.mods.galacticraft.core.client.sounds.GCSounds; import micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityAstroMiner; import net.minecraft.client.audio.MovingSound; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; -import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; /** * This file is part of the Galacticraft project @@ -22,7 +22,7 @@ public class SoundUpdaterMiner extends MovingSound public SoundUpdaterMiner(EntityPlayerSP par1EntityPlayerSP, EntityAstroMiner par2Entity) { - super(new ResourceLocation(Constants.TEXTURE_PREFIX + "entity.astrominer")); + super(GCSounds.astroMiner, SoundCategory.AMBIENT); this.theRocket = par2Entity; this.thePlayer = par1EntityPlayerSP; this.volume = 0.00001F; //If it's zero it won't start playing diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/AsteroidSaveData.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/AsteroidSaveData.java index e375a53bd3..2d03beea3c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/AsteroidSaveData.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/AsteroidSaveData.java @@ -24,5 +24,6 @@ public void readFromNBT(NBTTagCompound nbt) public NBTTagCompound writeToNBT(NBTTagCompound nbt) { nbt.setTag("asteroids", this.datacompound); + return nbt; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/ShortRangeTelepadHandler.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/ShortRangeTelepadHandler.java index 73739b1127..fbe96f9b32 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/ShortRangeTelepadHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/ShortRangeTelepadHandler.java @@ -87,6 +87,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) } nbt.setTag("TelepadList", tagList); + return nbt; } public static void addShortRangeTelepad(TileEntityShortRangeTelepad telepad) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java index 3086868289..19b56370b7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java @@ -6,7 +6,8 @@ import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.api.world.ITeleportType; import micdoodle8.mods.galacticraft.core.GCItems; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.core.util.GCLog; import micdoodle8.mods.galacticraft.planets.asteroids.blocks.AsteroidBlocks; @@ -43,9 +44,9 @@ public Vector3 getPlayerSpawnLocation(WorldServer world, EntityPlayerMP player) { if (player != null) { - GCPlayerStats stats = GCPlayerStats.get(player); - int x = MathHelper.floor_double(stats.coordsTeleportedFromX); - int z = MathHelper.floor_double(stats.coordsTeleportedFromZ); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + int x = MathHelper.floor_double(stats.getCoordsTeleportedFromX()); + int z = MathHelper.floor_double(stats.getCoordsTeleportedFromZ()); int attemptCount = 0; @@ -73,8 +74,8 @@ public Vector3 getPlayerSpawnLocation(WorldServer world, EntityPlayerMP player) { GCLog.info("Testing asteroid at x" + (bv3.x) + " y" + (bv3.y) + " z" + bv3.z); } - this.loadChunksAround(bv3.x, bv3.z, 2, world.theChunkProviderServer); - this.loadChunksAround(bv3.x, bv3.z, -3, world.theChunkProviderServer); + this.loadChunksAround(bv3.x, bv3.z, 2, world.getChunkProvider()); + this.loadChunksAround(bv3.x, bv3.z, -3, world.getChunkProvider()); if (goodAsteroidEntry(world, bv3.x, bv3.y, bv3.z)) { @@ -288,9 +289,9 @@ public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boole { if (!ridingAutoRocket && player != null) { - GCPlayerStats stats = GCPlayerStats.get(player); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); - if (stats.teleportCooldown <= 0) + if (stats.getTeleportCooldown() <= 0) { if (player.capabilities.isFlying) { @@ -304,7 +305,7 @@ public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boole newWorld.spawnEntityInWorld(entryPod); } - stats.teleportCooldown = 10; + stats.setTeleportCooldown(10); } } } @@ -312,35 +313,35 @@ public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boole @Override public void setupAdventureSpawn(EntityPlayerMP player) { - GCPlayerStats stats = GCPlayerStats.get(player); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); SchematicRegistry.unlockNewPage(player, new ItemStack(GCItems.schematic, 1, 1)); //Knows how to build T2 rocket SchematicRegistry.unlockNewPage(player, new ItemStack(MarsItems.schematic, 1, 0)); //Knows how to build T3 rocket SchematicRegistry.unlockNewPage(player, new ItemStack(MarsItems.schematic, 1, 2)); //Knows how to build Astro Miner - stats.rocketStacks = new ItemStack[20]; - stats.fuelLevel = 1000; + stats.setRocketStacks(new ItemStack[20]); + stats.setFuelLevel(1000); int i = 0; - stats.rocketStacks[i++] = new ItemStack(GCItems.oxMask); - stats.rocketStacks[i++] = new ItemStack(GCItems.oxygenGear); - stats.rocketStacks[i++] = new ItemStack(GCItems.oxTankMedium); - stats.rocketStacks[i++] = new ItemStack(GCItems.oxTankHeavy); - stats.rocketStacks[i++] = new ItemStack(GCItems.oxTankHeavy); - stats.rocketStacks[i++] = new ItemStack(AsteroidsItems.canisterLOX); - stats.rocketStacks[i++] = new ItemStack(AsteroidsItems.canisterLOX); - stats.rocketStacks[i++] = new ItemStack(AsteroidsItems.canisterLOX); - stats.rocketStacks[i++] = new ItemStack(AsteroidsItems.basicItem, 32, 7); - stats.rocketStacks[i++] = new ItemStack(Blocks.glass_pane, 16); - stats.rocketStacks[i++] = new ItemStack(Blocks.planks, 32, 2); - stats.rocketStacks[i++] = new ItemStack(MarsItems.marsItemBasic, 16, 2); //Desh ingot - stats.rocketStacks[i++] = new ItemStack(GCItems.basicItem, 8, 13); //Basic Wafer - stats.rocketStacks[i++] = new ItemStack(GCItems.basicItem, 2, 1); //Solar Panels - stats.rocketStacks[i++] = new ItemStack(GCItems.basicItem, 16, 15); //Canned food - stats.rocketStacks[i++] = new ItemStack(Items.egg, 12); - - stats.rocketStacks[i++] = new ItemStack(Items.spawn_egg, 2, EntityList.classToIDMapping.get(EntityCow.class)); - stats.rocketStacks[i++] = new ItemStack(Items.potionitem, 4, 8262); //Night Vision Potion - stats.rocketStacks[i++] = new ItemStack(MarsBlocks.machine, 1, 4); //Cryogenic Chamber - stats.rocketStacks[i++] = new ItemStack(MarsItems.rocketMars, 1, IRocketType.EnumRocketType.INVENTORY36.ordinal()); - //stats.rocketStacks[15] = new ItemStack(GCBlocks.brightLamp, 4); - //stats.rocketStacks[16] = new ItemStack(GCBlocks.aluminumWire, 32); + stats.getRocketStacks()[i++] = new ItemStack(GCItems.oxMask); + stats.getRocketStacks()[i++] = new ItemStack(GCItems.oxygenGear); + stats.getRocketStacks()[i++] = new ItemStack(GCItems.oxTankMedium); + stats.getRocketStacks()[i++] = new ItemStack(GCItems.oxTankHeavy); + stats.getRocketStacks()[i++] = new ItemStack(GCItems.oxTankHeavy); + stats.getRocketStacks()[i++] = new ItemStack(AsteroidsItems.canisterLOX); + stats.getRocketStacks()[i++] = new ItemStack(AsteroidsItems.canisterLOX); + stats.getRocketStacks()[i++] = new ItemStack(AsteroidsItems.canisterLOX); + stats.getRocketStacks()[i++] = new ItemStack(AsteroidsItems.basicItem, 32, 7); + stats.getRocketStacks()[i++] = new ItemStack(Blocks.GLASS_PANE, 16); + stats.getRocketStacks()[i++] = new ItemStack(Blocks.PLANKS, 32, 2); + stats.getRocketStacks()[i++] = new ItemStack(MarsItems.marsItemBasic, 16, 2); //Desh ingot + stats.getRocketStacks()[i++] = new ItemStack(GCItems.basicItem, 8, 13); //Basic Wafer + stats.getRocketStacks()[i++] = new ItemStack(GCItems.basicItem, 2, 1); //Solar Panels + stats.getRocketStacks()[i++] = new ItemStack(GCItems.basicItem, 16, 15); //Canned food + stats.getRocketStacks()[i++] = new ItemStack(Items.EGG, 12); + + stats.getRocketStacks()[i++] = new ItemStack(Items.SPAWN_EGG, 2, EntityList.CLASS_TO_ID.get(EntityCow.class)); + stats.getRocketStacks()[i++] = new ItemStack(Items.POTIONITEM, 4, 8262); //Night Vision Potion + stats.getRocketStacks()[i++] = new ItemStack(MarsBlocks.machine, 1, 4); //Cryogenic Chamber + stats.getRocketStacks()[i++] = new ItemStack(MarsItems.rocketMars, 1, IRocketType.EnumRocketType.INVENTORY36.ordinal()); + //stats.getRocketStacks()[15] = new ItemStack(GCBlocks.brightLamp, 4); + //stats.getRocketStacks()[16] = new ItemStack(GCBlocks.aluminumWire, 32); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/WorldProviderAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/WorldProviderAsteroids.java index 1fbbaea157..86afddd784 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/WorldProviderAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/WorldProviderAsteroids.java @@ -8,15 +8,17 @@ import micdoodle8.mods.galacticraft.core.event.EventHandlerGC; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.core.util.GCLog; +import micdoodle8.mods.galacticraft.planets.GCPlanetDimensions; import micdoodle8.mods.galacticraft.planets.asteroids.AsteroidsModule; import micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityAstroMiner; -import micdoodle8.mods.galacticraft.planets.asteroids.world.gen.ChunkProviderAsteroids; import micdoodle8.mods.galacticraft.planets.asteroids.world.gen.BiomeProviderAsteroids; +import micdoodle8.mods.galacticraft.planets.asteroids.world.gen.ChunkProviderAsteroids; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.world.biome.WorldChunkManager; -import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.DimensionType; +import net.minecraft.world.biome.BiomeProvider; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -75,13 +77,13 @@ public boolean isDaytime() } @Override - public Class getChunkProviderClass() + public Class getChunkProviderClass() { return ChunkProviderAsteroids.class; } @Override - public Class getBiomeProviderClass() + public Class getBiomeProviderClass() { return BiomeProviderAsteroids.class; } @@ -154,7 +156,7 @@ public boolean canRespawnHere() @Override public int getRespawnDimension(EntityPlayerMP player) { - return this.shouldForceRespawn() ? this.dimensionId : 0; + return this.shouldForceRespawn() ? this.getDimension() : 0; } @Override @@ -443,9 +445,9 @@ public int getActualHeight() } @Override - public void registerWorldChunkManager() + protected void createBiomeProvider() { - super.registerWorldChunkManager(); + super.createBiomeProvider(); this.hasNoSky = true; } @@ -460,12 +462,6 @@ public double getSolarEnergyMultiplier() return this.solarMultiplier; } - @Override - public String getInternalNameSuffix() - { - return "_asteroids"; - } - private static class AsteroidData { protected BlockVec3 centre; @@ -562,4 +558,10 @@ public boolean shouldCorrodeArmor() { return false; } + + @Override + public DimensionType getDimensionType() + { + return GCPlanetDimensions.ASTEROIDS; + } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java index 08b7185ec0..9730d40a72 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java @@ -9,7 +9,9 @@ import micdoodle8.mods.galacticraft.core.GCBlocks; import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.EntityFlag; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.network.IPacketReceiver; import micdoodle8.mods.galacticraft.core.network.PacketDynamic; import micdoodle8.mods.galacticraft.core.util.*; @@ -36,8 +38,17 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.datasync.DataParameter; +import net.minecraft.network.datasync.DataSerializers; +import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ITickable; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.IPlantable; @@ -53,6 +64,8 @@ public class EntityAstroMiner extends Entity implements IInventory, IPacketReceiver, IEntityNoisy, IAntiGrav, ITelemetry { + private static final DataParameter DAMAGE = EntityDataManager.createKey(EntityFlag.class, DataSerializers.FLOAT); + public static final int MINE_LENGTH = 24; public static final int MINE_LENGTH_AST = 12; private static final int MAXENERGY = 12000; @@ -169,17 +182,17 @@ public class EntityAstroMiner extends Entity implements IInventory, IPacketRecei // railtrack, levers, redstone dust, GC walkways, //Anything with a tileEntity will also be avoided: // spawners, chests, oxygen pipes, hydrogen pipes, wires - noMineList.add(Blocks.bedrock); - noMineList.add(Blocks.lava); - noMineList.add(Blocks.mossy_cobblestone); - noMineList.add(Blocks.end_portal); - noMineList.add(Blocks.end_portal_frame); - noMineList.add(Blocks.portal); - noMineList.add(Blocks.stonebrick); - noMineList.add(Blocks.farmland); - noMineList.add(Blocks.rail); - noMineList.add(Blocks.lever); - noMineList.add(Blocks.redstone_wire); + noMineList.add(Blocks.BEDROCK); + noMineList.add(Blocks.LAVA); + noMineList.add(Blocks.MOSSY_COBBLESTONE); + noMineList.add(Blocks.END_PORTAL); + noMineList.add(Blocks.END_PORTAL_FRAME); + noMineList.add(Blocks.PORTAL); + noMineList.add(Blocks.STONEBRICK); + noMineList.add(Blocks.FARMLAND); + noMineList.add(Blocks.RAIL); + noMineList.add(Blocks.LEVER); + noMineList.add(Blocks.REDSTONE_WIRE); noMineList.add(AsteroidBlocks.blockWalkway); //TODO: //Add configurable blacklist @@ -199,7 +212,6 @@ public EntityAstroMiner(World world) this.preventEntitySpawning = true; this.ignoreFrustumCheck = true; this.isImmuneToFire = true; - this.renderDistanceWeight = 5.0D; this.width = cLENGTH; this.height = cWIDTH; this.setSize(cLENGTH, cWIDTH); @@ -210,10 +222,24 @@ public EntityAstroMiner(World world) this.noClip = true; } + @Override + public boolean isInRangeToRenderDist(double distance) + { + double d0 = this.getEntityBoundingBox().getAverageEdgeLength(); + + if (Double.isNaN(d0)) + { + d0 = 1.0D; + } + + d0 = d0 * 64.0D * 5.0; + return distance < d0 * d0; + } + @Override protected void entityInit() { - this.dataManager.addObject(19, new Float(0.0F)); + this.dataManager.register(DAMAGE, 0.0F); } @Override @@ -1422,7 +1448,7 @@ private boolean tryMineBlock(BlockPos pos) //Can move through liquids including flowing lava IBlockState state = this.worldObj.getBlockState(pos); Block b = state.getBlock(); - if (b.getMaterial() == Material.AIR) + if (b.getMaterial(state) == Material.AIR) { return false; } @@ -1444,14 +1470,14 @@ private boolean tryMineBlock(BlockPos pos) boolean gtFlag = false; if (b != GCBlocks.fallenMeteor) { - if (b instanceof IPlantable && b != Blocks.tallgrass && b != Blocks.deadbush && b != Blocks.double_plant && b != Blocks.waterlily && !(b instanceof BlockFlower)) + if (b instanceof IPlantable && b != Blocks.TALLGRASS && b != Blocks.DEADBUSH && b != Blocks.DOUBLE_PLANT && b != Blocks.WATERLILY && !(b instanceof BlockFlower)) { blockingBlock.block = b; blockingBlock.meta = b.getMetaFromState(state); return true; } int meta = b.getMetaFromState(state); - if (b.getBlockHardness(this.worldObj, pos) < 0) + if (b.getBlockHardness(state, this.worldObj, pos) < 0) { blockingBlock.block = b; blockingBlock.meta = meta; @@ -1476,7 +1502,7 @@ private boolean tryMineBlock(BlockPos pos) { return false; } - int result = ForgeHooks.onBlockBreakEvent(this.worldObj, this.playerMP.theItemInWorldManager.getGameType(), this.playerMP, pos); + int result = ForgeHooks.onBlockBreakEvent(this.worldObj, this.playerMP.interactionManager.getGameType(), this.playerMP, pos); if (result < 0) { return true; @@ -1534,7 +1560,7 @@ private boolean tryBlockClient(BlockPos pos) //Add minable blocks to the laser fx list IBlockState state = this.worldObj.getBlockState(pos); Block b = state.getBlock(); - if (b.getMaterial() == Material.AIR) + if (b.getMaterial(state) == Material.AIR) { return false; } @@ -1554,8 +1580,7 @@ private boolean tryBlockClient(BlockPos pos) { return true; } - int meta = b.getMetaFromState(state); - if (b.hasTileEntity(state) || b.getBlockHardness(this.worldObj, pos) < 0) + if (b.hasTileEntity(state) || b.getBlockHardness(state, this.worldObj, pos) < 0) { return true; } @@ -2125,12 +2150,12 @@ public void performHurtAnimation() public float getDamage() { - return this.dataManager.getWatchableObjectFloat(19); + return this.dataManager.get(DAMAGE); } public void setDamage(float p_70492_1_) { - this.dataManager.set(19, Float.valueOf(p_70492_1_)); + this.dataManager.set(DAMAGE, Float.valueOf(p_70492_1_)); } @Override @@ -2187,10 +2212,11 @@ public void setDead() { if (!this.worldObj.isRemote && this.playerMP != null && !this.spawnedInCreative) { - int astroCount = GCPlayerStats.get(this.playerMP).astroMinerCount; + IStatsCapability stats = this.playerMP.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + int astroCount = stats.getAstroMinerCount(); if (astroCount > 0) { - GCPlayerStats.get(this.playerMP).astroMinerCount--; + stats.setAstroMinerCount(astroCount - 1); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java index 821c46127f..ca0bcd0983 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityEntryPod.java @@ -6,10 +6,12 @@ import micdoodle8.mods.galacticraft.core.entities.EntityLanderBase; import micdoodle8.mods.galacticraft.core.entities.IScaleableFuelLevel; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; -import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.Particle; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; @@ -55,7 +57,7 @@ public Map getParticleMap() } @Override - public EntityFX getParticle(Random rand, double x, double y, double z, double motX, double motY, double motZ) + public Particle getParticle(Random rand, double x, double y, double z, double motX, double motY, double motZ) { return null; } @@ -172,27 +174,27 @@ public boolean processInitialInteract(EntityPlayer player, ItemStack stack, Enum return false; } - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { - this.riddenByEntity.mountEntity(this); + this.removePassengers(); } return true; } - if (this.riddenByEntity == null && var1 instanceof EntityPlayerMP) + if (this.getPassengers().isEmpty() && player instanceof EntityPlayerMP) { - GCCoreUtil.openParachestInv((EntityPlayerMP) var1, this); + GCCoreUtil.openParachestInv((EntityPlayerMP) player, this); return true; } - else if (var1 instanceof EntityPlayerMP) + else if (player instanceof EntityPlayerMP) { if (!this.onGround) { return false; } - var1.mountEntity(null); + this.removePassengers(); return true; } else diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityGrapple.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityGrapple.java index 3ade2a135c..98d8e0d3d7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityGrapple.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityGrapple.java @@ -3,12 +3,12 @@ import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.dimension.WorldProviderZeroGravity; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsClientHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsClientCapability; import micdoodle8.mods.galacticraft.planets.asteroids.network.PacketSimpleAsteroids; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; import net.minecraft.entity.IProjectile; import net.minecraft.entity.player.EntityPlayer; @@ -17,7 +17,11 @@ import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.*; +import net.minecraft.network.datasync.DataParameter; +import net.minecraft.network.datasync.DataSerializers; +import net.minecraft.network.datasync.EntityDataManager; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.math.*; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.relauncher.Side; @@ -27,6 +31,8 @@ public class EntityGrapple extends Entity implements IProjectile { + private static final DataParameter PULLING_ENTITY_ID = EntityDataManager.createKey(EntityGrapple.class, DataSerializers.VARINT); + private static final DataParameter IS_PULLING = EntityDataManager.createKey(EntityGrapple.class, DataSerializers.BOOLEAN); private BlockPos hitVec; private Block hitBlock; private int inData; @@ -43,7 +49,6 @@ public class EntityGrapple extends Entity implements IProjectile public EntityGrapple(World par1World) { super(par1World); - this.renderDistanceWeight = 10.0D; this.ignoreFrustumCheck = false; // this.yOffset = -1.5F; this.setSize(0.75F, 0.75F); @@ -52,7 +57,6 @@ public EntityGrapple(World par1World) public EntityGrapple(World par1World, EntityPlayer shootingEntity, float par3) { super(par1World); - this.renderDistanceWeight = 10.0D; this.shootingEntity = shootingEntity; this.setSize(0.75F, 0.75F); @@ -73,6 +77,20 @@ public EntityGrapple(World par1World, EntityPlayer shootingEntity, float par3) this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, par3 * 1.5F, 1.0F); } + @Override + public boolean isInRangeToRenderDist(double distance) + { + double d0 = this.getEntityBoundingBox().getAverageEdgeLength(); + + if (Double.isNaN(d0)) + { + d0 = 1.0D; + } + + d0 = d0 * 64.0D * 10.0; + return distance < d0 * d0; + } + @Override public double getYOffset() { @@ -82,8 +100,8 @@ public double getYOffset() @Override protected void entityInit() { - this.dataManager.addObject(10, 0); - this.dataManager.addObject(11, 0); + this.dataManager.register(PULLING_ENTITY_ID, 0); + this.dataManager.register(IS_PULLING, false); } @Override @@ -186,8 +204,8 @@ public void onUpdate() shootingEntity.setVelocity((this.posX - shootingEntity.posX) / 12.0F, (this.posY - shootingEntity.posY) / 12.0F, (this.posZ - shootingEntity.posZ) / 12.0F); if (shootingEntity.worldObj.isRemote && shootingEntity.worldObj.provider instanceof WorldProviderZeroGravity) { - GCPlayerStatsClient stats = GCPlayerStatsClient.get((EntityPlayerSP) shootingEntity); - stats.freefallHandler.updateFreefall(shootingEntity); + IStatsClientCapability stats = shootingEntity.getCapability(CapabilityStatsClientHandler.GC_STATS_CLIENT_CAPABILITY, null); + stats.getFreefallHandler().updateFreefall(shootingEntity); } } } @@ -202,12 +220,11 @@ public void onUpdate() if (this.hitVec != null) { - Block block = this.worldObj.getBlockState(this.hitVec).getBlock(); + IBlockState state = this.worldObj.getBlockState(this.hitVec); - if (block.getMaterial() != Material.AIR) + if (state.getBlock().getMaterial(state) != Material.AIR) { - block.setBlockBoundsBasedOnState(this.worldObj, this.hitVec); - AxisAlignedBB axisalignedbb = block.getCollisionBoundingBox(this.worldObj, this.hitVec, this.worldObj.getBlockState(this.hitVec)); + AxisAlignedBB axisalignedbb = state.getBlock().getCollisionBoundingBox(state, this.worldObj, this.hitVec); if (axisalignedbb != null && axisalignedbb.isVecInside(new Vec3d(this.posX, this.posY, this.posZ))) { @@ -280,7 +297,7 @@ public void onUpdate() Vec3d vec31 = new Vec3d(this.posX, this.posY, this.posZ); Vec3d vec3 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec31, vec3, false, true, false); + RayTraceResult movingobjectposition = this.worldObj.rayTraceBlocks(vec31, vec3, false, true, false); vec31 = new Vec3d(this.posX, this.posY, this.posZ); vec3 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); @@ -303,7 +320,7 @@ public void onUpdate() { f1 = 0.3F; AxisAlignedBB axisalignedbb1 = entity1.getEntityBoundingBox().expand(f1, f1, f1); - MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3); + RayTraceResult movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3); if (movingobjectposition1 != null) { @@ -320,7 +337,7 @@ public void onUpdate() if (entity != null) { - movingobjectposition = new MovingObjectPosition(entity); + movingobjectposition = new RayTraceResult(entity); } if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) @@ -350,13 +367,13 @@ public void onUpdate() this.posX -= this.motionX / motion * 0.05000000074505806D; this.posY -= this.motionY / motion * 0.05000000074505806D; this.posZ -= this.motionZ / motion * 0.05000000074505806D; - this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); + this.playSound(SoundEvents.ENTITY_ARROW_HIT, 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); this.inGround = true; this.arrowShake = 7; - if (this.hitBlock.getMaterial() != Material.AIR) + if (this.hitBlock.getMaterial(state) != Material.AIR) { - this.hitBlock.onEntityCollidedWithBlock(this.worldObj, this.hitVec, this); + this.hitBlock.onEntityCollidedWithBlock(this.worldObj, this.hitVec, state, this); } } } @@ -467,7 +484,7 @@ public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; - if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.string, 1))) + if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.STRING, 1))) { flag = false; } @@ -494,8 +511,9 @@ protected boolean canTriggerWalking() // return 0.0F; // } + @Override - public boolean canAttackWithItem() + public boolean canBeAttackedWithItem() { return false; } @@ -504,13 +522,13 @@ private void updateShootingEntity() { if (this.shootingEntity != null) { - this.dataManager.set(10, this.shootingEntity.getEntityId()); + this.dataManager.set(PULLING_ENTITY_ID, this.shootingEntity.getEntityId()); } } public EntityPlayer getShootingEntity() { - Entity entity = this.worldObj.getEntityByID(this.dataManager.get(10)); + Entity entity = this.worldObj.getEntityByID(this.dataManager.get(PULLING_ENTITY_ID)); if (entity instanceof EntityPlayer) { @@ -522,11 +540,11 @@ public EntityPlayer getShootingEntity() public void updatePullingEntity(boolean pulling) { - this.dataManager.set(11, pulling ? 1 : 0); + this.dataManager.set(IS_PULLING, pulling); } public boolean getPullingEntity() { - return this.dataManager.get(11) == 1; + return this.dataManager.get(IS_PULLING); } } \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntitySmallAsteroid.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntitySmallAsteroid.java index 94574b7ddc..2b6c3cef8a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntitySmallAsteroid.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntitySmallAsteroid.java @@ -2,10 +2,16 @@ import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.datasync.DataParameter; +import net.minecraft.network.datasync.DataSerializers; +import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.world.World; public class EntitySmallAsteroid extends Entity { + private static final DataParameter SPIN_PITCH = EntityDataManager.createKey(EntitySmallAsteroid.class, DataSerializers.FLOAT); + private static final DataParameter SPIN_YAW = EntityDataManager.createKey(EntitySmallAsteroid.class, DataSerializers.FLOAT); + private static final DataParameter ASTEROID_TYPE = EntityDataManager.createKey(EntitySmallAsteroid.class, DataSerializers.VARINT); public float spinPitch; public float spinYaw; public int type; @@ -69,9 +75,9 @@ else if (this.posY > 288D || this.posY < -32D || this.ticksExisted > 3000) @Override protected void entityInit() { - this.dataManager.addObject(10, 0.0F); - this.dataManager.addObject(11, 0.0F); - this.dataManager.addObject(12, 0); + this.dataManager.register(SPIN_PITCH, 0.0F); + this.dataManager.register(SPIN_YAW, 0.0F); + this.dataManager.register(ASTEROID_TYPE, 0); } @Override @@ -92,31 +98,31 @@ protected void writeEntityToNBT(NBTTagCompound nbt) public float getSpinPitch() { - return this.dataManager.getWatchableObjectFloat(10); + return this.dataManager.get(SPIN_PITCH); } public float getSpinYaw() { - return this.dataManager.getWatchableObjectFloat(11); + return this.dataManager.get(SPIN_YAW); } public void setSpinPitch(float pitch) { - this.dataManager.set(10, pitch); + this.dataManager.set(SPIN_PITCH, pitch); } public void setSpinYaw(float yaw) { - this.dataManager.set(11, yaw); + this.dataManager.set(SPIN_YAW, yaw); } public int getAsteroidType() { - return this.dataManager.get(12); + return this.dataManager.get(ASTEROID_TYPE); } public void setAsteroidType(int type) { - this.dataManager.set(12, type); + this.dataManager.set(ASTEROID_TYPE, type); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityTier3Rocket.java index 6efa9d3ffa..db2092a424 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityTier3Rocket.java @@ -4,16 +4,18 @@ import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.core.util.PlayerUtil; import micdoodle8.mods.galacticraft.planets.asteroids.items.AsteroidsItems; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import java.util.List; @@ -46,7 +48,7 @@ public double getYOffset() } @Override - public ItemStack getPickedResult(MovingObjectPosition target) + public ItemStack getPickedResult(RayTraceResult target) { return new ItemStack(AsteroidsItems.tier3Rocket, 1, this.rocketType.getIndex()); } @@ -155,20 +157,20 @@ public void onTeleport(EntityPlayerMP player) if (playerBase != null) { - GCPlayerStats stats = GCPlayerStats.get(playerBase); + IStatsCapability stats = playerBase.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); if (this.cargoItems == null || this.cargoItems.length == 0) { - stats.rocketStacks = new ItemStack[2]; + stats.setRocketStacks(new ItemStack[2]); } else { - stats.rocketStacks = this.cargoItems; + stats.setRocketStacks(this.cargoItems); } - stats.rocketType = this.rocketType.getIndex(); - stats.rocketItem = AsteroidsItems.tier3Rocket; - stats.fuelLevel = this.fuelTank.getFluidAmount(); + stats.setRocketType(this.rocketType.getIndex()); + stats.setRocketItem(AsteroidsItems.tier3Rocket); + stats.setFuelLevel(this.fuelTank.getFluidAmount()); } } @@ -211,6 +213,8 @@ protected void spawnParticles(boolean launched) private void makeFlame(double x2, double y2, double z2, Vector3 motionVec, boolean getLaunched) { + EntityLivingBase riddenByEntity = this.getPassengers().isEmpty() || !(this.getPassengers().get(0) instanceof EntityLivingBase) ? null : (EntityLivingBase) this.getPassengers().get(0); + if (getLaunched) { GalacticraftCore.proxy.spawnParticle("launchFlameLaunched", new Vector3(x2 + 0.4 - this.rand.nextDouble() / 10, y2, z2 + 0.4 - this.rand.nextDouble() / 10), motionVec, new Object[] { riddenByEntity }); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/player/AsteroidsPlayerHandler.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/player/AsteroidsPlayerHandler.java index deca28b674..34486f7ab6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/player/AsteroidsPlayerHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/player/AsteroidsPlayerHandler.java @@ -1,11 +1,9 @@ package micdoodle8.mods.galacticraft.planets.asteroids.entities.player; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; import micdoodle8.mods.galacticraft.planets.asteroids.dimension.WorldProviderAsteroids; import micdoodle8.mods.galacticraft.planets.asteroids.entities.EntitySmallAsteroid; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraftforge.event.entity.EntityEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent; @@ -40,14 +38,14 @@ public void onPlayerRespawn(PlayerRespawnEvent event) } } - @SubscribeEvent - public void onEntityConstructing(EntityEvent.EntityConstructing event) - { - if (event.entity instanceof EntityPlayerMP && GCPlayerStats.get((EntityPlayerMP) event.entity) == null) - { - GCPlayerStats.register((EntityPlayerMP) event.entity); - } - } +// @SubscribeEvent +// public void onEntityConstructing(EntityEvent.EntityConstructing event) +// { +// if (event.getEntity() instanceof EntityPlayerMP && GCPlayerStats.get((EntityPlayerMP) event.entity) == null) +// { +// GCPlayerStats.register((EntityPlayerMP) event.entity); +// } +// } private void onPlayerLogin(EntityPlayerMP player) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicTier3Rocket.java index 18845b8bfb..ae4ab73d63 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/ContainerSchematicTier3Rocket.java @@ -153,7 +153,7 @@ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) } else { - if (var2.getItem() == Item.getItemFromBlock(Blocks.chest)) + if (var2.getItem() == Item.getItemFromBlock(Blocks.CHEST)) { if (!this.mergeOneItemTestValid(var4, 19, 22, false)) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java index 5c8aa3956e..25bfe42775 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/SlotSchematicAstroMiner.java @@ -76,7 +76,7 @@ public boolean isItemValid(ItemStack par1ItemStack) //Chest case 7: case 8: - return par1ItemStack.getItem() == Item.getItemFromBlock(Blocks.chest); + return par1ItemStack.getItem() == Item.getItemFromBlock(Blocks.CHEST); //Laser: beam core case 13: return par1ItemStack.getItem() == AsteroidsItems.basicItem && par1ItemStack.getItemDamage() == 8; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/AsteroidsItems.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/AsteroidsItems.java index 9b7d1a9000..f7311e48e7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/AsteroidsItems.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/AsteroidsItems.java @@ -6,6 +6,8 @@ import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.core.wrappers.PartialCanister; import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; +import net.minecraft.init.SoundEvents; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; @@ -40,7 +42,7 @@ public class AsteroidsItems public static Item titaniumSword; public static Item.ToolMaterial TOOL_TITANIUM = EnumHelper.addToolMaterial("titanium", 3, 520, 8.0F, 3.0F, 10); - public static ItemArmor.ArmorMaterial ARMOR_TITANIUM = EnumHelper.addArmorMaterial("titanium", "", 26, new int[] { 5, 10, 7, 5 }, 10); + public static ItemArmor.ArmorMaterial ARMOR_TITANIUM = EnumHelper.addArmorMaterial("titanium", "", 26, new int[] { 5, 10, 7, 5 }, 10, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0.0F); public static void initItems() { @@ -56,10 +58,10 @@ public static void initItems() AsteroidsItems.atmosphericValve = new ItemAtmosphericValve("atmospheric_valve"); AsteroidsItems.heavyNoseCone = new ItemHeavyNoseCone("heavy_nose_cone"); AsteroidsItems.orionDrive = new ItemOrionDrive("orion_drive"); - AsteroidsItems.titaniumHelmet = new ItemArmorAsteroids(0, "helmet"); - AsteroidsItems.titaniumChestplate = new ItemArmorAsteroids(1, "chestplate"); - AsteroidsItems.titaniumLeggings = new ItemArmorAsteroids(2, "leggings"); - AsteroidsItems.titaniumBoots = new ItemArmorAsteroids(3, "boots"); + AsteroidsItems.titaniumHelmet = new ItemArmorAsteroids(EntityEquipmentSlot.HEAD, "helmet"); + AsteroidsItems.titaniumChestplate = new ItemArmorAsteroids(EntityEquipmentSlot.CHEST, "chestplate"); + AsteroidsItems.titaniumLeggings = new ItemArmorAsteroids(EntityEquipmentSlot.LEGS, "leggings"); + AsteroidsItems.titaniumBoots = new ItemArmorAsteroids(EntityEquipmentSlot.FEET, "boots"); AsteroidsItems.titaniumAxe = new ItemAxeAsteroids("titanium_axe"); AsteroidsItems.titaniumPickaxe = new ItemPickaxeAsteroids("titanium_pickaxe"); AsteroidsItems.titaniumSpade = new ItemSpadeAsteroids("titanium_shovel"); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemArmorAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemArmorAsteroids.java index 3d681e871d..caac77963f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemArmorAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemArmorAsteroids.java @@ -7,6 +7,7 @@ import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; @@ -15,7 +16,7 @@ public class ItemArmorAsteroids extends ItemArmor implements ISortableItem { - public ItemArmorAsteroids(int armorIndex, String assetSuffix) + public ItemArmorAsteroids(EntityEquipmentSlot armorIndex, String assetSuffix) { super(AsteroidsItems.ARMOR_TITANIUM, 0, armorIndex); this.setUnlocalizedName("titanium_" + assetSuffix); @@ -36,7 +37,7 @@ public EnumRarity getRarity(ItemStack par1ItemStack) } @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { if (this.getArmorMaterial() == AsteroidsItems.ARMOR_TITANIUM) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java index 5855c5ab5e..49e4b2d60b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java @@ -4,7 +4,8 @@ import micdoodle8.mods.galacticraft.core.GCBlocks; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.dimension.WorldProviderZeroGravity; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.items.ISortableItem; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.tile.TileEntityMulti; @@ -22,9 +23,11 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.TextComponentString; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -57,13 +60,13 @@ public CreativeTabs getCreativeTab() } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { TileEntity tile = null; if (worldIn.isRemote || playerIn == null) { - return false; + return EnumActionResult.PASS; } else { @@ -89,45 +92,46 @@ public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, if (worldIn.provider instanceof WorldProviderZeroGravity) { playerIn.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner7.fail"))); - return false; + return EnumActionResult.FAIL; } if (((TileEntityMinerBase) tile).getLinkedMiner() != null) { playerIn.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner.fail"))); - return false; + return EnumActionResult.FAIL; } //Gives a chance for any loaded Astro Miner to link itself if (((TileEntityMinerBase) tile).ticks < 15L) { - return false; + return EnumActionResult.FAIL; } EntityPlayerMP playerMP = (EntityPlayerMP) playerIn; - int astroCount = GCPlayerStats.get(playerMP).astroMinerCount; + IStatsCapability stats = playerMP.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + int astroCount = stats.getAstroMinerCount(); if (astroCount >= ConfigManagerAsteroids.astroMinerMax && (!playerIn.capabilities.isCreativeMode)) { playerIn.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner2.fail"))); - return false; + return EnumActionResult.FAIL; } if (!((TileEntityMinerBase) tile).spawnMiner(playerMP)) { playerIn.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner1.fail") + " " + GCCoreUtil.translate(EntityAstroMiner.blockingBlock.toString()))); - return false; + return EnumActionResult.FAIL; } if (!playerIn.capabilities.isCreativeMode) { - GCPlayerStats.get(playerMP).astroMinerCount++; + stats.setAstroMinerCount(stats.getAstroMinerCount() + 1); --stack.stackSize; } - return true; + return EnumActionResult.SUCCESS; } } - return false; + return EnumActionResult.PASS; } @SuppressWarnings({ "unchecked", "rawtypes" }) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemCanisterLiquidNitrogen.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemCanisterLiquidNitrogen.java index d0a3f7f1e6..252a749e47 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemCanisterLiquidNitrogen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemCanisterLiquidNitrogen.java @@ -8,10 +8,15 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -81,50 +86,50 @@ public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlaye private Block canFreeze(Block b) { - if (b == Blocks.water) + if (b == Blocks.WATER) { - return Blocks.ice; + return Blocks.ICE; } - if (b == Blocks.lava) + if (b == Blocks.LAVA) { - return Blocks.obsidian; + return Blocks.OBSIDIAN; } return null; } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World par2World, EntityPlayer par3EntityPlayer) + public ActionResult onItemRightClick(ItemStack itemStack, World worldIn, EntityPlayer playerIn, EnumHand hand) { int damage = itemStack.getItemDamage() + 125; if (damage > itemStack.getMaxDamage()) { - return itemStack; + return new ActionResult<>(EnumActionResult.PASS, itemStack); } - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true); + RayTraceResult movingobjectposition = this.rayTrace(worldIn, playerIn, true); - if (movingobjectposition == null) + if (movingobjectposition.typeOfHit == RayTraceResult.Type.MISS) { - return itemStack; + return new ActionResult<>(EnumActionResult.PASS, itemStack); } else { - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + if (movingobjectposition.typeOfHit == RayTraceResult.Type.BLOCK) { BlockPos pos = movingobjectposition.getBlockPos(); - if (!par2World.canMineBlockBody(par3EntityPlayer, pos)) + if (!worldIn.canMineBlockBody(playerIn, pos)) { - return itemStack; + return new ActionResult<>(EnumActionResult.PASS, itemStack); } - if (!par3EntityPlayer.canPlayerEdit(pos, movingobjectposition.sideHit, itemStack)) + if (!playerIn.canPlayerEdit(pos, movingobjectposition.sideHit, itemStack)) { - return itemStack; + return new ActionResult<>(EnumActionResult.PASS, itemStack); } //Material material = par2World.getBlock(i, j, k).getMaterial(); - IBlockState state = par2World.getBlockState(pos); + IBlockState state = worldIn.getBlockState(pos); Block b = state.getBlock(); int meta = b.getMetaFromState(state); @@ -132,13 +137,13 @@ public ItemStack onItemRightClick(ItemStack itemStack, World par2World, EntityPl if (result != null) { this.setNewDamage(itemStack, damage); - par2World.playSoundEffect(pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, "fire.ignite", 1.0F, Item.itemRand.nextFloat() * 0.4F + 0.8F); - par2World.setBlockState(pos, result.getDefaultState(), 3); - return itemStack; + worldIn.playSound(null, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.NEUTRAL, 1.0F, Item.itemRand.nextFloat() * 0.4F + 0.8F); + worldIn.setBlockState(pos, result.getDefaultState(), 3); + return new ActionResult<>(EnumActionResult.SUCCESS, itemStack); } } - return itemStack; + return new ActionResult<>(EnumActionResult.PASS, itemStack); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemGrappleHook.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemGrappleHook.java index fb470f3a0b..5bba2161f7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemGrappleHook.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemGrappleHook.java @@ -7,12 +7,18 @@ import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.planets.asteroids.entities.EntityGrapple; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Enchantments; import net.minecraft.init.Items; +import net.minecraft.init.SoundEvents; import net.minecraft.item.*; -import net.minecraft.util.TextComponentString; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -42,41 +48,62 @@ public EnumRarity getRarity(ItemStack par1ItemStack) } @Override - public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) + public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBase entity, int timeLeft) { - boolean flag = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0; + if (!(entity instanceof EntityPlayer)) + { + return; + } + + EntityPlayer player = (EntityPlayer) entity; - if (flag || par3EntityPlayer.inventory.hasItem(Items.string)) + boolean canShoot = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantments.INFINITY, stack) > 0; + ItemStack string = null; + + for (ItemStack itemstack : player.inventory.mainInventory) { - EntityGrapple grapple = new EntityGrapple(par2World, par3EntityPlayer, 2.0F); + if (itemstack != null && itemstack.getItem() == Items.STRING) + { + string = itemstack; + canShoot = true; + } + } - par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (Item.itemRand.nextFloat() * 0.4F + 1.2F) + 0.5F); + if (canShoot) + { + if (string == null) + { + string = new ItemStack(Items.STRING, 1); + } + + EntityGrapple grapple = new EntityGrapple(worldIn, player, 2.0F); - if (!par2World.isRemote) + worldIn.playSound((EntityPlayer)null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (Item.itemRand.nextFloat() * 0.4F + 1.2F) + 0.5F); + + if (!worldIn.isRemote) { - par2World.spawnEntityInWorld(grapple); + worldIn.spawnEntityInWorld(grapple); } - par1ItemStack.damageItem(1, par3EntityPlayer); - grapple.canBePickedUp = par3EntityPlayer.capabilities.isCreativeMode ? 2 : 1; + stack.damageItem(1, player); + grapple.canBePickedUp = player.capabilities.isCreativeMode ? 2 : 1; - if (!par3EntityPlayer.capabilities.isCreativeMode) + if (!player.capabilities.isCreativeMode) { - par3EntityPlayer.inventory.consumeInventoryItem(Items.string); + --string.stackSize; + + if (string.stackSize == 0) + { + player.inventory.deleteStack(string); + } } } - else if (par2World.isRemote) + else if (worldIn.isRemote) { - par3EntityPlayer.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.grapple.fail"))); + player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.grapple.fail"))); } } - @Override - public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn) - { - return stack; - } - @Override public int getMaxItemUseDuration(ItemStack par1ItemStack) { @@ -90,10 +117,10 @@ public EnumAction getItemUseAction(ItemStack par1ItemStack) } @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + public ActionResult onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) { - par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); - return par1ItemStack; + playerIn.setActiveHand(hand); + return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemThermalPadding.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemThermalPadding.java index 1b6f8dd8cf..b19c8c3b52 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemThermalPadding.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemThermalPadding.java @@ -2,7 +2,8 @@ import micdoodle8.mods.galacticraft.api.item.IItemThermal; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.items.ISortableItem; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem; @@ -12,6 +13,9 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -91,21 +95,21 @@ public EnumSortCategoryItem getCategory(int meta) } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) + public ActionResult onItemRightClick(ItemStack itemStack, World worldIn, EntityPlayer player, EnumHand hand) { if (player instanceof EntityPlayerMP) { - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) player); - ItemStack gear = stats.extendedInventory.getStackInSlot(6); - ItemStack gear1 = stats.extendedInventory.getStackInSlot(7); - ItemStack gear2 = stats.extendedInventory.getStackInSlot(8); - ItemStack gear3 = stats.extendedInventory.getStackInSlot(9); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + ItemStack gear = stats.getExtendedInventory().getStackInSlot(6); + ItemStack gear1 = stats.getExtendedInventory().getStackInSlot(7); + ItemStack gear2 = stats.getExtendedInventory().getStackInSlot(8); + ItemStack gear3 = stats.getExtendedInventory().getStackInSlot(9); if (itemStack.getItemDamage() == 0) { if (gear == null) { - stats.extendedInventory.setInventorySlotContents(6, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(6, itemStack.copy()); itemStack.stackSize = 0; } } @@ -113,7 +117,7 @@ else if (itemStack.getItemDamage() == 1) { if (gear1 == null) { - stats.extendedInventory.setInventorySlotContents(7, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(7, itemStack.copy()); itemStack.stackSize = 0; } } @@ -121,7 +125,7 @@ else if (itemStack.getItemDamage() == 2) { if (gear2 == null) { - stats.extendedInventory.setInventorySlotContents(8, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(8, itemStack.copy()); itemStack.stackSize = 0; } } @@ -129,11 +133,11 @@ else if (itemStack.getItemDamage() == 3) { if (gear3 == null) { - stats.extendedInventory.setInventorySlotContents(9, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(9, itemStack.copy()); itemStack.stackSize = 0; } } } - return itemStack; + return new ActionResult<>(EnumActionResult.PASS, itemStack); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java index 95e6ccd2cb..5bdce518f8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java @@ -20,6 +20,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; @@ -57,14 +59,14 @@ public CreativeTabs getCreativeTab() } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { boolean padFound = false; TileEntity tile = null; if (worldIn.isRemote) { - return false; + return EnumActionResult.PASS; } else { @@ -107,12 +109,12 @@ public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, { if (((TileEntityLandingPad) tile).getDockedEntity() != null) { - return false; + return EnumActionResult.PASS; } } else { - return false; + return EnumActionResult.PASS; } EntityTier3Rocket rocket = new EntityTier3Rocket(worldIn, centerX, centerY, centerZ, EnumRocketType.values()[stack.getItemDamage()]); @@ -143,10 +145,10 @@ public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, } else { - return false; + return EnumActionResult.PASS; } } - return true; + return EnumActionResult.SUCCESS; } @SuppressWarnings({ "unchecked", "rawtypes" }) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/nei/AstroMinerRecipeHandler.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/nei/AstroMinerRecipeHandler.java index fdd85cd613..d41bd40041 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/nei/AstroMinerRecipeHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/nei/AstroMinerRecipeHandler.java @@ -1,9 +1,9 @@ package micdoodle8.mods.galacticraft.planets.asteroids.nei; import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.util.NEIServerUtils; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import micdoodle8.mods.galacticraft.planets.asteroids.client.gui.GuiSchematicAstroMiner; @@ -13,7 +13,6 @@ import java.util.ArrayList; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; public class AstroMinerRecipeHandler extends TemplateRecipeHandler @@ -31,7 +30,7 @@ public int recipiesPerPage() return 1; } - public Set, PositionedStack>> getRecipes() + public Set, PositionedStack>> getRecipes() { return NEIGalacticraftAsteroidsConfig.getAstroMinerRecipes(); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/nei/NEIGalacticraftAsteroidsConfig.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/nei/NEIGalacticraftAsteroidsConfig.java index 9a39d1821e..7c7abdb48f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/nei/NEIGalacticraftAsteroidsConfig.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/nei/NEIGalacticraftAsteroidsConfig.java @@ -1,8 +1,8 @@ package micdoodle8.mods.galacticraft.planets.asteroids.nei; -import codechicken.nei.PositionedStack; import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; +import codechicken.nei.api.stack.PositionedStack; import micdoodle8.mods.galacticraft.api.GalacticraftRegistry; import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.GCItems; @@ -89,36 +89,36 @@ public void registerRecipes() this.registerRocketBenchRecipe(input1, new PositionedStack(new ItemStack(AsteroidsItems.tier3Rocket, 1, 0), 139, 87 + changeY)); ArrayList input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90, -15 + changeY)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(AsteroidsItems.tier3Rocket, 1, 1), 139, 87 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 26, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 26, -15 + changeY)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(AsteroidsItems.tier3Rocket, 1, 1), 139, 87 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 52, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 52, -15 + changeY)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(AsteroidsItems.tier3Rocket, 1, 1), 139, 87 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90, -15 + changeY)); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 26, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 26, -15 + changeY)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(AsteroidsItems.tier3Rocket, 1, 2), 139, 87 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 26, -15 + changeY)); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 52, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 26, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 52, -15 + changeY)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(AsteroidsItems.tier3Rocket, 1, 2), 139, 87 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90, -15 + changeY)); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 52, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 52, -15 + changeY)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(AsteroidsItems.tier3Rocket, 1, 2), 139, 87 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90, -15 + changeY)); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 26, -15 + changeY)); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 52, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 26, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 52, -15 + changeY)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(AsteroidsItems.tier3Rocket, 1, 3), 139, 87 + changeY)); input1 = new ArrayList(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/nei/RocketT3RecipeHandler.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/nei/RocketT3RecipeHandler.java index 4151adc8dc..01aff414de 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/nei/RocketT3RecipeHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/nei/RocketT3RecipeHandler.java @@ -1,9 +1,9 @@ package micdoodle8.mods.galacticraft.planets.asteroids.nei; import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.util.NEIServerUtils; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import net.minecraft.item.ItemStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/recipe/RecipeManagerAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/recipe/RecipeManagerAsteroids.java index a48c4e154f..6db80bee3d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/recipe/RecipeManagerAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/recipe/RecipeManagerAsteroids.java @@ -35,13 +35,13 @@ private static void addUniversalRecipes() FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(AsteroidBlocks.blockBasic, 1, 3), new ItemStack(GCItems.basicItem, 1, 5), 0.0F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(AsteroidBlocks.blockBasic, 1, 4), new ItemStack(AsteroidsItems.basicItem, 1, 5), 0.0F); - FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(AsteroidBlocks.blockBasic, 1, 5), new ItemStack(Items.iron_ingot), 0.0F); - FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(AsteroidsItems.basicItem, 1, 3), new ItemStack(Items.iron_ingot), 0.5F); + FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(AsteroidBlocks.blockBasic, 1, 5), new ItemStack(Items.IRON_INGOT), 0.0F); + FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(AsteroidsItems.basicItem, 1, 3), new ItemStack(Items.IRON_INGOT), 0.5F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(AsteroidsItems.basicItem, 1, 4), new ItemStack(AsteroidsItems.basicItem, 1, 5), 0.5F); - RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.heavyNoseCone, 1), new Object[] { " Y ", " X ", "X X", 'X', new ItemStack(AsteroidsItems.basicItem, 1, 0), 'Y', Blocks.redstone_torch }); + RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.heavyNoseCone, 1), new Object[] { " Y ", " X ", "X X", 'X', new ItemStack(AsteroidsItems.basicItem, 1, 0), 'Y', Blocks.REDSTONE_TORCH }); - RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.basicItem, 1, 7), new Object[] { " X ", "XYX", " X ", 'X', Blocks.wool, 'Y', Items.redstone }); + RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.basicItem, 1, 7), new Object[] { " X ", "XYX", " X ", 'X', Blocks.WOOL, 'Y', Items.REDSTONE }); RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.thermalPadding, 1, 0), new Object[] { "XXX", "X X", 'X', new ItemStack(AsteroidsItems.basicItem, 1, 7) }); RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.thermalPadding, 1, 1), new Object[] { "X X", "XXX", "XXX", 'X', new ItemStack(AsteroidsItems.basicItem, 1, 7) }); @@ -53,21 +53,21 @@ private static void addUniversalRecipes() RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumLeggings, 1), new Object[] { "XXX", "X X", "X X", 'X', titaniumPlate }); RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumBoots, 1), new Object[] { "X X", "X X", 'X', titaniumPlate }); - RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumPickaxe, 1), new Object[] { "YYY", " X ", " X ", 'Y', titaniumPlate, 'X', Items.stick }); - RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumAxe, 1), new Object[] { "YY ", "YX ", " X ", 'Y', titaniumPlate, 'X', Items.stick }); - RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumAxe, 1), new Object[] { " YY", " XY", " X ", 'Y', titaniumPlate, 'X', Items.stick }); - RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumHoe, 1), new Object[] { " YY", " X ", " X ", 'Y', titaniumPlate, 'X', Items.stick }); - RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumHoe, 1), new Object[] { "YY ", " X ", " X ", 'Y', titaniumPlate, 'X', Items.stick }); - RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumSpade, 1), new Object[] { " Y ", " X ", " X ", 'Y', titaniumPlate, 'X', Items.stick }); - RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumSword, 1), new Object[] { " Y ", " Y ", " X ", 'Y', titaniumPlate, 'X', Items.stick }); + RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumPickaxe, 1), new Object[] { "YYY", " X ", " X ", 'Y', titaniumPlate, 'X', Items.STICK }); + RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumAxe, 1), new Object[] { "YY ", "YX ", " X ", 'Y', titaniumPlate, 'X', Items.STICK }); + RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumAxe, 1), new Object[] { " YY", " XY", " X ", 'Y', titaniumPlate, 'X', Items.STICK }); + RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumHoe, 1), new Object[] { " YY", " X ", " X ", 'Y', titaniumPlate, 'X', Items.STICK }); + RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumHoe, 1), new Object[] { "YY ", " X ", " X ", 'Y', titaniumPlate, 'X', Items.STICK }); + RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumSpade, 1), new Object[] { " Y ", " X ", " X ", 'Y', titaniumPlate, 'X', Items.STICK }); + RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.titaniumSword, 1), new Object[] { " Y ", " Y ", " X ", 'Y', titaniumPlate, 'X', Items.STICK }); - RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.basicItem, 1, 1), new Object[] { " YV", "XWX", "XZX", 'V', Blocks.stone_button, 'W', new ItemStack(GCItems.canister, 1, 0), 'X', new ItemStack(AsteroidsItems.basicItem, 1, 0), 'Y', Items.flint_and_steel, 'Z', GCItems.oxygenVent }); + RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.basicItem, 1, 1), new Object[] { " YV", "XWX", "XZX", 'V', Blocks.STONE_BUTTON, 'W', new ItemStack(GCItems.canister, 1, 0), 'X', new ItemStack(AsteroidsItems.basicItem, 1, 0), 'Y', Items.FLINT_AND_STEEL, 'Z', GCItems.oxygenVent }); - RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.basicItem, 1, 1), new Object[] { "VY ", "XWX", "XZX", 'V', Blocks.stone_button, 'W', new ItemStack(GCItems.canister, 1, 0), 'X', new ItemStack(AsteroidsItems.basicItem, 1, 0), 'Y', Items.flint_and_steel, 'Z', GCItems.oxygenVent }); + RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.basicItem, 1, 1), new Object[] { "VY ", "XWX", "XZX", 'V', Blocks.STONE_BUTTON, 'W', new ItemStack(GCItems.canister, 1, 0), 'X', new ItemStack(AsteroidsItems.basicItem, 1, 0), 'Y', Items.FLINT_AND_STEEL, 'Z', GCItems.oxygenVent }); RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.basicItem, 1, 2), new Object[] { " Y ", "XYX", "X X", 'X', new ItemStack(AsteroidsItems.basicItem, 1, 0), 'Y', new ItemStack(MarsItems.marsItemBasic, 1, 3) }); - RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.grapple, 1), new Object[] { " Z", "XZ ", "XX ", 'X', Items.iron_ingot, 'Z', Items.string }); + RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.grapple, 1), new Object[] { " Z", "XZ ", "XX ", 'X', Items.IRON_INGOT, 'Z', Items.STRING }); RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.atmosphericValve, 1, 0), new Object[] { " ", "XYX", " X ", 'X', new ItemStack(MarsItems.marsItemBasic, 1, 2), 'Y', GCItems.oxygenVent }); @@ -79,38 +79,38 @@ private static void addUniversalRecipes() CraftingManager.getInstance().addShapelessRecipe(new ItemStack(AsteroidBlocks.blockWalkway, 1, 1), new ItemStack(AsteroidBlocks.blockWalkway, 1), new ItemStack(GCBlocks.aluminumWire, 1, 1)); CraftingManager.getInstance().addShapelessRecipe(new ItemStack(AsteroidBlocks.blockWalkway, 1, 2), new ItemStack(AsteroidBlocks.blockWalkway, 1), new ItemStack(GCBlocks.oxygenPipe, 1)); - RecipeUtil.addRecipe(new ItemStack(AsteroidBlocks.shortRangeTelepad), new Object[] { "XWX", "ZYZ", "XXX", 'W', new ItemStack(AsteroidsItems.basicItem, 1, 8), 'X', titaniumPlate, 'Y', Items.redstone, 'Z', Items.ender_pearl }); + RecipeUtil.addRecipe(new ItemStack(AsteroidBlocks.shortRangeTelepad), new Object[] { "XWX", "ZYZ", "XXX", 'W', new ItemStack(AsteroidsItems.basicItem, 1, 8), 'X', titaniumPlate, 'Y', Items.REDSTONE, 'Z', Items.ENDER_PEARL }); - RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.basicItem, 1, 8), new Object[] { "XYX", "YZY", "XYX", 'X', Items.redstone, 'Y', "compressedIron", 'Z', Blocks.glass_pane }); + RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.basicItem, 1, 8), new Object[] { "XYX", "YZY", "XYX", 'X', Items.REDSTONE, 'Y', "compressedIron", 'Z', Blocks.GLASS_PANE }); RecipeUtil.addRecipe(new ItemStack(AsteroidBlocks.beamReceiver), new Object[] { " X ", "XYX", " X ", 'X', titaniumPlate, 'Y', new ItemStack(AsteroidsItems.basicItem, 1, 8) }); - RecipeUtil.addRecipe(new ItemStack(AsteroidBlocks.beamReflector), new Object[] { " Y ", "ZX ", "XXX", 'X', titaniumPlate, 'Y', new ItemStack(AsteroidsItems.basicItem, 1, 8), 'Z', Blocks.lever }); - RecipeUtil.addRecipe(new ItemStack(AsteroidBlocks.beamReflector), new Object[] { " Y ", " XZ", "XXX", 'X', titaniumPlate, 'Y', new ItemStack(AsteroidsItems.basicItem, 1, 8), 'Z', Blocks.lever }); + RecipeUtil.addRecipe(new ItemStack(AsteroidBlocks.beamReflector), new Object[] { " Y ", "ZX ", "XXX", 'X', titaniumPlate, 'Y', new ItemStack(AsteroidsItems.basicItem, 1, 8), 'Z', Blocks.LEVER }); + RecipeUtil.addRecipe(new ItemStack(AsteroidBlocks.beamReflector), new Object[] { " Y ", " XZ", "XXX", 'X', titaniumPlate, 'Y', new ItemStack(AsteroidsItems.basicItem, 1, 8), 'Z', Blocks.LEVER }); - RecipeUtil.addRecipe(new ItemStack(AsteroidBlocks.blockMinerBase, 4, 0), new Object[] { "XCX", "W W", "XBX", 'X', "compressedDesh", 'W', new ItemStack(AsteroidsItems.basicItem, 1, 8), 'C', new ItemStack(Blocks.chest), 'B', new ItemStack(GCBlocks.machineTiered, 1, BlockMachineTiered.STORAGE_MODULE_METADATA) }); + RecipeUtil.addRecipe(new ItemStack(AsteroidBlocks.blockMinerBase, 4, 0), new Object[] { "XCX", "W W", "XBX", 'X', "compressedDesh", 'W', new ItemStack(AsteroidsItems.basicItem, 1, 8), 'C', new ItemStack(Blocks.CHEST), 'B', new ItemStack(GCBlocks.machineTiered, 1, BlockMachineTiered.STORAGE_MODULE_METADATA) }); RecipeUtil.addRecipe(new ItemStack(AsteroidsItems.orionDrive, 1, 0), new Object[] { "ABC", "DOE", "FGH", 'A', "oreDiamond", 'B', "oreLapis", 'C', "oreGold", 'D', "oreRedstone", 'E', "oreCoal", 'F', "oreCheese", 'G', "oreDesh", 'H', "oreIlmenite", 'O', new ItemStack(AsteroidsItems.basicItem, 1, 8) }); //Cobblestone recipe - CraftingManager.getInstance().addShapelessRecipe(new ItemStack(Blocks.cobblestone, 2), new ItemStack(AsteroidBlocks.blockBasic, 1, 0), new ItemStack(AsteroidBlocks.blockBasic, 1, 1)); - CraftingManager.getInstance().addShapelessRecipe(new ItemStack(Blocks.cobblestone, 2), new ItemStack(AsteroidBlocks.blockBasic, 1, 0), new ItemStack(AsteroidBlocks.blockBasic, 1, 2)); - CraftingManager.getInstance().addShapelessRecipe(new ItemStack(Blocks.cobblestone, 2), new ItemStack(AsteroidBlocks.blockBasic, 1, 1), new ItemStack(AsteroidBlocks.blockBasic, 1, 2)); + CraftingManager.getInstance().addShapelessRecipe(new ItemStack(Blocks.COBBLESTONE, 2), new ItemStack(AsteroidBlocks.blockBasic, 1, 0), new ItemStack(AsteroidBlocks.blockBasic, 1, 1)); + CraftingManager.getInstance().addShapelessRecipe(new ItemStack(Blocks.COBBLESTONE, 2), new ItemStack(AsteroidBlocks.blockBasic, 1, 0), new ItemStack(AsteroidBlocks.blockBasic, 1, 2)); + CraftingManager.getInstance().addShapelessRecipe(new ItemStack(Blocks.COBBLESTONE, 2), new ItemStack(AsteroidBlocks.blockBasic, 1, 1), new ItemStack(AsteroidBlocks.blockBasic, 1, 2)); //Green dye from yellow and blue CraftingManager.getInstance().addShapelessRecipe(new ItemStack(Items.DYE, 2, 2), new ItemStack(Items.DYE, 1, 11), new ItemStack(Items.DYE, 1, 4)); //Cobblestone->Gravel, Gravel->Sand, Sand->Clay - CompressorRecipes.addRecipeAdventure(new ItemStack(Blocks.gravel, 9, 0), "XXX", "XXX", "XXX", 'X', new ItemStack(Blocks.cobblestone, 1)); - CompressorRecipes.addRecipeAdventure(new ItemStack(Blocks.sand, 9, 0), "XXX", "XXX", "XXX", 'X', new ItemStack(Blocks.gravel, 1)); - CompressorRecipes.addRecipeAdventure(new ItemStack(Blocks.clay, 8, 0), "XXX", "XBX", "XXX", 'X', new ItemStack(Blocks.sand), 'B', new ItemStack(Items.water_bucket)); - CompressorRecipes.addRecipeAdventure(new ItemStack(Blocks.soul_sand, 4, 0), "XFX", "FEF", "XFX", 'X', new ItemStack(Blocks.sand), 'F', new ItemStack(Items.rotten_flesh), 'E', new ItemStack(Items.fermented_spider_eye)); - CompressorRecipes.addRecipeAdventure(new ItemStack(Blocks.obsidian, 1, 0), "XXX", "XBX", "XXX", 'X', new ItemStack(Blocks.stone), 'B', new ItemStack(Items.blaze_powder)); + CompressorRecipes.addRecipeAdventure(new ItemStack(Blocks.GRAVEL, 9, 0), "XXX", "XXX", "XXX", 'X', new ItemStack(Blocks.COBBLESTONE, 1)); + CompressorRecipes.addRecipeAdventure(new ItemStack(Blocks.SAND, 9, 0), "XXX", "XXX", "XXX", 'X', new ItemStack(Blocks.GRAVEL, 1)); + CompressorRecipes.addRecipeAdventure(new ItemStack(Blocks.CLAY, 8, 0), "XXX", "XBX", "XXX", 'X', new ItemStack(Blocks.SAND), 'B', new ItemStack(Items.WATER_BUCKET)); + CompressorRecipes.addRecipeAdventure(new ItemStack(Blocks.SOUL_SAND, 4, 0), "XFX", "FEF", "XFX", 'X', new ItemStack(Blocks.SAND), 'F', new ItemStack(Items.ROTTEN_FLESH), 'E', new ItemStack(Items.FERMENTED_SPIDER_EYE)); + CompressorRecipes.addRecipeAdventure(new ItemStack(Blocks.OBSIDIAN, 1, 0), "XXX", "XBX", "XXX", 'X', new ItemStack(Blocks.STONE), 'B', new ItemStack(Items.BLAZE_POWDER)); //Charcoal into coal - CompressorRecipes.addShapelessAdventure(new ItemStack(Items.coal, 2, 0), new ItemStack(Items.coal, 1, 1), new ItemStack(AsteroidBlocks.blockBasic, 1, 0), new ItemStack(Items.coal, 1, 1)); - CompressorRecipes.addShapelessAdventure(new ItemStack(Items.coal, 2, 0), new ItemStack(Items.coal, 1, 1), new ItemStack(AsteroidBlocks.blockBasic, 1, 1), new ItemStack(Items.coal, 1, 1)); - CompressorRecipes.addShapelessAdventure(new ItemStack(Items.coal, 2, 0), new ItemStack(Items.coal, 1, 1), new ItemStack(AsteroidBlocks.blockBasic, 1, 2), new ItemStack(Items.coal, 1, 1)); + CompressorRecipes.addShapelessAdventure(new ItemStack(Items.COAL, 2, 0), new ItemStack(Items.COAL, 1, 1), new ItemStack(AsteroidBlocks.blockBasic, 1, 0), new ItemStack(Items.COAL, 1, 1)); + CompressorRecipes.addShapelessAdventure(new ItemStack(Items.COAL, 2, 0), new ItemStack(Items.COAL, 1, 1), new ItemStack(AsteroidBlocks.blockBasic, 1, 1), new ItemStack(Items.COAL, 1, 1)); + CompressorRecipes.addShapelessAdventure(new ItemStack(Items.COAL, 2, 0), new ItemStack(Items.COAL, 1, 1), new ItemStack(AsteroidBlocks.blockBasic, 1, 2), new ItemStack(Items.COAL, 1, 1)); //Splintered ice into Ice - CompressorRecipes.addShapelessRecipe(new ItemStack(Blocks.ice), new ItemStack(AsteroidBlocks.blockDenseIce), new ItemStack(AsteroidBlocks.blockDenseIce)); + CompressorRecipes.addShapelessRecipe(new ItemStack(Blocks.ICE), new ItemStack(AsteroidBlocks.blockDenseIce), new ItemStack(AsteroidBlocks.blockDenseIce)); //Slimeball - RecipeUtil.addRecipe(new ItemStack(Items.slime_ball), new Object [] { "XFX", "FEF", "XFX", 'X', new ItemStack(Items.DYE, 1, 2), 'E', new ItemStack(GCItems.cheeseCurd), 'F', new ItemStack(Items.sugar) } ); + RecipeUtil.addRecipe(new ItemStack(Items.SLIME_BALL), new Object [] { "XFX", "FEF", "XFX", 'X', new ItemStack(Items.DYE, 1, 2), 'E', new ItemStack(GCItems.cheeseCurd), 'F', new ItemStack(Items.SUGAR) } ); if (ConfigManagerCore.recipesRequireGCAdvancedMetals) CompressorRecipes.addShapelessRecipe(new ItemStack(AsteroidsItems.basicItem, 1, 6), titaniumIngot, titaniumIngot); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tick/AsteroidsTickHandlerServer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tick/AsteroidsTickHandlerServer.java index 55ed26a417..6825f98bd6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tick/AsteroidsTickHandlerServer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tick/AsteroidsTickHandlerServer.java @@ -32,7 +32,7 @@ public void onServerTick(TickEvent.ServerTickEvent event) if (AsteroidsTickHandlerServer.spaceRaceData == null) { World world = server.worldServerForDimension(0); - AsteroidsTickHandlerServer.spaceRaceData = (ShortRangeTelepadHandler) world.getMapStorage().loadData(ShortRangeTelepadHandler.class, ShortRangeTelepadHandler.saveDataID); + AsteroidsTickHandlerServer.spaceRaceData = (ShortRangeTelepadHandler) world.getMapStorage().getOrLoadData(ShortRangeTelepadHandler.class, ShortRangeTelepadHandler.saveDataID); if (AsteroidsTickHandlerServer.spaceRaceData == null) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamOutput.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamOutput.java index 934e749000..8acf45e791 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamOutput.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamOutput.java @@ -7,10 +7,12 @@ import micdoodle8.mods.miccore.Annotations.NetworkedField; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.fml.relauncher.Side; @@ -103,7 +105,7 @@ public void initiateReflector() { for (int cZ = chunkZMin; cZ <= chunkZMax; cZ++) { - if (this.worldObj.getChunkProvider().chunkExists(cX, cZ)) + if (this.worldObj.getChunkProvider().getLoadedChunk(cX, cZ) != null) { Chunk chunk = this.worldObj.getChunkFromChunkCoords(cX, cZ); @@ -351,5 +353,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) nbt.setInteger("TargetY", this.getTarget().getTile().getPos().getY()); nbt.setInteger("TargetZ", this.getTarget().getTile().getPos().getZ()); } + + return nbt; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamReceiver.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamReceiver.java index 5a8daa54ac..9a50a9301f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamReceiver.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityBeamReceiver.java @@ -364,5 +364,6 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setInteger("FacingSide", this.facing.ordinal()); + return nbt; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java index 41aeef18b0..ef36750b3d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java @@ -292,6 +292,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) mpList.appendTag(this.targetPoints.get(j).writeToNBT(new NBTTagCompound())); } nbt.setTag("TargetPoints", mpList); + return nbt; } @Override @@ -477,7 +478,7 @@ public boolean onActivated(EntityPlayer entityPlayer) { if (this.isMaster) { - ItemStack holding = entityPlayer.getCurrentEquippedItem(); + ItemStack holding = entityPlayer.getActiveItemStack(); if (holding != null && holding.getItem() == AsteroidsItems.astroMiner) { return false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java index 52ccc9d7c2..2b2ecb3ebf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java @@ -26,7 +26,12 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextComponentTranslation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -152,7 +157,7 @@ public void update() this.worldObj.updateEntityWithOptionalForce(e, true); if (e instanceof EntityPlayerMP) { - ((EntityPlayerMP) e).playerNetServerHandler.setPlayerLocation(finalPos.x, finalPos.y, finalPos.z, e.rotationYaw, e.rotationPitch); + ((EntityPlayerMP) e).connection.setPlayerLocation(finalPos.x, finalPos.y, finalPos.z, e.rotationYaw, e.rotationPitch); } GalacticraftCore.packetPipeline.sendToDimension(new PacketSimpleAsteroids(PacketSimpleAsteroids.EnumSimplePacketAsteroids.C_TELEPAD_SEND, this.worldObj.provider.getDimension(), new Object[] { finalPos, e.getEntityId() }), this.worldObj.provider.getDimension()); } @@ -257,6 +262,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) nbt.setInteger("TargetAddress", this.targetAddress); nbt.setInteger("Address", this.address); nbt.setString("Owner", this.owner); + return nbt; } @Override @@ -390,7 +396,7 @@ public boolean hasCustomName() @Override public ITextComponent getDisplayName() { - return (this.hasCustomName() ? new TextComponentString(this.getName()) : new ChatComponentTranslation(this.getName(), new Object[0])); + return (this.hasCustomName() ? new TextComponentString(this.getName()) : new TextComponentTranslation(this.getName(), new Object[0])); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityTelepadFake.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityTelepadFake.java index 3987b7763a..ca77ff974f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityTelepadFake.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityTelepadFake.java @@ -3,12 +3,13 @@ import micdoodle8.mods.galacticraft.core.energy.tile.TileBaseElectricBlock; import micdoodle8.mods.galacticraft.core.network.IPacketReceiver; import micdoodle8.mods.miccore.Annotations.NetworkedField; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import java.lang.ref.WeakReference; @@ -28,7 +29,8 @@ public void setMainBlock(BlockPos mainBlock) if (!this.worldObj.isRemote) { - this.worldObj.notifyBlockUpdate(this.getPos()); + IBlockState state = this.worldObj.getBlockState(this.getPos()); + this.worldObj.notifyBlockUpdate(this.getPos(), state, state, 3); } } @@ -132,6 +134,8 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) tagCompound.setInteger("z", this.mainBlockPosition.getZ()); nbt.setTag("mainBlockPosition", tagCompound); } + + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/BiomeGenBaseAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/BiomeAsteroids.java similarity index 83% rename from src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/BiomeGenBaseAsteroids.java rename to src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/BiomeAsteroids.java index 9c9c6c1bf1..2dcc4a78f8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/BiomeGenBaseAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/BiomeAsteroids.java @@ -11,12 +11,12 @@ public class BiomeAsteroids extends Biome { - public static final Biome asteroid = new BiomeAsteroids(ConfigManagerCore.biomeIDbase + 2).setBiomeName("Asteroids"); + public static final Biome asteroid = new BiomeAsteroids(new BiomeProperties("Asteroids").setRainfall(0.0F)); @SuppressWarnings("unchecked") - private BiomeAsteroids(int var1) + private BiomeAsteroids(BiomeProperties properties) { - super(var1); + super(properties); this.spawnableMonsterList.clear(); this.spawnableWaterCreatureList.clear(); this.spawnableCreatureList.clear(); @@ -29,19 +29,12 @@ private BiomeAsteroids(int var1) { spawnableMonsterList.add(new SpawnListEntry(EntityEnderman.class, 250, 1, 1)); } - this.rainfall = 0F; if (!ConfigManagerCore.disableBiomeTypeRegistrations) { BiomeDictionary.registerBiomeType(this, BiomeDictionary.Type.COLD, BiomeDictionary.Type.DRY, BiomeDictionary.Type.DEAD, BiomeDictionary.Type.SPOOKY); } } - @Override - public BiomeAsteroids setColor(int var1) - { - return (BiomeAsteroids) super.setColor(var1); - } - @Override public float getSpawningChance() { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java index 8b2cbb0fd8..4d8d2292e0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/world/gen/ChunkProviderAsteroids.java @@ -14,15 +14,13 @@ import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.IProgressUpdate; import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkPrimer; -import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.chunk.storage.ExtendedBlockStorage; -import net.minecraft.world.gen.ChunkProviderGenerate; +import net.minecraft.world.gen.ChunkProviderOverworld; import net.minecraft.world.gen.feature.WorldGenFlowers; import net.minecraft.world.gen.feature.WorldGenLakes; import net.minecraft.world.gen.feature.WorldGenTallGrass; @@ -33,25 +31,25 @@ import java.util.List; import java.util.Random; -public class ChunkProviderAsteroids extends ChunkProviderGenerate +public class ChunkProviderAsteroids extends ChunkProviderOverworld { final Block ASTEROID_STONE = AsteroidBlocks.blockBasic; final byte ASTEROID_STONE_META_0 = 0; final byte ASTEROID_STONE_META_1 = 1; final byte ASTEROID_STONE_META_2 = 2; - final Block DIRT = Blocks.dirt; + final Block DIRT = Blocks.DIRT; final byte DIRT_META = 0; - final Block GRASS = Blocks.grass; + final Block GRASS = Blocks.GRASS; final byte GRASS_META = 0; final Block LIGHT = Blocks.GLOWSTONE; final byte LIGHT_META = 0; BlockTallGrass.EnumType GRASS_TYPE = BlockTallGrass.EnumType.GRASS; - final BlockFlower FLOWER = Blocks.red_flower; + final BlockFlower FLOWER = Blocks.RED_FLOWER; - final Block LAVA = Blocks.lava; + final Block LAVA = Blocks.LAVA; final byte LAVA_META = 0; - final Block WATER = Blocks.water; + final Block WATER = Blocks.WATER; final byte WATER_META = 0; private final Random rand; @@ -172,7 +170,7 @@ public ChunkProviderAsteroids(World par1World, long par2, boolean par4) this.coreHandler.addBlock(new SpecialAsteroidBlock(this.ASTEROID_STONE, (byte) 5, 3, .2)); this.coreHandler.addBlock(new SpecialAsteroidBlock(GCBlocks.basicBlock, (byte) 8, 2, .15)); this.coreHandler.addBlock(new SpecialAsteroidBlock(GCBlocks.basicBlock, (byte) 12, 2, .13)); - this.coreHandler.addBlock(new SpecialAsteroidBlock(Blocks.diamond_ore, (byte) 0, 1, .1)); + this.coreHandler.addBlock(new SpecialAsteroidBlock(Blocks.DIAMOND_ORE, (byte) 0, 1, .1)); this.shellHandler = new SpecialAsteroidBlockHandler(); this.shellHandler.addBlock(new SpecialAsteroidBlock(this.ASTEROID_STONE, this.ASTEROID_STONE_META_0, 1, .15)); this.shellHandler.addBlock(new SpecialAsteroidBlock(this.ASTEROID_STONE, this.ASTEROID_STONE_META_1, 3, .15)); @@ -357,7 +355,7 @@ private void generateAsteroid(Random rand, int asteroidX, int asteroidY, int ast if ((y - 1) == terrainYY) { int index = indexBase | (y + 1); - primer.setBlockState(index, this.LIGHT.getStateFromMeta(this.LIGHT_META)); + primer.setBlockState(x, y + 1, z, this.LIGHT.getStateFromMeta(this.LIGHT_META)); // blockArray[index] = this.LIGHT; // metaArray[index] = this.LIGHT_META; } @@ -371,19 +369,19 @@ private void generateAsteroid(Random rand, int asteroidX, int asteroidY, int ast { if (y == terrainY) { - primer.setBlockState(index, this.GRASS.getStateFromMeta(this.GRASS_META)); + primer.setBlockState(x, y, z, this.GRASS.getStateFromMeta(this.GRASS_META)); // blockArray[index] = this.GRASS; // metaArray[index] = this.GRASS_META; } else if (y < terrainY) { - primer.setBlockState(index, this.DIRT.getStateFromMeta(this.DIRT_META)); + primer.setBlockState(x, y, z, this.DIRT.getStateFromMeta(this.DIRT_META)); // blockArray[index] = this.DIRT; // metaArray[index] = this.DIRT_META; } else { - primer.setBlockState(index, Blocks.AIR.getDefaultState()); + primer.setBlockState(x, y, z, Blocks.AIR.getDefaultState()); // blockArray[index] = Blocks.AIR; // metaArray[index] = 0; } @@ -392,26 +390,26 @@ else if (distance <= core.thickness) { if (rand.nextBoolean()) { - primer.setBlockState(index, core.block.getStateFromMeta(core.meta)); + primer.setBlockState(x, y, z, core.block.getStateFromMeta(core.meta)); // blockArray[index] = core.block; // metaArray[index] = core.meta; } else { - primer.setBlockState(index, this.ASTEROID_STONE.getStateFromMeta(this.ASTEROID_STONE_META_0)); + primer.setBlockState(x, y, z, this.ASTEROID_STONE.getStateFromMeta(this.ASTEROID_STONE_META_0)); // blockArray[index] = this.ASTEROID_STONE; // metaArray[index] = this.ASTEROID_STONE_META_0; } } else if (shell != null && distance >= shellThickness) { - primer.setBlockState(index, shell.block.getStateFromMeta(shell.meta)); + primer.setBlockState(x, y, z, shell.block.getStateFromMeta(shell.meta)); // blockArray[index] = shell.block; // metaArray[index] = shell.meta; } else { - primer.setBlockState(index, this.ASTEROID_STONE.getStateFromMeta(this.ASTEROID_STONE_META_1)); + primer.setBlockState(x, y, z, this.ASTEROID_STONE.getStateFromMeta(this.ASTEROID_STONE_META_1)); // blockArray[index] = this.ASTEROID_STONE; // metaArray[index] = this.ASTEROID_STONE_META_1; } @@ -433,7 +431,6 @@ else if (shell != null && distance >= shellThickness) int indexXZ = (x - xMin) * zSize - zMin; int distanceX = asteroidX - (x + chunkX); distanceX *= distanceX; - int indexBaseX = x * ChunkProviderAsteroids.CHUNK_SIZE_Y << 4; for (int z = zMin; z < zMax; z++) { @@ -442,7 +439,6 @@ else if (shell != null && distance >= shellThickness) sizeY *= sizeY; int distanceZ = asteroidZ - (z + chunkZ); distanceZ *= distanceZ; - int indexBase = indexBaseX | z * ChunkProviderAsteroids.CHUNK_SIZE_Y; for (int y = yMin; y < yMax; y++) { @@ -457,15 +453,13 @@ else if (shell != null && distance >= shellThickness) if (distance <= 1) { - int index = indexBase | y; - int indexAbove = indexBase | (y + 1); - IBlockState state = primer.getBlockState(index); - IBlockState stateAbove = primer.getBlockState(indexAbove); + IBlockState state = primer.getBlockState(x, y, z); + IBlockState stateAbove = primer.getBlockState(x, y + 1, z); if (Blocks.AIR == stateAbove.getBlock() && (state.getBlock() == ASTEROID_STONE || state.getBlock() == GRASS)) { if (this.rand.nextInt(GLOWSTONE_CHANCE) == 0) { - primer.setBlockState(index, this.LIGHT.getStateFromMeta(this.LIGHT_META)); + primer.setBlockState(x, y, z, this.LIGHT.getStateFromMeta(this.LIGHT_META)); // blockArray[index] = this.LIGHT; // metaArray[index] = this.LIGHT_META; } @@ -548,7 +542,7 @@ public Chunk provideChunk(int par1, int par2) for (int var6 = 0; var6 < var5.length; ++var6) { - var5[var6] = (byte) BiomeAsteroids.asteroid.biomeID; + var5[var6] = (byte) Biome.getIdForBiome(BiomeAsteroids.asteroid); } // long time3 = System.nanoTime(); @@ -602,13 +596,7 @@ private float randFromPointPos(int x, int z) } @Override - public boolean chunkExists(int par1, int par2) - { - return true; - } - - @Override - public void populate(IChunkProvider par1IChunkProvider, int chunkX, int chunkZ) + public void populate(int chunkX, int chunkZ) { int x = chunkX << 4; int z = chunkZ << 4; @@ -617,9 +605,9 @@ public void populate(IChunkProvider par1IChunkProvider, int chunkX, int chunkZ) return; } - BlockFalling.fallInstantly = true; - this.worldObj.getBiomeGenForCoords(new BlockPos(x + 16, 0, z + 16)); - BlockFalling.fallInstantly = false; +// BlockFalling.fallInstantly = true; +// this.worldObj.getBiome(new BlockPos(x + 16, 0, z + 16)); +// BlockFalling.fallInstantly = false; this.rand.setSeed(this.worldObj.getSeed()); long var7 = this.rand.nextLong() / 2L * 2L + 1L; @@ -732,8 +720,8 @@ else if (!(worldObj.getBlockState(new BlockPos(px - 4, y, pz)) instanceof BlockA { treeType = 0; } - IBlockState log = Blocks.log.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK); - IBlockState leaves = Blocks.leaves.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); + IBlockState log = Blocks.LOG.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK); + IBlockState leaves = Blocks.LEAVES.getDefaultState().withProperty(BlockOldLeaf.VARIANT, BlockPlanks.EnumType.OAK).withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)); WorldGenTrees wg = new WorldGenTrees(false, 2, log, leaves, false); for (int tries = 0; tries < 5; tries++) { @@ -794,12 +782,12 @@ else if (!(worldObj.getBlockState(new BlockPos(px - 4, y, pz)) instanceof BlockA public void generateSkylightMap(Chunk chunk, int cx, int cz) { - World w = chunk.getWorld(); - boolean flagXChunk = w.getChunkProvider().chunkExists(cx - 1, cz); - boolean flagZUChunk = w.getChunkProvider().chunkExists(cx, cz + 1); - boolean flagZDChunk = w.getChunkProvider().chunkExists(cx, cz - 1); - boolean flagXZUChunk = w.getChunkProvider().chunkExists(cx - 1, cz + 1); - boolean flagXZDChunk = w.getChunkProvider().chunkExists(cx - 1, cz - 1); +// World w = chunk.getWorld(); +// boolean flagXChunk = w.getChunkProvider().chunkExists(cx - 1, cz); +// boolean flagZUChunk = w.getChunkProvider().chunkExists(cx, cz + 1); +// boolean flagZDChunk = w.getChunkProvider().chunkExists(cx, cz - 1); +// boolean flagXZUChunk = w.getChunkProvider().chunkExists(cx - 1, cz + 1); +// boolean flagXZDChunk = w.getChunkProvider().chunkExists(cx - 1, cz - 1); for (int j = 0; j < 16; j++) { @@ -868,59 +856,59 @@ public void generateSkylightMap(Chunk chunk, int cx, int cz) { for (int y = yMin; y < yMax; y++) { - if (chunk.getBlock(x - 1, y, z) instanceof BlockAir && !(chunk.getBlock(x, y, z) instanceof BlockAir)) + if (chunk.getBlockState(x - 1, y, z).getBlock() instanceof BlockAir && !(chunk.getBlockState(x, y, z).getBlock() instanceof BlockAir)) { int count = 2; if (x > 1) { - if ((chunk.getBlock(x - 2, y, z) instanceof BlockAir)) + if ((chunk.getBlockState(x - 2, y, z).getBlock() instanceof BlockAir)) { count += 2; } } if (x > 2) { - if ((chunk.getBlock(x - 3, y, z) instanceof BlockAir)) + if ((chunk.getBlockState(x - 3, y, z).getBlock() instanceof BlockAir)) { count += 2; } - if ((chunk.getBlock(x - 3, y + 1, z) instanceof BlockAir)) + if ((chunk.getBlockState(x - 3, y + 1, z).getBlock() instanceof BlockAir)) { count++; } - if ((chunk.getBlock(x - 3, y + 1, z) instanceof BlockAir)) + if ((chunk.getBlockState(x - 3, y + 1, z).getBlock() instanceof BlockAir)) { count++; } - if ((z > 0 /*|| ((xPos & 15) > 2 ? flagZDChunk : flagXZDChunk)*/) && (chunk.getBlock(x - 3, y, z - 1) instanceof BlockAir)) + if ((z > 0 /*|| ((xPos & 15) > 2 ? flagZDChunk : flagXZDChunk)*/) && (chunk.getBlockState(x - 3, y, z - 1).getBlock() instanceof BlockAir)) { count++; } - if ((z < 15/* || ((xPos & 15) > 2 ? flagZUChunk : flagXZUChunk)*/) && (chunk.getBlock(x - 3, y, z + 1) instanceof BlockAir)) + if ((z < 15/* || ((xPos & 15) > 2 ? flagZUChunk : flagXZUChunk)*/) && (chunk.getBlockState(x - 3, y, z + 1).getBlock() instanceof BlockAir)) { count++; } } if (/*flagXChunk || */x > 3) { - if ((chunk.getBlock(x - 4, y, z) instanceof BlockAir)) + if ((chunk.getBlockState(x - 4, y, z).getBlock() instanceof BlockAir)) { count += 2; } - if ((chunk.getBlock(x - 4, y + 1, z) instanceof BlockAir)) + if ((chunk.getBlockState(x - 4, y + 1, z).getBlock() instanceof BlockAir)) { count++; } - if ((chunk.getBlock(x - 4, y + 1, z) instanceof BlockAir)) + if ((chunk.getBlockState(x - 4, y + 1, z).getBlock() instanceof BlockAir)) { count++; } - if ((z > 0/* || ((xPos & 15) > 3 ? flagZDChunk : flagXZDChunk)*/) && !(chunk.getBlock(x - 4, y, z - 1) instanceof BlockAir)) + if ((z > 0/* || ((xPos & 15) > 3 ? flagZDChunk : flagXZDChunk)*/) && !(chunk.getBlockState(x - 4, y, z - 1).getBlock() instanceof BlockAir)) { count++; } - if ((z < 15/* || ((xPos & 15) > 3 ? flagZUChunk : flagXZUChunk)*/) && !(chunk.getBlock(x - 4, y, z + 1) instanceof BlockAir)) + if ((z < 15/* || ((xPos & 15) > 3 ? flagZUChunk : flagXZUChunk)*/) && !(chunk.getBlockState(x - 4, y, z + 1).getBlock() instanceof BlockAir)) { count++; } @@ -944,30 +932,12 @@ public void generateSkylightMap(Chunk chunk, int cx, int cz) chunk.isModified = true; } - @Override - public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) - { - return true; - } - - @Override - public boolean canSave() - { - return true; - } - - @Override - public String makeString() - { - return "RandomLevelSource"; - } - @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { - Biome biomegenbase = this.worldObj.getBiomeGenForCoords(pos); - return biomegenbase.getSpawnableList(creatureType); + Biome biome = this.worldObj.getBiome(pos); + return biome.getSpawnableList(creatureType); } /** diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/ConfigManagerMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/ConfigManagerMars.java index 246710dd35..a19e47980b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/ConfigManagerMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/ConfigManagerMars.java @@ -55,40 +55,40 @@ public static void syncConfig(boolean load, boolean update) } prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "dimensionIDMars", -29); - prop.comment = "Dimension ID for Mars"; + prop.setComment("Dimension ID for Mars"); prop.setLanguageKey("gc.configgui.dimensionIDMars").setRequiresMcRestart(true); dimensionIDMars = prop.getInt(); // prop = config.get(Constants.CONFIG_CATEGORY_SCHEMATIC, "idSchematicRocketT2", 2); - prop.comment = "Schematic ID for Tier 2 Rocket, must be unique."; + prop.setComment("Schematic ID for Tier 2 Rocket, must be unique."); prop.setLanguageKey("gc.configgui.idSchematicRocketT2"); idSchematicRocketT2 = prop.getInt(2); prop = config.get(Constants.CONFIG_CATEGORY_SCHEMATIC, "idSchematicCargoRocket", 3); - prop.comment = "Schematic ID for Cargo Rocket, must be unique."; + prop.setComment("Schematic ID for Cargo Rocket, must be unique."); prop.setLanguageKey("gc.configgui.idSchematicCargoRocket"); idSchematicCargoRocket = prop.getInt(3); // prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "launchControllerChunkLoad", true); - prop.comment = "Whether or not the launch controller acts as a chunk loader. Will cause issues if disabled!"; + prop.setComment("Whether or not the launch controller acts as a chunk loader. Will cause issues if disabled!"); prop.setLanguageKey("gc.configgui.launchControllerChunkLoad"); launchControllerChunkLoad = prop.getBoolean(true); prop = config.get(Constants.CONFIG_CATEGORY_GENERAL, "launchControllerAllDims", false); - prop.comment = "May rarely cause issues if enabled, depends on how the other mod's dimensions are."; + prop.setComment("May rarely cause issues if enabled, depends on how the other mod's dimensions are."); prop.setLanguageKey("gc.configgui.launchControllerAllDims"); launchControllerAllDims = prop.getBoolean(false); prop = config.get(update ? Constants.CONFIG_CATEGORY_GENERAL : Constants.CONFIG_CATEGORY_WORLDGEN, "Disable Iron Ore Gen on Mars", false); - prop.comment = "Disable Iron Ore Gen on Mars."; + prop.setComment("Disable Iron Ore Gen on Mars."); prop.setLanguageKey("gc.configgui.disableIronGenMars"); if (update) { - prop = config.get(Constants.CONFIG_CATEGORY_WORLDGEN, prop.getName(), prop.getBoolean(), prop.comment); + prop = config.get(Constants.CONFIG_CATEGORY_WORLDGEN, prop.getName(), prop.getBoolean(), prop.getComment()); prop.setLanguageKey(prop.getLanguageKey()); config.getCategory(Constants.CONFIG_CATEGORY_GENERAL).remove(prop.getName()); } @@ -96,11 +96,11 @@ public static void syncConfig(boolean load, boolean update) propOrder.add(prop.getName()); prop = config.get(update ? Constants.CONFIG_CATEGORY_GENERAL : Constants.CONFIG_CATEGORY_WORLDGEN, "Disable Copper Ore Gen on Mars", false); - prop.comment = "Disable Copper Ore Gen on Mars."; + prop.setComment("Disable Copper Ore Gen on Mars."); prop.setLanguageKey("gc.configgui.disableCopperGenMars"); if (update) { - prop = config.get(Constants.CONFIG_CATEGORY_WORLDGEN, prop.getName(), prop.getBoolean(), prop.comment); + prop = config.get(Constants.CONFIG_CATEGORY_WORLDGEN, prop.getName(), prop.getBoolean(), prop.getComment()); prop.setLanguageKey(prop.getLanguageKey()); config.getCategory(Constants.CONFIG_CATEGORY_GENERAL).remove(prop.getName()); } @@ -108,11 +108,11 @@ public static void syncConfig(boolean load, boolean update) propOrder.add(prop.getName()); prop = config.get(update ? Constants.CONFIG_CATEGORY_GENERAL : Constants.CONFIG_CATEGORY_WORLDGEN, "Disable Tin Ore Gen on Mars", false); - prop.comment = "Disable Tin Ore Gen on Mars."; + prop.setComment("Disable Tin Ore Gen on Mars."); prop.setLanguageKey("gc.configgui.disableTinGenMars"); if (update) { - prop = config.get(Constants.CONFIG_CATEGORY_WORLDGEN, prop.getName(), prop.getBoolean(), prop.comment); + prop = config.get(Constants.CONFIG_CATEGORY_WORLDGEN, prop.getName(), prop.getBoolean(), prop.getComment()); prop.setLanguageKey(prop.getLanguageKey()); config.getCategory(Constants.CONFIG_CATEGORY_GENERAL).remove(prop.getName()); } @@ -120,11 +120,11 @@ public static void syncConfig(boolean load, boolean update) propOrder.add(prop.getName()); prop = config.get(update ? Constants.CONFIG_CATEGORY_GENERAL : Constants.CONFIG_CATEGORY_WORLDGEN, "Disable Desh Ore Gen on Mars", false); - prop.comment = "Disable Desh Ore Gen on Mars."; + prop.setComment("Disable Desh Ore Gen on Mars."); prop.setLanguageKey("gc.configgui.disableDeshGenMars"); if (update) { - prop = config.get(Constants.CONFIG_CATEGORY_WORLDGEN, prop.getName(), prop.getBoolean(), prop.comment); + prop = config.get(Constants.CONFIG_CATEGORY_WORLDGEN, prop.getName(), prop.getBoolean(), prop.getComment()); prop.setLanguageKey(prop.getLanguageKey()); config.getCategory(Constants.CONFIG_CATEGORY_GENERAL).remove(prop.getName()); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java index e8feaaa365..6ab5b31750 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java @@ -7,7 +7,7 @@ import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.blocks.BlockMulti; import micdoodle8.mods.galacticraft.core.client.render.entities.RenderPlayerGC; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; import micdoodle8.mods.galacticraft.core.event.EventHandlerGC.OrientCameraEvent; import micdoodle8.mods.galacticraft.core.event.EventLandingPadRemoval; import micdoodle8.mods.galacticraft.core.event.EventWakePlayer; @@ -27,13 +27,10 @@ import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayer.EnumStatus; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.potion.Potion; -import net.minecraft.server.MinecraftServer; +import net.minecraft.init.MobEffects; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EntityDamageSource; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.WorldServer; import net.minecraft.world.gen.feature.WorldGenerator; @@ -49,9 +46,9 @@ public class EventHandlerMars @SubscribeEvent public void onLivingDeath(LivingDeathEvent event) { - if (event.source.damageType.equals("slimeling") && event.source instanceof EntityDamageSource) + if (event.getSource().damageType.equals("slimeling") && event.getSource() instanceof EntityDamageSource) { - EntityDamageSource source = (EntityDamageSource) event.source; + EntityDamageSource source = (EntityDamageSource) event.getSource(); if (source.getEntity() instanceof EntitySlimeling && !source.getEntity().worldObj.isRemote) { @@ -63,9 +60,9 @@ public void onLivingDeath(LivingDeathEvent event) @SubscribeEvent public void onLivingAttacked(LivingAttackEvent event) { - if (!event.entity.isEntityInvulnerable(event.source) && !event.entity.worldObj.isRemote && event.entityLiving.getHealth() <= 0.0F && !(event.source.isFireDamage() && event.entityLiving.isPotionActive(Potion.fireResistance))) + if (!event.getEntity().isEntityInvulnerable(event.getSource()) && !event.getEntity().worldObj.isRemote && event.getEntityLiving().getHealth() <= 0.0F && !(event.getSource().isFireDamage() && event.getEntityLiving().isPotionActive(MobEffects.FIRE_RESISTANCE))) { - Entity entity = event.source.getEntity(); + Entity entity = event.getSource().getEntity(); if (entity instanceof EntitySlimeling) { @@ -83,8 +80,8 @@ public void onLivingAttacked(LivingAttackEvent event) @SubscribeEvent public void onPlayerWakeUp(EventWakePlayer event) { - BlockPos c = event.entityPlayer.playerLocation; - IBlockState state = event.entityPlayer.getEntityWorld().getBlockState(c); + BlockPos c = event.getEntityPlayer().bedLocation; + IBlockState state = event.getEntityPlayer().getEntityWorld().getBlockState(c); Block blockID = state.getBlock(); int metadata = blockID.getMetaFromState(state); @@ -92,21 +89,21 @@ public void onPlayerWakeUp(EventWakePlayer event) { if (!event.flag1 && event.flag2 && event.flag3) { - event.result = EnumStatus.NOT_POSSIBLE_HERE; + event.result = EntityPlayer.SleepResult.NOT_POSSIBLE_HERE; - if (event.entityPlayer.worldObj.isRemote && event.bypassed && event.entityPlayer instanceof EntityPlayerSP) + if (event.getEntityPlayer().worldObj.isRemote && event.bypassed && event.getEntityPlayer() instanceof EntityPlayerSP) { - GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_WAKE_PLAYER, event.entityPlayer.worldObj.provider.getDimension(), new Object[] {})); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_WAKE_PLAYER, event.getEntityPlayer().worldObj.provider.getDimension(), new Object[] {})); } } else if (!event.flag1 && !event.flag2 && event.flag3) { - if (!event.entityPlayer.worldObj.isRemote) + if (!event.getEntityPlayer().worldObj.isRemote) { - event.entityPlayer.heal(5.0F); - GCPlayerStats.get((EntityPlayerMP) event.entityPlayer).cryogenicChamberCooldown = 6000; + event.getEntityPlayer().heal(5.0F); + event.getEntityPlayer().getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null).setCryogenicChamberCooldown(6000); - for (WorldServer worldServer : MinecraftServer.getServer().worldServers) + for (WorldServer worldServer : event.getEntity().getServer().worldServers) { worldServer.setWorldTime(0); } @@ -119,14 +116,14 @@ else if (!event.flag1 && !event.flag2 && event.flag3) @SubscribeEvent public void onPlayerRotate(RenderPlayerGC.RotatePlayerEvent event) { - BlockPos blockPos = event.entityPlayer.playerLocation; - IBlockState state = event.entityPlayer.worldObj.getBlockState(blockPos); + BlockPos blockPos = event.getEntityPlayer().bedLocation; + IBlockState state = event.getEntityPlayer().worldObj.getBlockState(blockPos); if (state.getBlock() == GCBlocks.fakeBlock && state.getValue(BlockMulti.MULTI_TYPE) == BlockMulti.EnumBlockMultiType.CRYO_CHAMBER) { - TileEntity tile = event.entityPlayer.worldObj.getTileEntity(blockPos); + TileEntity tile = event.getEntityPlayer().worldObj.getTileEntity(blockPos); if (tile instanceof TileEntityMulti) { - state = event.entityPlayer.worldObj.getBlockState(((TileEntityMulti) tile).mainBlockPosition); + state = event.getEntityPlayer().worldObj.getBlockState(((TileEntityMulti) tile).mainBlockPosition); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java index 6095a12f5d..59b863551b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java @@ -42,19 +42,17 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.event.*; import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.common.registry.LanguageRegistry; import net.minecraftforge.fml.relauncher.Side; import java.lang.reflect.Method; @@ -64,7 +62,7 @@ public class MarsModule implements IPlanetsModule { public static Fluid sludge; public static Fluid sludgeGC; - public static Material sludgeMaterial = new MaterialLiquid(MapColor.foliageColor); + public static Material sludgeMaterial = new MaterialLiquid(MapColor.FOLIAGE); public static Planet planetMars; @@ -103,7 +101,7 @@ public void preInit(FMLPreInitializationEvent event) { MarsItems.bucketSludge = new ItemBucketGC(MarsBlocks.blockSludge).setUnlocalizedName("bucket_sludge"); MarsItems.registerItem(MarsItems.bucketSludge); - FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("bacterialsludge", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(MarsItems.bucketSludge), new ItemStack(Items.bucket)); + FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("bacterialsludge", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(MarsItems.bucketSludge), new ItemStack(Items.BUCKET)); } EventHandlerGC.bucketList.put(MarsBlocks.blockSludge, MarsItems.bucketSludge); @@ -224,22 +222,17 @@ public void registerOtherEntities() public void registerGalacticraftCreature(Class var0, String var1, int back, int fore) { MarsModule.registerGalacticraftNonMobEntity(var0, var1, 80, 3, true); - int nextEggID = GCCoreUtil.getNextValidEggID(); + int nextEggID = GCCoreUtil.getNextValidID(); if (nextEggID < 65536) { - EntityList.idToClassMapping.put(nextEggID, var0); - EntityList.classToIDMapping.put(var0, nextEggID); - EntityList.entityEggs.put(nextEggID, new EntityList.EntityEggInfo(nextEggID, back, fore)); + EntityList.ID_TO_CLASS.put(nextEggID, var0); + EntityList.CLASS_TO_ID.put(var0, nextEggID); + EntityList.ENTITY_EGGS.put(var1, new EntityList.EntityEggInfo(var1, back, fore)); } } public static void registerGalacticraftNonMobEntity(Class var0, String var1, int trackingDistance, int updateFreq, boolean sendVel) { - if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) - { - LanguageRegistry.instance().addStringLocalization("entity.galacticraftplanets." + var1 + ".name", GCCoreUtil.translate("entity." + var1 + ".name")); - LanguageRegistry.instance().addStringLocalization("entity.GalacticraftPlanets." + var1 + ".name", GCCoreUtil.translate("entity." + var1 + ".name")); - } EntityRegistry.registerModEntity(var0, var1, GCCoreUtil.nextInternalID(), GalacticraftPlanets.instance, trackingDistance, updateFreq, sendVel); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java index b3c046fda2..72665c12ec 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java @@ -16,7 +16,7 @@ import micdoodle8.mods.galacticraft.planets.mars.blocks.BlockCavernousVine; import micdoodle8.mods.galacticraft.planets.mars.blocks.MarsBlocks; import micdoodle8.mods.galacticraft.planets.mars.client.SkyProviderMars; -import micdoodle8.mods.galacticraft.planets.mars.client.fx.EntityBacterialDripFX; +import micdoodle8.mods.galacticraft.planets.mars.client.fx.ParticleDrip; import micdoodle8.mods.galacticraft.planets.mars.client.gui.*; import micdoodle8.mods.galacticraft.planets.mars.client.render.entity.*; import micdoodle8.mods.galacticraft.planets.mars.client.render.item.ItemModelRocketT2; @@ -28,24 +28,24 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.Particle; +import net.minecraft.client.renderer.block.model.ModelBakery; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.StateMapperBase; import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.event.TextureStitchEvent; -import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.model.IModelState; +import net.minecraftforge.common.model.TRSRTransformation; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry; @@ -142,7 +142,7 @@ public void loadTextures(TextureStitchEvent.Pre event) private void registerTexture(TextureStitchEvent.Pre event, String texture) { - event.map.registerSprite(new ResourceLocation(GalacticraftPlanets.TEXTURE_PREFIX + "blocks/" + texture)); + event.getMap().registerSprite(new ResourceLocation(GalacticraftPlanets.TEXTURE_PREFIX + "blocks/" + texture)); } @SubscribeEvent @@ -264,7 +264,7 @@ public void spawnParticle(String particleID, Vector3 position, Vector3 motion, O final double dPosX = mc.getRenderViewEntity().posX - position.x; final double dPosY = mc.getRenderViewEntity().posY - position.y; final double dPosZ = mc.getRenderViewEntity().posZ - position.z; - EntityFX particle = null; + Particle particle = null; final double maxDistSqrd = 64.0D; if (dPosX * dPosX + dPosY * dPosY + dPosZ * dPosZ < maxDistSqrd * maxDistSqrd) @@ -275,15 +275,12 @@ public void spawnParticle(String particleID, Vector3 position, Vector3 motion, O } else if (particleID.equals("bacterialDrip")) { - particle = new EntityBacterialDripFX(mc.theWorld, position.x, position.y, position.z); + particle = new ParticleDrip(mc.theWorld, position.x, position.y, position.z); } } if (particle != null) { - particle.prevPosX = particle.posX; - particle.prevPosY = particle.posY; - particle.prevPosZ = particle.posZ; mc.effectRenderer.addEffect(particle); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockBasicMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockBasicMars.java index b5dd52b135..8f5cb86bf0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockBasicMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockBasicMars.java @@ -5,9 +5,9 @@ import micdoodle8.mods.galacticraft.api.block.IPlantableBlock; import micdoodle8.mods.galacticraft.api.block.ITerraformableBlock; import micdoodle8.mods.galacticraft.api.vector.Vector3; -import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.blocks.ISortableBlock; +import micdoodle8.mods.galacticraft.core.client.sounds.GCSounds; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import micdoodle8.mods.galacticraft.planets.mars.items.MarsItems; @@ -15,17 +15,18 @@ import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -38,7 +39,7 @@ public class BlockBasicMars extends Block implements IDetectableResource, IPlantableBlock, ITerraformableBlock, ISortableBlock { - public static final PropertyEnum BASIC_TYPE = PropertyEnum.create("basicTypeMars", EnumBlockBasic.class); + public static final PropertyEnum BASIC_TYPE = PropertyEnum.create("basictypemars", EnumBlockBasic.class); public enum EnumBlockBasic implements IStringSerializable { @@ -90,14 +91,14 @@ public MapColor getMapColor(IBlockState state) { if (state.getValue(BASIC_TYPE) == EnumBlockBasic.DUNGEON_BRICK) { - return MapColor.greenColor; + return MapColor.GREEN; } else if (state.getValue(BASIC_TYPE) == EnumBlockBasic.SURFACE) { - return MapColor.dirtColor; + return MapColor.DIRT; } - return MapColor.redColor; + return MapColor.RED; } @Override @@ -200,7 +201,7 @@ public boolean isValueable(IBlockState state) } @Override - public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) + public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) { return false; } @@ -219,7 +220,7 @@ public boolean isPlantable(IBlockState state) @Override @SideOnly(Side.CLIENT) - public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) + public void randomDisplayTick(IBlockState state, World worldIn, BlockPos pos, Random rand) { if (rand.nextInt(10) == 0) { @@ -229,7 +230,7 @@ public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, if (rand.nextInt(100) == 0) { - worldIn.playSound(pos.getX(), pos.getY(), pos.getZ(), Constants.TEXTURE_PREFIX + "ambience.singledrip", 1, 0.8F + rand.nextFloat() / 5.0F, false); + worldIn.playSound(null, pos.getX(), pos.getY(), pos.getZ(), GCSounds.singleDrip, SoundCategory.AMBIENT, 1, 0.8F + rand.nextFloat() / 5.0F); } } } @@ -239,13 +240,13 @@ public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, public boolean isTerraformable(World world, BlockPos pos) { IBlockState state = world.getBlockState(pos); - return state.getValue(BASIC_TYPE) == EnumBlockBasic.SURFACE && !world.getBlockState(pos.up()).getBlock().isFullCube(); + IBlockState stateAbove = world.getBlockState(pos.up()); + return state.getValue(BASIC_TYPE) == EnumBlockBasic.SURFACE && !stateAbove.getBlock().isFullCube(stateAbove); } @Override public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { - IBlockState state = world.getBlockState(pos); int metadata = state.getBlock().getMetaFromState(state); if (state.getValue(BASIC_TYPE) == EnumBlockBasic.ORE_DESH) { @@ -256,13 +257,12 @@ public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World wo return new ItemStack(Item.getItemFromBlock(this), 1, metadata); } - return super.getPickBlock(target, world, pos, player); + return super.getPickBlock(state, target, world, pos, player); } @Override - public boolean isReplaceableOreGen(World world, BlockPos pos, Predicate target) + public boolean isReplaceableOreGen(IBlockState state, IBlockAccess world, BlockPos pos, Predicate target) { - IBlockState state = world.getBlockState(pos); return (state.getValue(BASIC_TYPE) == EnumBlockBasic.MIDDLE || state.getValue(BASIC_TYPE) == EnumBlockBasic.MARS_STONE); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java index c5d9348b0b..85a60584d8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java @@ -6,20 +6,24 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.init.MobEffects; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -import net.minecraft.util.*; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -33,7 +37,7 @@ public class BlockCavernousVine extends Block implements IShearable, IShiftDescription, ISortableBlock { - public static final PropertyEnum VINE_TYPE = PropertyEnum.create("vineType", EnumVineType.class); + public static final PropertyEnum VINE_TYPE = PropertyEnum.create("vinetype", EnumVineType.class); public enum EnumVineType implements IStringSerializable { @@ -69,15 +73,15 @@ public String getName() public BlockCavernousVine(String assetName) { - super(Material.vine); + super(Material.VINE); this.setLightLevel(1.0F); this.setTickRandomly(true); - this.setStepSound(soundTypeGrass); + this.setSoundType(SoundType.PLANT); this.setUnlocalizedName(assetName); } @Override - public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) + public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { if (world.setBlockToAir(pos)) { @@ -96,8 +100,8 @@ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, b public boolean canBlockStay(World worldIn, BlockPos pos) { - Block blockAbove = worldIn.getBlockState(pos.up()).getBlock(); - return (blockAbove == this || blockAbove.getMaterial().isSolid()); + IBlockState stateAbove = worldIn.getBlockState(pos.up()); + return (stateAbove.getBlock() == this || stateAbove.getBlock().getMaterial(stateAbove).isSolid()); } @Override @@ -124,15 +128,12 @@ public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState s entityIn.motionY = 0.06F; entityIn.rotationYaw += 0.4F; - if (!((EntityLivingBase) entityIn).getActivePotionEffects().contains(Potion.poison)) - { - ((EntityLivingBase) entityIn).addPotionEffect(new PotionEffect(Potion.poison.id, 5, 20, false, true)); - } + ((EntityLivingBase) entityIn).addPotionEffect(new PotionEffect(MobEffects.POISON, 5, 20, false, true)); } } @Override - public int getLightValue(IBlockAccess world, BlockPos pos) + public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { return this.getVineLight(world, pos); } @@ -212,7 +213,7 @@ public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random ra BlockPos pos1 = new BlockPos(pos.getX(), y2, pos.getZ()); Block blockID = worldIn.getBlockState(pos1).getBlock(); - if (!blockID.isAir(worldIn, pos1)) + if (!blockID.isAir(worldIn.getBlockState(pos1), worldIn, pos1)) { return; } @@ -261,7 +262,7 @@ public List onSheared(ItemStack item, IBlockAccess world, BlockPos po } @Override - public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) + public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java index c869bd64a8..09e7182ab0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java @@ -12,10 +12,10 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -96,20 +96,20 @@ public boolean canHarvestBlock(IBlockAccess world, BlockPos pos, EntityPlayer pl ItemStack stack = player.inventory.getCurrentItem(); if (stack == null) { - return player.canHarvestBlock(this); + return player.canHarvestBlock(world.getBlockState(pos)); } return stack.getItem() == MarsItems.deshPickSlime; } @Override - public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos) + public float getPlayerRelativeBlockHardness(IBlockState state, EntityPlayer player, World worldIn, BlockPos pos) { - ItemStack stack = playerIn.inventory.getCurrentItem(); + ItemStack stack = player.inventory.getCurrentItem(); if (stack != null && stack.getItem() == MarsItems.deshPickSlime) { return 0.2F; } - return super.getPlayerRelativeBlockHardness(playerIn, worldIn, pos); + return super.getPlayerRelativeBlockHardness(state, player, worldIn, pos); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java index 260147a5c9..c11707212b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java @@ -18,9 +18,10 @@ import micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityLaunchController; import micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityTerraformer; import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -29,9 +30,10 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -87,7 +89,7 @@ public String getName() public BlockMachineMars(String assetName) { super(GCBlocks.machine); - this.setStepSound(soundTypeMetal); + this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } @@ -139,7 +141,8 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti if (id == GCBlocks.landingPadFull) { - worldIn.notifyBlockUpdate(pos1); + IBlockState state1 = worldIn.getBlockState(pos1); + worldIn.notifyBlockUpdate(pos1, state1, state1, 3); } } } @@ -174,7 +177,7 @@ public boolean onUseWrench(World world, BlockPos pos, EntityPlayer entityPlayer, } @Override - public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityPlayer, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onMachineActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { int metadata = getMetaFromState(worldIn.getBlockState(pos)); @@ -226,7 +229,7 @@ public TileEntity createTileEntity(World world, IBlockState state) } @Override - public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) + public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { if (getMetaFromState(world.getBlockState(pos)) >= BlockMachineMars.LAUNCH_CONTROLLER_METADATA) { @@ -239,13 +242,14 @@ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, b if (id == GCBlocks.landingPadFull) { - world.notifyBlockUpdate(pos1); + IBlockState state1 = world.getBlockState(pos1); + world.notifyBlockUpdate(pos1, state1, state1, 3); } } } } - return super.removedByPlayer(world, pos, player, willHarvest); + return super.removedByPlayer(state, world, pos, player, willHarvest); } public ItemStack getTerraformer() @@ -291,13 +295,13 @@ else if (metadata >= BlockMachineMars.CRYOGENIC_CHAMBER_METADATA) } @Override - public boolean isBed(IBlockAccess world, BlockPos pos, Entity player) + public boolean isBed(IBlockState state, IBlockAccess world, BlockPos pos, Entity player) { return getMetaFromState(world.getBlockState(pos)) >= BlockMachineMars.CRYOGENIC_CHAMBER_METADATA; } @Override - public BlockPos getBedSpawnPosition(IBlockAccess world, BlockPos pos, EntityPlayer player) + public BlockPos getBedSpawnPosition(IBlockState state, IBlockAccess world, BlockPos pos, EntityPlayer player) { return pos.up(); } @@ -314,7 +318,7 @@ public void setBedOccupied(IBlockAccess world, BlockPos pos, EntityPlayer player } @Override - public EnumFacing getBedDirection(IBlockAccess world, BlockPos pos) + public EnumFacing getBedDirection(IBlockState state, IBlockAccess world, BlockPos pos) { return EnumFacing.DOWN; } @@ -369,7 +373,7 @@ protected BlockStateContainer createBlockState() @Override @SideOnly(Side.CLIENT) - public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) + public void randomDisplayTick(IBlockState state, World worldIn, BlockPos pos, Random rand) { if (state.getValue(TYPE) == EnumMachineType.CRYOGENIC_CHAMBER) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java index 7ba1a18c66..9aafc8a305 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java @@ -14,10 +14,10 @@ import micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityElectrolyzer; import micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityGasLiquefier; import micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityMethaneSynthesizer; -import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; @@ -25,7 +25,12 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -219,7 +224,7 @@ public boolean onUseWrench(World world, BlockPos pos, EntityPlayer entityPlayer, * Called when the block is right clicked by the player */ @Override - public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityPlayer, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onMachineActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { playerIn.openGui(GalacticraftPlanets.instance, GuiIdsPlanets.MACHINE_MARS, worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; @@ -265,8 +270,7 @@ public int damageDropped(IBlockState state) @Override public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { - int metadata = this.getDamageValue(world, pos); - + int metadata = this.getMetaFromState(world.getBlockState(pos)); return new ItemStack(this, 1, metadata); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java index 955a569265..1e2647364b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java @@ -12,26 +12,27 @@ import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Enchantments; import net.minecraft.item.Item; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumHand; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import javax.annotation.Nullable; import java.util.List; public class BlockSlimelingEgg extends Block implements ITileEntityProvider, IShiftDescription, ISortableBlock @@ -70,7 +71,7 @@ public String getName() public BlockSlimelingEgg(String assetName) { super(Material.ROCK); - this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.625F, 0.75F); +// this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.625F, 0.75F); this.setUnlocalizedName(assetName); this.setDefaultState(this.blockState.getBaseState().withProperty(EGG_COLOR, EnumEggColor.RED).withProperty(BROKEN, false)); } @@ -138,9 +139,9 @@ private boolean beginHatch(World world, BlockPos pos, EntityPlayer player) } @Override - public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) + public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { - ItemStack currentStack = player.getCurrentEquippedItem(); + ItemStack currentStack = player.getActiveItemStack(); if (currentStack != null && currentStack.getItem() instanceof ItemPickaxe) { return world.setBlockToAir(pos); @@ -163,23 +164,23 @@ public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, } @Override - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te) + public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, @Nullable ItemStack stack) { - ItemStack currentStack = player.getCurrentEquippedItem(); + ItemStack currentStack = player.getActiveItemStack(); if (currentStack != null && currentStack.getItem() instanceof ItemPickaxe) { - player.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1); + player.addStat(StatList.getBlockStats(this)); player.addExhaustion(0.025F); this.dropBlockAsItem(worldIn, pos, state.getBlock().getStateFromMeta(state.getBlock().getMetaFromState(state) % 3), 0); - if (currentStack.getItem() == MarsItems.deshPickaxe && EnchantmentHelper.getSilkTouchModifier(player)) + if (currentStack.getItem() == MarsItems.deshPickaxe && EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0) { ItemStack itemstack = new ItemStack(MarsItems.deshPickSlime, 1, currentStack.getItemDamage()); if (currentStack.getTagCompound() != null) { - itemstack.setTagCompound((NBTTagCompound) currentStack.getTagCompound().copy()); + itemstack.setTagCompound(currentStack.getTagCompound().copy()); } - player.setCurrentItemOrArmor(0, itemstack); + player.inventory.setInventorySlotContents(player.inventory.currentItem, itemstack); } } } @@ -241,7 +242,6 @@ public TileEntity createNewTileEntity(World world, int meta) @Override public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { - IBlockState state = world.getBlockState(pos); int metadata = state.getBlock().getMetaFromState(state); if (metadata == 3) @@ -256,7 +256,7 @@ public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World wo { return new ItemStack(Item.getItemFromBlock(this), 1, 2); } - return super.getPickBlock(target, world, pos, player); + return super.getPickBlock(state, target, world, pos, player); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/SkyProviderMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/SkyProviderMars.java index 1231ce4593..46ad5612dc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/SkyProviderMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/SkyProviderMars.java @@ -7,9 +7,9 @@ import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3d; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; import net.minecraftforge.client.IRenderHandler; import net.minecraftforge.fml.client.FMLClientHandler; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/EntityCryoFX.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/EntityCryoFX.java index 8f4dce2b03..d18af1ef17 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/EntityCryoFX.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/EntityCryoFX.java @@ -1,7 +1,7 @@ package micdoodle8.mods.galacticraft.planets.mars.client.fx; import micdoodle8.mods.galacticraft.api.vector.Vector3; -import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -11,7 +11,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class EntityCryoFX extends EntityFX +public class EntityCryoFX extends Particle { float field_70569_a; @@ -33,7 +33,7 @@ public EntityCryoFX(World worldIn, Vector3 position, Vector3 motion) this.field_70569_a = this.particleScale; this.particleMaxAge = (int) (8.0D / (Math.random() * 0.8D + 0.3D)); this.particleMaxAge = (int) ((float) this.particleMaxAge * f); - this.noClip = true; + this.canCollide = false; } /** @@ -60,7 +60,7 @@ public void onUpdate() if (this.particleAge++ >= this.particleMaxAge) { - this.setDead(); + this.setExpired(); } this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); @@ -68,7 +68,7 @@ public void onUpdate() this.motionX *= 0.9599999785423279D; this.motionY *= 0.9599999785423279D; this.motionZ *= 0.9599999785423279D; - EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, 2.0D); + EntityPlayer entityplayer = this.worldObj.getClosestPlayer(this.posX, this.posY, this.posZ, 2.0D, false); if (entityplayer != null && this.posY > entityplayer.getEntityBoundingBox().minY) { @@ -77,7 +77,7 @@ public void onUpdate() this.setPosition(this.posX, this.posY, this.posZ); } - if (this.onGround) + if (this.isCollided) { this.motionX *= 0.699999988079071D; this.motionZ *= 0.699999988079071D; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/EntityBacterialDripFX.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/ParticleDrip.java similarity index 82% rename from src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/EntityBacterialDripFX.java rename to src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/ParticleDrip.java index 464d0192f3..262769f64c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/EntityBacterialDripFX.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/ParticleDrip.java @@ -3,7 +3,7 @@ import net.minecraft.block.BlockLiquid; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.Particle; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; @@ -11,11 +11,11 @@ import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class EntityBacterialDripFX extends EntityFX +public class ParticleDrip extends Particle { private int bobTimer; - public EntityBacterialDripFX(World world, double x, double y, double z) + public ParticleDrip(World world, double x, double y, double z) { super(world, x, y, z, 0.0D, 0.0D, 0.0D); this.motionX = this.motionY = this.motionZ = 0.0D; @@ -57,19 +57,17 @@ public void onUpdate() if (this.particleMaxAge-- <= 0) { - this.setDead(); + this.setExpired(); } - if (this.onGround) + if (this.isCollided) { - this.setDead(); - this.motionX *= 0.699999988079071D; - this.motionZ *= 0.699999988079071D; + this.setExpired(); } - BlockPos pos = new BlockPos(this); + BlockPos pos = new BlockPos(this.posX, this.posY, this.posZ); IBlockState state = this.worldObj.getBlockState(pos); - Material material = state.getBlock().getMaterial(); + Material material = state.getBlock().getMaterial(state); if (material.isLiquid() || material.isSolid()) { @@ -84,7 +82,7 @@ public void onUpdate() if (this.posY < d1) { - this.setDead(); + this.setExpired(); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSlimeling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSlimeling.java index a0d25ffa44..8214f08683 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSlimeling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSlimeling.java @@ -14,6 +14,7 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.init.SoundEvents; import net.minecraft.util.ChatAllowedCharacters; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.FMLClientHandler; @@ -180,7 +181,7 @@ protected void mouseClicked(int px, int py, int par3) throws IOException if (px >= this.invX && px < this.invX + this.invWidth && py >= this.invY && py < this.invY + this.invHeight) { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + this.mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_SLIMELING_DATA, this.slimeling.worldObj.provider.getDimension(), new Object[] { this.slimeling.getEntityId(), 6, "" })); } @@ -317,7 +318,7 @@ public static void drawSlimelingOnGui(GuiSlimeling screen, EntitySlimeling slime slimeling.rotationYawHead = slimeling.rotationYaw; GL11.glTranslatef(0.0F, (float) slimeling.getYOffset(), 0.0F); FMLClientHandler.instance().getClient().getRenderManager().playerViewY = 180.0F; - FMLClientHandler.instance().getClient().getRenderManager().renderEntityWithPosYaw(slimeling, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + FMLClientHandler.instance().getClient().getRenderManager().doRenderEntity(slimeling, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false); slimeling.renderYawOffset = f2; slimeling.rotationYaw = f3; slimeling.rotationPitch = f4; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSlimelingInventory.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSlimelingInventory.java index c9ee99c057..776a5cf052 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSlimelingInventory.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSlimelingInventory.java @@ -5,7 +5,6 @@ import micdoodle8.mods.galacticraft.planets.mars.entities.EntitySlimeling; import micdoodle8.mods.galacticraft.planets.mars.inventory.ContainerSlimeling; import micdoodle8.mods.galacticraft.planets.mars.items.MarsItems; -import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiButton; @@ -13,6 +12,7 @@ import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.FMLClientHandler; @@ -76,7 +76,7 @@ protected void mouseClicked(int px, int py, int par3) throws IOException { if (px >= this.invX && px < this.invX + this.invWidth && py >= this.invY && py < this.invY + this.invHeight) { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + this.mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); this.mc.displayGuiScreen(new GuiSlimeling(this.slimeling)); } @@ -106,7 +106,7 @@ public static void drawSlimelingOnGui(GuiSlimelingInventory screen, EntitySlimel slimeling.rotationYawHead = slimeling.rotationYaw; GL11.glTranslatef(0.0F, (float) slimeling.getYOffset(), 0.0F); FMLClientHandler.instance().getClient().getRenderManager().playerViewY = 180.0F; - FMLClientHandler.instance().getClient().getRenderManager().renderEntityWithPosYaw(slimeling, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F); + FMLClientHandler.instance().getClient().getRenderManager().doRenderEntity(slimeling, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false); slimeling.renderYawOffset = f2; slimeling.rotationYaw = f3; slimeling.rotationPitch = f4; @@ -163,7 +163,7 @@ protected void drawGuiContainerBackgroundLayer(float f, int i, int j) this.drawTexturedModalRect(var5 + 8, var6 + 8, 176, 9, 18, 18); this.drawTexturedModalRect(var5 + 8, var6 + 29, 176, 9, 18, 18); - ItemStack stack = this.slimeling.getCargoSlot(); + ItemStack stack = this.slimeling.slimelingInventory.getStackInSlot(1); if (stack != null && stack.getItem() == MarsItems.marsItemBasic && stack.getItemDamage() == 4) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderCargoRocket.java index 5fcac50c8c..5cd021cbb4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderCargoRocket.java @@ -8,13 +8,11 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; @@ -74,11 +72,7 @@ public void doRender(EntityCargoRocket entity, double par2, double par4, double updateModel(); - Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer worldrenderer = tessellator.getBuffer(); - worldrenderer.begin(GL11.GL_QUADS, rocketModel.getFormat()); ClientUtil.drawBakedModel(rocketModel); - tessellator.draw(); GL11.glPopMatrix(); RenderHelper.enableStandardItemLighting(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderCreeperBoss.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderCreeperBoss.java index 75956b167f..46a86ac4be 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderCreeperBoss.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderCreeperBoss.java @@ -7,8 +7,6 @@ import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.entity.boss.BossStatus; -import net.minecraft.entity.boss.IBossDisplayData; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @@ -29,14 +27,6 @@ protected ResourceLocation getEntityTexture(EntityCreeperBoss entity) return RenderCreeperBoss.creeperTexture; } - @Override - public void doRender(EntityCreeperBoss par1EntityLiving, double par2, double par4, double par6, float par8, float par9) - { - BossStatus.setBossStatus((IBossDisplayData) par1EntityLiving, false); - - super.doRender(par1EntityLiving, par2, par4, par6, par8, par9); - } - // protected int func_27006_a(EntityCreeperBoss par1EntityCreeper, int par2, float par3) // { // if (par1EntityCreeper.headsRemaining == 1) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderProjectileTNT.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderProjectileTNT.java index b0d0b974f1..b7d974e113 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderProjectileTNT.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderProjectileTNT.java @@ -31,7 +31,7 @@ public void doRender(EntityProjectileTNT entity, double x, double y, double z, f float f2 = (1.0F - ((float) entity.ticksExisted - partialTicks + 1.0F) / 100.0F) * 0.1F; this.bindEntityTexture(entity); GlStateManager.translate(-0.5F, -0.5F, 0.5F); - blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getDefaultState(), entity.getBrightness(partialTicks)); + blockrendererdispatcher.renderBlockBrightness(Blocks.TNT.getDefaultState(), entity.getBrightness(partialTicks)); GlStateManager.translate(0.0F, 0.0F, 1.0F); if (entity.ticksExisted % 2 == 0) @@ -43,7 +43,7 @@ public void doRender(EntityProjectileTNT entity, double x, double y, double z, f GlStateManager.color(1.0F, 1.0F, 1.0F, f2); GlStateManager.doPolygonOffset(-3.0F, -3.0F); GlStateManager.enablePolygonOffset(); - blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getDefaultState(), 0.2F); + blockrendererdispatcher.renderBlockBrightness(Blocks.TNT.getDefaultState(), 0.2F); GlStateManager.doPolygonOffset(0.0F, 0.0F); GlStateManager.disablePolygonOffset(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderTier2Rocket.java index 9ec5f77396..28a0b2a8f3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderTier2Rocket.java @@ -10,13 +10,13 @@ import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.resources.model.ModelResourceLocation; -import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -38,14 +38,7 @@ private void updateModel() { if (rocketModel == null) { - Function textureGetter = new Function() - { - @Override - public TextureAtlasSprite apply(ResourceLocation input) - { - return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString()); - } - }; + Function textureGetter = input -> Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString()); ModelResourceLocation modelResourceLocation = new ModelResourceLocation(GalacticraftPlanets.TEXTURE_PREFIX + "rocket_t2", "inventory"); rocketModel = (ItemModelRocketT2) FMLClientHandler.instance().getClient().getRenderItem().getItemModelMesher().getModelManager().getModel(modelResourceLocation); @@ -94,13 +87,7 @@ public void doRender(EntityTier2Rocket entity, double par2, double par4, double GL11.glScalef(-1.0F, -1.0F, 1.0F); GL11.glScalef(0.8F, 0.8F, 0.8F); - Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer worldrenderer = tessellator.getBuffer(); - - worldrenderer.begin(GL11.GL_QUADS, rocketModel.getFormat()); - ClientUtil.drawBakedModel(rocketModel); - tessellator.draw(); GL11.glPopMatrix(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java index 194cbabfc7..0c2936e577 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java @@ -1,8 +1,8 @@ package micdoodle8.mods.galacticraft.planets.mars.client.render.item; import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.resources.model.IBakedModel; import org.lwjgl.Sys; import javax.vecmath.Matrix4f; @@ -52,7 +52,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.FIRST_PERSON) + if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) { Vector3f trans = new Vector3f(0.5F, 1.2F, -1.2F); Matrix4f ret = new Matrix4f(); @@ -76,7 +76,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.THIRD_PERSON) + if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) { Vector3f trans = new Vector3f(0.0F, -0.9F, -0.3F); Matrix4f ret = new Matrix4f(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/TeleportTypeMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/TeleportTypeMars.java index f901329779..19552c3635 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/TeleportTypeMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/TeleportTypeMars.java @@ -2,7 +2,8 @@ import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.api.world.ITeleportType; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.planets.mars.entities.EntityLandingBalloons; import net.minecraft.entity.Entity; @@ -25,8 +26,8 @@ public Vector3 getPlayerSpawnLocation(WorldServer world, EntityPlayerMP player) { if (player != null) { - GCPlayerStats stats = GCPlayerStats.get(player); - return new Vector3(stats.coordsTeleportedFromX, ConfigManagerCore.disableLander ? 250.0 : 900.0, stats.coordsTeleportedFromZ); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + return new Vector3(stats.getCoordsTeleportedFromX(), ConfigManagerCore.disableLander ? 250.0 : 900.0, stats.getCoordsTeleportedFromZ()); } return null; @@ -47,7 +48,8 @@ public Vector3 getParaChestSpawnLocation(WorldServer world, EntityPlayerMP playe @Override public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boolean ridingAutoRocket) { - if (!ridingAutoRocket && player != null && GCPlayerStats.get(player).teleportCooldown <= 0) + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + if (!ridingAutoRocket && player != null && stats.getTeleportCooldown() <= 0) { if (player.capabilities.isFlying) { @@ -61,7 +63,7 @@ public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boole newWorld.spawnEntityInWorld(lander); } - GCPlayerStats.get(player).teleportCooldown = 10; + stats.setTeleportCooldown(10); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/WorldProviderMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/WorldProviderMars.java index 93e1bab38c..956adf5296 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/WorldProviderMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/WorldProviderMars.java @@ -7,13 +7,15 @@ import micdoodle8.mods.galacticraft.api.world.ISolarLevel; import micdoodle8.mods.galacticraft.core.event.EventHandlerGC; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; +import micdoodle8.mods.galacticraft.planets.GCPlanetDimensions; import micdoodle8.mods.galacticraft.planets.mars.MarsModule; -import micdoodle8.mods.galacticraft.planets.mars.world.gen.ChunkProviderMars; import micdoodle8.mods.galacticraft.planets.mars.world.gen.BiomeProviderMars; +import micdoodle8.mods.galacticraft.planets.mars.world.gen.ChunkProviderMars; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.WorldChunkManager; -import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.DimensionType; +import net.minecraft.world.biome.BiomeProvider; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -54,13 +56,13 @@ public boolean shouldForceRespawn() } @Override - public Class getChunkProviderClass() + public Class getChunkProviderClass() { return ChunkProviderMars.class; } @Override - public Class getBiomeProviderClass() + public Class getBiomeProviderClass() { return BiomeProviderMars.class; } @@ -200,7 +202,7 @@ public boolean canRespawnHere() @Override public int getRespawnDimension(EntityPlayerMP player) { - return this.shouldForceRespawn() ? this.dimensionId : 0; + return this.shouldForceRespawn() ? this.getDimension() : 0; } // @Override @@ -322,12 +324,6 @@ public double getSolarEnergyMultiplier() return this.solarMultiplier; } - @Override - public String getInternalNameSuffix() - { - return "_mars"; - } - @Override public boolean shouldDisablePrecipitation() { @@ -339,4 +335,10 @@ public boolean shouldCorrodeArmor() { return false; } + + @Override + public DimensionType getDimensionType() + { + return GCPlanetDimensions.MARS; + } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCargoRocket.java index 0d756f5a3f..533c336cff 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCargoRocket.java @@ -13,13 +13,15 @@ import micdoodle8.mods.galacticraft.planets.mars.items.MarsItems; import micdoodle8.mods.galacticraft.planets.mars.util.MarsUtil; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldServer; @@ -68,7 +70,7 @@ public float getCargoFilledAmount() } @Override - public ItemStack getPickedResult(MovingObjectPosition target) + public ItemStack getPickedResult(RayTraceResult target) { return new ItemStack(MarsItems.rocketMars, 1, this.rocketType.getIndex() + 10); } @@ -186,6 +188,7 @@ protected void spawnParticles(boolean launched) if (!this.isDead) { + EntityLivingBase riddenByEntity = this.getPassengers().isEmpty() || !(this.getPassengers().get(0) instanceof EntityLivingBase) ? null : (EntityLivingBase) this.getPassengers().get(0); GalacticraftCore.proxy.spawnParticle(this.getLaunched() ? "launchFlameLaunched" : "launchFlameIdle", new Vector3(this.posX + 0.2 - this.rand.nextDouble() / 10 + x1, y, this.posZ + 0.2 - this.rand.nextDouble() / 10 + z1), new Vector3(x1, y1, z1), new Object[] { riddenByEntity }); GalacticraftCore.proxy.spawnParticle(this.getLaunched() ? "launchFlameLaunched" : "launchFlameIdle", new Vector3(this.posX - 0.2 + this.rand.nextDouble() / 10 + x1, y, this.posZ + 0.2 - this.rand.nextDouble() / 10 + z1), new Vector3(x1, y1, z1), new Object[] { riddenByEntity }); GalacticraftCore.proxy.spawnParticle(this.getLaunched() ? "launchFlameLaunched" : "launchFlameIdle", new Vector3(this.posX - 0.2 + this.rand.nextDouble() / 10 + x1, y, this.posZ - 0.2 + this.rand.nextDouble() / 10 + z1), new Vector3(x1, y1, z1), new Object[] { riddenByEntity }); @@ -282,11 +285,11 @@ public void onReachAtmosphere() } @Override - public boolean interactFirst(EntityPlayer par1EntityPlayer) + public boolean processInitialInteract(EntityPlayer player, ItemStack stack, EnumHand hand) { - if (!this.worldObj.isRemote && par1EntityPlayer instanceof EntityPlayerMP) + if (!this.worldObj.isRemote && player instanceof EntityPlayerMP) { - MarsUtil.openCargoRocketInventory((EntityPlayerMP) par1EntityPlayer, this); + MarsUtil.openCargoRocketInventory((EntityPlayerMP) player, this); } return false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java index aa368861d8..ca603cc48f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java @@ -3,13 +3,14 @@ import micdoodle8.mods.galacticraft.api.GalacticraftRegistry; import micdoodle8.mods.galacticraft.api.entity.IEntityBreathable; import micdoodle8.mods.galacticraft.api.recipe.ISchematicPage; -import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.GalacticraftCore; +import micdoodle8.mods.galacticraft.core.client.sounds.GCSounds; import micdoodle8.mods.galacticraft.core.dimension.SpaceRace; import micdoodle8.mods.galacticraft.core.dimension.SpaceRaceManager; import micdoodle8.mods.galacticraft.core.entities.EntityAIArrowAttack; import micdoodle8.mods.galacticraft.core.entities.EntityBossBase; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.network.PacketSimple; import micdoodle8.mods.galacticraft.core.network.PacketSimple.EnumSimplePacket; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; @@ -25,12 +26,13 @@ import net.minecraft.entity.ai.*; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.DamageSource; +import net.minecraft.util.SoundEvent; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BossInfo; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; @@ -70,7 +72,7 @@ else if (super.attackEntityFrom(damageSource, damage)) { Entity entity = damageSource.getEntity(); - if (this.riddenByEntity != entity && this.getRidingEntity() != entity) + if (this.getPassengers().contains(entity) && this.getRidingEntity() != entity) { if (entity != this && entity instanceof EntityLivingBase) { @@ -97,8 +99,8 @@ else if (super.attackEntityFrom(damageSource, damage)) protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0F * ConfigManagerCore.dungeonBossHealthMod); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.05F); + this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(200.0F * ConfigManagerCore.dungeonBossHealthMod); + this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.05F); } @Override @@ -113,24 +115,37 @@ public boolean canBePushed() } @Override - protected String getLivingSound() + protected SoundEvent getAmbientSound() { return null; } @Override - protected String getHurtSound() + protected SoundEvent getHurtSound() { - this.playSound(Constants.TEXTURE_PREFIX + "entity.ouch", this.getSoundVolume(), this.getSoundPitch() - 0.15F); + this.playSound(GCSounds.bossOuch, this.getSoundVolume(), this.getSoundPitch() - 0.15F); return null; } @Override - protected String getDeathSound() + protected SoundEvent getDeathSound() { return null; } + // @Override +// protected String getHurtSound() +// { +// this.playSound(Constants.TEXTURE_PREFIX + "entity.ouch", this.getSoundVolume(), this.getSoundPitch() - 0.15F); +// return null; +// } +// +// @Override +// protected String getDeathSound() +// { +// return null; +// } + @Override protected void onDeathUpdate() { @@ -189,7 +204,7 @@ else if (this.getHealth() <= 2 * (this.getMaxHealth() / 3.0)) @Override protected Item getDropItem() { - return Items.arrow; + return Items.ARROW; } @Override @@ -219,13 +234,13 @@ protected void dropFewItems(boolean b, int i) if (i > 0) { - final ItemStack var2 = new ItemStack(Items.bow); - EnchantmentHelper.addRandomEnchantment(this.rand, var2, 5); + final ItemStack var2 = new ItemStack(Items.BOW); + EnchantmentHelper.addRandomEnchantment(this.rand, var2, 5, false); this.entityDropItem(var2, 0.0F); } else { - this.dropItem(Items.bow, 1); + this.dropItem(Items.BOW, 1); } } @@ -244,10 +259,10 @@ public ItemStack getGuaranteedLoot(Random rand) final EntityPlayer player = this.worldObj.getClosestPlayer(this.posX, this.posY, this.posZ, 20.0, false); if (player != null) { - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) player); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); if (stats != null) { - for (ISchematicPage page : stats.unlockedSchematics) + for (ISchematicPage page : stats.getUnlockedSchematics()) { if (page.getPageID() == ConfigManagerAsteroids.idSchematicRocketT3) { @@ -255,7 +270,7 @@ public ItemStack getGuaranteedLoot(Random rand) break; } } - if (stats.rocketItem == AsteroidsItems.tier3Rocket) + if (stats.getRocketItem() == AsteroidsItems.tier3Rocket) { range = 3; } @@ -275,7 +290,7 @@ public ItemStack getGuaranteedLoot(Random rand) @Override public void attackEntityWithRangedAttack(EntityLivingBase entitylivingbase, float f) { - this.worldObj.playAuxSFXAtEntity(null, 1014, new BlockPos((int) this.posX, (int) this.posY, (int) this.posZ), 0); + this.worldObj.playEvent(null, 1024, new BlockPos(this), 0); double d3 = this.posX; double d4 = this.posY + 5.5D; double d5 = this.posZ; @@ -301,4 +316,10 @@ public void dropKey() { this.entityDropItem(new ItemStack(MarsItems.key, 1, 0), 0.5F); } + + @Override + public BossInfo.Color getHealthBarColor() + { + return BossInfo.Color.YELLOW; + } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityLandingBalloons.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityLandingBalloons.java index 0217fa5887..7b65944828 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityLandingBalloons.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityLandingBalloons.java @@ -10,11 +10,14 @@ import micdoodle8.mods.galacticraft.core.network.IPacketReceiver; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.planets.mars.util.MarsUtil; -import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.Particle; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -52,16 +55,22 @@ public double getMountedYOffset() @Override public void onUpdate() { - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { - this.riddenByEntity.onGround = false; + for (Entity entity : this.getPassengers()) + { + entity.onGround = false; + } } super.onUpdate(); - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { - this.riddenByEntity.onGround = false; + for (Entity entity : this.getPassengers()) + { + entity.onGround = false; + } } if (!this.onGround) @@ -107,26 +116,23 @@ public boolean processInitialInteract(EntityPlayer player, ItemStack stack, Enum return false; } - if (this.riddenByEntity != null) - { - this.riddenByEntity.mountEntity(this); - } + this.removePassengers(); return true; } - else if (this.riddenByEntity == null && this.groundHitCount >= 14 && var1 instanceof EntityPlayerMP) + else if (this.getPassengers().isEmpty() && this.groundHitCount >= 14 && player instanceof EntityPlayerMP) { - MarsUtil.openParachestInventory((EntityPlayerMP) var1, this); + MarsUtil.openParachestInventory((EntityPlayerMP) player, this); return true; } - else if (var1 instanceof EntityPlayerMP) + else if (player instanceof EntityPlayerMP) { if (!this.onGround) { return false; } - var1.mountEntity(null); + this.removePassengers(); return true; } else @@ -174,7 +180,7 @@ public boolean shouldMove() return false; } - return ((this.riddenByEntity != null && this.groundHitCount < 14) || !this.onGround); + return ((!this.getPassengers().isEmpty() && this.groundHitCount < 14) || !this.onGround); } @Override @@ -191,7 +197,7 @@ public Map getParticleMap() @SideOnly(Side.CLIENT) @Override - public EntityFX getParticle(Random rand, double x, double y, double z, double motX, double motY, double motZ) + public Particle getParticle(Random rand, double x, double y, double z, double motX, double motY, double motZ) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityProjectileTNT.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityProjectileTNT.java index a6589b7eb1..c9c179e8df 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityProjectileTNT.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityProjectileTNT.java @@ -6,7 +6,7 @@ import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.projectile.EntityFireball; import net.minecraft.util.DamageSource; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -39,7 +39,7 @@ public boolean isBurning() } @Override - protected void onImpact(MovingObjectPosition movingObjectPosition) + protected void onImpact(RayTraceResult movingObjectPosition) { if (!this.worldObj.isRemote) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySlimeling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySlimeling.java index 9bdaff6801..2c47f42061 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySlimeling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySlimeling.java @@ -1,10 +1,10 @@ package micdoodle8.mods.galacticraft.planets.mars.entities; -import com.google.common.base.Predicate; import micdoodle8.mods.galacticraft.api.entity.IEntityBreathable; import micdoodle8.mods.galacticraft.api.vector.Vector3; -import micdoodle8.mods.galacticraft.core.Constants; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.client.sounds.GCSounds; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.util.ColorUtil; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.core.util.WorldUtil; @@ -24,25 +24,42 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.projectile.EntityArrow; -import net.minecraft.init.Blocks; import net.minecraft.init.Items; +import net.minecraft.init.MobEffects; +import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.pathfinding.PathNavigateGround; -import net.minecraft.potion.Potion; -import net.minecraft.util.TextComponentString; +import net.minecraft.network.datasync.DataParameter; +import net.minecraft.network.datasync.DataSerializers; +import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.util.DamageSource; import net.minecraft.util.EntityDamageSource; +import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundEvent; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; +import java.util.UUID; + public class EntitySlimeling extends EntityTameable implements IEntityBreathable { public InventorySlimeling slimelingInventory = new InventorySlimeling(this); + private static final DataParameter HEALTH = EntityDataManager.createKey(EntitySlimeling.class, DataSerializers.FLOAT); + private static final DataParameter COLOR_RED = EntityDataManager.createKey(EntitySlimeling.class, DataSerializers.FLOAT); + private static final DataParameter COLOR_GREEN = EntityDataManager.createKey(EntitySlimeling.class, DataSerializers.FLOAT); + private static final DataParameter COLOR_BLUE = EntityDataManager.createKey(EntitySlimeling.class, DataSerializers.FLOAT); + private static final DataParameter AGE = EntityDataManager.createKey(EntitySlimeling.class, DataSerializers.VARINT); + private static final DataParameter NAME = EntityDataManager.createKey(EntitySlimeling.class, DataSerializers.STRING); + private static final DataParameter FAV_FOOD_ID = EntityDataManager.createKey(EntitySlimeling.class, DataSerializers.VARINT); + private static final DataParameter ATTACK_DAMAGE = EntityDataManager.createKey(EntitySlimeling.class, DataSerializers.FLOAT); + private static final DataParameter KILLS = EntityDataManager.createKey(EntitySlimeling.class, DataSerializers.VARINT); + private static final DataParameter OWNER_USERNAME = EntityDataManager.createKey(EntitySlimeling.class, DataSerializers.STRING); + public float colorRed; public float colorGreen; public float colorBlue; @@ -58,7 +75,6 @@ public EntitySlimeling(World par1World) { super(par1World); this.setSize(0.45F, 0.7F); - ((PathNavigateGround) this.getNavigator()).setAvoidsWater(true); this.tasks.addTask(1, new EntityAISwimming(this)); this.aiSit = new EntityAISitGC(this); this.tasks.addTask(2, this.aiSit); @@ -72,19 +88,7 @@ public EntitySlimeling(World par1World) this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this)); this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this)); this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true)); - this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySludgeling.class, false, new Predicate() - { - public boolean func_180094_a(Entity p_180094_1_) - { - return p_180094_1_ instanceof EntitySludgeling; - } - - @Override - public boolean apply(Object p_apply_1_) - { - return this.func_180094_a((Entity) p_apply_1_); - } - })); + this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySludgeling.class, false, p_apply_1_ -> p_apply_1_ instanceof EntitySludgeling)); this.setTamed(false); switch (this.rand.nextInt(3)) @@ -153,34 +157,34 @@ private void setRandomFavFood() switch (this.rand.nextInt(10)) { case 0: - this.favFoodID = Item.getIdFromItem(Items.gold_ingot); + this.favFoodID = Item.getIdFromItem(Items.GOLD_INGOT); break; case 1: - this.favFoodID = Item.getIdFromItem(Items.flint_and_steel); + this.favFoodID = Item.getIdFromItem(Items.FLINT_AND_STEEL); break; case 2: - this.favFoodID = Item.getIdFromItem(Items.baked_potato); + this.favFoodID = Item.getIdFromItem(Items.BAKED_POTATO); break; case 3: - this.favFoodID = Item.getIdFromItem(Items.stone_sword); + this.favFoodID = Item.getIdFromItem(Items.STONE_SWORD); break; case 4: - this.favFoodID = Item.getIdFromItem(Items.gunpowder); + this.favFoodID = Item.getIdFromItem(Items.GUNPOWDER); break; case 5: - this.favFoodID = Item.getIdFromItem(Items.wooden_hoe); + this.favFoodID = Item.getIdFromItem(Items.WOODEN_HOE); break; case 6: - this.favFoodID = Item.getIdFromItem(Items.emerald); + this.favFoodID = Item.getIdFromItem(Items.EMERALD); break; case 7: - this.favFoodID = Item.getIdFromItem(Items.fish); + this.favFoodID = Item.getIdFromItem(Items.FISH); break; case 8: - this.favFoodID = Item.getIdFromItem(Items.repeater); + this.favFoodID = Item.getIdFromItem(Items.REPEATER); break; case 9: - this.favFoodID = Item.getIdFromItem(Items.boat); + this.favFoodID = Item.getIdFromItem(Items.BOAT); break; } } @@ -197,8 +201,8 @@ public EntitySlimeling(World par1World, float red, float green, float blue) protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.getMaxHealthSlimeling()); + this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.30000001192092896D); + this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(this.getMaxHealthSlimeling()); } // @Override @@ -207,27 +211,27 @@ protected void applyEntityAttributes() // return true; // } + @Override - protected void updateAITick() + protected void updateAITasks() { - this.dataManager.set(18, Float.valueOf(this.getHealth())); + this.dataManager.set(HEALTH, this.getHealth()); } @Override protected void entityInit() { super.entityInit(); - this.dataManager.addObject(18, new Float(this.getHealth())); - this.dataManager.addObject(19, new Float(this.colorRed)); - this.dataManager.addObject(20, new Float(this.colorGreen)); - this.dataManager.addObject(21, new Float(this.colorBlue)); - this.dataManager.addObject(22, new Integer(this.age)); - this.dataManager.addObject(23, ""); - this.dataManager.addObject(24, new Integer(this.favFoodID)); - this.dataManager.addObject(25, new Float(this.attackDamage)); - this.dataManager.addObject(26, new Integer(this.kills)); - this.dataManager.addObject(27, new ItemStack(Blocks.stone)); - this.dataManager.addObject(28, ""); + this.dataManager.register(HEALTH, this.getHealth()); + this.dataManager.register(COLOR_RED, this.colorRed); + this.dataManager.register(COLOR_GREEN, this.colorGreen); + this.dataManager.register(COLOR_BLUE, this.colorBlue); + this.dataManager.register(AGE, this.age); + this.dataManager.register(NAME, ""); + this.dataManager.register(FAV_FOOD_ID, this.favFoodID); + this.dataManager.register(ATTACK_DAMAGE, this.attackDamage); + this.dataManager.register(KILLS, this.kills); + this.dataManager.register(OWNER_USERNAME, ""); this.setName(GCCoreUtil.translate("gui.message.unnamed.name")); } @@ -270,29 +274,23 @@ public void readEntityFromNBT(NBTTagCompound nbt) } @Override - protected String getLivingSound() + protected SoundEvent getHurtSound() { + this.playSound(SoundEvents.BLOCK_SLIME_STEP, this.getSoundVolume(), 1.1F); return null; } @Override - protected String getHurtSound() + protected SoundEvent getDeathSound() { - this.playSound("mob.slime.small", this.getSoundVolume(), 1.1F); - return null; - } - - @Override - protected String getDeathSound() - { - this.playSound(Constants.TEXTURE_PREFIX + "entity.slime_death", this.getSoundVolume(), 0.8F); + this.playSound(GCSounds.slimeDeath, this.getSoundVolume(), 0.8F); return null; } @Override protected Item getDropItem() { - return Items.slime_ball; + return Items.SLIME_BALL; } @Override @@ -329,12 +327,12 @@ public void onLivingUpdate() this.setFavoriteFood(this.favFoodID); this.setAttackDamage(this.attackDamage); this.setKillCount(this.kills); - this.setCargoSlot(this.slimelingInventory.getStackInSlot(1)); +// this.setCargoSlot(this.slimelingInventory.getStackInSlot(1)); } if (!this.worldObj.isRemote) { - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.getMaxHealthSlimeling()); + this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(this.getMaxHealthSlimeling()); if (this.getOwnerUsername().isEmpty()) { @@ -403,13 +401,13 @@ public float getDamage() public void setTamed(boolean par1) { super.setTamed(par1); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.getMaxHealthSlimeling()); + this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(this.getMaxHealthSlimeling()); } @Override - public boolean interact(EntityPlayer par1EntityPlayer) + public boolean processInteract(EntityPlayer player, EnumHand hand, ItemStack stack) { - ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); + ItemStack itemstack = player.inventory.getCurrentItem(); if (this.isTamed()) { @@ -417,13 +415,13 @@ public boolean interact(EntityPlayer par1EntityPlayer) { if (itemstack.getItem() == this.getFavoriteFood()) { - if (this.isOwner(par1EntityPlayer)) + if (this.isOwner(player)) { --itemstack.stackSize; if (itemstack.stackSize <= 0) { - par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null); + player.inventory.setInventorySlotContents(player.inventory.currentItem, null); } if (this.worldObj.isRemote) @@ -438,13 +436,13 @@ public boolean interact(EntityPlayer par1EntityPlayer) } else { - if (par1EntityPlayer instanceof EntityPlayerMP) + if (player instanceof EntityPlayerMP) { - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) par1EntityPlayer); - if (stats.chatCooldown == 0) + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + if (stats.getChatCooldown() == 0) { - par1EntityPlayer.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.slimeling.chat.wrong_player"))); - stats.chatCooldown = 100; + player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.slimeling.chat.wrong_player"))); + stats.setChatCooldown(100); } } } @@ -467,16 +465,16 @@ public boolean interact(EntityPlayer par1EntityPlayer) return true; } - else if (itemstack != null && itemstack.getItem() == Items.slime_ball) + else if (itemstack != null && itemstack.getItem() == Items.SLIME_BALL) { - if (!par1EntityPlayer.capabilities.isCreativeMode) + if (!player.capabilities.isCreativeMode) { --itemstack.stackSize; } if (itemstack.stackSize <= 0) { - par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, (ItemStack) null); + player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack) null); } if (!this.worldObj.isRemote) @@ -488,8 +486,8 @@ else if (itemstack != null && itemstack.getItem() == Items.slime_ball) this.setAttackTarget(null); this.setSittingAI(true); this.setHealth(20.0F); - this.setOwnerId(par1EntityPlayer.getUniqueID().toString()); - this.setOwnerUsername(par1EntityPlayer.getName()); + this.setOwnerId(player.getUniqueID()); + this.setOwnerUsername(player.getName()); this.playTameEffect(true); this.worldObj.setEntityState(this, (byte) 7); } @@ -503,7 +501,7 @@ else if (itemstack != null && itemstack.getItem() == Items.slime_ball) return true; } - return super.interact(par1EntityPlayer); + return super.processInteract(player, hand, stack); } public void setSittingAI(boolean sitting) @@ -513,13 +511,13 @@ public void setSittingAI(boolean sitting) public String getOwnerUsername() { - String s = this.dataManager.getWatchableObjectString(28); + String s = this.dataManager.get(OWNER_USERNAME); return s == null || s.length() == 0 ? "" : s; } public void setOwnerUsername(String username) { - this.dataManager.set(28, username); + this.dataManager.set(OWNER_USERNAME, username); } @Override @@ -542,9 +540,9 @@ public EntitySlimeling spawnBabyAnimal(EntityAgeable par1EntityAgeable) newColor.z = Math.max(Math.min(newColor.z, 1.0F), 0); EntitySlimeling newSlimeling = new EntitySlimeling(this.worldObj, (float) newColor.x, (float) newColor.y, (float) newColor.z); - String s = this.getOwnerId(); + UUID s = this.getOwnerId(); - if (s != null && s.trim().length() > 0) + if (s != null) { newSlimeling.setOwnerId(s); newSlimeling.setTamed(true); @@ -609,84 +607,84 @@ public EntityAgeable createChild(EntityAgeable par1EntityAgeable) public float getColorRed() { - return this.dataManager.getWatchableObjectFloat(19); + return this.dataManager.get(COLOR_RED); } public void setColorRed(float color) { - this.dataManager.set(19, color); + this.dataManager.set(COLOR_RED, color); } public float getColorGreen() { - return this.dataManager.getWatchableObjectFloat(20); + return this.dataManager.get(COLOR_GREEN); } public void setColorGreen(float color) { - this.dataManager.set(20, color); + this.dataManager.set(COLOR_GREEN, color); } public float getColorBlue() { - return this.dataManager.getWatchableObjectFloat(21); + return this.dataManager.get(COLOR_BLUE); } public void setColorBlue(float color) { - this.dataManager.set(21, color); + this.dataManager.set(COLOR_BLUE, color); } @Override public int getAge() { - return this.dataManager.get(22); + return this.dataManager.get(AGE); } public void setAge(int age) { - this.dataManager.set(22, age); + this.dataManager.set(AGE, age); } @Override public String getName() { - return this.dataManager.getWatchableObjectString(23); + return this.dataManager.get(NAME); } public void setName(String name) { - this.dataManager.set(23, name); + this.dataManager.set(NAME, name); } public Item getFavoriteFood() { - return Item.getItemById(this.dataManager.get(24)); + return Item.getItemById(this.dataManager.get(FAV_FOOD_ID)); } public void setFavoriteFood(int foodID) { - this.dataManager.set(24, foodID); + this.dataManager.set(FAV_FOOD_ID, foodID); } public float getAttackDamage() { - return this.dataManager.getWatchableObjectFloat(25); + return this.dataManager.get(ATTACK_DAMAGE); } public void setAttackDamage(float damage) { - this.dataManager.set(25, damage); + this.dataManager.set(ATTACK_DAMAGE, damage); } public int getKillCount() { - return this.dataManager.get(26); + return this.dataManager.get(KILLS); } public void setKillCount(int damage) { - this.dataManager.set(26, damage); + this.dataManager.set(KILLS, damage); } @Override @@ -705,22 +703,6 @@ public EntityAISit getAiSit() return this.aiSit; } - public ItemStack getCargoSlot() - { - return this.dataManager.getWatchableObjectItemStack(27); - } - - public void setCargoSlot(ItemStack stack) - { - ItemStack stack2 = this.dataManager.getWatchableObjectItemStack(27); - - if (stack != stack2) - { - this.dataManager.set(27, stack); - this.dataManager.setObjectWatched(27); - } - } - @Override public void onDeath(DamageSource p_70645_1_) { @@ -728,7 +710,7 @@ public void onDeath(DamageSource p_70645_1_) if (!this.worldObj.isRemote) { - ItemStack bag = this.getCargoSlot(); + ItemStack bag = this.slimelingInventory.getStackInSlot(1); if (bag != null && bag.getItem() == MarsItems.marsItemBasic && bag.getItemDamage() == 4) { this.slimelingInventory.decrStackSize(1, 64); @@ -801,9 +783,9 @@ protected void jump() this.motionY = 0.28D; } - if (this.isPotionActive(Potion.jump)) + if (this.isPotionActive(MobEffects.JUMP_BOOST)) { - this.motionY += (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F; + this.motionY += (this.getActivePotionEffect(MobEffects.JUMP_BOOST).getAmplifier() + 1) * 0.1F; } if (this.isSprinting()) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java index 58ea7cd48a..1581ed4f73 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java @@ -13,7 +13,9 @@ import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; +import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -26,7 +28,7 @@ public EntitySludgeling(World par1World) this.tasks.taskEntries.clear(); this.targetTasks.taskEntries.clear(); this.tasks.addTask(1, new EntityAIAttackMelee(this, 0.25F, true)); - this.tasks.addTask(4, new EntityAIAttackMelee(this, EntityPlayer.class, 1.0D, false)); + this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, false)); this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, false, true, null)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityEvolvedZombie.class, 0, false, true, null)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityEvolvedSkeleton.class, 0, false, true, null)); @@ -45,8 +47,8 @@ public boolean canBreatheUnderwater() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(7.0D); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.0F); + this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(7.0D); + this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(1.0F); } @Override @@ -55,22 +57,19 @@ protected boolean canTriggerWalking() return false; } - @Override - protected String getLivingSound() + protected SoundEvent getAmbientSound() { - return "mob.silverfish.say"; + return SoundEvents.ENTITY_SILVERFISH_AMBIENT; } - @Override - protected String getHurtSound() + protected SoundEvent getHurtSound() { - return "mob.silverfish.hit"; + return SoundEvents.ENTITY_SILVERFISH_HURT; } - @Override - protected String getDeathSound() + protected SoundEvent getDeathSound() { - return "mob.silverfish.kill"; + return SoundEvents.ENTITY_SILVERFISH_DEATH; } public EntityPlayer getClosestEntityToAttack(double par1, double par3, double par5, double par7) @@ -96,7 +95,7 @@ public EntityPlayer getClosestEntityToAttack(double par1, double par3, double pa @Override protected void playStepSound(BlockPos pos, Block block) { - this.worldObj.playSoundAtEntity(this, "mob.silverfish.step", 1.0F, 1.0F); + this.playSound(SoundEvents.ENTITY_SILVERFISH_STEP, 0.15F, 1.0F); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityTier2Rocket.java index 9c07a3e5d9..a42ed6feb1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityTier2Rocket.java @@ -5,17 +5,19 @@ import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.tile.TileEntityLandingPad; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.core.util.PlayerUtil; import micdoodle8.mods.galacticraft.planets.mars.items.MarsItems; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import java.util.List; @@ -55,7 +57,7 @@ protected void entityInit() } @Override - public ItemStack getPickedResult(MovingObjectPosition target) + public ItemStack getPickedResult(RayTraceResult target) { return new ItemStack(MarsItems.rocketMars, 1, this.rocketType.getIndex()); } @@ -158,20 +160,20 @@ public void onTeleport(EntityPlayerMP player) if (playerBase != null) { - GCPlayerStats stats = GCPlayerStats.get(playerBase); + IStatsCapability stats = playerBase.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); if (this.cargoItems == null || this.cargoItems.length == 0) { - stats.rocketStacks = new ItemStack[2]; + stats.setRocketStacks(new ItemStack[2]); } else { - stats.rocketStacks = this.cargoItems; + stats.setRocketStacks(this.cargoItems); } - stats.rocketType = this.rocketType.getIndex(); - stats.rocketItem = MarsItems.rocketMars; - stats.fuelLevel = this.fuelTank.getFluidAmount(); + stats.setRocketType(this.rocketType.getIndex()); + stats.setRocketItem(MarsItems.rocketMars); + stats.setFuelLevel(this.fuelTank.getFluidAmount()); } } @@ -199,6 +201,7 @@ protected void spawnParticles(boolean launched) final double z3 = z2 + z1 / 2D; Vector3 motionVec = new Vector3(x1, y1, z1); + EntityLivingBase riddenByEntity = this.getPassengers().isEmpty() || !(this.getPassengers().get(0) instanceof EntityLivingBase) ? null : (EntityLivingBase) this.getPassengers().get(0); GalacticraftCore.proxy.spawnParticle(this.getLaunched() ? "launchFlameLaunched" : "launchFlameIdle", new Vector3(x2 + 0.4 - this.rand.nextDouble() / 10, y, z2 + 0.4 - this.rand.nextDouble() / 10), motionVec, new Object[] { riddenByEntity }); GalacticraftCore.proxy.spawnParticle(this.getLaunched() ? "launchFlameLaunched" : "launchFlameIdle", new Vector3(x2 - 0.4 + this.rand.nextDouble() / 10, y, z2 + 0.4 - this.rand.nextDouble() / 10), motionVec, new Object[] { riddenByEntity }); GalacticraftCore.proxy.spawnParticle(this.getLaunched() ? "launchFlameLaunched" : "launchFlameIdle", new Vector3(x2 - 0.4 + this.rand.nextDouble() / 10, y, z2 - 0.4 + this.rand.nextDouble() / 10), motionVec, new Object[] { riddenByEntity }); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicCargoRocket.java index ccc007c391..6dbabee229 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicCargoRocket.java @@ -155,21 +155,21 @@ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) if (!done) { - if (var2.getItem() == Item.getItemFromBlock(Blocks.chest) && !((Slot) this.inventorySlots.get(14)).getHasStack()) + if (var2.getItem() == Item.getItemFromBlock(Blocks.CHEST) && !((Slot) this.inventorySlots.get(14)).getHasStack()) { if (!this.mergeOneItem(var4, 14, 15, false)) { return null; } } - else if (var2.getItem() == Item.getItemFromBlock(Blocks.chest) && !((Slot) this.inventorySlots.get(15)).getHasStack()) + else if (var2.getItem() == Item.getItemFromBlock(Blocks.CHEST) && !((Slot) this.inventorySlots.get(15)).getHasStack()) { if (!this.mergeOneItem(var4, 15, 16, false)) { return null; } } - else if (var2.getItem() == Item.getItemFromBlock(Blocks.chest) && !((Slot) this.inventorySlots.get(16)).getHasStack()) + else if (var2.getItem() == Item.getItemFromBlock(Blocks.CHEST) && !((Slot) this.inventorySlots.get(16)).getHasStack()) { if (!this.mergeOneItem(var4, 16, 17, false)) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicTier2Rocket.java index 202e1ba730..772cc3de0e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSchematicTier2Rocket.java @@ -153,21 +153,21 @@ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) if (!done) { - if (var2.getItem() == Item.getItemFromBlock(Blocks.chest) && !((Slot) this.inventorySlots.get(19)).getHasStack()) + if (var2.getItem() == Item.getItemFromBlock(Blocks.CHEST) && !((Slot) this.inventorySlots.get(19)).getHasStack()) { if (!this.mergeOneItem(var4, 19, 20, false)) { return null; } } - else if (var2.getItem() == Item.getItemFromBlock(Blocks.chest) && !((Slot) this.inventorySlots.get(20)).getHasStack()) + else if (var2.getItem() == Item.getItemFromBlock(Blocks.CHEST) && !((Slot) this.inventorySlots.get(20)).getHasStack()) { if (!this.mergeOneItem(var4, 20, 21, false)) { return null; } } - else if (var2.getItem() == Item.getItemFromBlock(Blocks.chest) && !((Slot) this.inventorySlots.get(21)).getHasStack()) + else if (var2.getItem() == Item.getItemFromBlock(Blocks.CHEST) && !((Slot) this.inventorySlots.get(21)).getHasStack()) { if (!this.mergeOneItem(var4, 21, 22, false)) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSlimeling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSlimeling.java index 067f84efae..7f0ee34419 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSlimeling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerSlimeling.java @@ -19,7 +19,7 @@ public ContainerSlimeling(InventoryPlayer playerInventory, EntitySlimeling slime this.slimelingInventory.currentContainer = this; ContainerSlimeling.addSlots(this, playerInventory, slimeling); - ContainerSlimeling.addAdditionalSlots(this, slimeling, slimeling.getCargoSlot()); + ContainerSlimeling.addAdditionalSlots(this, slimeling, this.slimelingInventory.getStackInSlot(1)); this.slimelingInventory.openInventory(player); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerTerraformer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerTerraformer.java index db08cc03ad..d69042abcc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerTerraformer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/ContainerTerraformer.java @@ -27,7 +27,7 @@ public ContainerTerraformer(InventoryPlayer par1InventoryPlayer, TileEntityTerra { this.tileEntity = tileEntity; - this.addSlotToContainer(new SlotSpecific(tileEntity, 0, 25, 19, new ItemStack(Items.water_bucket), new ItemStack(Items.bucket))); + this.addSlotToContainer(new SlotSpecific(tileEntity, 0, 25, 19, new ItemStack(Items.WATER_BUCKET), new ItemStack(Items.BUCKET))); this.addSlotToContainer(new SlotSpecific(tileEntity, 1, 25, 39, IItemElectric.class)); @@ -53,7 +53,7 @@ else if (var6 == 1) } else if (var6 == 2) { - stacks.add(new ItemStack(Items.wheat_seeds)); + stacks.add(new ItemStack(Items.WHEAT_SEEDS)); } for (var7 = 0; var7 < 4; ++var7) @@ -119,7 +119,7 @@ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) return null; } } - else if (var4.getItem() == Items.water_bucket) + else if (var4.getItem() == Items.WATER_BUCKET) { if (!this.mergeItemStack(var4, 0, 1, false)) { @@ -140,7 +140,7 @@ else if (this.getSlot(6).isItemValid(var4)) return null; } } - else if (var4.getItem() == Items.wheat_seeds) + else if (var4.getItem() == Items.WHEAT_SEEDS) { if (!this.mergeItemStack(var4, 10, 14, false)) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemArmorMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemArmorMars.java index e88ee8d999..11673f96c1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemArmorMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemArmorMars.java @@ -7,6 +7,7 @@ import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; @@ -17,7 +18,7 @@ public class ItemArmorMars extends ItemArmor implements ISortableItem { private final ArmorMaterial material; - public ItemArmorMars(ArmorMaterial par2EnumArmorMaterial, int par3, int par4) + public ItemArmorMars(ArmorMaterial par2EnumArmorMaterial, int par3, EntityEquipmentSlot par4) { super(par2EnumArmorMaterial, par3, par4); this.material = par2EnumArmorMaterial; @@ -32,7 +33,7 @@ public Item setUnlocalizedName(String par1Str) }*/ @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) + public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { if (this.material == MarsItems.ARMORDESH) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java index 5513ea9794..291f996648 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockMachine.java @@ -12,11 +12,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.TextComponentString; -import net.minecraft.util.ChatStyle; -import net.minecraft.util.TextFormatting; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.Style; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; @@ -42,16 +42,16 @@ public boolean placeBlockAt(ItemStack itemStack, EntityPlayer player, World worl { for (int y = 0; y < 3; y++) { - Block blockAt = world.getBlockState(pos.add(0, y, 0)).getBlock(); + IBlockState stateAt = world.getBlockState(pos.add(0, y, 0)); int metaAt = itemStack.getItemDamage(); if (this.getBlock() == MarsBlocks.machine) { - if (!blockAt.getMaterial().isReplaceable() && metaAt >= BlockMachineMars.CRYOGENIC_CHAMBER_METADATA && metaAt < BlockMachineMars.LAUNCH_CONTROLLER_METADATA) + if (!stateAt.getBlock().getMaterial(stateAt).isReplaceable() && metaAt >= BlockMachineMars.CRYOGENIC_CHAMBER_METADATA && metaAt < BlockMachineMars.LAUNCH_CONTROLLER_METADATA) { if (world.isRemote) { - FMLClientHandler.instance().getClient().ingameGUI.setRecordPlaying(new TextComponentString(GCCoreUtil.translate("gui.warning.noroom")).setChatStyle(new ChatStyle().setColor(TextFormatting.RED)).getFormattedText(), false); + FMLClientHandler.instance().getClient().ingameGUI.setRecordPlaying(new TextComponentString(GCCoreUtil.translate("gui.warning.noroom")).setStyle(new Style().setColor(TextFormatting.RED)).getFormattedText(), false); } return false; } @@ -112,8 +112,7 @@ public String getUnlocalizedName() @Override public boolean shouldHoldLeftHandUp(EntityPlayer player) { - ItemStack currentStack = player.getCurrentEquippedItem(); - + ItemStack currentStack = player.getHeldItemMainhand(); return currentStack != null && this.getBlock() == MarsBlocks.machine && currentStack.getItemDamage() >= BlockMachineMars.CRYOGENIC_CHAMBER_METADATA && currentStack.getItemDamage() < BlockMachineMars.LAUNCH_CONTROLLER_METADATA; } @@ -121,8 +120,7 @@ public boolean shouldHoldLeftHandUp(EntityPlayer player) @Override public boolean shouldHoldRightHandUp(EntityPlayer player) { - ItemStack currentStack = player.getCurrentEquippedItem(); - + ItemStack currentStack = player.getHeldItemMainhand(); return currentStack != null && this.getBlock() == MarsBlocks.machine && currentStack.getItemDamage() >= BlockMachineMars.CRYOGENIC_CHAMBER_METADATA && currentStack.getItemDamage() < BlockMachineMars.LAUNCH_CONTROLLER_METADATA; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockTintedGlassPane.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockTintedGlassPane.java index 54e28c2a6f..746206ae5a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockTintedGlassPane.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemBlockTintedGlassPane.java @@ -34,7 +34,7 @@ public IIcon getIconFromDamage(int par1) @Override public String getUnlocalizedName(ItemStack itemstack) { - return this.getBlock().getUnlocalizedName() + "." + ItemDye.dyeColors[~itemstack.getItemDamage() & 15]; + return this.getBlock().getUnlocalizedName() + "." + ItemDye.DYE_COLORS[~itemstack.getItemDamage() & 15]; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java index 19fea866db..642f06e4bf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java @@ -24,6 +24,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; @@ -59,14 +61,14 @@ public CreativeTabs getCreativeTab() } @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) + public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { boolean padFound = false; TileEntity tile = null; if (world.isRemote) { - return false; + return EnumActionResult.PASS; } else { @@ -109,12 +111,12 @@ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, { if (((TileEntityLandingPad) tile).getDockedEntity() != null) { - return false; + return EnumActionResult.PASS; } } else { - return false; + return EnumActionResult.PASS; } EntityAutoRocket rocket; @@ -160,10 +162,10 @@ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, } else { - return false; + return EnumActionResult.PASS; } } - return true; + return EnumActionResult.SUCCESS; } @SuppressWarnings({ "unchecked", "rawtypes" }) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/MarsItems.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/MarsItems.java index 674ab54c10..51962b218d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/MarsItems.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/MarsItems.java @@ -3,6 +3,8 @@ import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; +import net.minecraft.init.SoundEvents; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; @@ -30,7 +32,7 @@ public class MarsItems public static Item carbonFragments; public static Item bucketSludge; - public static ArmorMaterial ARMORDESH = EnumHelper.addArmorMaterial("DESH", "", 42, new int[] { 4, 9, 7, 4 }, 12); + public static ArmorMaterial ARMORDESH = EnumHelper.addArmorMaterial("DESH", "", 42, new int[] { 4, 9, 7, 4 }, 12, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0.0F); public static ToolMaterial TOOLDESH = EnumHelper.addToolMaterial("DESH", 3, 1024, 5.0F, 2.5F, 8); @@ -43,10 +45,10 @@ public static void initItems() MarsItems.deshHoe = new ItemHoeMars(MarsItems.TOOLDESH).setUnlocalizedName("desh_hoe"); MarsItems.deshSpade = new ItemSpadeMars(MarsItems.TOOLDESH).setUnlocalizedName("desh_spade"); MarsItems.deshSword = new ItemSwordMars(MarsItems.TOOLDESH).setUnlocalizedName("desh_sword"); - MarsItems.deshHelmet = new ItemArmorMars(MarsItems.ARMORDESH, 7, 0).setUnlocalizedName("desh_helmet"); - MarsItems.deshChestplate = new ItemArmorMars(MarsItems.ARMORDESH, 7, 1).setUnlocalizedName("desh_chestplate"); - MarsItems.deshLeggings = new ItemArmorMars(MarsItems.ARMORDESH, 7, 2).setUnlocalizedName("desh_leggings"); - MarsItems.deshBoots = new ItemArmorMars(MarsItems.ARMORDESH, 7, 3).setUnlocalizedName("desh_boots"); + MarsItems.deshHelmet = new ItemArmorMars(MarsItems.ARMORDESH, 7, EntityEquipmentSlot.HEAD).setUnlocalizedName("desh_helmet"); + MarsItems.deshChestplate = new ItemArmorMars(MarsItems.ARMORDESH, 7, EntityEquipmentSlot.CHEST).setUnlocalizedName("desh_chestplate"); + MarsItems.deshLeggings = new ItemArmorMars(MarsItems.ARMORDESH, 7, EntityEquipmentSlot.LEGS).setUnlocalizedName("desh_leggings"); + MarsItems.deshBoots = new ItemArmorMars(MarsItems.ARMORDESH, 7, EntityEquipmentSlot.FEET).setUnlocalizedName("desh_boots"); MarsItems.rocketMars = new ItemTier2Rocket().setUnlocalizedName("rocket_t2"); MarsItems.key = new ItemKeyMars().setUnlocalizedName("key"); MarsItems.schematic = new ItemSchematicTier2().setUnlocalizedName("schematic"); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/CargoRocketRecipeHandler.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/CargoRocketRecipeHandler.java index 2a6c86c1e6..83e2fd2f3d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/CargoRocketRecipeHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/CargoRocketRecipeHandler.java @@ -1,9 +1,9 @@ package micdoodle8.mods.galacticraft.planets.mars.nei; import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.util.NEIServerUtils; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import net.minecraft.item.ItemStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GCMarsNEIHighlightHandler.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GCMarsNEIHighlightHandler.java index f3582971de..f9c40dff69 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GCMarsNEIHighlightHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GCMarsNEIHighlightHandler.java @@ -11,7 +11,7 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import java.util.List; @@ -19,7 +19,7 @@ public class GCMarsNEIHighlightHandler implements IHighlightHandler { @Override - public List handleTextData(ItemStack stack, World world, EntityPlayer player, MovingObjectPosition mop, List currenttip, ItemInfo.Layout layout) + public List handleTextData(ItemStack stack, World world, EntityPlayer player, RayTraceResult mop, List currenttip, ItemInfo.Layout layout) { String name = null; try @@ -39,7 +39,7 @@ public List handleTextData(ItemStack stack, World world, EntityPlayer pl { } - if (stack.getItem() == Items.redstone) + if (stack.getItem() == Items.REDSTONE) { IBlockState state = world.getBlockState(mop.getBlockPos()); int md = state.getBlock().getMetaFromState(state); @@ -55,7 +55,7 @@ public List handleTextData(ItemStack stack, World world, EntityPlayer pl } @Override - public ItemStack identifyHighlight(World world, EntityPlayer player, MovingObjectPosition mop) + public ItemStack identifyHighlight(World world, EntityPlayer player, RayTraceResult mop) { BlockPos pos = mop.getBlockPos(); IBlockState state = world.getBlockState(pos); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GasLiquefierRecipeHandler.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GasLiquefierRecipeHandler.java index ddd0b8615e..408aea0ee2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GasLiquefierRecipeHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/GasLiquefierRecipeHandler.java @@ -1,9 +1,9 @@ package micdoodle8.mods.galacticraft.planets.mars.nei; import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.util.NEIServerUtils; import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/MethaneSynthesizerRecipeHandler.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/MethaneSynthesizerRecipeHandler.java index bf05aaf073..cb75e516fa 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/MethaneSynthesizerRecipeHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/MethaneSynthesizerRecipeHandler.java @@ -1,10 +1,10 @@ package micdoodle8.mods.galacticraft.planets.mars.nei; import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import codechicken.nei.recipe.GuiRecipe; import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.util.NEIServerUtils; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import micdoodle8.mods.galacticraft.planets.asteroids.items.AsteroidsItems; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/NEIGalacticraftMarsConfig.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/NEIGalacticraftMarsConfig.java index 96c0621166..8a257b717e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/NEIGalacticraftMarsConfig.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/NEIGalacticraftMarsConfig.java @@ -1,8 +1,8 @@ package micdoodle8.mods.galacticraft.planets.mars.nei; -import codechicken.nei.PositionedStack; import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; +import codechicken.nei.api.stack.PositionedStack; import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.planets.asteroids.items.AsteroidsItems; @@ -119,36 +119,36 @@ public void registerRecipes() this.registerRocketBenchRecipe(input1, new PositionedStack(new ItemStack(MarsItems.rocketMars, 1, 0), 139, 87 + changeY)); ArrayList input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90, -15 + changeY)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(MarsItems.rocketMars, 1, 1), 139, 87 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 26, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 26, -15 + changeY)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(MarsItems.rocketMars, 1, 1), 139, 87 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 52, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 52, -15 + changeY)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(MarsItems.rocketMars, 1, 1), 139, 87 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90, -15 + changeY)); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 26, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 26, -15 + changeY)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(MarsItems.rocketMars, 1, 2), 139, 87 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 26, -15 + changeY)); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 52, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 26, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 52, -15 + changeY)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(MarsItems.rocketMars, 1, 2), 139, 87 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90, -15 + changeY)); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 52, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 52, -15 + changeY)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(MarsItems.rocketMars, 1, 2), 139, 87 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90, -15 + changeY)); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 26, -15 + changeY)); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 52, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 26, -15 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 52, -15 + changeY)); this.registerRocketBenchRecipe(input2, new PositionedStack(new ItemStack(MarsItems.rocketMars, 1, 3), 139, 87 + changeY)); input1 = new ArrayList(); @@ -167,36 +167,36 @@ public void registerRecipes() input1.add(new PositionedStack(new ItemStack(GCItems.partFins), 72, 104)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90, -7 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90, -7 + changeY)); this.registerCargoBenchRecipe(input2, new PositionedStack(new ItemStack(MarsItems.rocketMars, 1, 11), 139, 77 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 116, -7 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 116, -7 + changeY)); this.registerCargoBenchRecipe(input2, new PositionedStack(new ItemStack(MarsItems.rocketMars, 1, 11), 139, 77 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 52, -7 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 52, -7 + changeY)); this.registerCargoBenchRecipe(input2, new PositionedStack(new ItemStack(MarsItems.rocketMars, 1, 11), 139, 77 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90, -7 + changeY)); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 26, -7 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90, -7 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 26, -7 + changeY)); this.registerCargoBenchRecipe(input2, new PositionedStack(new ItemStack(MarsItems.rocketMars, 1, 12), 139, 77 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90, -7 + changeY)); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 52, -7 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90, -7 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 52, -7 + changeY)); this.registerCargoBenchRecipe(input2, new PositionedStack(new ItemStack(MarsItems.rocketMars, 1, 12), 139, 77 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 116, -7 + changeY)); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 52, -7 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 116, -7 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 52, -7 + changeY)); this.registerCargoBenchRecipe(input2, new PositionedStack(new ItemStack(MarsItems.rocketMars, 1, 12), 139, 77 + changeY)); input2 = new ArrayList(input1); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90, -7 + changeY)); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 26, -7 + changeY)); - input2.add(new PositionedStack(new ItemStack(Blocks.chest), 90 + 52, -7 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90, -7 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 26, -7 + changeY)); + input2.add(new PositionedStack(new ItemStack(Blocks.CHEST), 90 + 52, -7 + changeY)); this.registerCargoBenchRecipe(input2, new PositionedStack(new ItemStack(MarsItems.rocketMars, 1, 13), 139, 77 + changeY)); this.registerLiquefierRecipe(new PositionedStack(new ItemStack(AsteroidsItems.methaneCanister, 1, 1), 2, 3), new PositionedStack(new ItemStack(GCItems.fuelCanister, 1, 1), 127, 3)); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/RocketT2RecipeHandler.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/RocketT2RecipeHandler.java index 11f410aa74..75c82ebe4a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/RocketT2RecipeHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/nei/RocketT2RecipeHandler.java @@ -1,9 +1,9 @@ package micdoodle8.mods.galacticraft.planets.mars.nei; import codechicken.lib.gui.GuiDraw; -import codechicken.nei.NEIServerUtils; -import codechicken.nei.PositionedStack; +import codechicken.nei.api.stack.PositionedStack; import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.util.NEIServerUtils; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import net.minecraft.item.ItemStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/network/PacketSimpleMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/network/PacketSimpleMars.java index 7f2aa85b37..dae71905c9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/network/PacketSimpleMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/network/PacketSimpleMars.java @@ -1,7 +1,8 @@ package micdoodle8.mods.galacticraft.planets.mars.network; import io.netty.buffer.ByteBuf; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.event.EventWakePlayer; import micdoodle8.mods.galacticraft.core.network.NetworkUtil; import micdoodle8.mods.galacticraft.core.network.PacketBase; @@ -176,7 +177,7 @@ public void handleClientSide(EntityPlayer player) public void handleServerSide(EntityPlayer player) { EntityPlayerMP playerBase = PlayerUtil.getPlayerBaseServerFromPlayer(player, false); - GCPlayerStats stats = GCPlayerStats.get(playerBase); + IStatsCapability stats = playerBase.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); switch (this.type) { @@ -241,7 +242,7 @@ public void handleServerSide(EntityPlayer player) } break; case S_WAKE_PLAYER: - BlockPos c = playerBase.playerLocation; + BlockPos c = playerBase.bedLocation; if (c != null) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/recipe/RecipeManagerMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/recipe/RecipeManagerMars.java index 50d49f0b5c..904fde72e7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/recipe/RecipeManagerMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/recipe/RecipeManagerMars.java @@ -38,7 +38,7 @@ private static void addUniversalRecipes() RecipeUtil.addRecipe(new ItemStack(MarsBlocks.machine, 1, 0), new Object[] { "XWX", "XZX", "WVW", 'V', GCItems.oxygenConcentrator, 'W', deshPlate, 'X', deshIngot, 'Z', new ItemStack(GCItems.canister) }); - RecipeUtil.addRecipe(new ItemStack(MarsBlocks.machine, 1, 4), new Object[] { "XYX", "XZX", "XYX", 'X', deshPlate, 'Y', new ItemStack(MarsItems.marsItemBasic, 1, 3), 'Z', Items.bed }); + RecipeUtil.addRecipe(new ItemStack(MarsBlocks.machine, 1, 4), new Object[] { "XYX", "XZX", "XYX", 'X', deshPlate, 'Y', new ItemStack(MarsItems.marsItemBasic, 1, 3), 'Z', Items.BED }); //Gas liquefier RecipeUtil.addRecipe(new ItemStack(MarsBlocks.machineT2, 1, 0), new Object[] { "TVS", "FWS", "PXO", 'T', new ItemStack(GCItems.oxTankHeavy, 1, GCItems.oxTankHeavy.getMaxDamage()), 'V', GCItems.oxygenVent, 'F', new ItemStack(GCBlocks.oxygenPipe, 1, 0), 'X', new ItemStack(GCItems.basicItem, 1, 10), 'W', new ItemStack(MarsItems.marsItemBasic, 1, 6), 'O', new ItemStack(GCBlocks.oxygenCompressor, 1, 0), 'P', new ItemStack(GCBlocks.oxygenCompressor, 1, 4), 'S', new ItemStack(GCItems.oxTankMedium, 1, GCItems.oxTankMedium.getMaxDamage()) }); //Methane Synthesizer @@ -46,11 +46,11 @@ private static void addUniversalRecipes() //Water Electrolyzer RecipeUtil.addRecipe(new ItemStack(MarsBlocks.machineT2, 1, 8), new Object[] { "TVT", "FWF", "BXB", 'T', new ItemStack(GCItems.oxTankHeavy, 1, GCItems.oxTankHeavy.getMaxDamage()), 'V', GCItems.oxygenVent, 'F', new ItemStack(GCBlocks.oxygenPipe, 1, 0), 'X', new ItemStack(GCItems.basicItem, 1, 10), 'W', new ItemStack(MarsItems.marsItemBasic, 1, 6), 'B', new ItemStack(GCItems.basicItem, 1, 6) }); //Fluid Manipulator - crafting item - RecipeUtil.addRecipe(new ItemStack(MarsItems.marsItemBasic, 1, 6), new Object[] { "MXM", "SWS", "MXM", 'S', Items.slime_ball, 'X', GCItems.oxygenFan, 'M', meteoricIronIngot, 'W', new ItemStack(GCItems.basicItem, 1, 14) }); + RecipeUtil.addRecipe(new ItemStack(MarsItems.marsItemBasic, 1, 6), new Object[] { "MXM", "SWS", "MXM", 'S', Items.SLIME_BALL, 'X', GCItems.oxygenFan, 'M', meteoricIronIngot, 'W', new ItemStack(GCItems.basicItem, 1, 14) }); RecipeUtil.addRecipe(new ItemStack(MarsItems.marsItemBasic, 1, 1), new Object[] { "X", "X", 'X', deshIngot }); - RecipeUtil.addRecipe(new ItemStack(MarsItems.marsItemBasic, 1, 4), new Object[] { "XWX", "XYX", " Z ", 'W', Items.diamond, 'X', Items.leather, 'Y', Items.slime_ball, 'Z', Blocks.chest }); + RecipeUtil.addRecipe(new ItemStack(MarsItems.marsItemBasic, 1, 4), new Object[] { "XWX", "XYX", " Z ", 'W', Items.DIAMOND, 'X', Items.LEATHER, 'Y', Items.SLIME_BALL, 'Z', Blocks.CHEST }); RecipeUtil.addRecipe(new ItemStack(MarsItems.deshSword), new Object[] { "X", "X", "Y", 'X', new ItemStack(MarsItems.marsItemBasic, 1, 2), 'Y', new ItemStack(MarsItems.marsItemBasic, 1, 1) }); @@ -90,9 +90,9 @@ private static void addUniversalRecipes() RecipeUtil.addRecipe(new ItemStack(GCBlocks.wallGC, 6, 4), new Object[] { "XXX", "XXX", 'X', new ItemStack(MarsBlocks.marsBlock, 1, 4) }); RecipeUtil.addRecipe(new ItemStack(GCBlocks.wallGC, 6, 5), new Object[] { "XXX", "XXX", 'X', new ItemStack(MarsBlocks.marsBlock, 1, 7) }); - CraftingManager.getInstance().addShapelessRecipe(new ItemStack(MarsItems.carbonFragments, 8, 0), new ItemStack(Items.coal, 1, 0)); + CraftingManager.getInstance().addShapelessRecipe(new ItemStack(MarsItems.carbonFragments, 8, 0), new ItemStack(Items.COAL, 1, 0)); - CraftingManager.getInstance().addShapelessRecipe(new ItemStack(MarsItems.carbonFragments, 4, 0), new ItemStack(Items.coal, 1, 1)); + CraftingManager.getInstance().addShapelessRecipe(new ItemStack(MarsItems.carbonFragments, 4, 0), new ItemStack(Items.COAL, 1, 1)); // Smelting FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MarsItems.marsItemBasic, 1, 0), new ItemStack(MarsItems.marsItemBasic, 1, 2), 0.2F); @@ -100,7 +100,7 @@ private static void addUniversalRecipes() FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MarsBlocks.marsBlock, 1, 0), new ItemStack(GCItems.basicItem, 1, 3), 1.0F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MarsBlocks.marsBlock, 1, 1), new ItemStack(GCItems.basicItem, 1, 4), 1.0F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MarsBlocks.marsBlock, 1, 2), new ItemStack(MarsItems.marsItemBasic, 1, 2), 0.2F); - FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MarsBlocks.marsBlock, 1, 3), new ItemStack(Items.iron_ingot), 0.2F); + FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MarsBlocks.marsBlock, 1, 3), new ItemStack(Items.IRON_INGOT), 0.2F); // Schematic HashMap input = new HashMap(); @@ -128,45 +128,45 @@ private static void addUniversalRecipes() MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 0), input); HashMap input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.chest)); + input2.put(19, new ItemStack(Blocks.CHEST)); input2.put(20, null); input2.put(21, null); MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 1), input2); input2 = new HashMap(input); input2.put(19, null); - input2.put(20, new ItemStack(Blocks.chest)); + input2.put(20, new ItemStack(Blocks.CHEST)); input2.put(21, null); MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 1), input2); input2 = new HashMap(input); input2.put(19, null); input2.put(20, null); - input2.put(21, new ItemStack(Blocks.chest)); + input2.put(21, new ItemStack(Blocks.CHEST)); MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 1), input2); input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.chest)); - input2.put(20, new ItemStack(Blocks.chest)); + input2.put(19, new ItemStack(Blocks.CHEST)); + input2.put(20, new ItemStack(Blocks.CHEST)); input2.put(21, null); MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 2), input2); input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.chest)); + input2.put(19, new ItemStack(Blocks.CHEST)); input2.put(20, null); - input2.put(21, new ItemStack(Blocks.chest)); + input2.put(21, new ItemStack(Blocks.CHEST)); MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 2), input2); input2 = new HashMap(input); input2.put(19, null); - input2.put(20, new ItemStack(Blocks.chest)); - input2.put(21, new ItemStack(Blocks.chest)); + input2.put(20, new ItemStack(Blocks.CHEST)); + input2.put(21, new ItemStack(Blocks.CHEST)); MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 2), input2); input2 = new HashMap(input); - input2.put(19, new ItemStack(Blocks.chest)); - input2.put(20, new ItemStack(Blocks.chest)); - input2.put(21, new ItemStack(Blocks.chest)); + input2.put(19, new ItemStack(Blocks.CHEST)); + input2.put(20, new ItemStack(Blocks.CHEST)); + input2.put(21, new ItemStack(Blocks.CHEST)); MarsUtil.addRocketBenchT2Recipe(new ItemStack(MarsItems.rocketMars, 1, 3), input2); // @@ -187,45 +187,45 @@ private static void addUniversalRecipes() input.put(13, new ItemStack(GCItems.partFins)); input2 = new HashMap(input); - input2.put(14, new ItemStack(Blocks.chest)); + input2.put(14, new ItemStack(Blocks.CHEST)); input2.put(15, null); input2.put(16, null); MarsUtil.adCargoRocketRecipe(new ItemStack(MarsItems.rocketMars, 1, 11), input2); input2 = new HashMap(input); input2.put(14, null); - input2.put(15, new ItemStack(Blocks.chest)); + input2.put(15, new ItemStack(Blocks.CHEST)); input2.put(16, null); MarsUtil.adCargoRocketRecipe(new ItemStack(MarsItems.rocketMars, 1, 11), input2); input2 = new HashMap(input); input2.put(14, null); input2.put(15, null); - input2.put(16, new ItemStack(Blocks.chest)); + input2.put(16, new ItemStack(Blocks.CHEST)); MarsUtil.adCargoRocketRecipe(new ItemStack(MarsItems.rocketMars, 1, 11), input2); input2 = new HashMap(input); - input2.put(14, new ItemStack(Blocks.chest)); - input2.put(15, new ItemStack(Blocks.chest)); + input2.put(14, new ItemStack(Blocks.CHEST)); + input2.put(15, new ItemStack(Blocks.CHEST)); input2.put(16, null); MarsUtil.adCargoRocketRecipe(new ItemStack(MarsItems.rocketMars, 1, 12), input2); input2 = new HashMap(input); - input2.put(14, new ItemStack(Blocks.chest)); + input2.put(14, new ItemStack(Blocks.CHEST)); input2.put(15, null); - input2.put(16, new ItemStack(Blocks.chest)); + input2.put(16, new ItemStack(Blocks.CHEST)); MarsUtil.adCargoRocketRecipe(new ItemStack(MarsItems.rocketMars, 1, 12), input2); input2 = new HashMap(input); input2.put(14, null); - input2.put(15, new ItemStack(Blocks.chest)); - input2.put(16, new ItemStack(Blocks.chest)); + input2.put(15, new ItemStack(Blocks.CHEST)); + input2.put(16, new ItemStack(Blocks.CHEST)); MarsUtil.adCargoRocketRecipe(new ItemStack(MarsItems.rocketMars, 1, 12), input2); input2 = new HashMap(input); - input2.put(14, new ItemStack(Blocks.chest)); - input2.put(15, new ItemStack(Blocks.chest)); - input2.put(16, new ItemStack(Blocks.chest)); + input2.put(14, new ItemStack(Blocks.CHEST)); + input2.put(15, new ItemStack(Blocks.CHEST)); + input2.put(16, new ItemStack(Blocks.CHEST)); MarsUtil.adCargoRocketRecipe(new ItemStack(MarsItems.rocketMars, 1, 13), input2); RecipeUtil.addRecipe(new ItemStack(MarsBlocks.machine, 1, BlockMachineMars.LAUNCH_CONTROLLER_METADATA), new Object[] { "ZVZ", "YXY", "ZWZ", 'V', new ItemStack(GCItems.basicItem, 1, 19), 'W', new ItemStack(GCBlocks.aluminumWire, 1, 0), 'X', new ItemStack(GCItems.basicItem, 1, 14), 'Y', deshPlate, 'Z', deshIngot }); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java index 5fff4837ff..3564271ee3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java @@ -4,23 +4,21 @@ import micdoodle8.mods.galacticraft.core.GCBlocks; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.blocks.BlockMulti; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; import micdoodle8.mods.galacticraft.core.tile.IMultiBlock; import micdoodle8.mods.galacticraft.core.tile.TileEntityMulti; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.planets.mars.network.PacketSimpleMars; import micdoodle8.mods.galacticraft.planets.mars.network.PacketSimpleMars.EnumSimplePacketMars; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayer.EnumStatus; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Biomes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.TextComponentString; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; -import net.minecraft.world.biome.Biome; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -49,52 +47,52 @@ public boolean onActivated(EntityPlayer entityPlayer) return false; } - EnumStatus enumstatus = this.sleepInBedAt(entityPlayer, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); + EntityPlayer.SleepResult enumstatus = this.sleepInBedAt(entityPlayer, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); switch (enumstatus) { case OK: - ((EntityPlayerMP) entityPlayer).playerNetServerHandler.setPlayerLocation(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, entityPlayer.rotationYaw, entityPlayer.rotationPitch); + ((EntityPlayerMP) entityPlayer).connection.setPlayerLocation(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, entityPlayer.rotationYaw, entityPlayer.rotationPitch); GalacticraftCore.packetPipeline.sendTo(new PacketSimpleMars(EnumSimplePacketMars.C_BEGIN_CRYOGENIC_SLEEP, entityPlayer.worldObj.provider.getDimension(), new Object[] { this.getPos() }), (EntityPlayerMP) entityPlayer); return true; case NOT_POSSIBLE_NOW: - entityPlayer.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.cryogenic.chat.cant_use", GCPlayerStats.get((EntityPlayerMP) entityPlayer).cryogenicChamberCooldown / 20))); + entityPlayer.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.cryogenic.chat.cant_use", entityPlayer.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null).getCryogenicChamberCooldown() / 20))); return false; default: return false; } } - public EnumStatus sleepInBedAt(EntityPlayer entityPlayer, int par1, int par2, int par3) + public EntityPlayer.SleepResult sleepInBedAt(EntityPlayer entityPlayer, int par1, int par2, int par3) { if (!this.worldObj.isRemote) { if (entityPlayer.isPlayerSleeping() || !entityPlayer.isEntityAlive()) { - return EnumStatus.OTHER_PROBLEM; + return EntityPlayer.SleepResult.OTHER_PROBLEM; } - if (this.worldObj.getBiomeGenForCoords(new BlockPos(par1, par2, par3)) == Biome.hell) + if (this.worldObj.getBiome(new BlockPos(par1, par2, par3)) == Biomes.HELL) { - return EnumStatus.NOT_POSSIBLE_HERE; + return EntityPlayer.SleepResult.NOT_POSSIBLE_HERE; } - if (GCPlayerStats.get((EntityPlayerMP) entityPlayer).cryogenicChamberCooldown > 0) + if (entityPlayer.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null).getCryogenicChamberCooldown() > 0) { -// return EnumStatus.NOT_POSSIBLE_NOW; + return EntityPlayer.SleepResult.NOT_POSSIBLE_NOW; } } if (entityPlayer.isRiding()) { - entityPlayer.mountEntity((Entity) null); + entityPlayer.dismountRidingEntity(); } entityPlayer.setPosition(this.getPos().getX() + 0.5F, this.getPos().getY() + 1.9F, this.getPos().getZ() + 0.5F); entityPlayer.sleeping = true; entityPlayer.sleepTimer = 0; - entityPlayer.playerLocation = new BlockPos(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); + entityPlayer.bedLocation = new BlockPos(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); entityPlayer.motionX = entityPlayer.motionZ = entityPlayer.motionY = 0.0D; if (!this.worldObj.isRemote) @@ -102,7 +100,7 @@ public EnumStatus sleepInBedAt(EntityPlayer entityPlayer, int par1, int par2, in this.worldObj.updateAllPlayersSleepingFlag(); } - return EnumStatus.OK; + return EntityPlayer.SleepResult.OK; } // @Override @@ -203,5 +201,6 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setBoolean("IsChamberOccupied", this.isOccupied); + return nbt; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityDungeonSpawnerMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityDungeonSpawnerMars.java index e37f94ab80..c2f0e2fc82 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityDungeonSpawnerMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityDungeonSpawnerMars.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.planets.mars.tile; -import micdoodle8.mods.galacticraft.core.Constants; +import micdoodle8.mods.galacticraft.core.client.sounds.GCSounds; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSkeleton; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSpider; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedZombie; @@ -8,6 +8,7 @@ import micdoodle8.mods.galacticraft.planets.mars.entities.EntityCreeperBoss; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; +import net.minecraft.util.SoundCategory; import java.util.ArrayList; import java.util.List; @@ -32,6 +33,6 @@ public List> getDisabledCreatures() @Override public void playSpawnSound(Entity entity) { - this.worldObj.playSoundAtEntity(entity, Constants.TEXTURE_PREFIX + "ambience.scaryscape", 9.0F, 1.4F); + this.worldObj.playSound(null, entity.posX, entity.posY, entity.posZ, GCSounds.scaryScape, SoundCategory.AMBIENT, 9.0F, 1.4F); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityElectrolyzer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityElectrolyzer.java index ad3797753e..9e317e694c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityElectrolyzer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityElectrolyzer.java @@ -224,6 +224,8 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) { nbt.setTag("gasTank2", this.liquidTank2.writeToNBT(new NBTTagCompound())); } + + return nbt; } @Override @@ -262,7 +264,7 @@ public boolean canInsertItem(int slotID, ItemStack itemstack, EnumFacing side) case 0: return ItemElectricBase.isElectricItem(itemstack.getItem()); case 1: - return itemstack.getItem() == Items.water_bucket; + return itemstack.getItem() == Items.WATER_BUCKET; default: return false; } @@ -280,7 +282,7 @@ public boolean canExtractItem(int slotID, ItemStack itemstack, EnumFacing side) case 0: return itemstack.getItem() instanceof ItemElectricBase && ((ItemElectricBase) itemstack.getItem()).getElectricityStored(itemstack) <= 0; case 1: - return itemstack.getItem() == Items.bucket; + return itemstack.getItem() == Items.BUCKET; default: return false; } @@ -297,7 +299,7 @@ public boolean isItemValidForSlot(int slotID, ItemStack itemstack) case 0: return ItemElectricBase.isElectricItem(item); case 1: - return item == Items.bucket || item == Items.water_bucket; + return item == Items.BUCKET || item == Items.WATER_BUCKET; } return false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityGasLiquefier.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityGasLiquefier.java index 4e783c3ffb..d8147af907 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityGasLiquefier.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityGasLiquefier.java @@ -19,15 +19,15 @@ import micdoodle8.mods.galacticraft.planets.asteroids.items.ItemAtmosphericValve; import micdoodle8.mods.galacticraft.planets.mars.blocks.BlockMachineMarsT2; import micdoodle8.mods.miccore.Annotations.NetworkedField; -import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; -import net.minecraft.util.text.ITextComponent; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.text.ITextComponent; import net.minecraft.world.WorldProvider; import net.minecraftforge.fluids.*; import net.minecraftforge.fml.relauncher.Side; @@ -148,8 +148,8 @@ public void update() //Air -> Air tank if (this.gasTankType == -1 || (this.gasTankType == TankGases.AIR.index && this.gasTank.getFluid().amount < this.gasTank.getCapacity())) { - Block blockAbove = this.worldObj.getBlockState(getPos().up()).getBlock(); - if (blockAbove != null && blockAbove.getMaterial() == Material.AIR && blockAbove != GCBlocks.breatheableAir && blockAbove != GCBlocks.brightBreatheableAir) + IBlockState stateAbove = this.worldObj.getBlockState(getPos().up()); + if (stateAbove.getBlock().getMaterial(stateAbove) == Material.AIR && stateAbove.getBlock() != GCBlocks.breatheableAir && stateAbove.getBlock() != GCBlocks.brightBreatheableAir) { FluidStack gcAtmosphere = FluidRegistry.getFluidStack(TankGases.AIR.gas, 4); this.gasTank.fill(gcAtmosphere, true); @@ -538,6 +538,8 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) { nbt.setTag("liquidTank2", this.liquidTank2.writeToNBT(new NBTTagCompound())); } + + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java index 80fb361d49..4b51f76128 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityLaunchController.java @@ -27,8 +27,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.ChunkPos; import net.minecraft.util.text.ITextComponent; -import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.IBlockAccess; import net.minecraft.world.WorldServer; import net.minecraftforge.common.ForgeChunkManager; @@ -138,7 +138,7 @@ public void update() if (block != GCBlocks.landingPadFull) { this.connectedPads.remove(i); - ForgeChunkManager.unforceChunk(this.chunkLoadTicket, new ChunkCoordIntPair(coords.getX() >> 4, coords.getZ() >> 4)); + ForgeChunkManager.unforceChunk(this.chunkLoadTicket, new ChunkPos(coords.getX() >> 4, coords.getZ() >> 4)); } } } @@ -266,6 +266,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) nbt.setBoolean("LaunchPadRemovalDisabled", this.launchPadRemovalDisabled); nbt.setBoolean("LaunchPadSchedulingEnabled", this.launchSchedulingEnabled); nbt.setBoolean("HideTargetDestination", this.hideTargetDestination); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntitySlimelingEgg.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntitySlimelingEgg.java index 99d9b6476a..bdec382ddb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntitySlimelingEgg.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntitySlimelingEgg.java @@ -8,6 +8,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ITickable; +import java.util.UUID; + public class TileEntitySlimelingEgg extends TileEntity implements ITickable { public int timeToHatch = -1; @@ -49,7 +51,7 @@ else if (this.timeToHatch == 0 && lastTouchedPlayerUUID != null && lastTouchedPl EntitySlimeling slimeling = new EntitySlimeling(this.worldObj, colorRed, colorGreen, colorBlue); slimeling.setPosition(this.getPos().getX() + 0.5, this.getPos().getY() + 1.0, this.getPos().getZ() + 0.5); - slimeling.setOwnerId(this.lastTouchedPlayerUUID); + slimeling.setOwnerId(UUID.fromString(this.lastTouchedPlayerUUID)); slimeling.setOwnerUsername(this.lastTouchedPlayerName); if (!this.worldObj.isRemote) @@ -80,7 +82,7 @@ public void readFromNBT(NBTTagCompound nbt) } else { - uuid = PreYggdrasilConverter.getStringUUIDFromName(nbt.getString("Owner")); + uuid = PreYggdrasilConverter.convertMobOwnerIfNeeded(this.worldObj.getMinecraftServer(), nbt.getString("Owner")); } if (uuid.length() > 0) @@ -98,5 +100,6 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) nbt.setInteger("TimeToHatch", this.timeToHatch); nbt.setString("OwnerUUID", this.lastTouchedPlayerUUID); nbt.setString("OwnerUsername", this.lastTouchedPlayerName); + return nbt; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java index 1c15803201..1919ac58e3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java @@ -143,7 +143,7 @@ public void update() continue; } - if (!(blockID.isAir(this.worldObj, pos)) && this.getDistanceFromServer(x, y, z) < bubbleSizeSq) + if (!(blockID.isAir(this.worldObj.getBlockState(pos), this.worldObj, pos)) && this.getDistanceFromServer(x, y, z) < bubbleSizeSq) { if (doGrass && blockID instanceof ITerraformableBlock && ((ITerraformableBlock) blockID).isTerraformable(this.worldObj, pos)) { @@ -152,7 +152,7 @@ public void update() else if (doTrees) { Block blockIDAbove = this.worldObj.getBlockState(pos.up()).getBlock(); - if (blockID == Blocks.grass && blockIDAbove.isAir(this.worldObj, pos.up())) + if (blockID == Blocks.GRASS && blockIDAbove.isAir(this.worldObj.getBlockState(pos.up()), this.worldObj, pos.up())) { this.grassBlockList.add(new BlockPos(x, y, z)); } @@ -180,27 +180,27 @@ else if (doTrees) case 0: if (this.worldObj.isBlockFullCube(new BlockPos(vec.getX() - 1, vec.getY(), vec.getZ())) && this.worldObj.isBlockFullCube(new BlockPos(vec.getX() + 1, vec.getY(), vec.getZ())) && this.worldObj.isBlockFullCube(new BlockPos(vec.getX(), vec.getY(), vec.getZ() - 1)) && this.worldObj.isBlockFullCube(new BlockPos(vec.getX(), vec.getY(), vec.getZ() + 1))) { - id = Blocks.flowing_water; + id = Blocks.FLOWING_WATER; } else { - id = Blocks.grass; + id = Blocks.GRASS; } break; default: - id = Blocks.grass; + id = Blocks.GRASS; break; } this.worldObj.setBlockState(vec, id.getDefaultState()); - if (id == Blocks.grass) + if (id == Blocks.GRASS) { this.useCount[0]++; this.waterTank.drain(1, true); this.checkUsage(1); } - else if (id == Blocks.flowing_water) + else if (id == Blocks.FLOWING_WATER) { this.checkUsage(2); } @@ -214,7 +214,7 @@ else if (id == Blocks.flowing_water) int randomIndex = this.worldObj.rand.nextInt(this.grassBlockList.size()); BlockPos vecGrass = grassBlockList.get(randomIndex); - if (this.worldObj.getBlockState(vecGrass).getBlock() == Blocks.grass) + if (this.worldObj.getBlockState(vecGrass).getBlock() == Blocks.GRASS) { BlockPos vecSapling = vecGrass.add(0, 1, 0); ItemStack sapling = this.getFirstSaplingStack(); @@ -486,6 +486,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) } nbt.setBoolean("bubbleVisible", this.shouldRenderBubble); + return nbt; } @Override @@ -558,7 +559,7 @@ public boolean isItemValidForSlot(int slotID, ItemStack itemstack) case 11: case 12: case 13: - return itemstack.getItem() == Items.wheat_seeds; + return itemstack.getItem() == Items.WHEAT_SEEDS; } return false; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/util/MarsUtil.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/util/MarsUtil.java index 881caad453..0e8dff5ee7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/util/MarsUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/util/MarsUtil.java @@ -38,7 +38,7 @@ public static void openParachestInventory(EntityPlayerMP player, EntityLandingBa GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_OPEN_PARACHEST_GUI, player.worldObj.provider.getDimension(), new Object[] { windowId, 1, landerInv.getEntityId() }), player); player.openContainer = new ContainerParaChest(player.inventory, landerInv, player); player.openContainer.windowId = windowId; - player.openContainer.onCraftGuiOpened(player); + player.openContainer.addListener(player); } public static void openSlimelingInventory(EntityPlayerMP player, EntitySlimeling slimeling) @@ -49,7 +49,7 @@ public static void openSlimelingInventory(EntityPlayerMP player, EntitySlimeling GalacticraftCore.packetPipeline.sendTo(new PacketSimpleMars(EnumSimplePacketMars.C_OPEN_CUSTOM_GUI, player.worldObj.provider.getDimension(), new Object[] { windowId, 0, slimeling.getEntityId() }), player); player.openContainer = new ContainerSlimeling(player.inventory, slimeling, player); player.openContainer.windowId = windowId; - player.openContainer.onCraftGuiOpened(player); + player.openContainer.addListener(player); } public static void openCargoRocketInventory(EntityPlayerMP player, EntityCargoRocket rocket) @@ -60,6 +60,6 @@ public static void openCargoRocketInventory(EntityPlayerMP player, EntityCargoRo GalacticraftCore.packetPipeline.sendTo(new PacketSimpleMars(EnumSimplePacketMars.C_OPEN_CUSTOM_GUI, player.worldObj.provider.getDimension(), new Object[] { windowId, 1, rocket.getEntityId() }), player); player.openContainer = new ContainerRocketInventory(player.inventory, rocket, rocket.rocketType, player); player.openContainer.windowId = windowId; - player.openContainer.onCraftGuiOpened(player); + player.openContainer.addListener(player); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeDecoratorMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeDecoratorMars.java index 6c55e38b7e..9669c39d10 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeDecoratorMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeDecoratorMars.java @@ -25,7 +25,7 @@ public BiomeDecoratorMars() this.deshGen = new WorldGenMinableMeta(MarsBlocks.marsBlock, 6, 2, true, MarsBlocks.marsBlock, 9); this.ironGen = new WorldGenMinableMeta(MarsBlocks.marsBlock, 8, 3, true, MarsBlocks.marsBlock, 9); this.dirtGen = new WorldGenMinableMeta(MarsBlocks.marsBlock, 32, 6, true, MarsBlocks.marsBlock, 9); - this.iceGen = new WorldGenMinableMeta(Blocks.ice, 18, 0, true, MarsBlocks.marsBlock, 6); + this.iceGen = new WorldGenMinableMeta(Blocks.ICE, 18, 0, true, MarsBlocks.marsBlock, 6); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeGenFlatMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeGenFlatMars.java index 7186dfc7bd..776ee3fcef 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeGenFlatMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeGenFlatMars.java @@ -5,11 +5,9 @@ public class BiomeGenFlatMars extends BiomeMars { - public BiomeGenFlatMars(int par1) + public BiomeGenFlatMars(BiomeProperties properties) { - super(par1); - this.setColor(16711680); - this.setHeight(new Height(2.5F, 0.4F)); + super(properties); if (!ConfigManagerCore.disableBiomeTypeRegistrations) { BiomeDictionary.registerBiomeType(this, BiomeDictionary.Type.COLD, BiomeDictionary.Type.DRY, BiomeDictionary.Type.DEAD, BiomeDictionary.Type.SANDY); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeGenBaseMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeMars.java similarity index 75% rename from src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeGenBaseMars.java rename to src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeMars.java index 66a5e5b67f..9fe358cc9b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeGenBaseMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/BiomeMars.java @@ -4,17 +4,16 @@ import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSkeleton; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSpider; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedZombie; -import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import net.minecraft.world.biome.Biome; public class BiomeMars extends Biome { - public static final Biome marsFlat = new BiomeGenFlatMars(ConfigManagerCore.biomeIDbase + 1).setBiomeName("Mars Flat"); + public static final Biome marsFlat = new BiomeGenFlatMars(new BiomeProperties("Mars Flat").setBaseHeight(2.5F).setHeightVariation(0.4F).setRainfall(0.0F).setRainDisabled()); @SuppressWarnings("unchecked") - BiomeMars(int var1) + BiomeMars(BiomeProperties properties) { - super(var1); + super(properties); this.spawnableMonsterList.clear(); this.spawnableWaterCreatureList.clear(); this.spawnableCreatureList.clear(); @@ -23,13 +22,6 @@ public class BiomeMars extends Biome this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityEvolvedSpider.class, 8, 2, 3)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityEvolvedSkeleton.class, 8, 2, 3)); this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityEvolvedCreeper.class, 8, 2, 3)); - this.rainfall = 0F; - } - - @Override - public BiomeMars setColor(int var1) - { - return (BiomeMars) super.setColor(var1); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/ChunkProviderMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/ChunkProviderMars.java index 3007aac26d..33d0d06131 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/ChunkProviderMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/ChunkProviderMars.java @@ -9,12 +9,11 @@ import micdoodle8.mods.galacticraft.core.world.gen.dungeon.MapGenDungeon; import micdoodle8.mods.galacticraft.planets.mars.blocks.BlockBasicMars; import micdoodle8.mods.galacticraft.planets.mars.blocks.MarsBlocks; -import net.minecraft.world.ChunkCoordIntPair; +import net.minecraft.util.math.ChunkPos; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkPrimer; -import net.minecraft.world.chunk.IChunkProvider; import java.util.List; @@ -109,18 +108,18 @@ public int getCraterProbability() @Override public void onChunkProvide(int cX, int cZ, ChunkPrimer primer) { - this.dungeonGenerator.generate(this, this.worldObj, cX, cZ, primer); + this.dungeonGenerator.generate(this.worldObj, cX, cZ, primer); } @Override - public void onPopulate(IChunkProvider provider, int cX, int cZ) + public void onPopulate(int cX, int cZ) { - this.dungeonGenerator.generateStructure(this.worldObj, this.rand, new ChunkCoordIntPair(cX, cZ)); + this.dungeonGenerator.generateStructure(this.worldObj, this.rand, new ChunkPos(cX, cZ)); } @Override public void recreateStructures(Chunk chunk, int x, int z) { - this.dungeonGenerator.generate(this, this.worldObj, x, z, null); + this.dungeonGenerator.generate(this.worldObj, x, z, null); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java index 325ba39eb1..e050b73d63 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java @@ -167,23 +167,21 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime if (xfactorSq + zfactorSq < 1.0D) { - final int coords = (localX * 16 + localZ) * 256 + localY; - if (yfactor > -0.7D && xfactorSq + yfactorSq + zfactorSq < 1.0D) { - IBlockState state = primer.getBlockState(coords); + IBlockState state = primer.getBlockState(localX, localY, localZ); Block block = state.getBlock(); int metadata = state.getBlock().getMetaFromState(state); if (block == MarsBlocks.marsBlock) { if (metadata == 6 || metadata == 9) { - primer.setBlockState(coords, Blocks.AIR.getDefaultState()); + primer.setBlockState(localX, localY, localZ, Blocks.AIR.getDefaultState()); // blockIdArray[coords] = Blocks.AIR; } else if (metadata == 5 && random.nextInt(MapGenCaveMars.BREAK_THROUGH_CHANCE) == 0) { - primer.setBlockState(coords, Blocks.AIR.getDefaultState()); + primer.setBlockState(localX, localY, localZ, Blocks.AIR.getDefaultState()); // blockIdArray[coords] = Blocks.AIR; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java index 9186590da2..4935ea1dd8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java @@ -7,29 +7,28 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.ChunkPrimer; -import net.minecraft.world.chunk.IChunkProvider; import java.util.Random; public class MapGenCavernMars extends MapGenBaseMeta { @Override - public void generate(IChunkProvider par1IChunkProvider, World par2World, int par3, int par4, ChunkPrimer primer) + public void generate(World world, int chunkX, int chunkZ, ChunkPrimer primer) { final int var6 = this.range; - this.worldObj = par2World; - this.rand.setSeed(par2World.getSeed()); + this.worldObj = world; + this.rand.setSeed(world.getSeed()); final long var7 = this.rand.nextLong(); final long var9 = this.rand.nextLong(); - for (int var11 = par3 - var6; var11 <= par3 + var6; ++var11) + for (int var11 = chunkX - var6; var11 <= chunkX + var6; ++var11) { - for (int var12 = par4 - var6; var12 <= par4 + var6; ++var12) + for (int var12 = chunkZ - var6; var12 <= chunkZ + var6; ++var12) { final long var13 = var11 * var7; final long var15 = var12 * var9; - this.rand.setSeed(var13 ^ var15 ^ par2World.getSeed()); - this.recursiveGenerate(par2World, var11, var12, par3, par4, primer); + this.rand.setSeed(var13 ^ var15 ^ world.getSeed()); + this.recursiveGenerate(world, var11, var12, chunkX, chunkZ, primer); } } } @@ -193,14 +192,11 @@ protected void generateCaveNode(long par1, int origXChunkCoord, int origZChunkCo { if (var51 > -0.7D) { - int coords = (var42 * 16 + var45) * 256 + var50; - - Block block = primer.getBlockState(coords).getBlock(); + Block block = primer.getBlockState(var42, var50, var45).getBlock(); if (block == MarsBlocks.marsBlock || block == MarsBlocks.blockSludge || block == MarsBlocks.vine) { - primer.setBlockState(coords, Blocks.AIR.getDefaultState()); -// arrayOfIDs[coords] = Blocks.AIR; + primer.setBlockState(var42, var50, var45, Blocks.AIR.getDefaultState()); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenTerraformTree.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenTerraformTree.java index c0e2f48d8c..d16f1aebbb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenTerraformTree.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/WorldGenTerraformTree.java @@ -88,11 +88,11 @@ public boolean generate(World worldIn, Random rand, BlockPos position) { BlockPos down = position.down(); Block block1 = worldIn.getBlockState(down).getBlock(); - boolean isSoil = block1.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) Blocks.sapling); + boolean isSoil = block1.canSustainPlant(worldIn.getBlockState(down), worldIn, down, net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) Blocks.SAPLING); if (isSoil && position.getY() < 256 - i - 1) { - block1.onPlantGrow(worldIn, down, position); + block1.onPlantGrow(worldIn.getBlockState(down), worldIn, down, position); b0 = 3; byte b1 = 0; int i1; @@ -117,11 +117,12 @@ public boolean generate(World worldIn, Random rand, BlockPos position) if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.nextInt(2) != 0 && i1 != 0) { blockpos1 = new BlockPos(k1, l, i2); - Block block = worldIn.getBlockState(blockpos1).getBlock(); + IBlockState state = worldIn.getBlockState(blockpos1); + Block block = state.getBlock(); - if (block.isAir(worldIn, blockpos1) || block.isLeaves(worldIn, blockpos1) || block.getMaterial() == Material.vine) + if (block.isAir(state, worldIn, blockpos1) || block.isLeaves(state, worldIn, blockpos1) || block.getMaterial(state) == Material.VINE) { - this.setBlockAndNotifyAdequately(worldIn, blockpos1, Blocks.leaves.getStateFromMeta(this.metaLeaves)); + this.setBlockAndNotifyAdequately(worldIn, blockpos1, Blocks.LEAVES.getStateFromMeta(this.metaLeaves)); } } } @@ -131,11 +132,12 @@ public boolean generate(World worldIn, Random rand, BlockPos position) for (l = 0; l < i; ++l) { BlockPos upN = position.up(l); - Block block2 = worldIn.getBlockState(upN).getBlock(); + IBlockState state2 = worldIn.getBlockState(upN); + Block block2 = state2.getBlock(); - if (block2.isAir(worldIn, upN) || block2.isLeaves(worldIn, upN) || block2.getMaterial() == Material.vine) + if (block2.isAir(state2, worldIn, upN) || block2.isLeaves(state2, worldIn, upN) || block2.getMaterial(state2) == Material.VINE) { - this.setBlockAndNotifyAdequately(worldIn, position.up(l), Blocks.log.getStateFromMeta(this.metaWood)); + this.setBlockAndNotifyAdequately(worldIn, position.up(l), Blocks.LOG.getStateFromMeta(this.metaWood)); if (this.vinesGrow && l > 0) { @@ -175,29 +177,34 @@ public boolean generate(World worldIn, Random rand, BlockPos position) { BlockPos blockpos3 = new BlockPos(k1, l, l1); - if (worldIn.getBlockState(blockpos3).getBlock().isLeaves(worldIn, blockpos3)) + IBlockState state3 = worldIn.getBlockState(blockpos3); + if (state3.getBlock().isLeaves(state3, worldIn, blockpos3)) { BlockPos blockpos4 = blockpos3.west(); blockpos1 = blockpos3.east(); BlockPos blockpos5 = blockpos3.north(); BlockPos blockpos2 = blockpos3.south(); - if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos4).getBlock().isAir(worldIn, blockpos4)) + IBlockState state4 = worldIn.getBlockState(blockpos4); + if (rand.nextInt(4) == 0 && state4.getBlock().isAir(state4, worldIn, blockpos4)) { this.func_181647_a(worldIn, blockpos4, BlockVine.EAST); } - if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos1).getBlock().isAir(worldIn, blockpos1)) + IBlockState state1 = worldIn.getBlockState(blockpos1); + if (rand.nextInt(4) == 0 && state1.getBlock().isAir(state1, worldIn, blockpos1)) { this.func_181647_a(worldIn, blockpos1, BlockVine.WEST); } - if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos5).getBlock().isAir(worldIn, blockpos5)) + IBlockState state5 = worldIn.getBlockState(blockpos5); + if (rand.nextInt(4) == 0 && state5.getBlock().isAir(state5, worldIn, blockpos5)) { this.func_181647_a(worldIn, blockpos5, BlockVine.SOUTH); } - if (rand.nextInt(4) == 0 && worldIn.getBlockState(blockpos2).getBlock().isAir(worldIn, blockpos2)) + IBlockState state2 = worldIn.getBlockState(blockpos2); + if (rand.nextInt(4) == 0 && state2.getBlock().isAir(state2, worldIn, blockpos2)) { this.func_181647_a(worldIn, blockpos2, BlockVine.NORTH); } @@ -238,11 +245,11 @@ public boolean generate(World worldIn, Random rand, BlockPos position) private void func_181647_a(World world, BlockPos pos, PropertyBool facing) { - IBlockState iblockstate = Blocks.vine.getDefaultState().withProperty(facing, Boolean.valueOf(true)); + IBlockState iblockstate = Blocks.VINE.getDefaultState().withProperty(facing, Boolean.valueOf(true)); this.setBlockAndNotifyAdequately(world, pos, iblockstate); int i = 4; - for (pos = pos.down(); world.getBlockState(pos).getBlock().isAir(world, pos) && i > 0; --i) + for (pos = pos.down(); world.getBlockState(pos).getBlock().isAir(world.getBlockState(pos), world, pos) && i > 0; --i) { this.setBlockAndNotifyAdequately(world, pos, iblockstate); pos = pos.down(); @@ -251,17 +258,18 @@ private void func_181647_a(World world, BlockPos pos, PropertyBool facing) private void func_181652_a(World p_181652_1_, int p_181652_2_, BlockPos p_181652_3_, EnumFacing p_181652_4_) { - this.setBlockAndNotifyAdequately(p_181652_1_, p_181652_3_, Blocks.cocoa.getDefaultState().withProperty(BlockCocoa.AGE, Integer.valueOf(p_181652_2_)).withProperty(BlockCocoa.FACING, p_181652_4_)); + this.setBlockAndNotifyAdequately(p_181652_1_, p_181652_3_, Blocks.COCOA.getDefaultState().withProperty(BlockCocoa.AGE, Integer.valueOf(p_181652_2_)).withProperty(BlockCocoa.FACING, p_181652_4_)); } - protected boolean func_150523_a(Block p_150523_1_) + protected boolean func_150523_a(IBlockState state) { - return p_150523_1_.getMaterial() == Material.AIR || p_150523_1_.getMaterial() == Material.leaves || p_150523_1_ == Blocks.grass || p_150523_1_ == Blocks.dirt || p_150523_1_ == Blocks.log || p_150523_1_ == Blocks.log2 || p_150523_1_ == Blocks.sapling || p_150523_1_ == Blocks.vine; + Block block = state.getBlock(); + return block.getMaterial(state) == Material.AIR || block.getMaterial(state) == Material.LEAVES || block == Blocks.GRASS || block == Blocks.DIRT || block == Blocks.LOG || block == Blocks.LOG2 || block == Blocks.SAPLING || block == Blocks.VINE; } public boolean isReplaceable(World world, BlockPos pos) { IBlockState state = world.getBlockState(pos); - return state.getBlock().isAir(world, pos) || state.getBlock().isLeaves(world, pos) || state.getBlock().isWood(world, pos) || func_150523_a(state.getBlock()); + return state.getBlock().isAir(state, world, pos) || state.getBlock().isLeaves(state, world, pos) || state.getBlock().isWood(world, pos) || func_150523_a(state); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/ConfigManagerVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/ConfigManagerVenus.java index e4988e6dd0..c95ecde43d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/ConfigManagerVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/ConfigManagerVenus.java @@ -55,18 +55,18 @@ public static void syncConfig(boolean load, boolean update) } prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "dimensionIDVenus", -31); - prop.comment = "Dimension ID for Venus"; + prop.setComment("Dimension ID for Venus"); prop.setLanguageKey("gc.configgui.dimensionIDVenus").setRequiresMcRestart(true); if (update) { - propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, prop.getName(), prop.getInt(), prop.comment); + propCopy = ConfigManagerMars.config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, prop.getName(), prop.getInt(), prop.getComment()); propCopy.setLanguageKey(prop.getLanguageKey()); propCopy.setRequiresMcRestart(prop.requiresMcRestart()); } dimensionIDVenus = prop.getInt(); prop = config.get(Constants.CONFIG_CATEGORY_SCHEMATIC, "disableAmbientLightning", false); - prop.comment = "Disables background thunder and lightning."; + prop.setComment("Disables background thunder and lightning."); prop.setLanguageKey("gc.configgui.disableAmbientLightning"); disableAmbientLightning = prop.getBoolean(false); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java index ebafc4376d..c3ea38261b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java @@ -37,19 +37,17 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.event.*; import net.minecraftforge.fml.common.registry.EntityRegistry; import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.common.registry.LanguageRegistry; import net.minecraftforge.fml.relauncher.Side; import java.util.List; @@ -59,7 +57,7 @@ public class VenusModule implements IPlanetsModule public static Planet planetVenus; public static Fluid sulphuricAcid; public static Fluid sulphuricAcidGC; - public static Material acidMaterial = new MaterialLiquid(MapColor.emeraldColor); + public static Material acidMaterial = new MaterialLiquid(MapColor.EMERALD); @Override public void preInit(FMLPreInitializationEvent event) @@ -96,7 +94,7 @@ public void preInit(FMLPreInitializationEvent event) { VenusItems.bucketSulphuricAcid = new ItemBucketGC(VenusBlocks.sulphuricAcid).setUnlocalizedName("bucket_sulphuric_acid"); VenusItems.registerItem(VenusItems.bucketSulphuricAcid); - FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("sulphuricacid", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(VenusItems.bucketSulphuricAcid), new ItemStack(Items.bucket)); + FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("sulphuricacid", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(VenusItems.bucketSulphuricAcid), new ItemStack(Items.BUCKET)); } EventHandlerGC.bucketList.put(VenusBlocks.sulphuricAcid, VenusItems.bucketSulphuricAcid); @@ -219,22 +217,17 @@ public void syncConfig() public void registerGalacticraftCreature(Class var0, String var1, int back, int fore) { VenusModule.registerGalacticraftNonMobEntity(var0, var1, 80, 3, true); - int nextEggID = GCCoreUtil.getNextValidEggID(); + int nextEggID = GCCoreUtil.getNextValidID(); if (nextEggID < 65536) { - EntityList.idToClassMapping.put(nextEggID, var0); - EntityList.classToIDMapping.put(var0, nextEggID); - EntityList.entityEggs.put(nextEggID, new EntityList.EntityEggInfo(nextEggID, back, fore)); + EntityList.ID_TO_CLASS.put(nextEggID, var0); + EntityList.CLASS_TO_ID.put(var0, nextEggID); + EntityList.ENTITY_EGGS.put(var1, new EntityList.EntityEggInfo(var1, back, fore)); } } public static void registerGalacticraftNonMobEntity(Class var0, String var1, int trackingDistance, int updateFreq, boolean sendVel) { - if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) - { - LanguageRegistry.instance().addStringLocalization("entity.galacticraftplanets." + var1 + ".name", GCCoreUtil.translate("entity." + var1 + ".name")); - LanguageRegistry.instance().addStringLocalization("entity.GalacticraftPlanets." + var1 + ".name", GCCoreUtil.translate("entity." + var1 + ".name")); - } EntityRegistry.registerModEntity(var0, var1, GCCoreUtil.nextInternalID(), GalacticraftPlanets.instance, trackingDistance, updateFreq, sendVel); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java index 567751ef94..96e7f04720 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java @@ -8,8 +8,8 @@ import micdoodle8.mods.galacticraft.planets.GuiIdsPlanets; import micdoodle8.mods.galacticraft.planets.IPlanetsModuleClient; import micdoodle8.mods.galacticraft.planets.venus.client.TickHandlerClientVenus; -import micdoodle8.mods.galacticraft.planets.venus.client.fx.EntityAcidExhaustFX; -import micdoodle8.mods.galacticraft.planets.venus.client.fx.EntityAcidVaporFX; +import micdoodle8.mods.galacticraft.planets.venus.client.fx.ParticleAcidExhaust; +import micdoodle8.mods.galacticraft.planets.venus.client.fx.ParticleAcidVapor; import micdoodle8.mods.galacticraft.planets.venus.client.gui.GuiCrashedProbe; import micdoodle8.mods.galacticraft.planets.venus.client.gui.GuiGeothermal; import micdoodle8.mods.galacticraft.planets.venus.client.render.entity.RenderEntryPodVenus; @@ -26,23 +26,23 @@ import micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityTreasureChestVenus; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.Particle; +import net.minecraft.client.renderer.block.model.ModelBakery; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.StateMapperBase; import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.event.TextureStitchEvent; -import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.model.IModelState; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.RenderingRegistry; @@ -118,7 +118,7 @@ public void loadTextures(TextureStitchEvent.Pre event) private void registerTexture(TextureStitchEvent.Pre event, String texture) { - event.map.registerSprite(new ResourceLocation(GalacticraftPlanets.TEXTURE_PREFIX + "blocks/" + texture)); + event.getMap().registerSprite(new ResourceLocation(GalacticraftPlanets.TEXTURE_PREFIX + "blocks/" + texture)); } @SubscribeEvent @@ -207,27 +207,24 @@ public void spawnParticle(String particleID, Vector3 position, Vector3 motion, O double dX = mc.getRenderViewEntity().posX - position.x; double dY = mc.getRenderViewEntity().posY - position.y; double dZ = mc.getRenderViewEntity().posZ - position.z; - EntityFX particle = null; + Particle particle = null; double viewDistance = 64.0D; if (particleID.equals("acidVapor")) { - particle = new EntityAcidVaporFX(mc.theWorld, position.x, position.y, position.z, motion.x, motion.y, motion.z, 2.5F); + particle = new ParticleAcidVapor(mc.theWorld, position.x, position.y, position.z, motion.x, motion.y, motion.z, 2.5F); } if (dX * dX + dY * dY + dZ * dZ < viewDistance * viewDistance) { if (particleID.equals("acidExhaust")) { - particle = new EntityAcidExhaustFX(mc.theWorld, position.x, position.y, position.z, motion.x, motion.y, motion.z, 0.5F); + particle = new ParticleAcidExhaust(mc.theWorld, position.x, position.y, position.z, motion.x, motion.y, motion.z, 0.5F); } } if (particle != null) { - particle.prevPosX = particle.posX; - particle.prevPosY = particle.posY; - particle.prevPosZ = particle.posZ; mc.effectRenderer.addEffect(particle); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockBasicVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockBasicVenus.java index ca95f41b43..80131ab71c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockBasicVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockBasicVenus.java @@ -1,5 +1,6 @@ package micdoodle8.mods.galacticraft.planets.venus.blocks; +import com.google.common.base.Predicate; import micdoodle8.mods.galacticraft.api.block.IDetectableResource; import micdoodle8.mods.galacticraft.api.block.IPlantableBlock; import micdoodle8.mods.galacticraft.api.block.ITerraformableBlock; @@ -10,7 +11,7 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; @@ -18,13 +19,14 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.Explosion; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.IPlantable; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -33,7 +35,7 @@ public class BlockBasicVenus extends Block implements IDetectableResource, IPlantableBlock, ITerraformableBlock, ISortableBlock { - public static final PropertyEnum BASIC_TYPE_VENUS = PropertyEnum.create("basicTypeVenus", EnumBlockBasicVenus.class); + public static final PropertyEnum BASIC_TYPE_VENUS = PropertyEnum.create("basictypevenus", EnumBlockBasicVenus.class); public enum EnumBlockBasicVenus implements IStringSerializable { @@ -100,7 +102,7 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) EnumBlockBasicVenus type = ((EnumBlockBasicVenus) state.getValue(BASIC_TYPE_VENUS)); if (type == EnumBlockBasicVenus.ROCK_MAGMA) { - worldIn.setBlockState(pos, Blocks.flowing_lava.getDefaultState()); + worldIn.setBlockState(pos, Blocks.FLOWING_LAVA.getDefaultState()); } } @@ -157,12 +159,6 @@ public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos po return this.blockHardness; } - @Override - public int getDamageValue(World worldIn, BlockPos pos) - { - return getMetaFromState(worldIn.getBlockState(pos)); - } - @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { @@ -172,7 +168,7 @@ public Item getItemDropped(IBlockState state, Random rand, int fortune) case ORE_SILICON: return GCItems.basicItem; case ORE_QUARTZ: - return Items.quartz; + return Items.QUARTZ; default: return Item.getItemFromBlock(this); } @@ -217,9 +213,8 @@ public int quantityDropped(IBlockState state, int fortune, Random random) } @Override - public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) + public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune) { - IBlockState state = world.getBlockState(pos); EnumBlockBasicVenus type = ((EnumBlockBasicVenus) state.getValue(BASIC_TYPE_VENUS)); Random rand = world instanceof World ? ((World)world).rand : new Random(); if (this.getItemDropped(state, rand, fortune) != Item.getItemFromBlock(this)) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java index b6a686245b..0ad5221d98 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java @@ -1,50 +1,43 @@ package micdoodle8.mods.galacticraft.planets.venus.blocks; -import com.google.common.collect.Lists; -import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.blocks.BlockTileGC; import micdoodle8.mods.galacticraft.core.blocks.ISortableBlock; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock; import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import micdoodle8.mods.galacticraft.planets.GuiIdsPlanets; -import micdoodle8.mods.galacticraft.planets.asteroids.items.AsteroidsItems; -import micdoodle8.mods.galacticraft.planets.mars.items.MarsItems; import micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityCrashedProbe; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumHand; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; import java.util.Random; public class BlockCrashedProbe extends BlockTileGC implements ISortableBlock, ITileEntityProvider { - public static final String CRASHED_PROBE = "crashedProbe"; - private static final List CONTENTS = Lists.newArrayList( - new WeightedRandomChestContent(MarsItems.marsItemBasic, 3, 3, 6, 5), // Tier 2 plate - new WeightedRandomChestContent(GCItems.heavyPlatingTier1, 0, 3, 6, 5), // Tier 1 plate - new WeightedRandomChestContent(AsteroidsItems.basicItem, 6, 3, 6, 5), // Titanium plate - new WeightedRandomChestContent(Items.iron_ingot, 0, 5, 9, 5), // Titanium plate - new WeightedRandomChestContent(AsteroidsItems.basicItem, 0, 3, 6, 5)); // Tier 3 plate +// public static final String CRASHED_PROBE = "crashedProbe"; +// private static final List CONTENTS = Lists.newArrayList( +// new WeightedRandomChestContent(MarsItems.marsItemBasic, 3, 3, 6, 5), // Tier 2 plate +// new WeightedRandomChestContent(GCItems.heavyPlatingTier1, 0, 3, 6, 5), // Tier 1 plate +// new WeightedRandomChestContent(AsteroidsItems.basicItem, 6, 3, 6, 5), // Titanium plate +// new WeightedRandomChestContent(Items.IRON_INGOT, 0, 5, 9, 5), // Titanium plate +// new WeightedRandomChestContent(AsteroidsItems.basicItem, 0, 3, 6, 5)); // Tier 3 plate - static - { - net.minecraftforge.common.ChestGenHooks.init(CRASHED_PROBE, CONTENTS, 4, 6); - } +// static +// { +// net.minecraftforge.common.ChestGenHooks.init(CRASHED_PROBE, CONTENTS, 4, 6); +// } public BlockCrashedProbe(String assetName) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java index 7799187825..5ad38cc3f4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java @@ -10,12 +10,12 @@ import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import micdoodle8.mods.galacticraft.planets.GuiIdsPlanets; import micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityGeothermalGenerator; -import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyDirection; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; @@ -23,8 +23,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumBlockRenderType; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -55,9 +56,9 @@ public EnumBlockRenderType getRenderType(IBlockState state) } @Override - public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityPlayer, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { - playerIn.openGui(GalacticraftPlanets.instance, GuiIdsPlanets.MACHINE_VENUS, worldIn, pos.getX(), pos.getY(), pos.getZ()); + playerIn.openGui(GalacticraftPlanets.instance, GuiIdsPlanets.MACHINE_VENUS, world, pos.getX(), pos.getY(), pos.getZ()); return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java index 0ea41557d1..2d2392cd89 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java @@ -8,14 +8,17 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.*; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -29,7 +32,7 @@ public class BlockTorchWeb extends Block implements IShearable, IShiftDescription, ISortableBlock { - public static final PropertyEnum WEB_TYPE = PropertyEnum.create("webType", EnumWebType.class); + public static final PropertyEnum WEB_TYPE = PropertyEnum.create("webtype", EnumWebType.class); public enum EnumWebType implements IStringSerializable { @@ -64,7 +67,7 @@ public String getName() public BlockTorchWeb(String assetName) { - super(Material.vine); + super(Material.VINE); this.setLightLevel(1.0F); this.setUnlocalizedName(assetName); } @@ -76,26 +79,26 @@ public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) list.add(new ItemStack(itemIn, 1, 1)); } - @Override - public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) - { - EnumWebType type = (EnumWebType)worldIn.getBlockState(pos).getValue(WEB_TYPE); - float f = 0.15F; - - if (type == EnumWebType.WEB_0) - { - this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f); - } - else if (type == EnumWebType.WEB_1) - { - this.setBlockBounds(0.5F - f, 0.25F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f); - } - - return super.collisionRayTrace(worldIn, pos, start, end); - } +// @Override +// public RayTraceResult collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) +// { +// EnumWebType type = (EnumWebType)worldIn.getBlockState(pos).getValue(WEB_TYPE); +// float f = 0.15F; +// +// if (type == EnumWebType.WEB_0) +// { +// this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f); +// } +// else if (type == EnumWebType.WEB_1) +// { +// this.setBlockBounds(0.5F - f, 0.25F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f); +// } +// +// return super.collisionRayTrace(worldIn, pos, start, end); +// } @Override - public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) + public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { if (world.setBlockToAir(pos)) { @@ -114,8 +117,9 @@ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, b public boolean canBlockStay(World worldIn, BlockPos pos) { - Block blockAbove = worldIn.getBlockState(pos.up()).getBlock(); - return (blockAbove == this || blockAbove.getMaterial().isSolid()); + IBlockState stateAbove = worldIn.getBlockState(pos.up()); + Block blockAbove = stateAbove.getBlock(); + return (blockAbove == this || blockAbove.getMaterial(stateAbove).isSolid()); } @Override @@ -130,9 +134,9 @@ public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighb } @Override - public int getLightValue(IBlockAccess world, BlockPos pos) + public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { - if (world.getBlockState(pos).getValue(WEB_TYPE) == EnumWebType.WEB_1) + if (state.getValue(WEB_TYPE) == EnumWebType.WEB_1) { return 15; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/SkyProviderVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/SkyProviderVenus.java index 1df55e975c..4c21bfe7bf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/SkyProviderVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/SkyProviderVenus.java @@ -7,9 +7,9 @@ import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec3d; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; import net.minecraftforge.client.IRenderHandler; import net.minecraftforge.fml.client.FMLClientHandler; import org.lwjgl.opengl.GL11; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/TickHandlerClientVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/TickHandlerClientVenus.java index 45ecc9e730..0983eedad6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/TickHandlerClientVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/TickHandlerClientVenus.java @@ -10,6 +10,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.init.SoundEvents; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -115,7 +117,7 @@ public void onPlayerTick(TickEvent.PlayerTickEvent event) double posX = player.posX + dX; double posY = 70; double posZ = player.posZ + dZ; - minecraft.theWorld.playSound(posX, posY, posZ, "ambient.weather.thunder", 1000.0F, 1.0F + player.getRNG().nextFloat() * 0.2F, false); + minecraft.theWorld.playSound(null, posX, posY, posZ, SoundEvents.ENTITY_LIGHTNING_THUNDER, SoundCategory.WEATHER, 1000.0F, 1.0F + player.getRNG().nextFloat() * 0.2F); lightning.put(new BlockPos(posX, posY, posZ), 20); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/fx/EntityAcidExhaustFX.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/fx/ParticleAcidExhaust.java similarity index 91% rename from src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/fx/EntityAcidExhaustFX.java rename to src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/fx/ParticleAcidExhaust.java index 2550688065..93d73f3a0e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/fx/EntityAcidExhaustFX.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/fx/ParticleAcidExhaust.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.planets.venus.client.fx; -import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.entity.Entity; @@ -10,11 +10,11 @@ import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class EntityAcidExhaustFX extends EntityFX +public class ParticleAcidExhaust extends Particle { float smokeParticleScale; - public EntityAcidExhaustFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double motionX, double motionY, double motionZ, float p_i46348_14_) + public ParticleAcidExhaust(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double motionX, double motionY, double motionZ, float p_i46348_14_) { super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); this.motionX *= 0.10000000149011612D; @@ -31,7 +31,7 @@ public EntityAcidExhaustFX(World worldIn, double xCoordIn, double yCoordIn, doub this.smokeParticleScale = this.particleScale; this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); this.particleMaxAge = (int)((float)this.particleMaxAge * p_i46348_14_ * 5.0F); - this.noClip = false; + this.canCollide = true; } @Override @@ -53,7 +53,7 @@ public void onUpdate() if (this.particleAge++ >= this.particleMaxAge) { - this.setDead(); + this.setExpired(); } this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); @@ -70,7 +70,7 @@ public void onUpdate() this.motionY *= 0.9599999785423279D; this.motionZ *= 0.9599999785423279D; - if (this.onGround) + if (this.isCollided) { this.motionX *= 0.699999988079071D; this.motionZ *= 0.699999988079071D; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/fx/EntityAcidVaporFX.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/fx/ParticleAcidVapor.java similarity index 91% rename from src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/fx/EntityAcidVaporFX.java rename to src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/fx/ParticleAcidVapor.java index dac4544885..adc33f0b33 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/fx/EntityAcidVaporFX.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/fx/ParticleAcidVapor.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.planets.venus.client.fx; -import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.entity.Entity; @@ -9,11 +9,11 @@ import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class EntityAcidVaporFX extends EntityFX +public class ParticleAcidVapor extends Particle { float smokeParticleScale; - public EntityAcidVaporFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double motionX, double motionY, double motionZ, float p_i46348_14_) + public ParticleAcidVapor(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double motionX, double motionY, double motionZ, float p_i46348_14_) { super(worldIn, xCoordIn, yCoordIn, zCoordIn, 0.0D, 0.0D, 0.0D); this.motionX *= 0.10000000149011612D; @@ -31,7 +31,7 @@ public EntityAcidVaporFX(World worldIn, double xCoordIn, double yCoordIn, double this.smokeParticleScale = this.particleScale; this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D)); this.particleMaxAge = (int)((float)this.particleMaxAge * p_i46348_14_); - this.noClip = false; + this.canCollide = true; } @Override @@ -54,7 +54,7 @@ public void onUpdate() if (this.particleAge++ >= this.particleMaxAge) { - this.setDead(); + this.setExpired(); } this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); @@ -65,7 +65,7 @@ public void onUpdate() this.motionX *= 1.001D; this.motionZ *= 1.001D; - if (this.onGround) + if (this.isCollided) { this.motionX *= 0.699999988079071D; this.motionZ *= 0.699999988079071D; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/render/entity/RenderSpiderQueen.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/render/entity/RenderSpiderQueen.java index ee9116a820..21cea6d4c0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/render/entity/RenderSpiderQueen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/render/entity/RenderSpiderQueen.java @@ -15,7 +15,6 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.boss.BossStatus; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.client.model.obj.OBJModel; @@ -69,7 +68,6 @@ protected void preRenderCallback(EntitySpiderQueen entity, float partialTickTime @Override public void doRender(EntitySpiderQueen entity, double x, double y, double z, float entityYaw, float partialTicks) { - BossStatus.setBossStatus(entity, false); super.doRender(entity, x, y, z, entityYaw, partialTicks); GL11.glPushMatrix(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/render/entity/RenderWebShot.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/render/entity/RenderWebShot.java index 4cf845732f..bc4e8a1552 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/render/entity/RenderWebShot.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/render/entity/RenderWebShot.java @@ -34,7 +34,7 @@ public void doRender(EntityWebShot entity, double x, double y, double z, float p GL11.glRotatef((entity.ticksExisted + partialTicks) * 50.0F, 0.0F, 1.0F, 0.0F); GlStateManager.scale(0.5F, 0.5F, 0.5F); GlStateManager.translate(-0.5F, -1F, 0.5F); - blockrendererdispatcher.renderBlockBrightness(Blocks.web.getDefaultState(), 1.0F); + blockrendererdispatcher.renderBlockBrightness(Blocks.WEB.getDefaultState(), 1.0F); GlStateManager.translate(0.0F, 0.0F, 1.0F); GlStateManager.popMatrix(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/TeleportTypeVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/TeleportTypeVenus.java index fba282076c..b027f7ef98 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/TeleportTypeVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/TeleportTypeVenus.java @@ -2,7 +2,8 @@ import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.api.world.ITeleportType; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.planets.venus.entities.EntityEntryPodVenus; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; @@ -24,8 +25,8 @@ public Vector3 getPlayerSpawnLocation(WorldServer world, EntityPlayerMP player) { if (player != null) { - GCPlayerStats stats = GCPlayerStats.get(player); - return new Vector3(stats.coordsTeleportedFromX, 900.0, stats.coordsTeleportedFromZ); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + return new Vector3(stats.getCoordsTeleportedFromX(), 900.0, stats.getCoordsTeleportedFromZ()); } return null; @@ -48,9 +49,9 @@ public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boole { if (!ridingAutoRocket && player != null) { - GCPlayerStats stats = GCPlayerStats.get(player); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); - if (stats.teleportCooldown <= 0) + if (stats.getTeleportCooldown() <= 0) { if (player.capabilities.isFlying) { @@ -64,7 +65,7 @@ public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boole newWorld.spawnEntityInWorld(entryPod); } - stats.teleportCooldown = 10; + stats.setTeleportCooldown(10); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/WorldProviderVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/WorldProviderVenus.java index 39f7dfc81a..41dbc42b08 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/WorldProviderVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/WorldProviderVenus.java @@ -7,13 +7,15 @@ import micdoodle8.mods.galacticraft.api.world.ISolarLevel; import micdoodle8.mods.galacticraft.core.event.EventHandlerGC; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; +import micdoodle8.mods.galacticraft.planets.GCPlanetDimensions; import micdoodle8.mods.galacticraft.planets.venus.VenusModule; +import micdoodle8.mods.galacticraft.planets.venus.world.gen.BiomeProviderVenus; import micdoodle8.mods.galacticraft.planets.venus.world.gen.ChunkProviderVenus; -import micdoodle8.mods.galacticraft.planets.venus.world.gen.WorldChunkManagerVenus; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.math.MathHelper; -import net.minecraft.world.biome.WorldChunkManager; -import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.DimensionType; +import net.minecraft.world.biome.BiomeProvider; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -72,15 +74,15 @@ public boolean shouldForceRespawn() } @Override - public Class getChunkProviderClass() + public Class getChunkProviderClass() { return ChunkProviderVenus.class; } @Override - public Class getBiomeProviderClass() + public Class getBiomeProviderClass() { - return WorldChunkManagerVenus.class; + return BiomeProviderVenus.class; } @Override @@ -146,7 +148,7 @@ public boolean canRespawnHere() @Override public int getRespawnDimension(EntityPlayerMP player) { - return this.shouldForceRespawn() ? this.dimensionId : 0; + return this.shouldForceRespawn() ? this.getDimension() : 0; } @Override @@ -221,20 +223,20 @@ public double getSolarEnergyMultiplier() } @Override - public String getInternalNameSuffix() + public boolean shouldDisablePrecipitation() { - return "_venus"; + return true; } @Override - public boolean shouldDisablePrecipitation() + public boolean shouldCorrodeArmor() { return true; } @Override - public boolean shouldCorrodeArmor() + public DimensionType getDimensionType() { - return true; + return GCPlanetDimensions.VENUS; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java index 23835ca914..8066240f8b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityEntryPodVenus.java @@ -6,10 +6,12 @@ import micdoodle8.mods.galacticraft.core.entities.EntityLanderBase; import micdoodle8.mods.galacticraft.core.entities.IScaleableFuelLevel; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; -import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.particle.Particle; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumHand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -58,7 +60,7 @@ public Map getParticleMap() } @Override - public EntityFX getParticle(Random rand, double x, double y, double z, double motX, double motY, double motZ) + public Particle getParticle(Random rand, double x, double y, double z, double motX, double motY, double motZ) { return null; } @@ -198,27 +200,27 @@ public boolean processInitialInteract(EntityPlayer player, ItemStack stack, Enum return false; } - if (this.riddenByEntity != null) + if (!this.getPassengers().isEmpty()) { - this.riddenByEntity.mountEntity(this); + this.removePassengers(); } return true; } - if (this.riddenByEntity == null && var1 instanceof EntityPlayerMP) + if (this.getPassengers().isEmpty() && player instanceof EntityPlayerMP) { - GCCoreUtil.openParachestInv((EntityPlayerMP) var1, this); + GCCoreUtil.openParachestInv((EntityPlayerMP) player, this); return true; } - else if (var1 instanceof EntityPlayerMP) + else if (player instanceof EntityPlayerMP) { if (!this.onGround) { return false; } - var1.mountEntity(null); + this.removePassengers(); return true; } else diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java index af30a94d93..e202de83bd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java @@ -13,14 +13,25 @@ import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.datasync.DataParameter; +import net.minecraft.network.datasync.DataSerializers; +import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.pathfinding.PathNavigate; -import net.minecraft.util.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.SoundEvent; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; public class EntityJuicer extends EntityMob implements IEntityBreathable { + private static final DataParameter IS_FALLING = EntityDataManager.createKey(EntityJuicer.class, DataSerializers.BOOLEAN); + private static final DataParameter IS_HANGING = EntityDataManager.createKey(EntityJuicer.class, DataSerializers.BOOLEAN); private BlockPos jumpTarget; private int timeSinceLastJump = 0; @@ -29,7 +40,7 @@ public EntityJuicer(World world) super(world); this.moveHelper = new EntityMoveHelperCeiling(this); this.setSize(1F, 0.6F); - this.tasks.addTask(4, new EntityAIAttackMelee(this, EntityPlayer.class, 1.0, true)); + this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0, true)); this.tasks.addTask(5, new EntityAIWander(this, 0.8D)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(6, new EntityAILookIdle(this)); @@ -42,28 +53,28 @@ public EntityJuicer(World world) protected void entityInit() { super.entityInit(); - this.dataManager.addObject(16, (byte)0); - this.dataManager.addObject(17, (byte)0); + this.dataManager.register(IS_FALLING, false); + this.dataManager.register(IS_HANGING, false); } public boolean isHanging() { - return this.dataManager.getWatchableObjectByte(16) != 0; + return this.dataManager.get(IS_FALLING); } public void setHanging(boolean hanging) { - this.dataManager.set(16, (byte)(hanging ? 1 : 0)); + this.dataManager.set(IS_FALLING, hanging); } public boolean isFalling() { - return this.dataManager.getWatchableObjectByte(17) != 0; + return this.dataManager.get(IS_FALLING); } public void setFalling(boolean falling) { - this.dataManager.set(17, (byte)(falling ? 1 : 0)); + this.dataManager.set(IS_FALLING, falling); } @Override @@ -76,37 +87,33 @@ public boolean canBreatheUnderwater() protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); + this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.30000001192092896D); } - @Override - protected boolean canTriggerWalking() + protected SoundEvent getAmbientSound() { - return false; + return SoundEvents.ENTITY_SPIDER_AMBIENT; } - @Override - protected String getLivingSound() + protected SoundEvent getHurtSound() { - return "mob.spider.say"; + return SoundEvents.ENTITY_SPIDER_HURT; } - @Override - protected String getHurtSound() + protected SoundEvent getDeathSound() { - return "mob.spider.say"; + return SoundEvents.ENTITY_SPIDER_DEATH; } - @Override - protected String getDeathSound() + protected void playStepSound(BlockPos pos, Block blockIn) { - return "mob.spider.death"; + this.playSound(SoundEvents.ENTITY_SPIDER_STEP, 0.15F, 1.0F); } @Override - protected void playStepSound(BlockPos pos, Block blockIn) + protected boolean canTriggerWalking() { - this.playSound("mob.spider.step", 0.15F, 1.2F); + return false; } @Override @@ -142,9 +149,9 @@ public void onLivingUpdate() if (blockAbove.getBlock() == VenusBlocks.venusBlock && (blockAbove.getValue(BlockBasicVenus.BASIC_TYPE_VENUS) == BlockBasicVenus.EnumBlockBasicVenus.DUNGEON_BRICK_2 || blockAbove.getValue(BlockBasicVenus.BASIC_TYPE_VENUS) == BlockBasicVenus.EnumBlockBasicVenus.DUNGEON_BRICK_1)) { - MovingObjectPosition hit = this.worldObj.rayTraceBlocks(new Vec3d(this.posX, this.posY, this.posZ), new Vec3d(this.posX, this.posY + (this.isHanging() ? -10 : 10), this.posZ), false, true, false); + RayTraceResult hit = this.worldObj.rayTraceBlocks(new Vec3d(this.posX, this.posY, this.posZ), new Vec3d(this.posX, this.posY + (this.isHanging() ? -10 : 10), this.posZ), false, true, false); - if (hit != null && hit.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + if (hit != null && hit.typeOfHit == RayTraceResult.Type.BLOCK) { IBlockState blockBelow = this.worldObj.getBlockState(hit.getBlockPos()); if (blockBelow.getBlock() == VenusBlocks.venusBlock && (blockBelow.getValue(BlockBasicVenus.BASIC_TYPE_VENUS) == BlockBasicVenus.EnumBlockBasicVenus.DUNGEON_BRICK_2 || diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java index 62f6c2a1cc..ea893f475d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java @@ -10,29 +10,35 @@ import net.minecraft.block.Block; import net.minecraft.entity.*; import net.minecraft.entity.ai.*; -import net.minecraft.entity.boss.IBossDisplayData; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; +import net.minecraft.init.MobEffects; +import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagLong; +import net.minecraft.network.datasync.DataParameter; +import net.minecraft.network.datasync.DataSerializers; +import net.minecraft.network.datasync.EntityDataManager; import net.minecraft.pathfinding.PathNavigate; import net.minecraft.pathfinding.PathNavigateGround; -import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.DamageSource; +import net.minecraft.util.SoundEvent; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; +import net.minecraft.world.BossInfo; import net.minecraft.world.World; import java.util.List; import java.util.Random; import java.util.UUID; -public class EntitySpiderQueen extends EntityBossBase implements IEntityBreathable, IBoss, IBossDisplayData, IRangedAttackMob +public class EntitySpiderQueen extends EntityBossBase implements IEntityBreathable, IBoss, IRangedAttackMob { + private static final DataParameter BURROWED_COUNT = EntityDataManager.createKey(EntitySpiderQueen.class, DataSerializers.BYTE); public boolean shouldEvade; private List juicersSpawned = Lists.newArrayList(); private List spawnedPreload; @@ -45,7 +51,7 @@ public EntitySpiderQueen(World worldIn) { super(worldIn); this.setSize(1.4F, 0.9F); - this.tasks.addTask(4, new EntityAIAttackMelee(this, EntityPlayer.class, 1.0, true)); + this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0, true)); this.tasks.addTask(5, new EntityAIWander(this, 0.8D)); this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(6, new EntityAILookIdle(this)); @@ -78,17 +84,17 @@ protected PathNavigate getNewNavigator(World worldIn) protected void entityInit() { super.entityInit(); - this.dataManager.addObject(16, (byte)-1); + this.dataManager.register(BURROWED_COUNT, (byte)-1); } public byte getBurrowedCount() { - return this.dataManager.getWatchableObjectByte(16); + return this.dataManager.get(BURROWED_COUNT); } public void setBurrowedCount(byte count) { - this.dataManager.set(16, count); + this.dataManager.set(BURROWED_COUNT, count); } @Override @@ -166,7 +172,7 @@ else if (this.rangedAttackTime < 0) double dY = (this.roomCoords.y + this.roomSize.y) - this.posY; double dZ = tarZ - this.posZ; - double movespeed = 1.0 * this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue(); + double movespeed = 1.0 * this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue(); this.motionX = Math.min(Math.max(dX / 2.0F, -movespeed), movespeed); this.motionZ = Math.min(Math.max(dZ / 2.0F, -movespeed), movespeed); this.navigator.tryMoveToXYZ(tarX, this.posY, tarZ, movespeed); @@ -242,8 +248,8 @@ public void knockBack(Entity entityIn, float par2, double par3, double par4) protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(150.0F * ConfigManagerCore.dungeonBossHealthMod); - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.250000001192092896D); + this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(150.0F * ConfigManagerCore.dungeonBossHealthMod); + this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.250000001192092896D); } @Override @@ -259,33 +265,33 @@ protected float getSoundVolume() } @Override - protected String getLivingSound() + protected SoundEvent getAmbientSound() { - return "mob.spider.say"; + return SoundEvents.ENTITY_SPIDER_AMBIENT; } @Override - protected String getHurtSound() + protected SoundEvent getHurtSound() { - return "mob.spider.say"; + return SoundEvents.ENTITY_SPIDER_HURT; } @Override - protected String getDeathSound() + protected SoundEvent getDeathSound() { - return "mob.spider.death"; + return SoundEvents.ENTITY_SPIDER_DEATH; } @Override protected void playStepSound(BlockPos pos, Block blockIn) { - this.playSound("mob.spider.step", 0.5F, 0.5F); + this.playSound(SoundEvents.ENTITY_SPIDER_STEP, 0.5F, 0.5F); } @Override protected Item getDropItem() { - return Items.string; + return Items.STRING; } @Override @@ -295,7 +301,7 @@ protected void dropFewItems(boolean par1, int par2) if (par1 && (this.rand.nextInt(3) == 0 || this.rand.nextInt(1 + par2) > 0)) { - this.dropItem(Items.spider_eye, 1); + this.dropItem(Items.SPIDER_EYE, 1); } } @@ -313,7 +319,7 @@ public EnumCreatureAttribute getCreatureAttribute() @Override public boolean isPotionApplicable(PotionEffect potioneffectIn) { - return potioneffectIn.getPotionID() != Potion.poison.id && super.isPotionApplicable(potioneffectIn); + return potioneffectIn.getPotion() != MobEffects.POISON && super.isPotionApplicable(potioneffectIn); } @Override @@ -362,7 +368,7 @@ else if (health < 2 * thirdHealth && healthLast >= 2 * thirdHealth) public void attackEntityWithRangedAttack(EntityLivingBase target, float damage) { EntityWebShot entityarrow = new EntityWebShot(this.worldObj, this, target, 0.8F, (float)(14 - this.worldObj.getDifficulty().getDifficultyId() * 4)); - this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); + this.playSound(SoundEvents.ENTITY_ARROW_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); this.worldObj.spawnEntityInWorld(entityarrow); } @@ -413,4 +419,10 @@ public void dropKey() { this.entityDropItem(new ItemStack(VenusItems.key, 1, 0), 0.5F); } + + @Override + public BossInfo.Color getHealthBarColor() + { + return BossInfo.Color.PURPLE; + } } \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityWebShot.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityWebShot.java index d8d382a04a..2ddc6d8804 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityWebShot.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityWebShot.java @@ -8,6 +8,10 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.PotionEffect; import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -24,14 +28,12 @@ public class EntityWebShot extends Entity implements IProjectile public EntityWebShot(World worldIn) { super(worldIn); - this.renderDistanceWeight = 10.0D; this.setSize(0.5F, 0.5F); } public EntityWebShot(World worldIn, double x, double y, double z) { super(worldIn); - this.renderDistanceWeight = 10.0D; this.setSize(0.5F, 0.5F); this.setPosition(x, y, z); } @@ -39,7 +41,6 @@ public EntityWebShot(World worldIn, double x, double y, double z) public EntityWebShot(World worldIn, EntityLivingBase shooter, EntityLivingBase target, float p_i1755_4_, float p_i1755_5_) { super(worldIn); - this.renderDistanceWeight = 10.0D; this.shootingEntity = shooter; if (shooter instanceof EntityPlayer) @@ -68,7 +69,6 @@ public EntityWebShot(World worldIn, EntityLivingBase shooter, EntityLivingBase t public EntityWebShot(World worldIn, EntityLivingBase shooter, float velocity) { super(worldIn); - this.renderDistanceWeight = 10.0D; this.shootingEntity = shooter; if (shooter instanceof EntityPlayer) @@ -88,6 +88,20 @@ public EntityWebShot(World worldIn, EntityLivingBase shooter, float velocity) this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, velocity * 1.5F, 1.0F); } + @Override + public boolean isInRangeToRenderDist(double distance) + { + double d0 = this.getEntityBoundingBox().getAverageEdgeLength(); + + if (Double.isNaN(d0)) + { + d0 = 1.0D; + } + + d0 = d0 * 64.0D * 10.0; + return distance < d0 * d0; + } + @Override protected void entityInit() { @@ -166,7 +180,7 @@ public void onUpdate() ++this.ticksInAir; Vec3d vec31 = new Vec3d(this.posX, this.posY, this.posZ); Vec3d vec3 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec31, vec3, false, true, false); + RayTraceResult movingobjectposition = this.worldObj.rayTraceBlocks(vec31, vec3, false, true, false); vec31 = new Vec3d(this.posX, this.posY, this.posZ); vec3 = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); @@ -187,7 +201,7 @@ public void onUpdate() { float f1 = 0.3F; AxisAlignedBB axisalignedbb1 = entity1.getEntityBoundingBox().expand((double)f1, (double)f1, (double)f1); - MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3); + RayTraceResult movingobjectposition1 = axisalignedbb1.calculateIntercept(vec31, vec3); if (movingobjectposition1 != null) { @@ -204,7 +218,7 @@ public void onUpdate() if (entity != null) { - movingobjectposition = new MovingObjectPosition(entity); + movingobjectposition = new RayTraceResult(entity); } if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) @@ -324,7 +338,7 @@ protected boolean canTriggerWalking() } @Override - public boolean canAttackWithItem() + public boolean canBeAttackedWithItem() { return false; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/EntityMoveHelperCeiling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/EntityMoveHelperCeiling.java index 07ea20579c..e09c1f22c2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/EntityMoveHelperCeiling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/EntityMoveHelperCeiling.java @@ -17,9 +17,9 @@ public void onUpdateMoveHelper() { this.entity.setMoveForward(0.0F); - if (this.update) + if (this.isUpdating()) { - this.update = false; + this.action = EntityMoveHelper.Action.WAIT; int i = MathHelper.floor_double(this.entity.getEntityBoundingBox().minY + 0.5D); double d0 = this.posX - this.entity.posX; double d1 = this.posZ - this.entity.posZ; @@ -30,7 +30,7 @@ public void onUpdateMoveHelper() { float f = (float)(MathHelper.atan2(d1, d0) * 180.0D / Math.PI) - 90.0F; this.entity.rotationYaw = f; - this.entity.setAIMoveSpeed((float)(this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue())); + this.entity.setAIMoveSpeed((float)(this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue())); if (d2 > 0.0D && d0 * d0 + d1 * d1 < 1.0D) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java index 5b57bac097..3c45ba5b58 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java @@ -3,13 +3,14 @@ import micdoodle8.mods.galacticraft.planets.venus.entities.EntityJuicer; import net.minecraft.block.Block; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.passive.EntityChicken; import net.minecraft.pathfinding.PathFinder; import net.minecraft.pathfinding.PathNavigate; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.Vec3d; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; public class PathNavigateCeiling extends PathNavigate @@ -144,8 +145,8 @@ private boolean isSafeToStandAt(int x, int y, int z, int sizeX, int sizeY, int s if (d0 * distanceX + d1 * distanceZ >= 0.0D) { - Block block = this.worldObj.getBlockState(new BlockPos(k, y + 1, l)).getBlock(); - Material material = block.getMaterial(); + IBlockState state = this.worldObj.getBlockState(new BlockPos(k, y + 1, l)); + Material material = state.getBlock().getMaterial(state); if (material == Material.AIR) { @@ -157,7 +158,7 @@ private boolean isSafeToStandAt(int x, int y, int z, int sizeX, int sizeY, int s return false; } - if (material == Material.lava) + if (material == Material.LAVA) { return false; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java index 383e753343..ab75956255 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java @@ -1,58 +1,123 @@ package micdoodle8.mods.galacticraft.planets.venus.entities.ai; +import com.google.common.collect.Sets; import net.minecraft.block.*; import net.minecraft.block.material.Material; -import net.minecraft.entity.Entity; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLiving; import net.minecraft.init.Blocks; +import net.minecraft.pathfinding.NodeProcessor; +import net.minecraft.pathfinding.PathNodeType; import net.minecraft.pathfinding.PathPoint; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; -import net.minecraft.world.pathfinder.NodeProcessor; + +import javax.annotation.Nullable; +import java.util.EnumSet; +import java.util.Set; public class WalkNodeProcessorCeiling extends NodeProcessor { + private float avoidsWater; + @Override - public void initProcessor(IBlockAccess iblockaccessIn, Entity entityIn) + public void initProcessor(IBlockAccess sourceIn, EntityLiving mob) { - super.initProcessor(iblockaccessIn, entityIn); + super.initProcessor(sourceIn, mob); + this.avoidsWater = mob.getPathPriority(PathNodeType.WATER); } @Override public void postProcess() { + this.entity.setPathPriority(PathNodeType.WATER, this.avoidsWater); super.postProcess(); } @Override - public PathPoint getPathPointTo(Entity entityIn) + public PathPoint getStart() { - int i = MathHelper.floor_double(entityIn.getEntityBoundingBox().minY + 0.5D); + int i; + + if (this.getCanSwim() && this.entity.isInWater()) + { + i = (int)this.entity.getEntityBoundingBox().minY; + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor_double(this.entity.posX), i, MathHelper.floor_double(this.entity.posZ)); + + for (Block block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock(); block == Blocks.FLOWING_WATER || block == Blocks.WATER; block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock()) + { + ++i; + blockpos$mutableblockpos.setPos(MathHelper.floor_double(this.entity.posX), i, MathHelper.floor_double(this.entity.posZ)); + } + } + else if (this.entity.onGround) + { + i = MathHelper.floor_double(this.entity.getEntityBoundingBox().minY + 0.5D); + } + else + { + BlockPos blockpos; + + for (blockpos = new BlockPos(this.entity); (this.blockaccess.getBlockState(blockpos).getMaterial() == Material.AIR || this.blockaccess.getBlockState(blockpos).getBlock().isPassable(this.blockaccess, blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down()) + { + ; + } + + i = blockpos.up().getY(); + } + + BlockPos blockpos2 = new BlockPos(this.entity); + PathNodeType pathnodetype1 = this.getPathNodeType(this.entity, blockpos2.getX(), i, blockpos2.getZ()); - return this.openPoint(MathHelper.floor_double(entityIn.getEntityBoundingBox().minX), i, MathHelper.floor_double(entityIn.getEntityBoundingBox().minZ)); + if (this.entity.getPathPriority(pathnodetype1) < 0.0F) + { + Set set = Sets.newHashSet(); + set.add(new BlockPos(this.entity.getEntityBoundingBox().minX, (double)i, this.entity.getEntityBoundingBox().minZ)); + set.add(new BlockPos(this.entity.getEntityBoundingBox().minX, (double)i, this.entity.getEntityBoundingBox().maxZ)); + set.add(new BlockPos(this.entity.getEntityBoundingBox().maxX, (double)i, this.entity.getEntityBoundingBox().minZ)); + set.add(new BlockPos(this.entity.getEntityBoundingBox().maxX, (double)i, this.entity.getEntityBoundingBox().maxZ)); + + for (BlockPos blockpos1 : set) + { + PathNodeType pathnodetype = this.getPathNodeType(this.entity, blockpos1); + + if (this.entity.getPathPriority(pathnodetype) >= 0.0F) + { + return this.openPoint(blockpos1.getX(), blockpos1.getY(), blockpos1.getZ()); + } + } + } + + return this.openPoint(blockpos2.getX(), i, blockpos2.getZ()); } @Override - public PathPoint getPathPointToCoords(Entity entityIn, double x, double y, double target) + public PathPoint getPathPointToCoords(double x, double y, double z) { - return this.openPoint(MathHelper.floor_double(x - (double)(entityIn.width / 2.0F)), MathHelper.floor_double(y), MathHelper.floor_double(target - (double)(entityIn.width / 2.0F))); + return this.openPoint(MathHelper.floor_double(x - (double)(this.entity.width / 2.0F)), MathHelper.floor_double(y), MathHelper.floor_double(z - (double)(this.entity.width / 2.0F))); } @Override - public int findPathOptions(PathPoint[] pathOptions, Entity entityIn, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) + public int findPathOptions(PathPoint[] pathOptions, PathPoint currentPoint, PathPoint targetPoint, float maxDistance) { int i = 0; int j = 0; + PathNodeType pathnodetype = this.getPathNodeType(this.entity, currentPoint.xCoord, currentPoint.yCoord + 1, currentPoint.zCoord); - if (this.getVerticalOffset(entityIn, currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord) == 1) + if (this.entity.getPathPriority(pathnodetype) >= 0.0F) { - j = 1; + j = MathHelper.floor_float(Math.max(1.0F, this.entity.stepHeight)); } - PathPoint pathpoint = this.getSafePoint(entityIn, currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord + 1, j); - PathPoint pathpoint1 = this.getSafePoint(entityIn, currentPoint.xCoord - 1, currentPoint.yCoord, currentPoint.zCoord, j); - PathPoint pathpoint2 = this.getSafePoint(entityIn, currentPoint.xCoord + 1, currentPoint.yCoord, currentPoint.zCoord, j); - PathPoint pathpoint3 = this.getSafePoint(entityIn, currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord - 1, j); + BlockPos blockpos = (new BlockPos(currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord)).down(); + double d0 = (double)currentPoint.yCoord - (1.0D - this.blockaccess.getBlockState(blockpos).getBoundingBox(this.blockaccess, blockpos).maxY); + PathPoint pathpoint = this.getSafePoint(currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord + 1, j, d0, EnumFacing.SOUTH); + PathPoint pathpoint1 = this.getSafePoint(currentPoint.xCoord - 1, currentPoint.yCoord, currentPoint.zCoord, j, d0, EnumFacing.WEST); + PathPoint pathpoint2 = this.getSafePoint(currentPoint.xCoord + 1, currentPoint.yCoord, currentPoint.zCoord, j, d0, EnumFacing.EAST); + PathPoint pathpoint3 = this.getSafePoint(currentPoint.xCoord, currentPoint.yCoord, currentPoint.zCoord - 1, j, d0, EnumFacing.NORTH); if (pathpoint != null && !pathpoint.visited && pathpoint.distanceTo(targetPoint) < maxDistance) { @@ -74,142 +139,303 @@ public int findPathOptions(PathPoint[] pathOptions, Entity entityIn, PathPoint c pathOptions[i++] = pathpoint3; } + boolean flag = pathpoint3 == null || pathpoint3.nodeType == PathNodeType.OPEN || pathpoint3.costMalus != 0.0F; + boolean flag1 = pathpoint == null || pathpoint.nodeType == PathNodeType.OPEN || pathpoint.costMalus != 0.0F; + boolean flag2 = pathpoint2 == null || pathpoint2.nodeType == PathNodeType.OPEN || pathpoint2.costMalus != 0.0F; + boolean flag3 = pathpoint1 == null || pathpoint1.nodeType == PathNodeType.OPEN || pathpoint1.costMalus != 0.0F; + + if (flag && flag3) + { + PathPoint pathpoint4 = this.getSafePoint(currentPoint.xCoord - 1, currentPoint.yCoord, currentPoint.zCoord - 1, j, d0, EnumFacing.NORTH); + + if (pathpoint4 != null && !pathpoint4.visited && pathpoint4.distanceTo(targetPoint) < maxDistance) + { + pathOptions[i++] = pathpoint4; + } + } + + if (flag && flag2) + { + PathPoint pathpoint5 = this.getSafePoint(currentPoint.xCoord + 1, currentPoint.yCoord, currentPoint.zCoord - 1, j, d0, EnumFacing.NORTH); + + if (pathpoint5 != null && !pathpoint5.visited && pathpoint5.distanceTo(targetPoint) < maxDistance) + { + pathOptions[i++] = pathpoint5; + } + } + + if (flag1 && flag3) + { + PathPoint pathpoint6 = this.getSafePoint(currentPoint.xCoord - 1, currentPoint.yCoord, currentPoint.zCoord + 1, j, d0, EnumFacing.SOUTH); + + if (pathpoint6 != null && !pathpoint6.visited && pathpoint6.distanceTo(targetPoint) < maxDistance) + { + pathOptions[i++] = pathpoint6; + } + } + + if (flag1 && flag2) + { + PathPoint pathpoint7 = this.getSafePoint(currentPoint.xCoord + 1, currentPoint.yCoord, currentPoint.zCoord + 1, j, d0, EnumFacing.SOUTH); + + if (pathpoint7 != null && !pathpoint7.visited && pathpoint7.distanceTo(targetPoint) < maxDistance) + { + pathOptions[i++] = pathpoint7; + } + } + return i; } - /** - * Returns a point that the entity can safely move to - */ - private PathPoint getSafePoint(Entity entityIn, int x, int y, int z, int offsetY) + @Nullable + private PathPoint getSafePoint(int x, int y, int z, int p_186332_4_, double p_186332_5_, EnumFacing facing) { PathPoint pathpoint = null; - int i = this.getVerticalOffset(entityIn, x, y, z); + BlockPos blockpos = new BlockPos(x, y, z); + BlockPos blockpos1 = blockpos.down(); + double d0 = (double)y - (1.0D - this.blockaccess.getBlockState(blockpos1).getBoundingBox(this.blockaccess, blockpos1).maxY); - if (i == 2) + if (d0 - p_186332_5_ > 1.125D) { - return this.openPoint(x, y, z); + return null; } else { - if (i == 1) + PathNodeType pathnodetype = this.getPathNodeType(this.entity, x, y, z); + float f = this.entity.getPathPriority(pathnodetype); + double d1 = (double)this.entity.width / 2.0D; + + if (f >= 0.0F) { pathpoint = this.openPoint(x, y, z); + pathpoint.nodeType = pathnodetype; + pathpoint.costMalus = Math.max(pathpoint.costMalus, f); } - if (pathpoint == null && offsetY > 0 && i != -3 && i != -4 && this.getVerticalOffset(entityIn, x, y + offsetY, z) == 1) + if (pathnodetype == PathNodeType.WALKABLE) { - pathpoint = this.openPoint(x, y + offsetY, z); - y += offsetY; + return pathpoint; } - - if (pathpoint != null) + else { - int j; - int k; + if (pathpoint == null && p_186332_4_ > 0 && pathnodetype != PathNodeType.FENCE && pathnodetype != PathNodeType.TRAPDOOR) + { + pathpoint = this.getSafePoint(x, y + 1, z, p_186332_4_ - 1, p_186332_5_, facing); + + if (pathpoint != null && (pathpoint.nodeType == PathNodeType.OPEN || pathpoint.nodeType == PathNodeType.WALKABLE) && this.entity.width < 1.0F) + { + double d2 = (double)(x - facing.getFrontOffsetX()) + 0.5D; + double d3 = (double)(z - facing.getFrontOffsetZ()) + 0.5D; + AxisAlignedBB axisalignedbb = new AxisAlignedBB(d2 - d1, (double)y + 0.001D, d3 - d1, d2 + d1, (double)((float)y + this.entity.height), d3 + d1); + AxisAlignedBB axisalignedbb1 = this.blockaccess.getBlockState(blockpos).getBoundingBox(this.blockaccess, blockpos); + AxisAlignedBB axisalignedbb2 = axisalignedbb.addCoord(0.0D, axisalignedbb1.maxY - 0.002D, 0.0D); - for (j = 0; y - j > 0; pathpoint = this.openPoint(x, y, z), j++) + if (this.entity.worldObj.collidesWithAnyBlock(axisalignedbb2)) + { + pathpoint = null; + } + } + } + + if (pathnodetype == PathNodeType.OPEN) { - k = this.getVerticalOffset(entityIn, x, y - j - 1, z); + AxisAlignedBB axisalignedbb3 = new AxisAlignedBB((double)x - d1 + 0.5D, (double)y + 0.001D, (double)z - d1 + 0.5D, (double)x + d1 + 0.5D, (double)((float)y + this.entity.height), (double)z + d1 + 0.5D); - if (k == -2) + if (this.entity.worldObj.collidesWithAnyBlock(axisalignedbb3)) { return null; } - if (k != 1) + if (this.entity.width >= 1.0F) + { + PathNodeType pathnodetype1 = this.getPathNodeType(this.entity, x, y - 1, z); + + if (pathnodetype1 == PathNodeType.BLOCKED) + { + pathpoint = this.openPoint(x, y, z); + pathpoint.nodeType = PathNodeType.WALKABLE; + pathpoint.costMalus = Math.max(pathpoint.costMalus, f); + return pathpoint; + } + } + + int i = 0; + + while (y > 0 && pathnodetype == PathNodeType.OPEN) + { + --y; + + if (i++ >= this.entity.getMaxFallHeight()) + { + return null; + } + + pathnodetype = this.getPathNodeType(this.entity, x, y, z); + f = this.entity.getPathPriority(pathnodetype); + + if (pathnodetype != PathNodeType.OPEN && f >= 0.0F) + { + pathpoint = this.openPoint(x, y, z); + pathpoint.nodeType = pathnodetype; + pathpoint.costMalus = Math.max(pathpoint.costMalus, f); + break; + } + + if (f < 0.0F) + { + return null; + } + } + } + + return pathpoint; + } + } + } + + @Override + public PathNodeType getPathNodeType(IBlockAccess blockaccessIn, int x, int y, int z, EntityLiving entitylivingIn, int xSize, int ySize, int zSize, boolean canBreakDoorsIn, boolean canEnterDoorsIn) + { + EnumSet enumset = EnumSet.noneOf(PathNodeType.class); + PathNodeType pathnodetype = PathNodeType.BLOCKED; + double d0 = (double)entitylivingIn.width / 2.0D; + BlockPos blockpos = new BlockPos(entitylivingIn); + + for (int i = 0; i < xSize; ++i) + { + for (int j = 0; j < ySize; ++j) + { + for (int k = 0; k < zSize; ++k) + { + int l = i + x; + int i1 = j + y; + int j1 = k + z; + PathNodeType pathnodetype1 = this.getPathNodeType(blockaccessIn, l, i1, j1); + + if (pathnodetype1 == PathNodeType.DOOR_WOOD_CLOSED && canBreakDoorsIn && canEnterDoorsIn) + { + pathnodetype1 = PathNodeType.WALKABLE; + } + + if (pathnodetype1 == PathNodeType.DOOR_OPEN && !canEnterDoorsIn) + { + pathnodetype1 = PathNodeType.BLOCKED; + } + + if (pathnodetype1 == PathNodeType.RAIL && !(blockaccessIn.getBlockState(blockpos).getBlock() instanceof BlockRailBase) && !(blockaccessIn.getBlockState(blockpos.down()).getBlock() instanceof BlockRailBase)) { - break; + pathnodetype1 = PathNodeType.FENCE; } + + if (i == 0 && j == 0 && k == 0) + { + pathnodetype = pathnodetype1; + } + + enumset.add(pathnodetype1); + } + } + } + + if (enumset.contains(PathNodeType.FENCE)) + { + return PathNodeType.FENCE; + } + else + { + PathNodeType pathnodetype2 = PathNodeType.BLOCKED; + + for (PathNodeType pathnodetype3 : enumset) + { + if (entitylivingIn.getPathPriority(pathnodetype3) < 0.0F) + { + return pathnodetype3; + } + + if (entitylivingIn.getPathPriority(pathnodetype3) >= entitylivingIn.getPathPriority(pathnodetype2)) + { + pathnodetype2 = pathnodetype3; } } - return pathpoint; + if (pathnodetype == PathNodeType.OPEN && entitylivingIn.getPathPriority(pathnodetype2) == 0.0F) + { + return PathNodeType.OPEN; + } + else + { + return pathnodetype2; + } } } - /** - * Checks if an entity collides with blocks at a position. - * Returns 1 if clear, 0 for colliding with any solid block, -1 for water(if avoids water), - * -2 for lava, -3 for fence and wall, -4 for closed trapdoor, 2 if otherwise clear except for open trapdoor or - * water(if not avoiding) - */ - private int getVerticalOffset(Entity entityIn, int x, int y, int z) + private PathNodeType getPathNodeType(EntityLiving entitylivingIn, BlockPos pos) { - return getVerticalOffset(this.blockaccess, entityIn, x, y, z, this.entitySizeX, this.entitySizeY, this.entitySizeZ); + return this.getPathNodeType(entitylivingIn, pos.getX(), pos.getY(), pos.getZ()); } - public static int getVerticalOffset(IBlockAccess blockaccessIn, Entity entityIn, int x, int y, int z, int sizeX, int sizeY, int sizeZ) + private PathNodeType getPathNodeType(EntityLiving entitylivingIn, int x, int y, int z) + { + return this.getPathNodeType(this.blockaccess, x, y, z, entitylivingIn, this.entitySizeX, this.entitySizeY, this.entitySizeZ, this.getCanBreakDoors(), this.getCanEnterDoors()); + } + + @Override + public PathNodeType getPathNodeType(IBlockAccess blockaccessIn, int x, int y, int z) { - boolean flag = false; - BlockPos blockpos = new BlockPos(entityIn); - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); + PathNodeType pathnodetype = this.getPathNodeTypeRaw(blockaccessIn, x, y, z); - for (int i = x; i < x + sizeX; ++i) + if (pathnodetype == PathNodeType.OPEN && y >= 1) { - for (int j = y; j < y + sizeY; ++j) + Block block = blockaccessIn.getBlockState(new BlockPos(x, y - 1, z)).getBlock(); + PathNodeType pathnodetype1 = this.getPathNodeTypeRaw(blockaccessIn, x, y - 1, z); + pathnodetype = pathnodetype1 != PathNodeType.WALKABLE && pathnodetype1 != PathNodeType.OPEN && pathnodetype1 != PathNodeType.WATER && pathnodetype1 != PathNodeType.LAVA ? PathNodeType.WALKABLE : PathNodeType.OPEN; + + if (pathnodetype1 == PathNodeType.DAMAGE_FIRE || block == Blocks.MAGMA) { - for (int k = z; k < z + sizeZ; ++k) - { - blockpos$mutableblockpos.set(i, j, k); - Block block = blockaccessIn.getBlockState(blockpos$mutableblockpos).getBlock(); + pathnodetype = PathNodeType.DAMAGE_FIRE; + } - if (block.getMaterial() != Material.AIR) + if (pathnodetype1 == PathNodeType.DAMAGE_CACTUS) + { + pathnodetype = PathNodeType.DAMAGE_CACTUS; + } + } + + BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain(); + + if (pathnodetype == PathNodeType.WALKABLE) + { + for (int j = -1; j <= 1; ++j) + { + for (int i = -1; i <= 1; ++i) + { + if (j != 0 || i != 0) { - if (block != Blocks.trapdoor && block != Blocks.iron_trapdoor) - { - if (block != Blocks.flowing_water && block != Blocks.water) - { - if (block instanceof BlockDoor && block.getMaterial() == Material.WOOD) - { - return 0; - } - } - else - { - flag = true; - } - } - else - { - flag = true; - } + Block block1 = blockaccessIn.getBlockState(blockpos$pooledmutableblockpos.setPos(j + x, y, i + z)).getBlock(); - if (entityIn.worldObj.getBlockState(blockpos$mutableblockpos).getBlock() instanceof BlockRailBase) + if (block1 == Blocks.CACTUS) { - if (!(entityIn.worldObj.getBlockState(blockpos).getBlock() instanceof BlockRailBase) && !(entityIn.worldObj.getBlockState(blockpos.down()).getBlock() instanceof BlockRailBase)) - { - return -3; - } + pathnodetype = PathNodeType.DANGER_CACTUS; } - else if (!block.isPassable(blockaccessIn, blockpos$mutableblockpos)) + else if (block1 == Blocks.FIRE) { - if (block instanceof BlockFence || block instanceof BlockFenceGate || block instanceof BlockWall) - { - return -3; - } - - if (block == Blocks.trapdoor || block == Blocks.iron_trapdoor) - { - return -4; - } - - Material material = block.getMaterial(); - - if (material != Material.lava) - { - return 0; - } - - if (!entityIn.isInLava()) - { - return -2; - } + pathnodetype = PathNodeType.DANGER_FIRE; } } } } } - return flag ? 2 : 1; + blockpos$pooledmutableblockpos.release(); + return pathnodetype; + } + + private PathNodeType getPathNodeTypeRaw(IBlockAccess p_189553_1_, int p_189553_2_, int p_189553_3_, int p_189553_4_) + { + BlockPos blockpos = new BlockPos(p_189553_2_, p_189553_3_, p_189553_4_); + IBlockState iblockstate = p_189553_1_.getBlockState(blockpos); + Block block = iblockstate.getBlock(); + Material material = iblockstate.getMaterial(); + return material == Material.AIR ? PathNodeType.OPEN : (block != Blocks.TRAPDOOR && block != Blocks.IRON_TRAPDOOR && block != Blocks.WATERLILY ? (block == Blocks.FIRE ? PathNodeType.DAMAGE_FIRE : (block == Blocks.CACTUS ? PathNodeType.DAMAGE_CACTUS : (block instanceof BlockDoor && material == Material.WOOD && !((Boolean)iblockstate.getValue(BlockDoor.OPEN)).booleanValue() ? PathNodeType.DOOR_WOOD_CLOSED : (block instanceof BlockDoor && material == Material.IRON && !((Boolean)iblockstate.getValue(BlockDoor.OPEN)).booleanValue() ? PathNodeType.DOOR_IRON_CLOSED : (block instanceof BlockDoor && ((Boolean)iblockstate.getValue(BlockDoor.OPEN)).booleanValue() ? PathNodeType.DOOR_OPEN : (block instanceof BlockRailBase ? PathNodeType.RAIL : (!(block instanceof BlockFence) && !(block instanceof BlockWall) && (!(block instanceof BlockFenceGate) || ((Boolean)iblockstate.getValue(BlockFenceGate.OPEN)).booleanValue()) ? (material == Material.WATER ? PathNodeType.WATER : (material == Material.LAVA ? PathNodeType.LAVA : (block.isPassable(p_189553_1_, blockpos) ? PathNodeType.OPEN : PathNodeType.BLOCKED))) : PathNodeType.FENCE))))))) : PathNodeType.TRAPDOOR); } } \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemBasicVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemBasicVenus.java index e34348b70d..43559cb690 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemBasicVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemBasicVenus.java @@ -1,7 +1,8 @@ package micdoodle8.mods.galacticraft.planets.venus.items; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.items.ISortableItem; import micdoodle8.mods.galacticraft.core.items.ItemDesc; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; @@ -13,6 +14,9 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -78,20 +82,20 @@ public EnumSortCategoryItem getCategory(int meta) } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) + public ActionResult onItemRightClick(ItemStack itemStack, World worldIn, EntityPlayer player, EnumHand hand) { if (player instanceof EntityPlayerMP) { - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) player); - ItemStack gear = stats.extendedInventory.getStackInSlot(10); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + ItemStack gear = stats.getExtendedInventory().getStackInSlot(10); if (gear == null) { - stats.extendedInventory.setInventorySlotContents(10, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(10, itemStack.copy()); itemStack.stackSize = 0; } } - return itemStack; + return new ActionResult<>(EnumActionResult.SUCCESS, itemStack); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemThermalPaddingTier2.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemThermalPaddingTier2.java index 9a966d3cae..40733a4eb5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemThermalPaddingTier2.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemThermalPaddingTier2.java @@ -2,7 +2,8 @@ import micdoodle8.mods.galacticraft.api.item.IItemThermal; import micdoodle8.mods.galacticraft.core.GalacticraftCore; -import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; +import micdoodle8.mods.galacticraft.core.entities.player.IStatsCapability; import micdoodle8.mods.galacticraft.core.items.ISortableItem; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem; @@ -13,6 +14,9 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -97,21 +101,21 @@ public EnumSortCategoryItem getCategory(int meta) } @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) + public ActionResult onItemRightClick(ItemStack itemStack, World worldIn, EntityPlayer player, EnumHand hand) { if (player instanceof EntityPlayerMP) { - GCPlayerStats stats = GCPlayerStats.get((EntityPlayerMP) player); - ItemStack gear = stats.extendedInventory.getStackInSlot(6); - ItemStack gear1 = stats.extendedInventory.getStackInSlot(7); - ItemStack gear2 = stats.extendedInventory.getStackInSlot(8); - ItemStack gear3 = stats.extendedInventory.getStackInSlot(9); + IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); + ItemStack gear = stats.getExtendedInventory().getStackInSlot(6); + ItemStack gear1 = stats.getExtendedInventory().getStackInSlot(7); + ItemStack gear2 = stats.getExtendedInventory().getStackInSlot(8); + ItemStack gear3 = stats.getExtendedInventory().getStackInSlot(9); if (itemStack.getItemDamage() == 0) { if (gear == null) { - stats.extendedInventory.setInventorySlotContents(6, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(6, itemStack.copy()); itemStack.stackSize = 0; } } @@ -119,7 +123,7 @@ else if (itemStack.getItemDamage() == 1) { if (gear1 == null) { - stats.extendedInventory.setInventorySlotContents(7, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(7, itemStack.copy()); itemStack.stackSize = 0; } } @@ -127,7 +131,7 @@ else if (itemStack.getItemDamage() == 2) { if (gear2 == null) { - stats.extendedInventory.setInventorySlotContents(8, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(8, itemStack.copy()); itemStack.stackSize = 0; } } @@ -135,11 +139,11 @@ else if (itemStack.getItemDamage() == 3) { if (gear3 == null) { - stats.extendedInventory.setInventorySlotContents(9, itemStack.copy()); + stats.getExtendedInventory().setInventorySlotContents(9, itemStack.copy()); itemStack.stackSize = 0; } } } - return itemStack; + return new ActionResult<>(EnumActionResult.SUCCESS, itemStack); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemVolcanicPickaxe.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemVolcanicPickaxe.java index e5bb48d9b3..8057c8b306 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemVolcanicPickaxe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/items/ItemVolcanicPickaxe.java @@ -7,7 +7,6 @@ import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.planets.venus.VenusItems; -import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.settings.GameSettings; import net.minecraft.creativetab.CreativeTabs; @@ -17,8 +16,8 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.relauncher.Side; @@ -72,22 +71,22 @@ public EnumSortCategoryItem getCategory(int meta) } @Override - public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn) + public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving) { - boolean ret = super.onBlockDestroyed(stack, worldIn, blockIn, pos, playerIn); + boolean ret = super.onBlockDestroyed(stack, worldIn, state, pos, entityLiving); - if (!(playerIn instanceof EntityPlayer)) + if (!(entityLiving instanceof EntityPlayer)) { return ret; } - EnumFacing facing = playerIn.getHorizontalFacing(); + EnumFacing facing = entityLiving.getHorizontalFacing(); - if (playerIn.rotationPitch < -45.0F) + if (entityLiving.rotationPitch < -45.0F) { facing = EnumFacing.UP; } - else if (playerIn.rotationPitch > 45.0F) + else if (entityLiving.rotationPitch > 45.0F) { facing = EnumFacing.DOWN; } @@ -114,12 +113,12 @@ else if (facing.getAxis() == EnumFacing.Axis.X) { pos1 = pos.add(i, j, 0); } - IBlockState state = worldIn.getBlockState(pos1); + IBlockState state1 = worldIn.getBlockState(pos1); if (worldIn.getBlockState(pos).equals(state)) { worldIn.setBlockState(pos1, Blocks.AIR.getDefaultState()); - state.getBlock().harvestBlock(worldIn, (EntityPlayer) playerIn, pos1, state, worldIn.getTileEntity(pos1)); - stack.damageItem(1, playerIn); + state.getBlock().harvestBlock(worldIn, (EntityPlayer) entityLiving, pos1, state1, worldIn.getTileEntity(pos1), stack); + stack.damageItem(1, entityLiving); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityCrashedProbe.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityCrashedProbe.java index a56ac5e4d3..e5dd223131 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityCrashedProbe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityCrashedProbe.java @@ -52,6 +52,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) } nbt.setTag("Items", list); + return nbt; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityDungeonSpawnerVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityDungeonSpawnerVenus.java index d63b05a9cb..de1c8edd6c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityDungeonSpawnerVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityDungeonSpawnerVenus.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.planets.venus.tile; -import micdoodle8.mods.galacticraft.core.Constants; +import micdoodle8.mods.galacticraft.core.client.sounds.GCSounds; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSkeleton; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSpider; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedZombie; @@ -8,6 +8,7 @@ import micdoodle8.mods.galacticraft.planets.venus.entities.EntitySpiderQueen; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; +import net.minecraft.util.SoundCategory; import java.util.ArrayList; import java.util.List; @@ -32,6 +33,6 @@ public List> getDisabledCreatures() @Override public void playSpawnSound(Entity entity) { - this.worldObj.playSoundAtEntity(entity, Constants.TEXTURE_PREFIX + "ambience.scaryscape", 9.0F, 1.4F); + this.worldObj.playSound(null, entity.posX, entity.posY, entity.posZ, GCSounds.scaryScape, SoundCategory.AMBIENT, 9.0F, 1.4F); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java index 2e97721786..6204450f3a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java @@ -75,7 +75,7 @@ public void update() this.validSpout = true; break; } - else if (!state.getBlock().isAir(this.worldObj, pos1)) + else if (!state.getBlock().isAir(this.worldObj.getBlockState(pos1), this.worldObj, pos1)) { // Not valid break; @@ -86,7 +86,8 @@ else if (!state.getBlock().isAir(this.worldObj, pos1)) if (this.worldObj.isRemote && this.validSpout != lastValidSpout) { // Update active texture - this.worldObj.notifyBlockUpdate(this.getPos()); + IBlockState state = this.worldObj.getBlockState(this.getPos()); + this.worldObj.notifyBlockUpdate(this.getPos(), state, state, 3); } } @@ -178,6 +179,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) } nbt.setTag("Items", list); + return nbt; } @Override @@ -234,7 +236,8 @@ public void setDisabled(int index, boolean disabled) if (this.disabled != disabled && this.worldObj.isRemote) { // Update active texture - this.worldObj.notifyBlockUpdate(this.getPos()); + IBlockState state = this.worldObj.getBlockState(this.getPos()); + this.worldObj.notifyBlockUpdate(this.getPos(), state, state, 3); } this.disabled = disabled; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntitySpout.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntitySpout.java index 366b55908e..2762217dff 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntitySpout.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntitySpout.java @@ -20,7 +20,7 @@ public void update() if (rand.nextInt(400) == 0) { IBlockState stateAbove = this.worldObj.getBlockState(this.getPos().up()); - if (stateAbove.getBlock().isAir(this.worldObj, this.getPos().up())) + if (stateAbove.getBlock().isAir(this.worldObj.getBlockState(this.getPos().up()), this.worldObj, this.getPos().up())) { double posX = (double)pos.getX() + 0.45 + rand.nextDouble() * 0.1; double posY = (double)pos.getY() + 1.0; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java index 316cd497eb..b88a6c7404 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeDecoratorVenus.java @@ -42,32 +42,30 @@ public void decorate(World worldIn, Random random, Biome biome, BlockPos blockPo else { this.worldObj = worldIn; - this.randomGenerator = random; - this.field_180294_c = blockPos; - this.generateVenus(); + this.chunkPos = blockPos; + this.generateVenus(random); this.worldObj = null; - this.randomGenerator = null; } } - private void genStandardOre(int amountPerChunk, WorldGenerator worldGenerator, int minY, int maxY) + private void genStandardOre(int amountPerChunk, WorldGenerator worldGenerator, int minY, int maxY, Random random) { for (int var5 = 0; var5 < amountPerChunk; ++var5) { - BlockPos blockpos = this.field_180294_c.add(this.randomGenerator.nextInt(16), this.randomGenerator.nextInt(maxY - minY) + minY, this.randomGenerator.nextInt(16)); - worldGenerator.generate(this.worldObj, this.randomGenerator, blockpos); + BlockPos blockpos = this.chunkPos.add(random.nextInt(16), random.nextInt(maxY - minY) + minY, random.nextInt(16)); + worldGenerator.generate(this.worldObj, random, blockpos); } } - private void generateVenus() + private void generateVenus(Random random) { - MinecraftForge.EVENT_BUS.post(new GCCoreEventPopulate.Pre(this.worldObj, this.randomGenerator, field_180294_c)); - this.genStandardOre(18, this.aluminumGen, 0, 60); - this.genStandardOre(24, this.copperGen, 0, 60); - this.genStandardOre(18, this.galenaGen, 0, 60); - this.genStandardOre(26, this.quartzGen, 0, 60); - this.genStandardOre(4, this.siliconGen, 0, 60); - this.genStandardOre(22, this.tinGen, 0, 60); - MinecraftForge.EVENT_BUS.post(new GCCoreEventPopulate.Post(this.worldObj, this.randomGenerator, field_180294_c)); + MinecraftForge.EVENT_BUS.post(new GCCoreEventPopulate.Pre(this.worldObj, random, chunkPos)); + this.genStandardOre(18, this.aluminumGen, 0, 60, random); + this.genStandardOre(24, this.copperGen, 0, 60, random); + this.genStandardOre(18, this.galenaGen, 0, 60, random); + this.genStandardOre(26, this.quartzGen, 0, 60, random); + this.genStandardOre(4, this.siliconGen, 0, 60, random); + this.genStandardOre(22, this.tinGen, 0, 60, random); + MinecraftForge.EVENT_BUS.post(new GCCoreEventPopulate.Post(this.worldObj, random, chunkPos)); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenFlatVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenFlatVenus.java index 4da9eafb90..5cf42d327a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenFlatVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenFlatVenus.java @@ -11,11 +11,9 @@ public class BiomeGenFlatVenus extends BiomeVenus { - public BiomeGenFlatVenus(int par1) + public BiomeGenFlatVenus(BiomeProperties properties) { - super(par1); - this.setColor(180 << 16 | 180 << 8 | 180); - this.setHeight(new Height(0.5F, 0.4F)); + super(properties); if (!ConfigManagerCore.disableBiomeTypeRegistrations) { BiomeDictionary.registerBiomeType(this, BiomeDictionary.Type.HOT, BiomeDictionary.Type.DRY, BiomeDictionary.Type.DEAD, BiomeDictionary.Type.SANDY); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusMountain.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusMountain.java index d368d9aba8..f0cd7ed274 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusMountain.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusMountain.java @@ -11,11 +11,9 @@ public class BiomeGenVenusMountain extends BiomeVenus { - public BiomeGenVenusMountain(int par1) + public BiomeGenVenusMountain(BiomeProperties properties) { - super(par1); - this.setColor(255 << 16 | 255 << 8 | 255); - this.setHeight(new Height(2.0F, 1.0F)); + super(properties); if (!ConfigManagerCore.disableBiomeTypeRegistrations) { BiomeDictionary.registerBiomeType(this, BiomeDictionary.Type.HOT, BiomeDictionary.Type.DRY, BiomeDictionary.Type.DEAD, BiomeDictionary.Type.SANDY); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusValley.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusValley.java index 503541938a..473e405bc7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusValley.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenVenusValley.java @@ -14,11 +14,9 @@ public class BiomeGenVenusValley extends BiomeVenus { - public BiomeGenVenusValley(int par1) + public BiomeGenVenusValley(BiomeProperties properties) { - super(par1); - this.setColor(100 << 16 | 100 << 8 | 100); - this.setHeight(new Height(-0.4F, 0.2F)); + super(properties); if (!ConfigManagerCore.disableBiomeTypeRegistrations) { BiomeDictionary.registerBiomeType(this, BiomeDictionary.Type.HOT, BiomeDictionary.Type.DRY, BiomeDictionary.Type.DEAD, BiomeDictionary.Type.SANDY); @@ -45,13 +43,13 @@ public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimer { if (j1 <= rand.nextInt(5)) { - chunkPrimerIn.setBlockState(i1, j1, l, Blocks.bedrock.getDefaultState()); + chunkPrimerIn.setBlockState(i1, j1, l, Blocks.BEDROCK.getDefaultState()); } else { IBlockState iblockstate2 = chunkPrimerIn.getBlockState(i1, j1, l); - if (iblockstate2.getBlock().getMaterial() == Material.AIR) + if (iblockstate2.getBlock().getMaterial(iblockstate2) == Material.AIR) { j = -1; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldChunkManagerVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeProviderVenus.java similarity index 79% rename from src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldChunkManagerVenus.java rename to src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeProviderVenus.java index dee4a18f7c..d3b761cd52 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldChunkManagerVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeProviderVenus.java @@ -4,34 +4,34 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldType; -import net.minecraft.world.biome.BiomeCache; import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.WorldChunkManager; +import net.minecraft.world.biome.BiomeCache; +import net.minecraft.world.biome.BiomeProvider; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import javax.annotation.Nullable; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Random; -public class WorldChunkManagerVenus extends WorldChunkManager +public class BiomeProviderVenus extends BiomeProvider { private GenLayer unzoomedBiomes; private GenLayer zoomedBiomes; private BiomeCache biomeCache; private List biomesToSpawnIn; - protected WorldChunkManagerVenus() + protected BiomeProviderVenus() { biomeCache = new BiomeCache(this); biomesToSpawnIn = new ArrayList<>(); // biomesToSpawnIn.add() } - public WorldChunkManagerVenus(long seed, WorldType type) + public BiomeProviderVenus(long seed, WorldType type) { this(); GenLayer[] genLayers = GenLayerVenus.createWorld(seed); @@ -39,7 +39,7 @@ public WorldChunkManagerVenus(long seed, WorldType type) this.zoomedBiomes = genLayers[1]; } - public WorldChunkManagerVenus(World world) + public BiomeProviderVenus(World world) { this(world.getSeed(), world.getWorldInfo().getTerrainType()); } @@ -51,21 +51,9 @@ public List getBiomesToSpawnIn() } @Override - public Biome getBiomeGenerator(BlockPos pos, Biome biomeGenBaseIn) + public Biome getBiome(BlockPos pos, Biome defaultBiome) { - return this.biomeCache.func_180284_a(pos.getX(), pos.getZ(), BiomeVenus.venusFlat); - } - - @Override - public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) - { - if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) - { - par1ArrayOfFloat = new float[par4 * par5]; - } - - Arrays.fill(par1ArrayOfFloat, 0, par4 * par5, 0.0F); - return par1ArrayOfFloat; + return this.biomeCache.getBiome(pos.getX(), pos.getZ(), BiomeVenus.venusFlat); } @Override @@ -103,13 +91,13 @@ public Biome[] getBiomesForGeneration(Biome[] biomes, int x, int z, int length, } @Override - public Biome[] loadBlockGeneratorData(Biome[] oldBiomeList, int x, int z, int length, int width) + public Biome[] getBiomes(@Nullable Biome[] oldBiomeList, int x, int z, int width, int depth) { - return getBiomeGenAt(oldBiomeList, x, z, length, width, true); + return getBiomes(oldBiomeList, x, z, width, depth, true); } @Override - public Biome[] getBiomeGenAt(Biome[] listToReuse, int x, int z, int length, int width, boolean cacheFlag) + public Biome[] getBiomes(@Nullable Biome[] listToReuse, int x, int z, int width, int length, boolean cacheFlag) { IntCache.resetIntCache(); @@ -135,7 +123,7 @@ public Biome[] getBiomeGenAt(Biome[] listToReuse, int x, int z, int length, int } else { - listToReuse[i] = Biome.beach; // TODO Replace with venus default + listToReuse[i] = BiomeVenus.venusFlat; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenBaseVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeVenus.java similarity index 87% rename from src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenBaseVenus.java rename to src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeVenus.java index ecedcdca62..221f8901c5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeGenBaseVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/BiomeVenus.java @@ -4,29 +4,28 @@ import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSkeleton; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedSpider; import micdoodle8.mods.galacticraft.core.entities.EntityEvolvedZombie; -import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.planets.venus.VenusBlocks; import micdoodle8.mods.galacticraft.planets.venus.blocks.BlockBasicVenus; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.chunk.ChunkPrimer; import java.util.Random; public class BiomeVenus extends Biome { - public static final Biome venusFlat = new BiomeGenFlatVenus(ConfigManagerCore.biomeIDbase + 4).setBiomeName("Venus Flat"); - public static final Biome venusMountain = new BiomeGenVenusMountain(ConfigManagerCore.biomeIDbase + 5).setBiomeName("Venus Mountain"); - public static final Biome venusValley = new BiomeGenVenusValley(ConfigManagerCore.biomeIDbase + 6).setBiomeName("Venus Valley"); + public static final Biome venusFlat = new BiomeGenFlatVenus(new BiomeProperties("Venus Flat").setRainfall(0.0F).setRainDisabled().setBaseHeight(0.5F).setHeightVariation(0.4F)); + public static final Biome venusMountain = new BiomeGenVenusMountain(new BiomeProperties("Venus Mountain").setRainfall(0.0F).setRainDisabled().setBaseHeight(2.0F).setHeightVariation(1.0F)); + public static final Biome venusValley = new BiomeGenVenusValley(new BiomeProperties("Venus Valley").setRainfall(0.0F).setRainDisabled().setBaseHeight(-0.4F).setHeightVariation(0.2F)); @SuppressWarnings("unchecked") - BiomeVenus(int var1) + BiomeVenus(BiomeProperties properties) { - super(var1); + super(properties); this.spawnableMonsterList.clear(); this.spawnableWaterCreatureList.clear(); this.spawnableCreatureList.clear(); @@ -35,7 +34,6 @@ public class BiomeVenus extends Biome this.spawnableMonsterList.add(new SpawnListEntry(EntityEvolvedSpider.class, 8, 2, 3)); this.spawnableMonsterList.add(new SpawnListEntry(EntityEvolvedSkeleton.class, 8, 2, 3)); this.spawnableMonsterList.add(new SpawnListEntry(EntityEvolvedCreeper.class, 8, 2, 3)); - this.rainfall = 0F; } @Override @@ -70,13 +68,13 @@ public final void generateBiomeTerrainVenus(World worldIn, Random rand, ChunkPri { if (j1 <= rand.nextInt(5)) { - chunkPrimerIn.setBlockState(i1, j1, l, Blocks.bedrock.getDefaultState()); + chunkPrimerIn.setBlockState(i1, j1, l, Blocks.BEDROCK.getDefaultState()); } else { IBlockState iblockstate2 = chunkPrimerIn.getBlockState(i1, j1, l); - if (iblockstate2.getBlock().getMaterial() == Material.AIR) + if (iblockstate2.getBlock().getMaterial(iblockstate2) == Material.AIR) { j = -1; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java index 393a38ae58..5a830456cd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/ChunkProviderVenus.java @@ -12,16 +12,15 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EnumCreatureType; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.IProgressUpdate; +import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.world.ChunkCoordIntPair; -import net.minecraft.world.SpawnerAnimals; import net.minecraft.world.World; +import net.minecraft.world.WorldEntitySpawner; import net.minecraft.world.WorldType; import net.minecraft.world.biome.Biome; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.ChunkPrimer; -import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.gen.NoiseGenerator; import net.minecraft.world.gen.NoiseGeneratorOctaves; import net.minecraft.world.gen.NoiseGeneratorPerlin; @@ -29,7 +28,7 @@ import java.util.List; import java.util.Random; -public class ChunkProviderVenus implements IChunkProvider +public class ChunkProviderVenus implements IChunkGenerator { public static final IBlockState BLOCK_FILL = VenusBlocks.venusBlock.getDefaultState().withProperty(BlockBasicVenus.BASIC_TYPE_VENUS, BlockBasicVenus.EnumBlockBasicVenus.ROCK_HARD); @@ -97,7 +96,7 @@ public ChunkProviderVenus(World worldIn, long seed, boolean mapFeaturesEnabled) private void setBlocksInChunk(int chunkX, int chunkZ, ChunkPrimer primer) { this.noiseGenSmooth1.setFrequency(0.015F); - this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, chunkX * 4 - 2, chunkZ * 4 - 2, 10, 10); + this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomesForGeneration(this.biomesForGeneration, chunkX * 4 - 2, chunkZ * 4 - 2, 10, 10); this.createLandPerBiome(chunkX * 4, chunkZ * 4); for (int i = 0; i < 4; ++i) @@ -163,7 +162,7 @@ private void setBlocksInChunk(int chunkX, int chunkZ, ChunkPrimer primer) private void replaceBlocksForBiome(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, Biome[] p_180517_4_) { double d0 = 0.03125D; - this.stoneNoise = this.noiseGen4.func_151599_a(this.stoneNoise, (double) (p_180517_1_ * 16), (double) (p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); + this.stoneNoise = this.noiseGen4.getRegion(this.stoneNoise, (double) (p_180517_1_ * 16), (double) (p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); for (int i = 0; i < 16; ++i) { @@ -181,21 +180,21 @@ public Chunk provideChunk(int x, int z) this.rand.setSeed((long) x * 341873128712L + (long) z * 132897987541L); ChunkPrimer chunkprimer = new ChunkPrimer(); this.setBlocksInChunk(x, z, chunkprimer); - this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16); + this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomes(this.biomesForGeneration, x * 16, z * 16, 16, 16); - this.lavaCaveGenerator.generate(this, this.worldObj, x, z, chunkprimer); + this.lavaCaveGenerator.generate(this.worldObj, x, z, chunkprimer); this.replaceBlocksForBiome(x, z, chunkprimer, this.biomesForGeneration); - this.caveGenerator.generate(this, this.worldObj, x, z, chunkprimer); - this.dungeonGenerator.generate(this, this.worldObj, x, z, chunkprimer); + this.caveGenerator.generate(this.worldObj, x, z, chunkprimer); + this.dungeonGenerator.generate(this.worldObj, x, z, chunkprimer); Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z); byte[] abyte = chunk.getBiomeArray(); for (int i = 0; i < abyte.length; ++i) { - abyte[i] = (byte) this.biomesForGeneration[i].biomeID; + abyte[i] = (byte) Biome.getIdForBiome(this.biomesForGeneration[i]); } chunk.generateSkylightMap(); @@ -226,8 +225,8 @@ private void createLandPerBiome(int x, int z) for (int k1 = -i1; k1 <= i1; ++k1) { Biome biomegenbase1 = this.biomesForGeneration[k + j1 + 2 + (l + k1 + 2) * 10]; - float f5 = biomegenbase1.minHeight; - float f6 = biomegenbase1.maxHeight; + float f5 = biomegenbase1.getBaseHeight(); + float f6 = biomegenbase1.getHeightVariation(); if (this.worldType == WorldType.AMPLIFIED && f5 > 0.0F) { @@ -237,7 +236,7 @@ private void createLandPerBiome(int x, int z) float f7 = this.parabolicField[j1 + 2 + (k1 + 2) * 5] / (f5 + 2.0F); - if (biomegenbase1.minHeight > biomegenbase.minHeight) + if (biomegenbase1.getBaseHeight() > biomegenbase.getBaseHeight()) { f7 /= 2.0F; } @@ -319,19 +318,13 @@ private void createLandPerBiome(int x, int z) } @Override - public boolean chunkExists(int x, int z) - { - return true; - } - - @Override - public void populate(IChunkProvider provider, int x, int z) + public void populate(int x, int z) { BlockFalling.fallInstantly = true; int i = x * 16; int j = z * 16; BlockPos blockpos = new BlockPos(i, 0, j); - Biome biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos.add(16, 0, 16)); + Biome biomegenbase = this.worldObj.getBiome(blockpos.add(16, 0, 16)); this.rand.setSeed(this.worldObj.getSeed()); long k = this.rand.nextLong() / 2L * 2L + 1L; long l = this.rand.nextLong() / 2L * 2L + 1L; @@ -367,53 +360,18 @@ else if (this.rand.nextInt(190) == 0) } } - this.dungeonGenerator.generateStructure(this.worldObj, this.rand, new ChunkCoordIntPair(x, z)); + this.dungeonGenerator.generateStructure(this.worldObj, this.rand, new ChunkPos(x, z)); biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(i, 0, j)); - SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, i + 8, j + 8, 16, 16, this.rand); + WorldEntitySpawner.performWorldGenSpawning(this.worldObj, biomegenbase, i + 8, j + 8, 16, 16, this.rand); BlockFalling.fallInstantly = false; } - @Override - public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_) - { - return false; - } - - @Override - public boolean saveChunks(boolean p_73151_1_, IProgressUpdate progressCallback) - { - return true; - } - - @Override - public void saveExtraData() - { - } - - @Override - public boolean unloadQueuedChunks() - { - return false; - } - - @Override - public boolean canSave() - { - return true; - } - - @Override - public String makeString() - { - return "VenusLevelSource"; - } - @Override public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { - Biome biomegenbase = this.worldObj.getBiomeGenForCoords(pos); + Biome biomegenbase = this.worldObj.getBiome(pos); return biomegenbase.getSpawnableList(creatureType); } @@ -424,21 +382,15 @@ public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos p return null; } - @Override - public int getLoadedChunkCount() - { - return 0; - } - @Override public void recreateStructures(Chunk chunk, int x, int z) { - this.dungeonGenerator.generate(this, this.worldObj, x, z, null); + this.dungeonGenerator.generate(this.worldObj, x, z, null); } @Override - public Chunk provideChunk(BlockPos blockPosIn) + public boolean generateStructures(Chunk chunkIn, int x, int z) { - return this.provideChunk(blockPosIn.getX() >> 4, blockPosIn.getZ() >> 4); + return false; } } \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java index db40a69fe5..0c8567dc8c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java @@ -166,18 +166,16 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime if (xfactorSq + zfactorSq < 1.0D) { - final int coords = (localX * 16 + localZ) * 256 + localY; - if (yfactor > -0.7D && xfactorSq + yfactorSq + zfactorSq < 1.0D) { - IBlockState state = primer.getBlockState(coords); + IBlockState state = primer.getBlockState(localX, localY, localZ); Block block = state.getBlock(); int metadata = state.getBlock().getMetaFromState(state); if (block == VenusBlocks.venusBlock) { if (metadata == 1) { - primer.setBlockState(coords, Blocks.AIR.getDefaultState()); + primer.setBlockState(localX, localY, localZ, Blocks.AIR.getDefaultState()); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java index 1a52d44470..e023ec5ef1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java @@ -159,28 +159,26 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime if (xfactorSq + zfactorSq < 1.0D) { - final int coords = (localX * 16 + localZ) * 256 + localY; - if (yfactor > -0.7D && xfactorSq + yfactorSq + zfactorSq < 1.0D) { - IBlockState toReplace = primer.getBlockState(coords); + IBlockState toReplace = primer.getBlockState(localX, localY, localZ); if (toReplace.getBlock() == VenusBlocks.venusBlock) { BlockBasicVenus.EnumBlockBasicVenus type = (BlockBasicVenus.EnumBlockBasicVenus)toReplace.getValue(BlockBasicVenus.BASIC_TYPE_VENUS); if (type == BlockBasicVenus.EnumBlockBasicVenus.ROCK_HARD || type == BlockBasicVenus.EnumBlockBasicVenus.ROCK_SOFT) { - IBlockState north = localZ == 0 ? Blocks.AIR.getDefaultState() : primer.getBlockState((localX * 16 + localZ - 1) * 256 + localY); - IBlockState south = localZ == 15 ? Blocks.AIR.getDefaultState() : primer.getBlockState((localX * 16 + localZ + 1) * 256 + localY); - IBlockState east = localX == 15 ? Blocks.AIR.getDefaultState() : primer.getBlockState(((localX + 1) * 16 + localZ) * 256 + localY); - IBlockState west = localX == 0 ? Blocks.AIR.getDefaultState() : primer.getBlockState(((localX - 1) * 16 + localZ) * 256 + localY); - IBlockState below = localY == 0 ? Blocks.AIR.getDefaultState() : primer.getBlockState((localX * 16 + localZ) * 256 + localY - 1); + IBlockState north = localZ == 0 ? Blocks.AIR.getDefaultState() : primer.getBlockState(localX, localY, localZ - 1); + IBlockState south = localZ == 15 ? Blocks.AIR.getDefaultState() : primer.getBlockState(localX, localY, localZ + 1); + IBlockState east = localX == 15 ? Blocks.AIR.getDefaultState() : primer.getBlockState(localX + 1, localY, localZ); + IBlockState west = localX == 0 ? Blocks.AIR.getDefaultState() : primer.getBlockState(localX - 1, localY, localZ); + IBlockState below = localY == 0 ? Blocks.AIR.getDefaultState() : primer.getBlockState(localX, localY - 1, localZ); if (north.getBlock() == Blocks.AIR || south.getBlock() == Blocks.AIR || east.getBlock() == Blocks.AIR || west.getBlock() == Blocks.AIR || below.getBlock() == Blocks.AIR) { - primer.setBlockState(coords, VenusBlocks.venusBlock.getDefaultState().withProperty(BlockBasicVenus.BASIC_TYPE_VENUS, BlockBasicVenus.EnumBlockBasicVenus.ROCK_MAGMA)); + primer.setBlockState(localX, localY, localZ, VenusBlocks.venusBlock.getDefaultState().withProperty(BlockBasicVenus.BASIC_TYPE_VENUS, BlockBasicVenus.EnumBlockBasicVenus.ROCK_MAGMA)); } else { - primer.setBlockState(coords, Blocks.lava.getDefaultState()); + primer.setBlockState(localX, localY, localZ, Blocks.LAVA.getDefaultState()); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenCrashedProbe.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenCrashedProbe.java index d3db2733bd..aebc925874 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenCrashedProbe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenCrashedProbe.java @@ -1,14 +1,11 @@ package micdoodle8.mods.galacticraft.planets.venus.world.gen; import micdoodle8.mods.galacticraft.planets.venus.VenusBlocks; -import micdoodle8.mods.galacticraft.planets.venus.blocks.BlockCrashedProbe; import micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityCrashedProbe; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -import net.minecraftforge.common.ChestGenHooks; import java.util.Random; @@ -42,7 +39,7 @@ public boolean generate(World worldIn, Random rand, BlockPos position) for (int poolZ = -radius; poolZ <= radius; poolZ++) { BlockPos pos = new BlockPos(poolX + position.getX(), poolY + position.getY(), poolZ + position.getZ()); - if (poolY > 15 && !worldIn.getBlockState(pos).getBlock().isAir(worldIn, pos)) + if (poolY > 15 && !worldIn.getBlockState(pos).getBlock().isAir(worldIn.getBlockState(pos), worldIn, pos)) { return false; } @@ -83,9 +80,10 @@ else if (worldIn.getBlockState(pos).getBlock() == VenusBlocks.venusBlock && pool probe.setInventorySlotContents(i, null); } - ChestGenHooks info = ChestGenHooks.getInfo(BlockCrashedProbe.CRASHED_PROBE); - - WeightedRandomChestContent.generateChestContents(rand, info.getItems(rand), probe, info.getCount(rand)); + // TODO +// ChestGenHooks info = ChestGenHooks.getInfo(BlockCrashedProbe.CRASHED_PROBE); +// +// WeightedRandomChestContent.generateChestContents(rand, info.getItems(rand), probe, info.getCount(rand)); } return true; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java index e06fa1bc38..4429552e74 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/WorldGenLakesVenus.java @@ -3,6 +3,7 @@ import micdoodle8.mods.galacticraft.planets.venus.VenusBlocks; import micdoodle8.mods.galacticraft.planets.venus.blocks.BlockBasicVenus; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.world.EnumSkyBlock; @@ -75,14 +76,15 @@ public boolean generate(World worldIn, Random rand, BlockPos position) if (flag) { - Material material = worldIn.getBlockState(position.add(k1, k, l2)).getBlock().getMaterial(); + IBlockState state = worldIn.getBlockState(position.add(k1, k, l2)); + Material material = state.getBlock().getMaterial(state); if (k >= 4 && material.isLiquid()) { return false; } - if (k < 4 && !material.isSolid() && worldIn.getBlockState(position.add(k1, k, l2)).getBlock() != Blocks.lava) + if (k < 4 && !material.isSolid() && worldIn.getBlockState(position.add(k1, k, l2)).getBlock() != Blocks.LAVA) { return false; } @@ -99,7 +101,7 @@ public boolean generate(World worldIn, Random rand, BlockPos position) { if (aboolean[(l1 * 16 + i3) * 8 + i4]) { - worldIn.setBlockState(position.add(l1, i4, i3), i4 >= 4 ? Blocks.AIR.getDefaultState() : Blocks.lava.getDefaultState(), 2); + worldIn.setBlockState(position.add(l1, i4, i3), i4 >= 4 ? Blocks.AIR.getDefaultState() : Blocks.LAVA.getDefaultState(), 2); } } } @@ -115,17 +117,17 @@ public boolean generate(World worldIn, Random rand, BlockPos position) { BlockPos blockpos = position.add(i2, j4 - 1, j3); - if (worldIn.getBlockState(blockpos).getBlock() == Blocks.dirt && worldIn.getLightFor(EnumSkyBlock.SKY, position.add(i2, j4, j3)) > 0) + if (worldIn.getBlockState(blockpos).getBlock() == Blocks.DIRT && worldIn.getLightFor(EnumSkyBlock.SKY, position.add(i2, j4, j3)) > 0) { - Biome biomegenbase = worldIn.getBiomeGenForCoords(blockpos); + Biome biomegenbase = worldIn.getBiome(blockpos); - if (biomegenbase.topBlock.getBlock() == Blocks.mycelium) + if (biomegenbase.topBlock.getBlock() == Blocks.MYCELIUM) { - worldIn.setBlockState(blockpos, Blocks.mycelium.getDefaultState(), 2); + worldIn.setBlockState(blockpos, Blocks.MYCELIUM.getDefaultState(), 2); } else { - worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState(), 2); + worldIn.setBlockState(blockpos, Blocks.GRASS.getDefaultState(), 2); } } } @@ -141,7 +143,8 @@ public boolean generate(World worldIn, Random rand, BlockPos position) { boolean flag1 = !aboolean[(j2 * 16 + k3) * 8 + k4] && (j2 < 15 && aboolean[((j2 + 1) * 16 + k3) * 8 + k4] || j2 > 0 && aboolean[((j2 - 1) * 16 + k3) * 8 + k4] || k3 < 15 && aboolean[(j2 * 16 + k3 + 1) * 8 + k4] || k3 > 0 && aboolean[(j2 * 16 + (k3 - 1)) * 8 + k4] || k4 < 7 && aboolean[(j2 * 16 + k3) * 8 + k4 + 1] || k4 > 0 && aboolean[(j2 * 16 + k3) * 8 + (k4 - 1)]); - if (flag1 && (k4 < 4 || rand.nextInt(2) != 0) && worldIn.getBlockState(position.add(j2, k4, k3)).getBlock().getMaterial().isSolid()) + IBlockState state = worldIn.getBlockState(position.add(j2, k4, k3)); + if (flag1 && (k4 < 4 || rand.nextInt(2) != 0) && state.getBlock().getMaterial(state).isSolid()) { worldIn.setBlockState(position.add(j2, k4, k3), VenusBlocks.venusBlock.getDefaultState().withProperty(BlockBasicVenus.BASIC_TYPE_VENUS, BlockBasicVenus.EnumBlockBasicVenus.ROCK_MAGMA), 2); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/CorridorVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/CorridorVenus.java index a783ea47ab..8e92ad66f4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/CorridorVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/CorridorVenus.java @@ -17,7 +17,7 @@ public CorridorVenus() public CorridorVenus(DungeonConfigurationVenus configuration, Random rand, int blockPosX, int blockPosZ, int sizeX, int sizeY, int sizeZ, EnumFacing direction) { super(configuration, sizeX, sizeY, sizeZ, direction); - this.coordBaseMode = EnumFacing.SOUTH; + this.setCoordBaseMode(EnumFacing.SOUTH); this.boundingBox = new StructureBoundingBox(blockPosX, configuration.getYPosition(), blockPosZ, blockPosX + sizeX, configuration.getYPosition() + sizeY, blockPosZ + sizeZ); } @@ -34,11 +34,11 @@ public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundi { if (i == 0 || i == this.boundingBox.getXSize() - 1) { - this.setBlockState(worldIn, Blocks.lava.getDefaultState(), i, j, k, this.boundingBox); + this.setBlockState(worldIn, Blocks.LAVA.getDefaultState(), i, j, k, this.boundingBox); } else if (i == 1 || i == this.boundingBox.getXSize() - 2) { - this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), i, j, k, this.boundingBox); + this.setBlockState(worldIn, Blocks.IRON_BARS.getDefaultState(), i, j, k, this.boundingBox); } else { @@ -49,11 +49,11 @@ else if (j == 2 && this.getDirection().getAxis() == EnumFacing.Axis.X && (i + 1) { if (k == 0 || k == this.boundingBox.getZSize() - 1) { - this.setBlockState(worldIn, Blocks.lava.getDefaultState(), i, j, k, this.boundingBox); + this.setBlockState(worldIn, Blocks.LAVA.getDefaultState(), i, j, k, this.boundingBox); } else if (k == 1 || k == this.boundingBox.getZSize() - 2) { - this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), i, j, k, this.boundingBox); + this.setBlockState(worldIn, Blocks.IRON_BARS.getDefaultState(), i, j, k, this.boundingBox); } else { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomBossVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomBossVenus.java index c95367007d..9dde6f31a8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomBossVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomBossVenus.java @@ -32,7 +32,7 @@ public RoomBossVenus(DungeonConfigurationVenus configuration, Random rand, int b public RoomBossVenus(DungeonConfigurationVenus configuration, Random rand, int blockPosX, int blockPosZ, int sizeX, int sizeY, int sizeZ, EnumFacing entranceDir) { super(configuration, sizeX, sizeY, sizeZ, entranceDir.getOpposite()); - this.coordBaseMode = EnumFacing.SOUTH; + this.setCoordBaseMode(EnumFacing.SOUTH); this.sizeX = sizeX; this.sizeZ = sizeZ; this.sizeY = sizeY; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java index e80672ecc8..005266e8e5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java @@ -3,12 +3,11 @@ import micdoodle8.mods.galacticraft.core.blocks.BlockT1TreasureChest; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.WeightedRandomChestContent; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; -import net.minecraftforge.common.ChestGenHooks; +import net.minecraft.world.storage.loot.LootTableList; import java.util.Random; @@ -31,22 +30,14 @@ public boolean addComponentParts(World worldIn, Random rand, StructureBoundingBo int chestX = this.sizeX / 2; int chestY = 1; int chestZ = this.sizeZ / 2; - this.setBlockState(worldIn, Blocks.chest.getDefaultState().withProperty(BlockT1TreasureChest.FACING, this.getDirection().getOpposite()), chestX, chestY, chestZ, boundingBox); + this.setBlockState(worldIn, Blocks.CHEST.getDefaultState().withProperty(BlockT1TreasureChest.FACING, this.getDirection().getOpposite()), chestX, chestY, chestZ, boundingBox); BlockPos blockpos = new BlockPos(this.getXWithOffset(chestX, chestZ), this.getYWithOffset(chestY), this.getZWithOffset(chestX, chestZ)); TileEntityChest chest = (TileEntityChest) worldIn.getTileEntity(blockpos); if (chest != null) { - for (int i = 0; i < chest.getSizeInventory(); ++i) - { - // Clear contents - chest.setInventorySlotContents(i, null); - } - - ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); - - WeightedRandomChestContent.generateChestContents(rand, info.getItems(rand), chest, info.getCount(rand)); + chest.setLootTable(LootTableList.CHESTS_SIMPLE_DUNGEON, rand.nextLong()); } return true; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEmptyVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEmptyVenus.java index 71406bcb02..1b85692762 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEmptyVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEmptyVenus.java @@ -16,7 +16,7 @@ public RoomEmptyVenus() public RoomEmptyVenus(DungeonConfigurationVenus configuration, Random rand, int blockPosX, int blockPosZ, int sizeX, int sizeY, int sizeZ, EnumFacing entranceDir) { super(configuration, sizeX, sizeY, sizeZ, entranceDir.getOpposite()); - this.coordBaseMode = EnumFacing.SOUTH; + this.setCoordBaseMode(EnumFacing.SOUTH); this.sizeX = sizeX; this.sizeY = sizeY; this.sizeZ = sizeZ; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEntranceVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEntranceVenus.java index 0eb95b8eac..08600a7450 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEntranceVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomEntranceVenus.java @@ -20,7 +20,7 @@ public RoomEntranceVenus() public RoomEntranceVenus(World world, DungeonConfigurationVenus configuration, Random rand, int blockPosX, int blockPosZ) { super(configuration, rand.nextInt(4) + 6, rand.nextInt(2) + 5, rand.nextInt(4) + 6, EnumFacing.Plane.HORIZONTAL.random(rand)); - this.coordBaseMode = EnumFacing.SOUTH; + this.setCoordBaseMode(EnumFacing.SOUTH); this.boundingBox = new StructureBoundingBox(blockPosX - range, configuration.getYPosition(), blockPosZ - range, blockPosX + range, 150, blockPosZ + range); System.out.println("Generating dungeon at " + blockPosX + " " + configuration.getYPosition() + " " + blockPosZ); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java index 18b638d252..3688b7f288 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java @@ -33,14 +33,14 @@ public boolean addComponentParts(World worldIn, Random random, StructureBounding { if (random.nextFloat() < 0.05F) { - this.setBlockState(worldIn, Blocks.web.getDefaultState(), i, j, k, boundingBox); + this.setBlockState(worldIn, Blocks.WEB.getDefaultState(), i, j, k, boundingBox); } } } } - this.setBlockState(worldIn, Blocks.mob_spawner.getDefaultState(), 1, 0, 1, boundingBox); - this.setBlockState(worldIn, Blocks.mob_spawner.getDefaultState(), this.sizeX - 1, 0, this.sizeZ - 1, boundingBox); + this.setBlockState(worldIn, Blocks.MOB_SPAWNER.getDefaultState(), 1, 0, 1, boundingBox); + this.setBlockState(worldIn, Blocks.MOB_SPAWNER.getDefaultState(), this.sizeX - 1, 0, this.sizeZ - 1, boundingBox); BlockPos blockpos = new BlockPos(this.getXWithOffset(1, 1), this.getYWithOffset(0), this.getZWithOffset(1, 1)); TileEntityMobSpawner spawner = (TileEntityMobSpawner) worldIn.getTileEntity(blockpos); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java index cd5de0f6be..a11cc2c189 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomTreasureVenus.java @@ -26,7 +26,7 @@ public RoomTreasureVenus(DungeonConfigurationVenus configuration, Random rand, i public RoomTreasureVenus(DungeonConfigurationVenus configuration, Random rand, int blockPosX, int blockPosZ, int sizeX, int sizeY, int sizeZ, EnumFacing entranceDir) { super(configuration, sizeX, sizeY, sizeZ, entranceDir.getOpposite()); - this.coordBaseMode = EnumFacing.SOUTH; + this.setCoordBaseMode(EnumFacing.SOUTH); int yPos = configuration.getYPosition(); this.boundingBox = new StructureBoundingBox(blockPosX, yPos, blockPosZ, blockPosX + this.sizeX, yPos + this.sizeY, blockPosZ + this.sizeZ); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/layer/GenLayerVenusBiomes.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/layer/GenLayerVenusBiomes.java index 5cc898e211..eaa2045056 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/layer/GenLayerVenusBiomes.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/layer/GenLayerVenusBiomes.java @@ -30,7 +30,7 @@ public int[] getInts(int x, int z, int width, int depth) for (int i = 0; i < width; ++i) { initChunkSeed(x + i, z + k); - dest[i + k * width] = biomes[nextInt(biomes.length)].biomeID; + dest[i + k * width] = Biome.getIdForBiome(biomes[nextInt(biomes.length)]); } } From 352e0245c98d4ab7455268f68693dded87f1737c Mon Sep 17 00:00:00 2001 From: Mitch Date: Sun, 12 Mar 2017 21:38:45 -0400 Subject: [PATCH 006/535] Fix item/block rendering --- .../api/GalacticraftRegistry.java | 3 +- .../galacticraft/core/GalacticraftCore.java | 5 + .../galacticraft/core/TransformerHooks.java | 4 +- .../galacticraft/core/blocks/BlockBasic.java | 2 +- .../client/render/item/ItemModelBuggy.java | 11 +- .../client/render/item/ItemModelFlag.java | 13 +- .../client/render/item/ItemModelRocket.java | 12 +- .../core/dimension/SpaceRaceManager.java | 2 +- .../galacticraft/core/items/ItemAxeGC.java | 25 ++- .../core/items/ItemBlockBase.java | 2 +- .../core/proxy/ClientProxyCore.java | 7 +- .../galacticraft/core/util/WorldUtil.java | 5 +- .../asteroids/AsteroidsModuleClient.java | 6 +- .../render/item/ItemModelAstroMiner.java | 12 +- .../render/item/ItemModelBeamReceiver.java | 4 +- .../render/item/ItemModelBeamReflector.java | 5 +- .../render/item/ItemModelCargoRocket.java | 10 +- .../client/render/item/ItemModelGrapple.java | 8 +- .../client/render/item/ItemModelRocketT3.java | 12 +- .../client/render/item/ItemModelTelepad.java | 7 +- .../asteroids/items/ItemAxeAsteroids.java | 25 ++- .../client/render/item/ItemModelRocketT2.java | 12 +- .../planets/mars/items/ItemAxeMars.java | 26 ++- .../models/block/arclamp.json | 8 + .../models/block/buggy_pad_model.json | 1 + .../models/block/cheese_uneaten_model.json | 1 + .../models/block/fallen_meteor_model.json | 2 +- .../models/block/fluid_pipe.json | 40 ++-- .../models/block/fluid_pipe_neswud.json | 197 +++++++++--------- .../models/block/gc_wall_inventory.json | 13 ++ .../models/block/landing_pad_model.json | 1 + .../models/block/moon_turf_model.json | 1 + .../models/block/parachest.json | 8 + .../galacticraftcore/models/block/screen.json | 2 +- .../models/block/spin_thruster_model.json | 8 + .../galacticraftcore/models/block/tank.json | 1 + .../models/block/tank_ud.json | 1 + .../models/block/treasure_chest.json | 2 +- .../galacticraftcore/models/item/arclamp.json | 5 +- .../galacticraftcore/models/item/key.json | 4 +- .../models/item/landing_pad.json | 9 +- .../models/item/meteor_chunk.json | 2 +- .../models/item/meteor_chunk_hot.json | 2 +- .../models/item/moon_stairs_brick.json | 12 +- .../models/item/moon_stairs_stone.json | 12 +- .../models/item/parachest.json | 5 +- .../models/item/slab_mars_cobblestone.json | 12 +- .../models/item/slab_mars_dungeon_brick.json | 12 +- .../models/item/slab_moon_dungeon_brick.json | 12 +- .../models/item/slab_moon_stone.json | 12 +- .../models/item/slab_tin_1.json | 12 +- .../models/item/slab_tin_2.json | 12 +- .../models/item/spin_thruster.json | 7 +- .../models/item/tin_stairs_1.json | 12 +- .../models/item/tin_stairs_2.json | 12 +- .../models/item/treasure_chest.json | 7 +- .../models/item/wall_mars_cobblestone.json | 12 +- .../models/item/wall_mars_dungeon_brick.json | 12 +- .../models/item/wall_moon_dungeon_brick.json | 12 +- .../models/item/wall_moon_stone.json | 12 +- .../models/item/wall_tin_1.json | 12 +- .../models/item/wall_tin_2.json | 12 +- .../models/block/creeper_egg.json | 1 + .../models/block/cryo_0.json | 8 + .../models/block/slimeling_egg_blue.json | 1 + .../models/block/slimeling_egg_red.json | 1 + .../models/block/slimeling_egg_yellow.json | 1 + .../models/block/treasure_t2.json | 1 + .../models/block/treasure_t3.json | 1 + .../models/block/walkway_nesw.json | 2 +- .../models/block/walkway_oxygen_neswd.json | 2 +- .../models/block/walkway_wire_neswd.json | 2 +- .../models/item/creeper_egg.json | 9 +- .../models/item/cryogenic_chamber.json | 5 +- .../galacticraftplanets/models/item/key.json | 4 +- .../models/item/key_t3.json | 4 +- .../models/item/mars_stairs_brick.json | 12 +- .../models/item/mars_stairs_cobblestone.json | 12 +- .../models/item/treasure_t2.json | 7 +- .../models/item/treasure_t3.json | 7 +- 80 files changed, 383 insertions(+), 434 deletions(-) diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/GalacticraftRegistry.java b/src/main/java/micdoodle8/mods/galacticraft/api/GalacticraftRegistry.java index 914dfd6f7e..320225c3d2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/GalacticraftRegistry.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/GalacticraftRegistry.java @@ -13,7 +13,6 @@ import net.minecraft.world.DimensionType; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldProviderSurface; -import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -210,7 +209,7 @@ public static List getDungeonLoot(int tier) public static DimensionType registerDimension(String name, String suffix, int id, Class provider, boolean keepLoaded) throws IllegalArgumentException { DimensionType type = DimensionType.register(name, suffix, id, provider, keepLoaded); - DimensionManager.registerDimension(id, type); +// DimensionManager.registerDimension(id, type); GalacticraftRegistry.dimensionTypeIDs.add(id); return type; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java index e7c3a1de6d..864ce03a86 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java @@ -17,6 +17,8 @@ import micdoodle8.mods.galacticraft.core.energy.EnergyConfigHandler; import micdoodle8.mods.galacticraft.core.energy.grid.ChunkPowerHandler; import micdoodle8.mods.galacticraft.core.entities.*; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsClientHandler; +import micdoodle8.mods.galacticraft.core.entities.player.CapabilityStatsHandler; import micdoodle8.mods.galacticraft.core.entities.player.GCPlayerHandler; import micdoodle8.mods.galacticraft.core.event.EventHandlerGC; import micdoodle8.mods.galacticraft.core.network.ConnectionEvents; @@ -101,6 +103,9 @@ public class GalacticraftCore @EventHandler public void preInit(FMLPreInitializationEvent event) { + CapabilityStatsHandler.register(); + CapabilityStatsClientHandler.register(); + this.initModInfo(event.getModMetadata()); isPlanetsLoaded = Loader.isModLoaded(Constants.MOD_ID_PLANETS); GCCoreUtil.nextID = 0; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java b/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java index ac8a4a7610..2e5a6e919a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java @@ -165,8 +165,10 @@ public static float getRainStrength(World world, float partialTicks) return world.prevRainingStrength + (world.rainingStrength - world.prevRainingStrength) * partialTicks; } - public static boolean otherModPreventGenerate(int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) + public static boolean otherModPreventGenerate(int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator) { + IChunkProvider chunkProvider = world.getChunkProvider(); + if (!(world.provider instanceof IGalacticraftWorldProvider)) { return false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java index db1083007a..0f61da2dd0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java @@ -183,7 +183,7 @@ public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos po @Override public void getSubBlocks(Item itemIn, CreativeTabs tabs, List list) { - for (int var4 = 3; var4 < 13; ++var4) + for (int var4 = 3; var4 < 12; ++var4) { list.add(new ItemStack(itemIn, 1, var4)); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java index caf7d837d6..8c553d23ef 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java @@ -3,8 +3,10 @@ import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraftforge.common.model.TRSRTransformation; import javax.vecmath.Matrix4f; +import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; public class ItemModelBuggy extends ModelTransformWrapper @@ -23,7 +25,11 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.setScale(0.175F); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(30, 225, 0)); + mul.setRotation(rot); + ret.mul(mul); + mul.setIdentity(); + mul.setScale(0.1085F); ret.mul(mul); mul.setIdentity(); mul.setTranslation(new Vector3f(0.2F, -0.3F, 0.0F)); @@ -31,9 +37,6 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) mul.setIdentity(); mul.rotY(-0.3F); ret.mul(mul); -// mul.setIdentity(); -// mul.rotX((float) (Math.PI / 4.0F)); -// ret.mul(mul); return ret; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java index e6594a9b1d..2a1aa7d055 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java @@ -27,13 +27,16 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.setScale(0.4F); + mul.setScale(0.25F); ret.mul(mul); mul.setIdentity(); - mul.setTranslation(new Vector3f(0.2F, -0.8F, 0.0F)); + mul.setTranslation(new Vector3f(-0.22F, -1.5F, 0.0F)); ret.mul(mul); mul.setIdentity(); - mul.rotY((float) (Math.PI / 2.0F)); + mul.rotX(0.5F); + ret.mul(mul); + mul.setIdentity(); + mul.rotY((float) ((Math.PI / 4.0F) - (Math.PI / 2.0F))); ret.mul(mul); return ret; } @@ -93,10 +96,10 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) mul.setScale(0.5F); ret.mul(mul); mul.setIdentity(); - mul.setTranslation(new Vector3f(0.15F, 0.45F, 0.15F)); + mul.setTranslation(new Vector3f(0.55F, -0.4F, 0.55F)); ret.mul(mul); mul.setIdentity(); - mul.rotX((float) -(Math.PI / 2.0F)); +// mul.rotX((float) (Math.PI / 2.0F)); ret.mul(mul); mul.setIdentity(); mul.setTranslation(new Vector3f(0.0F, 0.5F, 0.0F)); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java index ddbca6f692..1d2d7f2bee 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java @@ -4,8 +4,10 @@ import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraftforge.common.model.TRSRTransformation; import javax.vecmath.Matrix4f; +import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; public class ItemModelRocket extends ModelTransformWrapper @@ -20,15 +22,19 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) { if (cameraTransformType == TransformType.GUI) { - Vector3f trans = new Vector3f(-0.08F, 0.0F, -0.08F); + Vector3f trans = new Vector3f(-0.12F, 0.0F, -0.12F); Matrix4f ret = new Matrix4f(); ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.setScale(0.9F); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(30, 225, 0)); + mul.setRotation(rot); ret.mul(mul); mul.setIdentity(); - mul.setTranslation(new Vector3f(-0.25F, -0.3F, 0.0F)); + mul.setScale(0.57F); + ret.mul(mul); + mul.setIdentity(); + mul.setTranslation(new Vector3f(-0.5F, -0.6F, 0.0F)); ret.mul(mul); mul.setIdentity(); mul.rotY((float) (Math.PI / 2.0F)); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceRaceManager.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceRaceManager.java index 23d0175fa5..1e76f7674b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceRaceManager.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceRaceManager.java @@ -149,7 +149,7 @@ public static void sendSpaceRaceData(EntityPlayerMP toPlayer, SpaceRace spaceRac } else { - for (WorldServer server : toPlayer.worldObj.getMinecraftServer().worldServers) + for (WorldServer server : FMLCommonHandler.instance().getMinecraftServerInstance().worldServers) { GalacticraftCore.packetPipeline.sendToDimension(new PacketSimple(EnumSimplePacket.C_UPDATE_SPACE_RACE_DATA, server.provider.getDimension(), objList), server.provider.getDimension()); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemAxeGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemAxeGC.java index 125df735bc..3154420601 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemAxeGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemAxeGC.java @@ -1,23 +1,33 @@ package micdoodle8.mods.galacticraft.core.items; +import com.google.common.collect.Sets; import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemTool; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class ItemAxeGC extends ItemAxe implements ISortableItem +import java.util.Set; + +public class ItemAxeGC extends ItemTool implements ISortableItem { + private static final Set EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE}); + public ItemAxeGC(String assetName) { - super(GCItems.TOOL_STEEL); + super(GCItems.TOOL_STEEL, EFFECTIVE_ON); this.setUnlocalizedName(assetName); - //this.setTextureName(Constants.TEXTURE_PREFIX + assetName); + this.damageVsEntity = 6.0F; + this.attackSpeed = -3.0F; } @Override @@ -38,4 +48,11 @@ public EnumSortCategoryItem getCategory(int meta) { return EnumSortCategoryItem.TOOLS; } + + @Override + public float getStrVsBlock(ItemStack stack, IBlockState state) + { + Material material = state.getMaterial(); + return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial; + } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockBase.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockBase.java index c494c3023e..da0a8d5d8a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockBase.java @@ -33,7 +33,7 @@ public EnumRarity getRarity(ItemStack par1ItemStack) @Override public String getUnlocalizedName(ItemStack itemstack) { - String name = BlockBasic.EnumBlockBasic.values()[itemstack.getItemDamage() - 3].getName(); + String name = BlockBasic.EnumBlockBasic.values()[Math.min(Math.max(itemstack.getItemDamage() - 3, 0), 9)].getName(); return this.getBlock().getUnlocalizedName() + "." + name; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java index 214d727f85..b4ce461a46 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java @@ -83,6 +83,8 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import javax.vecmath.Quat4f; +import javax.vecmath.Vector3f; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -157,6 +159,8 @@ public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos return BlockFallenMeteor.colorMultiplier(worldIn, pos); } }, new Block[] { GCBlocks.fallenMeteor }); + + GCSounds.registerSounds(); } @Override @@ -348,7 +352,8 @@ public void onTextureStitchedPre(TextureStitchEvent.Pre event) @SideOnly(Side.CLIENT) public void onModelBakeEvent(ModelBakeEvent event) { - replaceModelDefault(event, "rocket_workbench", "block/workbench.obj", ImmutableList.of("Cube"), ItemModelWorkbench.class, new TRSRTransformation(new javax.vecmath.Vector3f(0.6F, 0.04F, 0.0F), new javax.vecmath.Quat4f(), new javax.vecmath.Vector3f(0.42F, 0.42F, 0.42F), new javax.vecmath.Quat4f())); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(30, 225, 0)); + replaceModelDefault(event, "rocket_workbench", "block/workbench.obj", ImmutableList.of("Cube"), ItemModelWorkbench.class, new TRSRTransformation(new javax.vecmath.Vector3f(0.7F, 0.1F, 0.0F), rot, new javax.vecmath.Vector3f(0.2604F, 0.2604F, 0.2604F), new javax.vecmath.Quat4f())); replaceModelDefault(event, "rocket_t1", "rocketT1.obj", ImmutableList.of("Rocket"), ItemModelRocket.class, TRSRTransformation.identity()); for (int i = 0; i < 4; ++i) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java index 59ebde2263..dfb5270322 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java @@ -1068,7 +1068,10 @@ public static void decodePlanetsListClient(List data) { for (Integer registeredID : WorldUtil.registeredPlanets) { - DimensionManager.unregisterDimension(registeredID); + if (DimensionManager.isDimensionRegistered(registeredID)) + { + DimensionManager.unregisterDimension(registeredID); + } } } WorldUtil.registeredPlanets = new ArrayList(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java index 4757f9636b..0bb3f4873c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java @@ -105,9 +105,9 @@ public void registerVariants() @SideOnly(Side.CLIENT) public void onModelBakeEvent(ModelBakeEvent event) { - replaceModelDefault(event, "beam_receiver", "receiver.obj", ImmutableList.of("Main", "Receiver", "Ring"), ItemModelBeamReceiver.class, new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F))); - replaceModelDefault(event, "beam_reflector", "reflector.obj", ImmutableList.of("Base", "Axle", "EnergyBlaster", "Ring"), ItemModelBeamReflector.class, new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F))); - replaceModelDefault(event, "telepad_short", "telepadShort.obj", ImmutableList.of("Top", "Bottom", "Connector"), ItemModelTelepad.class, new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(0.2F, 0.2F, 0.2F))); + replaceModelDefault(event, "beam_receiver", "receiver.obj", ImmutableList.of("Main", "Receiver", "Ring"), ItemModelBeamReceiver.class, new ItemTransformVec3f(new Vector3f(30, 225, 0), new Vector3f(-1.0F, 0.0F, 0.0F), new Vector3f(1.0F, 1.0F, 1.0F))); + replaceModelDefault(event, "beam_reflector", "reflector.obj", ImmutableList.of("Base", "Axle", "EnergyBlaster", "Ring"), ItemModelBeamReflector.class, new ItemTransformVec3f(new Vector3f(30, 225, 0), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F))); + replaceModelDefault(event, "telepad_short", "telepadShort.obj", ImmutableList.of("Top", "Bottom", "Connector"), ItemModelTelepad.class, TRSRTransformation.identity()); replaceModelDefault(event, "grapple", "grapple.obj", ImmutableList.of("Grapple"), ItemModelGrapple.class, TRSRTransformation.identity()); replaceModelDefault(event, "rocket_t3", "tier3rocket.obj", ImmutableList.of("Boosters", "Cube", "NoseCone", "Rocket"), ItemModelRocketT3.class, TRSRTransformation.identity()); replaceModelDefault(event, "astro_miner", "astroMinerInv.obj", ImmutableList.of("Hull_Center"), ItemModelAstroMiner.class, TRSRTransformation.identity()); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java index c99be15843..594cd1b9d1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java @@ -4,8 +4,10 @@ import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraftforge.common.model.TRSRTransformation; import javax.vecmath.Matrix4f; +import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; public class ItemModelAstroMiner extends ModelTransformWrapper @@ -20,15 +22,19 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) { if (cameraTransformType == TransformType.GUI) { - Vector3f trans = new Vector3f(-0.08F, 0.0F, -0.08F); + Vector3f trans = new Vector3f(-0.17F, 0.0F, -0.17F); Matrix4f ret = new Matrix4f(); ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.setScale(1.35F); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(30, 225, 0)); + mul.setRotation(rot); ret.mul(mul); mul.setIdentity(); - mul.setTranslation(new Vector3f(0.16F, 0.1F, 0.0F)); + mul.setScale(0.85F); + ret.mul(mul); + mul.setIdentity(); + mul.setTranslation(new Vector3f(0.36F, 0.3F, 0.0F)); ret.mul(mul); mul.setIdentity(); mul.setTranslation(trans); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReceiver.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReceiver.java index 14c4996913..ce8c1f2fca 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReceiver.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReceiver.java @@ -23,10 +23,10 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.setTranslation(new Vector3f(0.24F, -0.05F, 0.24F)); + mul.setTranslation(new Vector3f(0.44F, -0.05F, 0.24F)); ret.mul(mul); mul.setIdentity(); - mul.setScale(1.4F); + mul.setScale(1.0F); ret.mul(mul); return ret; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReflector.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReflector.java index 419f884acd..43e739d5d4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReflector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReflector.java @@ -23,7 +23,10 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.setTranslation(new Vector3f(0.24F, -0.05F, 0.24F)); + mul.setTranslation(new Vector3f(-0.42F, -0.05F, 0.24F)); + ret.mul(mul); + mul.setIdentity(); + mul.setScale(0.6F); ret.mul(mul); return ret; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java index 8f996d3d92..f246d26e61 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java @@ -4,8 +4,10 @@ import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraftforge.common.model.TRSRTransformation; import javax.vecmath.Matrix4f; +import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; public class ItemModelCargoRocket extends ModelTransformWrapper @@ -25,10 +27,14 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.setScale(0.7F); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(30, 225, 0)); + mul.setRotation(rot); ret.mul(mul); mul.setIdentity(); - mul.setTranslation(new Vector3f(-0.18F, -0.25F, 0.0F)); + mul.setScale(0.5F); + ret.mul(mul); + mul.setIdentity(); + mul.setTranslation(new Vector3f(-0.3F, -0.4F, 0.0F)); ret.mul(mul); mul.setIdentity(); mul.rotY((float) (Math.PI / 2.0F)); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java index 80a47863b1..6dbe3bdf05 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java @@ -3,8 +3,10 @@ import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraftforge.common.model.TRSRTransformation; import javax.vecmath.Matrix4f; +import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; public class ItemModelGrapple extends ModelTransformWrapper @@ -23,7 +25,11 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.setScale(1.0F); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(30, 225, 0)); + mul.setRotation(rot); + ret.mul(mul); + mul.setIdentity(); + mul.setScale(0.6F); ret.mul(mul); mul.setIdentity(); mul.setTranslation(new Vector3f(-0.2F, -0.1F, 0.0F)); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java index ebb3deefd4..e6d66e3e7c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java @@ -4,8 +4,10 @@ import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraftforge.common.model.TRSRTransformation; import javax.vecmath.Matrix4f; +import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; public class ItemModelRocketT3 extends ModelTransformWrapper @@ -20,15 +22,19 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) { if (cameraTransformType == TransformType.GUI) { - Vector3f trans = new Vector3f(-0.08F, 0.0F, -0.08F); + Vector3f trans = new Vector3f(-0.12F, 0.0F, -0.12F); Matrix4f ret = new Matrix4f(); ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.setScale(1.0F); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(30, 225, 0)); + mul.setRotation(rot); ret.mul(mul); mul.setIdentity(); - mul.setTranslation(new Vector3f(-0.125F, -0.2F, 0.0F)); + mul.setScale(0.61F); + ret.mul(mul); + mul.setIdentity(); + mul.setTranslation(new Vector3f(-0.25F, -0.35F, 0.0F)); ret.mul(mul); mul.setIdentity(); mul.rotY((float) (Math.PI / 2.0F)); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelTelepad.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelTelepad.java index d90e29e112..9a41db733d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelTelepad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelTelepad.java @@ -23,13 +23,16 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.setTranslation(new Vector3f(-0.14F, -0.36F, 0.24F)); + mul.setTranslation(new Vector3f(0.12F, -0.25F, 0.24F)); + ret.mul(mul); + mul.setIdentity(); + mul.rotX((float) Math.PI / 12.0F); ret.mul(mul); mul.setIdentity(); mul.rotY((float) Math.PI / 5.0F); ret.mul(mul); mul.setIdentity(); - mul.setScale(1.3F); + mul.setScale(0.17F); ret.mul(mul); return ret; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAxeAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAxeAsteroids.java index ff8898f361..78636d5d23 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAxeAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAxeAsteroids.java @@ -1,24 +1,34 @@ package micdoodle8.mods.galacticraft.planets.asteroids.items; +import com.google.common.collect.Sets; import micdoodle8.mods.galacticraft.core.GCItems; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.items.ISortableItem; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemTool; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class ItemAxeAsteroids extends ItemAxe implements ISortableItem +import java.util.Set; + +public class ItemAxeAsteroids extends ItemTool implements ISortableItem { + private static final Set EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE}); + public ItemAxeAsteroids(String assetName) { - super(GCItems.TOOL_STEEL); + super(GCItems.TOOL_STEEL, EFFECTIVE_ON); this.setUnlocalizedName(assetName); - //this.setTextureName(GalacticraftPlanets.TEXTURE_PREFIX + assetName); + this.damageVsEntity = 6.0F; + this.attackSpeed = -3.0F; } @Override @@ -39,4 +49,11 @@ public EnumSortCategoryItem getCategory(int meta) { return EnumSortCategoryItem.TOOLS; } + + @Override + public float getStrVsBlock(ItemStack stack, IBlockState state) + { + Material material = state.getMaterial(); + return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial; + } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java index 0c2936e577..bf64f6ac7e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java @@ -3,9 +3,11 @@ import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraftforge.common.model.TRSRTransformation; import org.lwjgl.Sys; import javax.vecmath.Matrix4f; +import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; public class ItemModelRocketT2 extends ModelTransformWrapper @@ -20,15 +22,19 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) { if (cameraTransformType == TransformType.GUI) { - Vector3f trans = new Vector3f(-0.08F, 0.0F, -0.08F); + Vector3f trans = new Vector3f(-0.12F, 0.0F, -0.12F); Matrix4f ret = new Matrix4f(); ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.setScale(0.82F); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(30, 225, 0)); + mul.setRotation(rot); ret.mul(mul); mul.setIdentity(); - mul.setTranslation(new Vector3f(-0.28F, -0.35F, 0.0F)); + mul.setScale(0.5F); + ret.mul(mul); + mul.setIdentity(); + mul.setTranslation(new Vector3f(-0.6F, -0.7F, 0.0F)); ret.mul(mul); mul.setIdentity(); mul.rotY((float) (Math.PI / 2.0F)); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemAxeMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemAxeMars.java index e16ed3d5e6..88b2dae624 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemAxeMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemAxeMars.java @@ -1,21 +1,32 @@ package micdoodle8.mods.galacticraft.planets.mars.items; +import com.google.common.collect.Sets; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.items.ISortableItem; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryItem; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; -import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemTool; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -public class ItemAxeMars extends ItemAxe implements ISortableItem +import java.util.Set; + +public class ItemAxeMars extends ItemTool implements ISortableItem { - public ItemAxeMars(ToolMaterial par2EnumToolMaterial) + private static final Set EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE}); + + public ItemAxeMars(ToolMaterial material) { - super(par2EnumToolMaterial); + super(material, EFFECTIVE_ON); + this.damageVsEntity = 6.0F; + this.attackSpeed = -3.0F; } @Override @@ -37,4 +48,11 @@ public EnumSortCategoryItem getCategory(int meta) { return EnumSortCategoryItem.TOOLS; } + + @Override + public float getStrVsBlock(ItemStack stack, IBlockState state) + { + Material material = state.getMaterial(); + return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE ? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial; + } } diff --git a/src/main/resources/assets/galacticraftcore/models/block/arclamp.json b/src/main/resources/assets/galacticraftcore/models/block/arclamp.json index 70812c7aec..7da12c3f19 100644 --- a/src/main/resources/assets/galacticraftcore/models/block/arclamp.json +++ b/src/main/resources/assets/galacticraftcore/models/block/arclamp.json @@ -1,7 +1,15 @@ { + "parent": "block/block", "textures": { "texture": "galacticraft:blocks/arc_lamp_on" }, + "display": { + "gui": { + "rotation": [ 30, 45, 0 ], + "translation": [ 0, 0, 0], + "scale":[ 0.625, 0.625, 0.625 ] + } + }, "elements": [ { "from": [ 2, 0, 2 ], diff --git a/src/main/resources/assets/galacticraftcore/models/block/buggy_pad_model.json b/src/main/resources/assets/galacticraftcore/models/block/buggy_pad_model.json index f8f69b0ef5..38910cd6ab 100644 --- a/src/main/resources/assets/galacticraftcore/models/block/buggy_pad_model.json +++ b/src/main/resources/assets/galacticraftcore/models/block/buggy_pad_model.json @@ -1,4 +1,5 @@ { + "parent": "block/block", "elements": [ { "from": [ 0, 0, 0 ], "to": [ 16, 3, 16 ], diff --git a/src/main/resources/assets/galacticraftcore/models/block/cheese_uneaten_model.json b/src/main/resources/assets/galacticraftcore/models/block/cheese_uneaten_model.json index 012040f35d..54709ac67d 100644 --- a/src/main/resources/assets/galacticraftcore/models/block/cheese_uneaten_model.json +++ b/src/main/resources/assets/galacticraftcore/models/block/cheese_uneaten_model.json @@ -1,4 +1,5 @@ { + "parent": "block/block", "textures": { "particle": "galacticraftcore:blocks/cheese_2", "bottom": "galacticraftcore:blocks/cheese_1", diff --git a/src/main/resources/assets/galacticraftcore/models/block/fallen_meteor_model.json b/src/main/resources/assets/galacticraftcore/models/block/fallen_meteor_model.json index 90e5db7b0b..faa821968b 100644 --- a/src/main/resources/assets/galacticraftcore/models/block/fallen_meteor_model.json +++ b/src/main/resources/assets/galacticraftcore/models/block/fallen_meteor_model.json @@ -1,5 +1,5 @@ { -"__comment": "Designed by Micdoodle8 with BDcraft Cubik PRO 0.96 Beta - http://bdcraft.net", +"parent": "block/block", "textures": { "particle": "galacticraftcore:blocks/fallen_meteor", "texture": "galacticraftcore:blocks/fallen_meteor" diff --git a/src/main/resources/assets/galacticraftcore/models/block/fluid_pipe.json b/src/main/resources/assets/galacticraftcore/models/block/fluid_pipe.json index 293a7f594d..bd31ecc4a3 100644 --- a/src/main/resources/assets/galacticraftcore/models/block/fluid_pipe.json +++ b/src/main/resources/assets/galacticraftcore/models/block/fluid_pipe.json @@ -1,22 +1,22 @@ { -"__comment": "Designed by - with BDcraft Cubik PRO 0.93 Beta - http://bdcraft.net", -"textures": { - "particle": "galacticraftcore:blocks/pipe_oxygen_white", - "pipeTex": "galacticraftcore:blocks/pipe_oxygen_white" -}, -"elements": [ -{ - "__comment": "Middle", - "from": [ 6.5, 6.5, 6.5 ], - "to": [ 9.5, 9.5, 9.5 ], - "faces": { - "down": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "up": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "north": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "south": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "west": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "east": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" } - } -} -] + "parent": "block/block", + "textures": { + "particle": "galacticraftcore:blocks/pipe_oxygen_white", + "pipeTex": "galacticraftcore:blocks/pipe_oxygen_white" + }, + "elements": [ + { + "__comment": "Middle", + "from": [ 6.5, 6.5, 6.5 ], + "to": [ 9.5, 9.5, 9.5 ], + "faces": { + "down": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "up": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "north": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "south": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "west": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "east": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" } + } + } + ] } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/fluid_pipe_neswud.json b/src/main/resources/assets/galacticraftcore/models/block/fluid_pipe_neswud.json index 48ef0475af..1e93658cef 100644 --- a/src/main/resources/assets/galacticraftcore/models/block/fluid_pipe_neswud.json +++ b/src/main/resources/assets/galacticraftcore/models/block/fluid_pipe_neswud.json @@ -1,100 +1,101 @@ { -"textures": { - "particle": "galacticraftcore:blocks/pipe_oxygen_white", - "pipeTex": "galacticraftcore:blocks/pipe_oxygen_white", - "pull_texture": "galacticraftcore:blocks/pipe_pull" -}, -"elements": [ -{ - "__comment": "Middle", - "from": [ 6.5, 6.5, 6.5 ], - "to": [ 9.5, 9.5, 9.5 ], - "faces": { - "down": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "up": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "north": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "south": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "west": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "east": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" } - } -}, -{ - "__comment": "North", - "from": [ 6.5, 6.4375, 0 ], - "to": [ 9.5, 9.4375, 6.5 ], - "faces": { - "down": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, - "up": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, - "north": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "south": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "west": { "uv": [ 6, 0, 10, 6 ], "rotation": 90, "texture": "#pipeTex" }, - "east": { "uv": [ 6, 0, 10, 6 ], "rotation": 90, "texture": "#pipeTex" } - } -}, -{ - "__comment": "East", - "from": [ 9.5, 6.5, 6.5 ], - "to": [ 16, 9.5, 9.5 ], - "faces": { - "down": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, - "up": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, - "north": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, - "south": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, - "west": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "east": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" } - } -}, -{ - "__comment": "South", - "from": [ 6.5, 6.5, 9.5 ], - "to": [ 9.5, 9.5, 16 ], - "faces": { - "down": { "uv": [ 6, 10, 10, 16 ], "texture": "#pipeTex" }, - "up": { "uv": [ 6, 10, 10, 16 ], "texture": "#pipeTex" }, - "north": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "south": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "west": { "uv": [ 6, 10, 10, 16 ], "rotation": 90, "texture": "#pipeTex" }, - "east": { "uv": [ 6, 10, 10, 16 ], "rotation": 90, "texture": "#pipeTex" } - } -}, -{ - "__comment": "West", - "from": [ 0, 6.5, 6.5 ], - "to": [ 6.5, 9.5, 9.5 ], - "faces": { - "down": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, - "up": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, - "north": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, - "south": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, - "west": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "east": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" } - } -}, -{ - "__comment": "Up", - "from": [ 6.5, 9.5, 6.5 ], - "to": [ 9.5, 16, 9.5 ], - "faces": { - "down": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "up": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "north": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, - "south": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, - "west": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, - "east": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" } - } -}, -{ - "__comment": "Down", - "from": [ 6.5, 0.0625, 6.5 ], - "to": [ 9.5, 6.5625, 9.5 ], - "faces": { - "down": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "up": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, - "north": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, - "south": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, - "west": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, - "east": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" } - } -} -] + "parent": "block/block", + "textures": { + "particle": "galacticraftcore:blocks/pipe_oxygen_white", + "pipeTex": "galacticraftcore:blocks/pipe_oxygen_white", + "pull_texture": "galacticraftcore:blocks/pipe_pull" + }, + "elements": [ + { + "__comment": "Middle", + "from": [ 6.5, 6.5, 6.5 ], + "to": [ 9.5, 9.5, 9.5 ], + "faces": { + "down": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "up": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "north": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "south": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "west": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "east": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" } + } + }, + { + "__comment": "North", + "from": [ 6.5, 6.4375, 0 ], + "to": [ 9.5, 9.4375, 6.5 ], + "faces": { + "down": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, + "up": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, + "north": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "south": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "west": { "uv": [ 6, 0, 10, 6 ], "rotation": 90, "texture": "#pipeTex" }, + "east": { "uv": [ 6, 0, 10, 6 ], "rotation": 90, "texture": "#pipeTex" } + } + }, + { + "__comment": "East", + "from": [ 9.5, 6.5, 6.5 ], + "to": [ 16, 9.5, 9.5 ], + "faces": { + "down": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, + "up": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, + "north": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, + "south": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, + "west": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "east": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" } + } + }, + { + "__comment": "South", + "from": [ 6.5, 6.5, 9.5 ], + "to": [ 9.5, 9.5, 16 ], + "faces": { + "down": { "uv": [ 6, 10, 10, 16 ], "texture": "#pipeTex" }, + "up": { "uv": [ 6, 10, 10, 16 ], "texture": "#pipeTex" }, + "north": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "south": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "west": { "uv": [ 6, 10, 10, 16 ], "rotation": 90, "texture": "#pipeTex" }, + "east": { "uv": [ 6, 10, 10, 16 ], "rotation": 90, "texture": "#pipeTex" } + } + }, + { + "__comment": "West", + "from": [ 0, 6.5, 6.5 ], + "to": [ 6.5, 9.5, 9.5 ], + "faces": { + "down": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, + "up": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, + "north": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, + "south": { "uv": [ 0, 6, 6, 10 ], "texture": "#pipeTex" }, + "west": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "east": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" } + } + }, + { + "__comment": "Up", + "from": [ 6.5, 9.5, 6.5 ], + "to": [ 9.5, 16, 9.5 ], + "faces": { + "down": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "up": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "north": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, + "south": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, + "west": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, + "east": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" } + } + }, + { + "__comment": "Down", + "from": [ 6.5, 0.0625, 6.5 ], + "to": [ 9.5, 6.5625, 9.5 ], + "faces": { + "down": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "up": { "uv": [ 6, 6, 10, 10 ], "texture": "#pipeTex" }, + "north": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, + "south": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, + "west": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" }, + "east": { "uv": [ 6, 0, 10, 6 ], "texture": "#pipeTex" } + } + } + ] } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_inventory.json b/src/main/resources/assets/galacticraftcore/models/block/gc_wall_inventory.json index d04b1bd212..ecb7f8037b 100644 --- a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_inventory.json +++ b/src/main/resources/assets/galacticraftcore/models/block/gc_wall_inventory.json @@ -1,5 +1,18 @@ { + "parent": "block/block", "ambientocclusion": false, + "display": { + "gui": { + "rotation": [ 30, 135, 0 ], + "translation": [ 0, 0, 0], + "scale":[ 0.625, 0.625, 0.625 ] + }, + "fixed": { + "rotation": [ 0, 90, 0 ], + "translation": [ 0, 0, 0 ], + "scale": [ 0.5, 0.5, 0.5 ] + } + }, "textures": { "particle": "#wall" }, diff --git a/src/main/resources/assets/galacticraftcore/models/block/landing_pad_model.json b/src/main/resources/assets/galacticraftcore/models/block/landing_pad_model.json index a1293018c9..5c6c6f6053 100644 --- a/src/main/resources/assets/galacticraftcore/models/block/landing_pad_model.json +++ b/src/main/resources/assets/galacticraftcore/models/block/landing_pad_model.json @@ -1,4 +1,5 @@ { + "parent": "block/block", "elements": [ { "from": [ 0, 0, 0 ], "to": [ 16, 3, 16 ], diff --git a/src/main/resources/assets/galacticraftcore/models/block/moon_turf_model.json b/src/main/resources/assets/galacticraftcore/models/block/moon_turf_model.json index 43142aba2e..0bac4e510a 100644 --- a/src/main/resources/assets/galacticraftcore/models/block/moon_turf_model.json +++ b/src/main/resources/assets/galacticraftcore/models/block/moon_turf_model.json @@ -1,4 +1,5 @@ { + "parent": "block/block", "elements": [ { "from": [ 0, 0, 0 ], "to": [ 16, 16, 16 ], diff --git a/src/main/resources/assets/galacticraftcore/models/block/parachest.json b/src/main/resources/assets/galacticraftcore/models/block/parachest.json index 03f4136838..08a47c0138 100644 --- a/src/main/resources/assets/galacticraftcore/models/block/parachest.json +++ b/src/main/resources/assets/galacticraftcore/models/block/parachest.json @@ -1,9 +1,17 @@ { +"parent": "block/block", "textures": { "particle": "galacticraftcore:blocks/parachest", "texture": "galacticraftcore:blocks/parachest", "chute": "galacticraftcore:model/parachute/red" }, +"display": { + "gui": { + "rotation": [ 30, 45, 0 ], + "translation": [ 0, 0, 0], + "scale":[ 0.625, 0.625, 0.625 ] + } +}, "elements": [ { "from": [ 1, 0, 1 ], diff --git a/src/main/resources/assets/galacticraftcore/models/block/screen.json b/src/main/resources/assets/galacticraftcore/models/block/screen.json index 9d8e73d671..c9b32bb286 100644 --- a/src/main/resources/assets/galacticraftcore/models/block/screen.json +++ b/src/main/resources/assets/galacticraftcore/models/block/screen.json @@ -1,5 +1,5 @@ { -"__comment": "Designed by Micdoodle8 with BDcraft Cubik PRO 0.96 Beta - http://bdcraft.net", +"parent": "block/block", "textures": { "texture": "galacticraftcore:blocks/screenSide" }, diff --git a/src/main/resources/assets/galacticraftcore/models/block/spin_thruster_model.json b/src/main/resources/assets/galacticraftcore/models/block/spin_thruster_model.json index 6024ad5e6b..bd99780cd9 100644 --- a/src/main/resources/assets/galacticraftcore/models/block/spin_thruster_model.json +++ b/src/main/resources/assets/galacticraftcore/models/block/spin_thruster_model.json @@ -1,7 +1,15 @@ { +"parent": "block/block", "textures": { "texture": "galacticraftcore:blocks/thruster" }, +"display": { + "gui": { + "rotation": [ 30, 315, 0 ], + "translation": [ -2.0, -1.0, 0.0 ], + "scale": [ 0.7, 0.7, 0.7 ] + } +}, "elements": [ { "from": [ 1, 1, 0 ], diff --git a/src/main/resources/assets/galacticraftcore/models/block/tank.json b/src/main/resources/assets/galacticraftcore/models/block/tank.json index e4ef27c97c..36865ce80f 100644 --- a/src/main/resources/assets/galacticraftcore/models/block/tank.json +++ b/src/main/resources/assets/galacticraftcore/models/block/tank.json @@ -1,4 +1,5 @@ { +"parent": "block/block", "textures": { "tank": "galacticraftcore:blocks/tank", "tank_top": "galacticraftcore:blocks/tank_top", diff --git a/src/main/resources/assets/galacticraftcore/models/block/tank_ud.json b/src/main/resources/assets/galacticraftcore/models/block/tank_ud.json index 7f7330cc56..73686b8601 100644 --- a/src/main/resources/assets/galacticraftcore/models/block/tank_ud.json +++ b/src/main/resources/assets/galacticraftcore/models/block/tank_ud.json @@ -1,4 +1,5 @@ { +"parent": "block/block", "textures": { "tank": "galacticraftcore:blocks/tank", "tank_top": "galacticraftcore:blocks/tank_top", diff --git a/src/main/resources/assets/galacticraftcore/models/block/treasure_chest.json b/src/main/resources/assets/galacticraftcore/models/block/treasure_chest.json index 3de50bcecc..b5c35f0ead 100644 --- a/src/main/resources/assets/galacticraftcore/models/block/treasure_chest.json +++ b/src/main/resources/assets/galacticraftcore/models/block/treasure_chest.json @@ -1,5 +1,5 @@ { -"__comment": "Designed by Micdoodle8 with BDcraft Cubik PRO 0.96 Beta - http://bdcraft.net", +"parent": "block/block", "textures": { "particle": "galacticraftcore:blocks/parachest", "texture": "galacticraftcore:model/treasure" diff --git a/src/main/resources/assets/galacticraftcore/models/item/arclamp.json b/src/main/resources/assets/galacticraftcore/models/item/arclamp.json index 094cea1104..a689eb6fcf 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/arclamp.json +++ b/src/main/resources/assets/galacticraftcore/models/item/arclamp.json @@ -5,9 +5,6 @@ "rotation": [ 10, -45, 170 ], "translation": [ 0, 1.5, -2.75 ], "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } + } } } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/key.json b/src/main/resources/assets/galacticraftcore/models/item/key.json index d09e361c5e..4f60f1718c 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/key.json +++ b/src/main/resources/assets/galacticraftcore/models/item/key.json @@ -76,9 +76,9 @@ "scale": [ 1.5, 1.5, 1.5 ] }, "gui": { - "rotation": [ 0, 180, 0 ], + "rotation": [ 30, 225, 0 ], "translation": [ 0, 1, 0 ], - "scale": [ 1.5, 1.5, 1.5 ] + "scale": [ 1.1, 1.1, 1.1 ] } } } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/landing_pad.json b/src/main/resources/assets/galacticraftcore/models/item/landing_pad.json index 836b3e32ca..948d0d74e9 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/landing_pad.json +++ b/src/main/resources/assets/galacticraftcore/models/item/landing_pad.json @@ -1,10 +1,3 @@ { - "parent":"galacticraftcore:block/landing_pad_model", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } + "parent":"galacticraftcore:block/landing_pad_model" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/meteor_chunk.json b/src/main/resources/assets/galacticraftcore/models/item/meteor_chunk.json index 0ef2330a03..d36e5a6d62 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/meteor_chunk.json +++ b/src/main/resources/assets/galacticraftcore/models/item/meteor_chunk.json @@ -89,7 +89,7 @@ "scale": [ 1.00, 1.00, 1.00 ] }, "gui": { - "rotation": [ 0, 100, 0 ], + "rotation": [ 30, 325, 0 ], "translation": [ 0.00, 0.00, 0.00 ], "scale": [ 1.16, 1.16, 1.16 ] }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/meteor_chunk_hot.json b/src/main/resources/assets/galacticraftcore/models/item/meteor_chunk_hot.json index fb5358ebfc..b9efa56404 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/meteor_chunk_hot.json +++ b/src/main/resources/assets/galacticraftcore/models/item/meteor_chunk_hot.json @@ -89,7 +89,7 @@ "scale": [ 1.00, 1.00, 1.00 ] }, "gui": { - "rotation": [ 0, 100, 0 ], + "rotation": [ 30, 325, 0 ], "translation": [ 0.00, 0.00, 0.00 ], "scale": [ 1.16, 1.16, 1.16 ] }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/moon_stairs_brick.json b/src/main/resources/assets/galacticraftcore/models/item/moon_stairs_brick.json index ca4e74fa86..9f96a06083 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/moon_stairs_brick.json +++ b/src/main/resources/assets/galacticraftcore/models/item/moon_stairs_brick.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/moon_brick_stairs", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/moon_brick_stairs" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/moon_stairs_stone.json b/src/main/resources/assets/galacticraftcore/models/item/moon_stairs_stone.json index c304db9261..461efd9034 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/moon_stairs_stone.json +++ b/src/main/resources/assets/galacticraftcore/models/item/moon_stairs_stone.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/moon_stone_stairs", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/moon_stone_stairs" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachest.json b/src/main/resources/assets/galacticraftcore/models/item/parachest.json index 123f116c98..f1e950b7dd 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachest.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachest.json @@ -5,9 +5,6 @@ "rotation": [ 10, 45, 170 ], "translation": [ 0, 1.5, -2.75 ], "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } + } } } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/slab_mars_cobblestone.json b/src/main/resources/assets/galacticraftcore/models/item/slab_mars_cobblestone.json index 6eec03a56d..e90acb8ffd 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/slab_mars_cobblestone.json +++ b/src/main/resources/assets/galacticraftcore/models/item/slab_mars_cobblestone.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/half_slab_mars_cobblestone", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/half_slab_mars_cobblestone" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/slab_mars_dungeon_brick.json b/src/main/resources/assets/galacticraftcore/models/item/slab_mars_dungeon_brick.json index 7935b42849..fa158c420f 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/slab_mars_dungeon_brick.json +++ b/src/main/resources/assets/galacticraftcore/models/item/slab_mars_dungeon_brick.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/half_slab_mars_dungeon_brick", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/half_slab_mars_dungeon_brick" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/slab_moon_dungeon_brick.json b/src/main/resources/assets/galacticraftcore/models/item/slab_moon_dungeon_brick.json index 64638c754a..9cef9b4767 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/slab_moon_dungeon_brick.json +++ b/src/main/resources/assets/galacticraftcore/models/item/slab_moon_dungeon_brick.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/half_slab_moon_dungeon_brick", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/half_slab_moon_dungeon_brick" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/slab_moon_stone.json b/src/main/resources/assets/galacticraftcore/models/item/slab_moon_stone.json index 6a867242c7..8fc2c4a24f 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/slab_moon_stone.json +++ b/src/main/resources/assets/galacticraftcore/models/item/slab_moon_stone.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/half_slab_moon_stone", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/half_slab_moon_stone" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/slab_tin_1.json b/src/main/resources/assets/galacticraftcore/models/item/slab_tin_1.json index f1848d44e6..322e642194 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/slab_tin_1.json +++ b/src/main/resources/assets/galacticraftcore/models/item/slab_tin_1.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/half_slab_tin_1", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/half_slab_tin_1" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/slab_tin_2.json b/src/main/resources/assets/galacticraftcore/models/item/slab_tin_2.json index befc4536af..fe671a5180 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/slab_tin_2.json +++ b/src/main/resources/assets/galacticraftcore/models/item/slab_tin_2.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/half_slab_tin_2", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/half_slab_tin_2" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/spin_thruster.json b/src/main/resources/assets/galacticraftcore/models/item/spin_thruster.json index 3d0019a774..80fcfae541 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/spin_thruster.json +++ b/src/main/resources/assets/galacticraftcore/models/item/spin_thruster.json @@ -5,11 +5,6 @@ "rotation": [ 10, -45, 170 ], "translation": [ 0, 1.5, -2.75 ], "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 90, 0 ], - "translation": [ 3.0, 0.0, -1.0 ], - "scale": [ 1.2, 1.2, 1.2 ] - } + } } } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/tin_stairs_1.json b/src/main/resources/assets/galacticraftcore/models/item/tin_stairs_1.json index 05eeb7706e..86166d620f 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/tin_stairs_1.json +++ b/src/main/resources/assets/galacticraftcore/models/item/tin_stairs_1.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/tin_1_stairs", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/tin_1_stairs" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/tin_stairs_2.json b/src/main/resources/assets/galacticraftcore/models/item/tin_stairs_2.json index 4735b3399a..d67b08c875 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/tin_stairs_2.json +++ b/src/main/resources/assets/galacticraftcore/models/item/tin_stairs_2.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/tin_2_stairs", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/tin_2_stairs" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/treasure_chest.json b/src/main/resources/assets/galacticraftcore/models/item/treasure_chest.json index 9aa5225f65..dc90388b58 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/treasure_chest.json +++ b/src/main/resources/assets/galacticraftcore/models/item/treasure_chest.json @@ -1,8 +1,3 @@ { - "parent":"galacticraftcore:block/treasure_chest", - "display": { - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/treasure_chest" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/wall_mars_cobblestone.json b/src/main/resources/assets/galacticraftcore/models/item/wall_mars_cobblestone.json index 11b466c2a3..db81d342ba 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/wall_mars_cobblestone.json +++ b/src/main/resources/assets/galacticraftcore/models/item/wall_mars_cobblestone.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/mars_cobblestone_wall_inventory", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/mars_cobblestone_wall_inventory" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/wall_mars_dungeon_brick.json b/src/main/resources/assets/galacticraftcore/models/item/wall_mars_dungeon_brick.json index f12011df91..2c4ac75544 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/wall_mars_dungeon_brick.json +++ b/src/main/resources/assets/galacticraftcore/models/item/wall_mars_dungeon_brick.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/mars_dungeon_brick_wall_inventory", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/mars_dungeon_brick_wall_inventory" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/wall_moon_dungeon_brick.json b/src/main/resources/assets/galacticraftcore/models/item/wall_moon_dungeon_brick.json index c6b032a73e..f4f9177ff7 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/wall_moon_dungeon_brick.json +++ b/src/main/resources/assets/galacticraftcore/models/item/wall_moon_dungeon_brick.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/moon_dungeon_brick_wall_inventory", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/moon_dungeon_brick_wall_inventory" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/wall_moon_stone.json b/src/main/resources/assets/galacticraftcore/models/item/wall_moon_stone.json index a90137ac18..315c340a25 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/wall_moon_stone.json +++ b/src/main/resources/assets/galacticraftcore/models/item/wall_moon_stone.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/moon_stone_wall_inventory", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/moon_stone_wall_inventory" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/wall_tin_1.json b/src/main/resources/assets/galacticraftcore/models/item/wall_tin_1.json index 6fe77acfd9..74c291beba 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/wall_tin_1.json +++ b/src/main/resources/assets/galacticraftcore/models/item/wall_tin_1.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/tin_1_wall_inventory", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/tin_1_wall_inventory" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/item/wall_tin_2.json b/src/main/resources/assets/galacticraftcore/models/item/wall_tin_2.json index 49a3ec3505..97d561b036 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/wall_tin_2.json +++ b/src/main/resources/assets/galacticraftcore/models/item/wall_tin_2.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftcore:block/tin_2_wall_inventory", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftcore:block/tin_2_wall_inventory" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftplanets/models/block/creeper_egg.json b/src/main/resources/assets/galacticraftplanets/models/block/creeper_egg.json index 10b08214de..672711b94b 100644 --- a/src/main/resources/assets/galacticraftplanets/models/block/creeper_egg.json +++ b/src/main/resources/assets/galacticraftplanets/models/block/creeper_egg.json @@ -1,4 +1,5 @@ { + "parent": "block/block", "ambientocclusion": false, "textures": { "particle": "galacticraftplanets:blocks/creeperEgg", diff --git a/src/main/resources/assets/galacticraftplanets/models/block/cryo_0.json b/src/main/resources/assets/galacticraftplanets/models/block/cryo_0.json index 8cfac3d541..00f637f257 100644 --- a/src/main/resources/assets/galacticraftplanets/models/block/cryo_0.json +++ b/src/main/resources/assets/galacticraftplanets/models/block/cryo_0.json @@ -1,9 +1,17 @@ { +"parent": "block/block", "textures": { "texture": "galacticraftcore:blocks/cryo_0", "particle": "galacticraftcore:blocks/cryo_0", "cryo_1": "galacticraftcore:blocks/cryo_1" }, +"display": { + "gui": { + "rotation": [ 30, 45, 0 ], + "translation": [ 0, 0, 0], + "scale":[ 0.625, 0.625, 0.625 ] + } +}, "elements": [ { "from": [ 0, 0, 0 ], diff --git a/src/main/resources/assets/galacticraftplanets/models/block/slimeling_egg_blue.json b/src/main/resources/assets/galacticraftplanets/models/block/slimeling_egg_blue.json index e15a5e1811..acdc79b2df 100644 --- a/src/main/resources/assets/galacticraftplanets/models/block/slimeling_egg_blue.json +++ b/src/main/resources/assets/galacticraftplanets/models/block/slimeling_egg_blue.json @@ -1,4 +1,5 @@ { +"parent": "block/block", "textures": { "particle": "galacticraftplanets:blocks/blueEgg_0", "texture": "galacticraftplanets:blocks/blueEgg_0" diff --git a/src/main/resources/assets/galacticraftplanets/models/block/slimeling_egg_red.json b/src/main/resources/assets/galacticraftplanets/models/block/slimeling_egg_red.json index b2bb6f1290..9b6d7f12ba 100644 --- a/src/main/resources/assets/galacticraftplanets/models/block/slimeling_egg_red.json +++ b/src/main/resources/assets/galacticraftplanets/models/block/slimeling_egg_red.json @@ -1,4 +1,5 @@ { +"parent": "block/block", "textures": { "particle": "galacticraftplanets:blocks/redEgg_0", "texture": "galacticraftplanets:blocks/redEgg_0" diff --git a/src/main/resources/assets/galacticraftplanets/models/block/slimeling_egg_yellow.json b/src/main/resources/assets/galacticraftplanets/models/block/slimeling_egg_yellow.json index fae66dc229..c8cdff8686 100644 --- a/src/main/resources/assets/galacticraftplanets/models/block/slimeling_egg_yellow.json +++ b/src/main/resources/assets/galacticraftplanets/models/block/slimeling_egg_yellow.json @@ -1,4 +1,5 @@ { +"parent": "block/block", "textures": { "particle": "galacticraftplanets:blocks/yellowEgg_0", "texture": "galacticraftplanets:blocks/yellowEgg_0" diff --git a/src/main/resources/assets/galacticraftplanets/models/block/treasure_t2.json b/src/main/resources/assets/galacticraftplanets/models/block/treasure_t2.json index 23ec86b89d..ff3841f7ca 100644 --- a/src/main/resources/assets/galacticraftplanets/models/block/treasure_t2.json +++ b/src/main/resources/assets/galacticraftplanets/models/block/treasure_t2.json @@ -1,4 +1,5 @@ { +"parent": "block/block", "textures": { "particle": "galacticraftplanets:blocks/treasure", "texture": "galacticraftplanets:model/treasure" diff --git a/src/main/resources/assets/galacticraftplanets/models/block/treasure_t3.json b/src/main/resources/assets/galacticraftplanets/models/block/treasure_t3.json index 22c425eb83..3847d03c1a 100644 --- a/src/main/resources/assets/galacticraftplanets/models/block/treasure_t3.json +++ b/src/main/resources/assets/galacticraftplanets/models/block/treasure_t3.json @@ -1,4 +1,5 @@ { +"parent": "block/block", "textures": { "particle": "galacticraftplanets:blocks/treasure_venus", "texture": "galacticraftplanets:model/treasure_venus" diff --git a/src/main/resources/assets/galacticraftplanets/models/block/walkway_nesw.json b/src/main/resources/assets/galacticraftplanets/models/block/walkway_nesw.json index 95b21ce85d..eefc4d95ff 100644 --- a/src/main/resources/assets/galacticraftplanets/models/block/walkway_nesw.json +++ b/src/main/resources/assets/galacticraftplanets/models/block/walkway_nesw.json @@ -1,5 +1,5 @@ { -"__comment": "Designed by Micdoodle8 with BDcraft Cubik PRO 0.96 Beta - http://bdcraft.net", +"parent": "block/block", "textures": { "particle": "galacticraftplanets:blocks/walkway", "texture": "galacticraftplanets:blocks/walkway" diff --git a/src/main/resources/assets/galacticraftplanets/models/block/walkway_oxygen_neswd.json b/src/main/resources/assets/galacticraftplanets/models/block/walkway_oxygen_neswd.json index 25297c209b..8b9d993497 100644 --- a/src/main/resources/assets/galacticraftplanets/models/block/walkway_oxygen_neswd.json +++ b/src/main/resources/assets/galacticraftplanets/models/block/walkway_oxygen_neswd.json @@ -1,5 +1,5 @@ { -"__comment": "Designed by Micdoodle8 with BDcraft Cubik PRO 0.96 Beta - http://bdcraft.net", +"parent": "block/block", "textures": { "particle": "galacticraftplanets:blocks/walkway", "texture": "galacticraftplanets:blocks/walkway", diff --git a/src/main/resources/assets/galacticraftplanets/models/block/walkway_wire_neswd.json b/src/main/resources/assets/galacticraftplanets/models/block/walkway_wire_neswd.json index d577f92114..9eaf1f025d 100644 --- a/src/main/resources/assets/galacticraftplanets/models/block/walkway_wire_neswd.json +++ b/src/main/resources/assets/galacticraftplanets/models/block/walkway_wire_neswd.json @@ -1,5 +1,5 @@ { -"__comment": "Designed by Micdoodle8 with BDcraft Cubik PRO 0.96 Beta - http://bdcraft.net", +"parent": "block/block", "textures": { "particle": "galacticraftplanets:blocks/walkway", "texture": "galacticraftplanets:blocks/walkway", diff --git a/src/main/resources/assets/galacticraftplanets/models/item/creeper_egg.json b/src/main/resources/assets/galacticraftplanets/models/item/creeper_egg.json index 1dcf030acf..6490bc375e 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/creeper_egg.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/creeper_egg.json @@ -1,10 +1,3 @@ { - "parent":"galacticraftplanets:block/creeper_egg", - "display": { - "thirdperson": { - "rotation": [ 10, -45, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - } - } + "parent":"galacticraftplanets:block/creeper_egg" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftplanets/models/item/cryogenic_chamber.json b/src/main/resources/assets/galacticraftplanets/models/item/cryogenic_chamber.json index b7a7e9016e..260e85b54a 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/cryogenic_chamber.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/cryogenic_chamber.json @@ -5,9 +5,6 @@ "rotation": [ 10, -45, 170 ], "translation": [ 0, 1.5, -2.75 ], "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } + } } } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftplanets/models/item/key.json b/src/main/resources/assets/galacticraftplanets/models/item/key.json index 0552a2fec8..000bc59672 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/key.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/key.json @@ -76,9 +76,9 @@ "scale": [ 1.5, 1.5, 1.5 ] }, "gui": { - "rotation": [ 0, 180, 0 ], + "rotation": [ 30, 225, 0 ], "translation": [ 0, 1, 0 ], - "scale": [ 1.5, 1.5, 1.5 ] + "scale": [ 1.1, 1.1, 1.1 ] } } } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftplanets/models/item/key_t3.json b/src/main/resources/assets/galacticraftplanets/models/item/key_t3.json index d6041a959d..c832778d2f 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/key_t3.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/key_t3.json @@ -76,9 +76,9 @@ "scale": [ 1.5, 1.5, 1.5 ] }, "gui": { - "rotation": [ 0, 180, 0 ], + "rotation": [ 30, 225, 0 ], "translation": [ 0, 1, 0 ], - "scale": [ 1.5, 1.5, 1.5 ] + "scale": [ 1.1, 1.1, 1.1 ] }, "ground": { "scale": [ 4.5, 4.5, 4.5 ] diff --git a/src/main/resources/assets/galacticraftplanets/models/item/mars_stairs_brick.json b/src/main/resources/assets/galacticraftplanets/models/item/mars_stairs_brick.json index 1473829d71..e1db231800 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/mars_stairs_brick.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/mars_stairs_brick.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftplanets:block/mars_brick_stairs", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftplanets:block/mars_brick_stairs" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftplanets/models/item/mars_stairs_cobblestone.json b/src/main/resources/assets/galacticraftplanets/models/item/mars_stairs_cobblestone.json index 771da5bd46..658df0bc41 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/mars_stairs_cobblestone.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/mars_stairs_cobblestone.json @@ -1,13 +1,3 @@ { - "parent":"galacticraftplanets:block/mars_cobblestone_stairs", - "display": { - "thirdperson": { - "rotation": [ 10, 135, 170 ], - "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] - }, - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftplanets:block/mars_cobblestone_stairs" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftplanets/models/item/treasure_t2.json b/src/main/resources/assets/galacticraftplanets/models/item/treasure_t2.json index 619d0ba51f..8f8ab77474 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/treasure_t2.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/treasure_t2.json @@ -1,8 +1,3 @@ { - "parent":"galacticraftplanets:block/treasure_t2", - "display": { - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftplanets:block/treasure_t2" } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftplanets/models/item/treasure_t3.json b/src/main/resources/assets/galacticraftplanets/models/item/treasure_t3.json index 9bccf88235..fe493f8009 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/treasure_t3.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/treasure_t3.json @@ -1,8 +1,3 @@ { - "parent":"galacticraftplanets:block/treasure_t3", - "display": { - "gui": { - "rotation": [ 0, 180, 0 ] - } - } + "parent":"galacticraftplanets:block/treasure_t3" } \ No newline at end of file From fc8c60e90079b37e370d543bc6a4c123567b493a Mon Sep 17 00:00:00 2001 From: Mitch Date: Wed, 15 Mar 2017 01:52:13 -0400 Subject: [PATCH 007/535] Re-add all custom AABBs, other small fixes. --- .../mods/galacticraft/core/GCBlocks.java | 2 +- .../core/blocks/BlockAdvanced.java | 18 +- .../core/blocks/BlockAluminumWire.java | 206 ++++++++++++++++-- .../core/blocks/BlockBrightLamp.java | 22 ++ .../galacticraft/core/blocks/BlockCheese.java | 16 ++ .../core/blocks/BlockFallenMeteor.java | 10 +- .../core/blocks/BlockFluidPipe.java | 130 +++++++++-- .../core/blocks/BlockFluidTank.java | 6 + .../core/blocks/BlockGlowstoneTorch.java | 29 ++- .../core/blocks/BlockLandingPad.java | 10 +- .../galacticraft/core/blocks/BlockMulti.java | 21 ++ .../core/blocks/BlockParaChest.java | 7 + .../core/blocks/BlockSpinThruster.java | 28 ++- ...hest.java => BlockTier1TreasureChest.java} | 11 +- .../core/blocks/BlockTransmitter.java | 4 - .../core/event/EventHandlerGC.java | 45 +++- .../core/items/ItemUniversalWrench.java | 8 +- .../core/network/PacketDynamic.java | 2 +- .../galacticraft/core/util/OxygenUtil.java | 5 + .../core/world/gen/dungeon/RoomChest.java | 4 +- .../core/world/gen/dungeon/RoomTreasure.java | 4 +- .../asteroids/blocks/BlockBeamReceiver.java | 28 +++ .../asteroids/blocks/BlockBeamReflector.java | 10 + .../blocks/BlockShortRangeTelepad.java | 10 + .../asteroids/blocks/BlockTelepadFake.java | 9 + .../asteroids/blocks/BlockWalkway.java | 23 +- .../planets/mars/blocks/BlockCreeperEgg.java | 9 + .../mars/blocks/BlockSlimelingEgg.java | 19 +- .../mars/blocks/BlockTier2TreasureChest.java | 4 +- .../venus/blocks/BlockTier3TreasureChest.java | 4 +- .../planets/venus/blocks/BlockTorchWeb.java | 15 +- .../world/gen/dungeon/RoomChestVenus.java | 4 +- 32 files changed, 624 insertions(+), 99 deletions(-) rename src/main/java/micdoodle8/mods/galacticraft/core/blocks/{BlockT1TreasureChest.java => BlockTier1TreasureChest.java} (97%) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/GCBlocks.java b/src/main/java/micdoodle8/mods/galacticraft/core/GCBlocks.java index 625b7af6a7..98cca224e9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/GCBlocks.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/GCBlocks.java @@ -103,7 +103,7 @@ public static void initBlocks() GCBlocks.brightAir = new BlockBrightAir("bright_air"); GCBlocks.brightBreatheableAir = new BlockBrightBreathableAir("bright_breathable_air"); GCBlocks.brightLamp = new BlockBrightLamp("arclamp"); - GCBlocks.treasureChestTier1 = new BlockT1TreasureChest("treasure_chest"); + GCBlocks.treasureChestTier1 = new BlockTier1TreasureChest("treasure_chest"); GCBlocks.landingPad = new BlockLandingPad("landing_pad"); GCBlocks.landingPadFull = new BlockLandingPadFull("landing_pad_full"); GCBlocks.unlitTorch = new BlockUnlitTorch(false, "unlit_torch"); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java index 904d57f2fb..3d7b0f6588 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java @@ -29,30 +29,40 @@ public BlockAdvanced(Material material) @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { + if (hand != EnumHand.MAIN_HAND) + { + return false; + } + /** * Check if the player is holding a wrench or an electric item. If so, * call the wrench event. */ - if (this.isUsableWrench(playerIn, playerIn.inventory.getCurrentItem(), pos)) + if (this.isUsableWrench(playerIn, heldItem, pos)) { - this.damageWrench(playerIn, playerIn.inventory.getCurrentItem(), pos); + this.damageWrench(playerIn, heldItem, pos); if (playerIn.isSneaking()) { if (this.onSneakUseWrench(worldIn, pos, playerIn, hand, heldItem, side, hitX, hitY, hitZ)) { playerIn.swingArm(hand); - return true; + return !worldIn.isRemote; } } if (this.onUseWrench(worldIn, pos, playerIn, hand, heldItem, side, hitX, hitY, hitZ)) { playerIn.swingArm(hand); - return true; + return !worldIn.isRemote; } } + if (!worldIn.isRemote) + { + return false; + } + if (playerIn.isSneaking()) { if (this.onSneakMachineActivated(worldIn, pos, playerIn, hand, heldItem, side, hitX, hitY, hitZ)) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java index 81d2c50f63..f9c6820e24 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java @@ -1,7 +1,6 @@ package micdoodle8.mods.galacticraft.core.blocks; import micdoodle8.mods.galacticraft.api.transmission.NetworkType; -import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.items.IShiftDescription; import micdoodle8.mods.galacticraft.core.tile.TileEntityAluminumWire; @@ -18,7 +17,11 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -28,6 +31,147 @@ public class BlockAluminumWire extends BlockTransmitter implements ITileEntityProvider, IShiftDescription, ISortableBlock { public static final PropertyEnum WIRE_TYPE = PropertyEnum.create("wiretype", EnumWireType.class); + private static final float MIN = 0.38F; + private static final float MINH = 0.3F; + private static final float MAX = 0.62F; + private static final float MAXH = 0.7F; + protected static final AxisAlignedBB[] BOUNDING_BOXES = new AxisAlignedBB[] { + + new AxisAlignedBB(MIN, MIN, MIN, MAX, MAX, MAX), // No connection 0000000 + new AxisAlignedBB(MIN, MIN, MIN, MAX, MAX, 1.0D), // South 0000001 + new AxisAlignedBB(0.0D, MIN, MIN, MAX, MAX, MAX), // West 0000010 + new AxisAlignedBB(0.0D, MIN, MIN, MAX, MAX, 1.0D), // South West 0000011 + new AxisAlignedBB(MIN, MIN, 0.0D, MAX, MAX, MAX), // North 0000100 + new AxisAlignedBB(MIN, MIN, 0.0D, MAX, MAX, 1.0D), // North South 0000101 + new AxisAlignedBB(0.0D, MIN, 0.0D, MAX, MAX, MAX), // North West 0000110 + new AxisAlignedBB(0.0D, MIN, 0.0D, MAX, MAX, 1.0D), // North South West 0000111 + new AxisAlignedBB(MIN, MIN, MIN, 1.0D, MAX, MAX), // East 0001000 + new AxisAlignedBB(MIN, MIN, MIN, 1.0D, MAX, 1.0D), // East South 0001001 + new AxisAlignedBB(0.0D, MIN, MIN, 1.0D, MAX, MAX), // West East 0001010 + new AxisAlignedBB(0.0D, MIN, MIN, 1.0D, MAX, 1.0D), // South West East 0001011 + new AxisAlignedBB(MIN, MIN, 0.0D, 1.0D, MAX, MAX), // North East 0001100 + new AxisAlignedBB(MIN, MIN, 0.0D, 1.0D, MAX, 1.0D), // North South East 0001101 + new AxisAlignedBB(0.0D, MIN, 0.0D, 1.0D, MAX, MAX), // North East West 0001110 + new AxisAlignedBB(0.0D, MIN, 0.0D, 1.0D, MAX, 1.0D), // North South East West 0001111 + + new AxisAlignedBB(MIN, 0.0D, MIN, MAX, MAX, MAX), // Down 0010000 + new AxisAlignedBB(MIN, 0.0D, MIN, MAX, MAX, 1.0D), // Down South 0010001 + new AxisAlignedBB(0.0D, 0.0D, MIN, MAX, MAX, MAX), // Down West 0010010 + new AxisAlignedBB(0.0D, 0.0D, MIN, MAX, MAX, 1.0D), // Down South West 0010011 + new AxisAlignedBB(MIN, 0.0D, 0.0D, MAX, MAX, MAX), // Down North 0010100 + new AxisAlignedBB(MIN, 0.0D, 0.0D, MAX, MAX, 1.0D), // Down North South 0010101 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, MAX, MAX, MAX), // Down North West 0010110 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, MAX, MAX, 1.0D), // Down North South West 0010111 + new AxisAlignedBB(MIN, 0.0D, MIN, 1.0D, MAX, MAX), // Down East 0011000 + new AxisAlignedBB(MIN, 0.0D, MIN, 1.0D, MAX, 1.0D), // Down East South 0011001 + new AxisAlignedBB(0.0D, 0.0D, MIN, 1.0D, MAX, MAX), // Down West East 0011010 + new AxisAlignedBB(0.0D, 0.0D, MIN, 1.0D, MAX, 1.0D), // Down South West East 0011011 + new AxisAlignedBB(MIN, 0.0D, 0.0D, 1.0D, MAX, MAX), // Down North East 0011100 + new AxisAlignedBB(MIN, 0.0D, 0.0D, 1.0D, MAX, 1.0D), // Down North South East 0011101 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, MAX, MAX), // Down North East West 0011110 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, MAX, 1.0D), // Down North South East West 0011111 + + new AxisAlignedBB(MIN, MIN, MIN, MAX, 1.0D, MAX), // Up 0100000 + new AxisAlignedBB(MIN, MIN, MIN, MAX, 1.0D, 1.0D), // Up South 0100001 + new AxisAlignedBB(0.0D, MIN, MIN, MAX, 1.0D, MAX), // Up West 0100010 + new AxisAlignedBB(0.0D, MIN, MIN, MAX, 1.0D, 1.0D), // Up South West 0100011 + new AxisAlignedBB(MIN, MIN, 0.0D, MAX, 1.0D, MAX), // Up North 0100100 + new AxisAlignedBB(MIN, MIN, 0.0D, MAX, 1.0D, 1.0D), // Up North South 0100101 + new AxisAlignedBB(0.0D, MIN, 0.0D, MAX, 1.0D, MAX), // Up North West 0100110 + new AxisAlignedBB(0.0D, MIN, 0.0D, MAX, 1.0D, 1.0D), // Up North South West 0100111 + new AxisAlignedBB(MIN, MIN, MIN, 1.0D, 1.0D, MAX), // Up East 0101000 + new AxisAlignedBB(MIN, MIN, MIN, 1.0D, 1.0D, 1.0D), // Up East South 0101001 + new AxisAlignedBB(0.0D, MIN, MIN, 1.0D, 1.0D, MAX), // Up West East 0101010 + new AxisAlignedBB(0.0D, MIN, MIN, 1.0D, 1.0D, 1.0D), // Up South West East 0101011 + new AxisAlignedBB(MIN, MIN, 0.0D, 1.0D, 1.0D, MAX), // Up North East 0101100 + new AxisAlignedBB(MIN, MIN, 0.0D, 1.0D, 1.0D, 1.0D), // Up North South East 0101101 + new AxisAlignedBB(0.0D, MIN, 0.0D, 1.0D, 1.0D, MAX), // Up North East West 0101110 + new AxisAlignedBB(0.0D, MIN, 0.0D, 1.0D, 1.0D, 1.0D), // Up North South East West 0101111 + + new AxisAlignedBB(MIN, 0.0D, MIN, MAX, 1.0D, MAX), // Up Down 0110000 + new AxisAlignedBB(MIN, 0.0D, MIN, MAX, 1.0D, 1.0D), // Up Down South 0110001 + new AxisAlignedBB(0.0D, 0.0D, MIN, MAX, 1.0D, MAX), // Up Down West 0110010 + new AxisAlignedBB(0.0D, 0.0D, MIN, MAX, 1.0D, 1.0D), // Up Down South West 0110011 + new AxisAlignedBB(MIN, 0.0D, 0.0D, MAX, 1.0D, MAX), // Up Down North 0110100 + new AxisAlignedBB(MIN, 0.0D, 0.0D, MAX, 1.0D, 1.0D), // Up Down North South 0110101 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, MAX, 1.0D, MAX), // Up Down North West 0110110 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, MAX, 1.0D, 1.0D), // Up Down North South West 0110111 + new AxisAlignedBB(MIN, 0.0D, MIN, 1.0D, 1.0D, MAX), // Up Down East 0111000 + new AxisAlignedBB(MIN, 0.0D, MIN, 1.0D, 1.0D, 1.0D), // Up Down East South 0111001 + new AxisAlignedBB(0.0D, 0.0D, MIN, 1.0D, 1.0D, MAX), // Up Down West East 0111010 + new AxisAlignedBB(0.0D, 0.0D, MIN, 1.0D, 1.0D, 1.0D), // Up Down South West East 0111011 + new AxisAlignedBB(MIN, 0.0D, 0.0D, 1.0D, 1.0D, MAX), // Up Down North East 0111100 + new AxisAlignedBB(MIN, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), // Up Down North South East 0111101 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, MAX), // Up Down North East West 0111110 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), // Up Down North South East West 0111111 + + new AxisAlignedBB(MINH, MINH, MINH, MAXH, MAXH, MAXH), // No connection 1000000 + new AxisAlignedBB(MINH, MINH, MINH, MAXH, MAXH, 1.0D), // South 1000001 + new AxisAlignedBB(0.0D, MINH, MINH, MAXH, MAXH, MAXH), // West 1000010 + new AxisAlignedBB(0.0D, MINH, MINH, MAXH, MAXH, 1.0D), // South West 1000011 + new AxisAlignedBB(MINH, MINH, 0.0D, MAXH, MAXH, MAXH), // North 1000100 + new AxisAlignedBB(MINH, MINH, 0.0D, MAXH, MAXH, 1.0D), // North South 1000101 + new AxisAlignedBB(0.0D, MINH, 0.0D, MAXH, MAXH, MAXH), // North West 1000110 + new AxisAlignedBB(0.0D, MINH, 0.0D, MAXH, MAXH, 1.0D), // North South West 1000111 + new AxisAlignedBB(MINH, MINH, MINH, 1.0D, MAXH, MAXH), // East 1001000 + new AxisAlignedBB(MINH, MINH, MINH, 1.0D, MAXH, 1.0D), // East South 1001001 + new AxisAlignedBB(0.0D, MINH, MINH, 1.0D, MAXH, MAXH), // West East 1001010 + new AxisAlignedBB(0.0D, MINH, MINH, 1.0D, MAXH, 1.0D), // South West East 1001011 + new AxisAlignedBB(MINH, MINH, 0.0D, 1.0D, MAXH, MAXH), // North East 1001100 + new AxisAlignedBB(MINH, MINH, 0.0D, 1.0D, MAXH, 1.0D), // North South East 1001101 + new AxisAlignedBB(0.0D, MINH, 0.0D, 1.0D, MAXH, MAXH), // North East West 1001110 + new AxisAlignedBB(0.0D, MINH, 0.0D, 1.0D, MAXH, 1.0D), // North South East West 1001111 + + new AxisAlignedBB(MINH, 0.0D, MINH, MAXH, MAXH, MAXH), // Down 1010000 + new AxisAlignedBB(MINH, 0.0D, MINH, MAXH, MAXH, 1.0D), // Down South 1010001 + new AxisAlignedBB(0.0D, 0.0D, MINH, MAXH, MAXH, MAXH), // Down West 1010010 + new AxisAlignedBB(0.0D, 0.0D, MINH, MAXH, MAXH, 1.0D), // Down South West 1010011 + new AxisAlignedBB(MINH, 0.0D, 0.0D, MAXH, MAXH, MAXH), // Down North 1010100 + new AxisAlignedBB(MINH, 0.0D, 0.0D, MAXH, MAXH, 1.0D), // Down North South 1010101 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, MAXH, MAXH, MAXH), // Down North West 1010110 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, MAXH, MAXH, 1.0D), // Down North South West 1010111 + new AxisAlignedBB(MINH, 0.0D, MINH, 1.0D, MAXH, MAXH), // Down East 1011000 + new AxisAlignedBB(MINH, 0.0D, MINH, 1.0D, MAXH, 1.0D), // Down East South 1011001 + new AxisAlignedBB(0.0D, 0.0D, MINH, 1.0D, MAXH, MAXH), // Down West East 1011010 + new AxisAlignedBB(0.0D, 0.0D, MINH, 1.0D, MAXH, 1.0D), // Down South West East 1011011 + new AxisAlignedBB(MINH, 0.0D, 0.0D, 1.0D, MAXH, MAXH), // Down North East 1011100 + new AxisAlignedBB(MINH, 0.0D, 0.0D, 1.0D, MAXH, 1.0D), // Down North South East 1011101 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, MAXH, MAXH), // Down North East West 1011110 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, MAXH, 1.0D), // Down North South East West 1011111 + + new AxisAlignedBB(MINH, MINH, MINH, MAXH, 1.0D, MAXH), // Up 1100000 + new AxisAlignedBB(MINH, MINH, MINH, MAXH, 1.0D, 1.0D), // Up South 1100001 + new AxisAlignedBB(0.0D, MINH, MINH, MAXH, 1.0D, MAXH), // Up West 1100010 + new AxisAlignedBB(0.0D, MINH, MINH, MAXH, 1.0D, 1.0D), // Up South West 1100011 + new AxisAlignedBB(MINH, MINH, 0.0D, MAXH, 1.0D, MAXH), // Up North 1100100 + new AxisAlignedBB(MINH, MINH, 0.0D, MAXH, 1.0D, 1.0D), // Up North South 1100101 + new AxisAlignedBB(0.0D, MINH, 0.0D, MAXH, 1.0D, MAXH), // Up North West 1100110 + new AxisAlignedBB(0.0D, MINH, 0.0D, MAXH, 1.0D, 1.0D), // Up North South West 1100111 + new AxisAlignedBB(MINH, MINH, MINH, 1.0D, 1.0D, MAXH), // Up East 1101000 + new AxisAlignedBB(MINH, MINH, MINH, 1.0D, 1.0D, 1.0D), // Up East South 1101001 + new AxisAlignedBB(0.0D, MINH, MINH, 1.0D, 1.0D, MAXH), // Up West East 1101010 + new AxisAlignedBB(0.0D, MINH, MINH, 1.0D, 1.0D, 1.0D), // Up South West East 1101011 + new AxisAlignedBB(MINH, MINH, 0.0D, 1.0D, 1.0D, MAXH), // Up North East 1101100 + new AxisAlignedBB(MINH, MINH, 0.0D, 1.0D, 1.0D, 1.0D), // Up North South East 1101101 + new AxisAlignedBB(0.0D, MINH, 0.0D, 1.0D, 1.0D, MAXH), // Up North East West 1101110 + new AxisAlignedBB(0.0D, MINH, 0.0D, 1.0D, 1.0D, 1.0D), // Up North South East West 1101111 + + new AxisAlignedBB(MINH, 0.0D, MINH, MAXH, 1.0D, MAXH), // Up Down 1110000 + new AxisAlignedBB(MINH, 0.0D, MINH, MAXH, 1.0D, 1.0D), // Up Down South 1110001 + new AxisAlignedBB(0.0D, 0.0D, MINH, MAXH, 1.0D, MAXH), // Up Down West 1110010 + new AxisAlignedBB(0.0D, 0.0D, MINH, MAXH, 1.0D, 1.0D), // Up Down South West 1110011 + new AxisAlignedBB(MINH, 0.0D, 0.0D, MAXH, 1.0D, MAXH), // Up Down North 1110100 + new AxisAlignedBB(MINH, 0.0D, 0.0D, MAXH, 1.0D, 1.0D), // Up Down North South 1110101 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, MAXH, 1.0D, MAXH), // Up Down North West 1110110 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, MAXH, 1.0D, 1.0D), // Up Down North South West 1110111 + new AxisAlignedBB(MINH, 0.0D, MINH, 1.0D, 1.0D, MAXH), // Up Down East 1111000 + new AxisAlignedBB(MINH, 0.0D, MINH, 1.0D, 1.0D, 1.0D), // Up Down East South 1111001 + new AxisAlignedBB(0.0D, 0.0D, MINH, 1.0D, 1.0D, MAXH), // Up Down West East 1111010 + new AxisAlignedBB(0.0D, 0.0D, MINH, 1.0D, 1.0D, 1.0D), // Up Down South West East 1111011 + new AxisAlignedBB(MINH, 0.0D, 0.0D, 1.0D, 1.0D, MAXH), // Up Down North East 1111100 + new AxisAlignedBB(MINH, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), // Up Down North South East 1111101 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, MAXH), // Up Down North East West 1111110 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)}; // Up Down North South East West 1111111 public enum EnumWireType implements IStringSerializable { @@ -62,41 +206,63 @@ public String getName() } } - private Vector3 minVectorNormal = new Vector3(0.38, 0.38, 0.38); - private Vector3 minVectorHeavy = new Vector3(0.3, 0.3, 0.3); - private Vector3 maxVectorNormal = new Vector3(0.62, 0.62, 0.62); - private Vector3 maxVectorHeavy = new Vector3(0.7, 0.7, 0.7); - public BlockAluminumWire(String assetName) { super(Material.CLOTH); this.setSoundType(SoundType.CLOTH); this.setResistance(0.2F); -// this.setBlockBounds(0.4F, 0.4F, 0.4F, 0.6F, 0.6F, 0.6F); this.setHardness(0.075F); this.setUnlocalizedName(assetName); } @Override - public Vector3 getMinVector(IBlockState state) + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { - EnumWireType type = (EnumWireType) state.getValue(WIRE_TYPE); - if (type == EnumWireType.ALUMINUM_WIRE || type == EnumWireType.ALUMINUM_WIRE_SWITCHED) - { - return minVectorNormal; - } - return minVectorHeavy; + state = this.getActualState(state, source, pos); + return BOUNDING_BOXES[getBoundingBoxIdx(state)]; } - @Override - public Vector3 getMaxVector(IBlockState state) + private static int getBoundingBoxIdx(IBlockState state) { - EnumWireType type = (EnumWireType) state.getValue(WIRE_TYPE); - if (type == EnumWireType.ALUMINUM_WIRE || type == EnumWireType.ALUMINUM_WIRE_SWITCHED) + int i = 0; + + if (state.getValue(NORTH).booleanValue()) { - return maxVectorNormal; + i |= 1 << EnumFacing.NORTH.getHorizontalIndex(); } - return maxVectorHeavy; + + if (state.getValue(EAST).booleanValue()) + { + i |= 1 << EnumFacing.EAST.getHorizontalIndex(); + } + + if (state.getValue(SOUTH).booleanValue()) + { + i |= 1 << EnumFacing.SOUTH.getHorizontalIndex(); + } + + if (state.getValue(WEST).booleanValue()) + { + i |= 1 << EnumFacing.WEST.getHorizontalIndex(); + } + + if (state.getValue(DOWN).booleanValue()) + { + i |= 1 << 4; + } + + if (state.getValue(UP).booleanValue()) + { + i |= 1 << 5; + } + + // Is heavy: + if (((EnumWireType) state.getValue(WIRE_TYPE)).ordinal() % 2 == 1) + { + i |= 1 << 6; + } + + return i; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java index d8f617f35f..5f21b559b8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java @@ -32,6 +32,11 @@ public class BlockBrightLamp extends BlockAdvanced implements IShiftDescription, public static final PropertyDirection FACING = PropertyDirection.create("facing"); public static final PropertyBool ACTIVE = PropertyBool.create("active"); + protected static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0.2F, 0.2F, 0.0F, 0.8F, 0.8F, 0.6F); + protected static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.2F, 0.2F, 0.4F, 0.8F, 0.8F, 1.0F); + protected static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0.0F, 0.2F, 0.2F, 0.6F, 0.8F, 0.8F); + protected static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(0.4F, 0.2F, 0.2F, 1.0F, 0.8F, 0.8F); + //Metadata: bits 0-2 are the side of the base plate using standard side convention (0-5) public BlockBrightLamp(String assetName) @@ -44,6 +49,23 @@ public BlockBrightLamp(String assetName) this.setLightLevel(1.0F); } + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + switch (state.getValue(FACING)) + { + case EAST: + return EAST_AABB; + case WEST: + return WEST_AABB; + case SOUTH: + return SOUTH_AABB; + default: + case NORTH: + return NORTH_AABB; + } + } + @Override public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java index 3bd3f91565..a4037fce39 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java @@ -18,6 +18,7 @@ import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -29,6 +30,15 @@ public class BlockCheese extends Block implements IShiftDescription, ISortableBlock { public static final PropertyInteger BITES = PropertyInteger.create("bites", 0, 6); + protected static final AxisAlignedBB[] CHEESE_AABB = new AxisAlignedBB[] { + new AxisAlignedBB(0.0625, 0.0, 0.0625, 0.9375, 0.5, 0.9375), + new AxisAlignedBB(0.1875, 0.0, 0.0625, 0.9375, 0.5, 0.9375), + new AxisAlignedBB(0.3125, 0.0, 0.0625, 0.9375, 0.5, 0.9375), + new AxisAlignedBB(0.4375, 0.0, 0.0625, 0.9375, 0.5, 0.9375), + new AxisAlignedBB(0.5625, 0.0, 0.0625, 0.9375, 0.5, 0.9375), + new AxisAlignedBB(0.6875, 0.0, 0.0625, 0.9375, 0.5, 0.9375), + new AxisAlignedBB(0.8125, 0.0, 0.0625, 0.9375, 0.5, 0.9375) + }; public BlockCheese(String assetName) { @@ -41,6 +51,12 @@ public BlockCheese(String assetName) this.setUnlocalizedName(assetName); } + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + return CHEESE_AABB[((Integer)state.getValue(BITES)).intValue()]; + } + // @Override // public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) // { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFallenMeteor.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFallenMeteor.java index 1ea5460331..a8aa4cee43 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFallenMeteor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFallenMeteor.java @@ -23,6 +23,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.SoundCategory; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -31,15 +32,22 @@ public class BlockFallenMeteor extends Block implements ITileEntityProvider, IShiftDescription, ISortableBlock { + private static final AxisAlignedBB BOUNDS = new AxisAlignedBB(0.15, 0.05, 0.15, 0.85, 0.75, 0.85); + public BlockFallenMeteor(String assetName) { super(Material.ROCK); -// this.setBlockBounds(0.2F, 0.2F, 0.2F, 0.8F, 0.8F, 0.8F); this.setHardness(50.0F); this.setSoundType(SoundType.STONE); this.setUnlocalizedName(assetName); } + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + return BOUNDS; + } + @Override public CreativeTabs getCreativeTabToDisplayOn() { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidPipe.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidPipe.java index a8b637ed25..f8b4f548f6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidPipe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidPipe.java @@ -2,7 +2,6 @@ import micdoodle8.mods.galacticraft.api.tile.IColorable; import micdoodle8.mods.galacticraft.api.transmission.NetworkType; -import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.items.IShiftDescription; import micdoodle8.mods.galacticraft.core.network.PacketSimple; @@ -39,13 +38,82 @@ public class BlockFluidPipe extends BlockTransmitter implements ITileEntityProvi { public static final PropertyEnum COLOR = PropertyEnum.create("color", EnumDyeColor.class); - public Vector3 minVector = new Vector3(0.35, 0.35, 0.35); - public Vector3 maxVector = new Vector3(0.65, 0.65, 0.65); - public static boolean ignoreDrop = false; private EnumPipeMode mode; + private static final float MIN = 0.35F; + private static final float MAX = 0.65F; + protected static final AxisAlignedBB[] BOUNDING_BOXES = new AxisAlignedBB[] { + + new AxisAlignedBB(MIN, MIN, MIN, MAX, MAX, MAX), // No connection 000000 + new AxisAlignedBB(MIN, MIN, MIN, MAX, MAX, 1.0D), // South 000001 + new AxisAlignedBB(0.0D, MIN, MIN, MAX, MAX, MAX), // West 000010 + new AxisAlignedBB(0.0D, MIN, MIN, MAX, MAX, 1.0D), // South West 000011 + new AxisAlignedBB(MIN, MIN, 0.0D, MAX, MAX, MAX), // North 000100 + new AxisAlignedBB(MIN, MIN, 0.0D, MAX, MAX, 1.0D), // North South 000101 + new AxisAlignedBB(0.0D, MIN, 0.0D, MAX, MAX, MAX), // North West 000110 + new AxisAlignedBB(0.0D, MIN, 0.0D, MAX, MAX, 1.0D), // North South West 000111 + new AxisAlignedBB(MIN, MIN, MIN, 1.0D, MAX, MAX), // East 001000 + new AxisAlignedBB(MIN, MIN, MIN, 1.0D, MAX, 1.0D), // East South 001001 + new AxisAlignedBB(0.0D, MIN, MIN, 1.0D, MAX, MAX), // West East 001010 + new AxisAlignedBB(0.0D, MIN, MIN, 1.0D, MAX, 1.0D), // South West East 001011 + new AxisAlignedBB(MIN, MIN, 0.0D, 1.0D, MAX, MAX), // North East 001100 + new AxisAlignedBB(MIN, MIN, 0.0D, 1.0D, MAX, 1.0D), // North South East 001101 + new AxisAlignedBB(0.0D, MIN, 0.0D, 1.0D, MAX, MAX), // North East West 001110 + new AxisAlignedBB(0.0D, MIN, 0.0D, 1.0D, MAX, 1.0D), // North South East West 001111 + + new AxisAlignedBB(MIN, 0.0D, MIN, MAX, MAX, MAX), // Down 010000 + new AxisAlignedBB(MIN, 0.0D, MIN, MAX, MAX, 1.0D), // Down South 010001 + new AxisAlignedBB(0.0D, 0.0D, MIN, MAX, MAX, MAX), // Down West 010010 + new AxisAlignedBB(0.0D, 0.0D, MIN, MAX, MAX, 1.0D), // Down South West 010011 + new AxisAlignedBB(MIN, 0.0D, 0.0D, MAX, MAX, MAX), // Down North 010100 + new AxisAlignedBB(MIN, 0.0D, 0.0D, MAX, MAX, 1.0D), // Down North South 010101 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, MAX, MAX, MAX), // Down North West 010110 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, MAX, MAX, 1.0D), // Down North South West 010111 + new AxisAlignedBB(MIN, 0.0D, MIN, 1.0D, MAX, MAX), // Down East 011000 + new AxisAlignedBB(MIN, 0.0D, MIN, 1.0D, MAX, 1.0D), // Down East South 011001 + new AxisAlignedBB(0.0D, 0.0D, MIN, 1.0D, MAX, MAX), // Down West East 011010 + new AxisAlignedBB(0.0D, 0.0D, MIN, 1.0D, MAX, 1.0D), // Down South West East 011011 + new AxisAlignedBB(MIN, 0.0D, 0.0D, 1.0D, MAX, MAX), // Down North East 011100 + new AxisAlignedBB(MIN, 0.0D, 0.0D, 1.0D, MAX, 1.0D), // Down North South East 011101 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, MAX, MAX), // Down North East West 011110 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, MAX, 1.0D), // Down North South East West 011111 + + new AxisAlignedBB(MIN, MIN, MIN, MAX, 1.0D, MAX), // Up 100000 + new AxisAlignedBB(MIN, MIN, MIN, MAX, 1.0D, 1.0D), // Up South 100001 + new AxisAlignedBB(0.0D, MIN, MIN, MAX, 1.0D, MAX), // Up West 100010 + new AxisAlignedBB(0.0D, MIN, MIN, MAX, 1.0D, 1.0D), // Up South West 100011 + new AxisAlignedBB(MIN, MIN, 0.0D, MAX, 1.0D, MAX), // Up North 100100 + new AxisAlignedBB(MIN, MIN, 0.0D, MAX, 1.0D, 1.0D), // Up North South 100101 + new AxisAlignedBB(0.0D, MIN, 0.0D, MAX, 1.0D, MAX), // Up North West 100110 + new AxisAlignedBB(0.0D, MIN, 0.0D, MAX, 1.0D, 1.0D), // Up North South West 100111 + new AxisAlignedBB(MIN, MIN, MIN, 1.0D, 1.0D, MAX), // Up East 101000 + new AxisAlignedBB(MIN, MIN, MIN, 1.0D, 1.0D, 1.0D), // Up East South 101001 + new AxisAlignedBB(0.0D, MIN, MIN, 1.0D, 1.0D, MAX), // Up West East 101010 + new AxisAlignedBB(0.0D, MIN, MIN, 1.0D, 1.0D, 1.0D), // Up South West East 101011 + new AxisAlignedBB(MIN, MIN, 0.0D, 1.0D, 1.0D, MAX), // Up North East 101100 + new AxisAlignedBB(MIN, MIN, 0.0D, 1.0D, 1.0D, 1.0D), // Up North South East 101101 + new AxisAlignedBB(0.0D, MIN, 0.0D, 1.0D, 1.0D, MAX), // Up North East West 101110 + new AxisAlignedBB(0.0D, MIN, 0.0D, 1.0D, 1.0D, 1.0D), // Up North South East West 101111 + + new AxisAlignedBB(MIN, 0.0D, MIN, MAX, 1.0D, MAX), // Up Down 110000 + new AxisAlignedBB(MIN, 0.0D, MIN, MAX, 1.0D, 1.0D), // Up Down South 110001 + new AxisAlignedBB(0.0D, 0.0D, MIN, MAX, 1.0D, MAX), // Up Down West 110010 + new AxisAlignedBB(0.0D, 0.0D, MIN, MAX, 1.0D, 1.0D), // Up Down South West 110011 + new AxisAlignedBB(MIN, 0.0D, 0.0D, MAX, 1.0D, MAX), // Up Down North 110100 + new AxisAlignedBB(MIN, 0.0D, 0.0D, MAX, 1.0D, 1.0D), // Up Down North South 110101 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, MAX, 1.0D, MAX), // Up Down North West 110110 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, MAX, 1.0D, 1.0D), // Up Down North South West 110111 + new AxisAlignedBB(MIN, 0.0D, MIN, 1.0D, 1.0D, MAX), // Up Down East 111000 + new AxisAlignedBB(MIN, 0.0D, MIN, 1.0D, 1.0D, 1.0D), // Up Down East South 111001 + new AxisAlignedBB(0.0D, 0.0D, MIN, 1.0D, 1.0D, MAX), // Up Down West East 111010 + new AxisAlignedBB(0.0D, 0.0D, MIN, 1.0D, 1.0D, 1.0D), // Up Down South West East 111011 + new AxisAlignedBB(MIN, 0.0D, 0.0D, 1.0D, 1.0D, MAX), // Up Down North East 111100 + new AxisAlignedBB(MIN, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), // Up Down North South East 111101 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, MAX), // Up Down North East West 111110 + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)}; // Up Down North South East West 111111 + public BlockFluidPipe(String assetName, EnumPipeMode mode) { super(Material.GLASS); @@ -57,15 +125,47 @@ public BlockFluidPipe(String assetName, EnumPipeMode mode) } @Override - public Vector3 getMinVector(IBlockState state) + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { - return minVector; + state = this.getActualState(state, source, pos); + return BOUNDING_BOXES[getBoundingBoxIdx(state)]; } - @Override - public Vector3 getMaxVector(IBlockState state) + private static int getBoundingBoxIdx(IBlockState state) { - return maxVector; + int i = 0; + + if (state.getValue(NORTH).booleanValue()) + { + i |= 1 << EnumFacing.NORTH.getHorizontalIndex(); + } + + if (state.getValue(EAST).booleanValue()) + { + i |= 1 << EnumFacing.EAST.getHorizontalIndex(); + } + + if (state.getValue(SOUTH).booleanValue()) + { + i |= 1 << EnumFacing.SOUTH.getHorizontalIndex(); + } + + if (state.getValue(WEST).booleanValue()) + { + i |= 1 << EnumFacing.WEST.getHorizontalIndex(); + } + + if (state.getValue(DOWN).booleanValue()) + { + i |= 1 << 4; + } + + if (state.getValue(UP).booleanValue()) + { + i |= 1 << 5; + } + + return i; } @Override @@ -208,12 +308,12 @@ public TileEntity createNewTileEntity(World world, int meta) return new TileEntityFluidPipe(); } - @SideOnly(Side.CLIENT) - @Override - public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) - { - return this.getCollisionBoundingBox(worldIn.getBlockState(pos), worldIn, pos); - } +// @SideOnly(Side.CLIENT) +// @Override +// public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) +// { +// return this.getCollisionBoundingBox(worldIn.getBlockState(pos), worldIn, pos); +// } @Override public NetworkType getNetworkType(IBlockState state) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidTank.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidTank.java index bd1cc0c8b6..1ced44c339 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidTank.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockFluidTank.java @@ -40,6 +40,12 @@ public BlockFluidTank(String assetName) this.setUnlocalizedName(assetName); } + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + return BOUNDS; + } + @Override public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java index cac613ae70..106626d290 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockGlowstoneTorch.java @@ -27,6 +27,11 @@ public class BlockGlowstoneTorch extends Block implements IShiftDescription, ISortableBlock { public static final PropertyDirection FACING = PropertyDirection.create("facing", facing -> facing != EnumFacing.DOWN); + protected static final AxisAlignedBB STANDING_AABB = new AxisAlignedBB(0.4000000059604645D, 0.0D, 0.4000000059604645D, 0.6000000238418579D, 0.6000000238418579D, 0.6000000238418579D); + protected static final AxisAlignedBB TORCH_NORTH_AABB = new AxisAlignedBB(0.3499999940395355D, 0.20000000298023224D, 0.699999988079071D, 0.6499999761581421D, 0.800000011920929D, 1.0D); + protected static final AxisAlignedBB TORCH_SOUTH_AABB = new AxisAlignedBB(0.3499999940395355D, 0.20000000298023224D, 0.0D, 0.6499999761581421D, 0.800000011920929D, 0.30000001192092896D); + protected static final AxisAlignedBB TORCH_WEST_AABB = new AxisAlignedBB(0.699999988079071D, 0.20000000298023224D, 0.3499999940395355D, 1.0D, 0.800000011920929D, 0.6499999761581421D); + protected static final AxisAlignedBB TORCH_EAST_AABB = new AxisAlignedBB(0.0D, 0.20000000298023224D, 0.3499999940395355D, 0.30000001192092896D, 0.800000011920929D, 0.6499999761581421D); public BlockGlowstoneTorch(String assetName) { @@ -39,15 +44,33 @@ public BlockGlowstoneTorch(String assetName) } @Override - public CreativeTabs getCreativeTabToDisplayOn() + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { - return GalacticraftCore.galacticraftBlocksTab; + switch (state.getValue(FACING)) + { + case EAST: + return TORCH_EAST_AABB; + case WEST: + return TORCH_WEST_AABB; + case SOUTH: + return TORCH_SOUTH_AABB; + case NORTH: + return TORCH_NORTH_AABB; + default: + return STANDING_AABB; + } } @Override public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { - return null; + return NULL_AABB; + } + + @Override + public CreativeTabs getCreativeTabToDisplayOn() + { + return GalacticraftCore.galacticraftBlocksTab; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPad.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPad.java index 0ec926b4e8..66aa87aede 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPad.java @@ -20,7 +20,9 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -30,6 +32,7 @@ public class BlockLandingPad extends BlockAdvancedTile implements IPartialSealableBlock, IShiftDescription, ISortableBlock { public static final PropertyEnum PAD_TYPE = PropertyEnum.create("type", EnumLandingPadType.class); + protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 0.1875, 1.0); public enum EnumLandingPadType implements IStringSerializable { @@ -65,13 +68,18 @@ public String getName() public BlockLandingPad(String assetName) { super(Material.IRON); -// this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 3 / 16.0F, 1.0F); this.setHardness(1.0F); this.setResistance(10.0F); this.setSoundType(SoundType.METAL); this.setUnlocalizedName(assetName); } + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + return AABB; + } + @Override public CreativeTabs getCreativeTabToDisplayOn() { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java index aaf87f0fe7..871dbab380 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java @@ -22,6 +22,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.Explosion; @@ -35,6 +36,10 @@ public class BlockMulti extends BlockAdvanced implements IPartialSealableBlock, public static final PropertyEnum MULTI_TYPE = PropertyEnum.create("type", EnumBlockMultiType.class); public static final PropertyInteger RENDER_TYPE = PropertyInteger.create("rendertype", 0, 7); + protected static final AxisAlignedBB AABB_PAD = new AxisAlignedBB(0.0F, 0.0F, 0.0F, 1.0F, 0.2F, 1.0F); + protected static final AxisAlignedBB AABB_SOLAR = new AxisAlignedBB(0.3F, 0.0F, 0.3F, 0.7F, 1.0F, 0.7F); + protected static final AxisAlignedBB AABB_SOLAR_TOP = new AxisAlignedBB(0.3F, 0.0F, 0.3F, 0.7F, 0.6F, 0.7F); + public enum EnumBlockMultiType implements IStringSerializable { SOLAR_PANEL_0(0, "solar"), @@ -81,6 +86,22 @@ public BlockMulti(String assetName) this.setResistance(1000000000000000.0F); } + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + switch ((EnumBlockMultiType)state.getValue(MULTI_TYPE)) + { + case SOLAR_PANEL_0: + case SOLAR_PANEL_1: + return source.getBlockState(pos.up()) == this ? AABB_SOLAR : AABB_SOLAR_TOP; + case ROCKET_PAD: + case BUGGY_FUEL_PAD: + return AABB_PAD; + default: + return FULL_BLOCK_AABB; + } + } + @Override public boolean isOpaqueCube(IBlockState state) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java index 2ad4919c2f..a1d6787f72 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java @@ -40,6 +40,7 @@ public class BlockParaChest extends BlockContainer implements ITileEntityProvide public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); public static final PropertyEnum COLOR = PropertyEnum.create("color", EnumDyeColor.class); private final Random random = new Random(); + protected static final AxisAlignedBB NOT_CONNECTED_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.875D, 0.9375D); public BlockParaChest(String assetName) { @@ -51,6 +52,12 @@ public BlockParaChest(String assetName) this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + return NOT_CONNECTED_AABB; + } + @Override public EnumBlockRenderType getRenderType(IBlockState state) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java index 245b488a62..55eeae5b15 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java @@ -33,6 +33,11 @@ public class BlockSpinThruster extends BlockAdvanced implements IShiftDescriptio { public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + protected static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0.2F, 0.2F, 0.4F, 0.8F, 0.8F, 1.0F); + protected static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.2F, 0.2F, 0.0F, 0.8F, 0.8F, 0.6F); + protected static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0.4F, 0.2F, 0.2F, 1.0F, 0.8F, 0.8F); + protected static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(0.0F, 0.2F, 0.2F, 0.6F, 0.8F, 0.8F); + public BlockSpinThruster(String assetName) { super(Material.CIRCUITS); @@ -42,16 +47,27 @@ public BlockSpinThruster(String assetName) this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); } - private static boolean isBlockSolidOnSide(World world, BlockPos pos, EnumFacing direction) + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { - IBlockState state = world.getBlockState(pos); - return state.getBlock().isSideSolid(state, world, pos, direction); + switch (state.getValue(FACING)) + { + case EAST: + return EAST_AABB; + case WEST: + return WEST_AABB; + case SOUTH: + return SOUTH_AABB; + default: + case NORTH: + return NORTH_AABB; + } } - @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) + private static boolean isBlockSolidOnSide(World world, BlockPos pos, EnumFacing direction) { - return null; + IBlockState state = world.getBlockState(pos); + return state.getBlock().isSideSolid(state, world, pos, direction); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockT1TreasureChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTier1TreasureChest.java similarity index 97% rename from src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockT1TreasureChest.java rename to src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTier1TreasureChest.java index 55b4fc6955..7ad3012c4c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockT1TreasureChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTier1TreasureChest.java @@ -33,11 +33,12 @@ import java.util.Iterator; -public class BlockT1TreasureChest extends BlockContainer implements ITileEntityProvider, IShiftDescription, ISortableBlock +public class BlockTier1TreasureChest extends BlockContainer implements ITileEntityProvider, IShiftDescription, ISortableBlock { public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); + protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.0625, 0.0, 0.0625, 0.9375, 0.875, 0.9375); - public BlockT1TreasureChest(String assetName) + public BlockTier1TreasureChest(String assetName) { super(Material.WOOD); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); @@ -46,6 +47,12 @@ public BlockT1TreasureChest(String assetName) this.setUnlocalizedName(assetName); } + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + return AABB; + } + @Override public CreativeTabs getCreativeTabToDisplayOn() { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java index 0ddf607098..065979edeb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java @@ -49,10 +49,6 @@ public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighb } } - public abstract Vector3 getMinVector(IBlockState state); - - public abstract Vector3 getMaxVector(IBlockState state); - // @Override // public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) // { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java index e98619be26..f5284411d2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java @@ -40,6 +40,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.ISound; +import net.minecraft.client.audio.PositionedSound; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.WorldClient; @@ -55,7 +56,10 @@ import net.minecraft.item.ItemFlintAndSteel; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvent; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; @@ -90,6 +94,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import java.lang.reflect.Field; import java.util.*; public class EventHandlerGC @@ -874,6 +879,9 @@ public void overrideSkyColor(EntityViewRenderEvent.FogColors event) private List soundPlayList = new ArrayList(); + private static Field volumeField; + private static Field pitchField; + @SideOnly(Side.CLIENT) @SubscribeEvent public void onSoundPlayed(PlaySoundEvent event) @@ -886,7 +894,7 @@ public void onSoundPlayed(PlaySoundEvent event) EntityPlayerSP player = FMLClientHandler.instance().getClient().thePlayer; - if (player != null && player.worldObj != null && player.worldObj.provider instanceof IGalacticraftWorldProvider && event != null) + if (player != null && player.worldObj != null && player.worldObj.provider instanceof IGalacticraftWorldProvider) { //Only modify standard game sounds, not music if (event.getResultSound().getAttenuationType() != ISound.AttenuationType.NONE) @@ -906,7 +914,36 @@ public void onSoundPlayed(PlaySoundEvent event) boolean soundInAtmosphere = OxygenUtil.isAABBInBreathableAirBlock(player.worldObj, bb); if ((!playerInAtmosphere || !soundInAtmosphere)) { - float volume = event.getResultSound().getVolume(); + float volume = 1.0F; + float pitch = 1.0F; + + if (volumeField == null) + { + try + { + volumeField = PositionedSound.class.getDeclaredField("volume"); // TODO Obfuscated environment support + volumeField.setAccessible(true); + pitchField = PositionedSound.class.getDeclaredField("pitch"); // TODO Obfuscated environment support + pitchField.setAccessible(true); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + + if (volumeField != null && pitchField != null) + { + try + { + volume = event.getSound() instanceof PositionedSound ? (float) volumeField.get(event.getSound()) : 1.0F; + pitch = event.getSound() instanceof PositionedSound ? (float) pitchField.get(event.getSound()) : 1.0F; + } + catch (IllegalAccessException e) + { + e.printStackTrace(); + } + } //First check for duplicate firing of PlaySoundEvent17 on this handler's own playing of a reduced volume sound (see below) for (int i = 0; i < this.soundPlayList.size(); i++) @@ -925,7 +962,7 @@ public void onSoundPlayed(PlaySoundEvent event) this.soundPlayList.add(new SoundPlayEntry(event.getName(), x, y, z, newVolume)); SoundEvent soundEvent = SoundEvent.REGISTRY.getObject(event.getResultSound().getSoundLocation()); - ISound newSound = new PositionedSoundRecord(soundEvent, SoundCategory.NEUTRAL, newVolume, event.getResultSound().getPitch(), x, y, z); + ISound newSound = new PositionedSoundRecord(soundEvent, SoundCategory.NEUTRAL, newVolume, pitch, x, y, z); event.getManager().playSound(newSound); event.setResultSound(null); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java index d4c4acb431..d359dbdb86 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java @@ -99,7 +99,7 @@ public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, Wor { if (world.isRemote) { - return EnumActionResult.FAIL; + return EnumActionResult.PASS; } IBlockState state = world.getBlockState(pos); Block blockID = state.getBlock(); @@ -108,13 +108,13 @@ public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, Wor { int metadata = blockID.getMetaFromState(state); - world.setBlockState(pos, blockID.getStateFromMeta(EnumFacing.getHorizontal((metadata + 1) % 4).ordinal()), 3); + world.setBlockState(pos, blockID.getStateFromMeta(EnumFacing.getFront(metadata).rotateY().ordinal()), 3); this.wrenchUsed(player, pos); - return EnumActionResult.PASS; + return EnumActionResult.SUCCESS; } - return EnumActionResult.FAIL; + return EnumActionResult.PASS; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java index d1f57f7afa..c8ff132108 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketDynamic.java @@ -96,7 +96,7 @@ public void decodeInto(ByteBuf buffer) if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) { - world = world.getMinecraftServer().worldServerForDimension(this.getDimensionID()); + world = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(this.getDimensionID()); } if (world == null) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java index f97e239587..5740edeb91 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java @@ -458,6 +458,11 @@ public static TileEntity[] getAdjacentFluidConnections(TileEntity tile, boolean { TileEntity[] adjacentConnections = new TileEntity[EnumFacing.values().length]; + if (tile == null) + { + return adjacentConnections; + } + boolean isMekLoaded = EnergyConfigHandler.isMekanismLoaded(); BlockVec3 thisVec = new BlockVec3(tile); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java index eae39585b8..1085b94ddf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomChest.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.dungeon; -import micdoodle8.mods.galacticraft.core.blocks.BlockT1TreasureChest; +import micdoodle8.mods.galacticraft.core.blocks.BlockTier1TreasureChest; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityChest; @@ -31,7 +31,7 @@ public boolean addComponentParts(World worldIn, Random rand, StructureBoundingBo int chestX = this.sizeX / 2; int chestY = 1; int chestZ = this.sizeZ / 2; - this.setBlockState(worldIn, Blocks.CHEST.getDefaultState().withProperty(BlockT1TreasureChest.FACING, this.getDirection().getOpposite()), chestX, chestY, chestZ, boundingBox); + this.setBlockState(worldIn, Blocks.CHEST.getDefaultState().withProperty(BlockTier1TreasureChest.FACING, this.getDirection().getOpposite()), chestX, chestY, chestZ, boundingBox); BlockPos blockpos = new BlockPos(this.getXWithOffset(chestX, chestZ), this.getYWithOffset(chestY), this.getZWithOffset(chestX, chestZ)); TileEntityChest chest = (TileEntityChest) worldIn.getTileEntity(blockpos); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java index 2df0f75b1e..c40802cd7e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomTreasure.java @@ -2,7 +2,7 @@ import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.GCBlocks; -import micdoodle8.mods.galacticraft.core.blocks.BlockT1TreasureChest; +import micdoodle8.mods.galacticraft.core.blocks.BlockTier1TreasureChest; import micdoodle8.mods.galacticraft.core.tile.TileEntityTreasureChest; import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; @@ -96,7 +96,7 @@ else if ((i == 1 && k == 1) || (i == 1 && k == this.sizeZ - 1) || (i == this.siz } else if (i == this.sizeX / 2 && j == 1 && k == this.sizeZ / 2) { - this.setBlockState(worldIn, GCBlocks.treasureChestTier1.getDefaultState().withProperty(BlockT1TreasureChest.FACING, this.getDirection().getOpposite()), i, j, k, boundingBox); + this.setBlockState(worldIn, GCBlocks.treasureChestTier1.getDefaultState().withProperty(BlockTier1TreasureChest.FACING, this.getDirection().getOpposite()), i, j, k, boundingBox); BlockPos blockpos = new BlockPos(this.getXWithOffset(i, k), this.getYWithOffset(j), this.getZWithOffset(i, k)); if (worldIn.getTileEntity(blockpos) == null) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java index feb016aeea..fa047c97e0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java @@ -25,6 +25,7 @@ import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.IBlockAccess; @@ -38,6 +39,12 @@ public class BlockBeamReceiver extends BlockTileGC implements IShiftDescription, ISortableBlock { public static final PropertyDirection FACING = PropertyDirection.create("facing"); + protected static final AxisAlignedBB UP_AABB = new AxisAlignedBB(0.3F, 0.3F, 0.3F, 0.7F, 1.0F, 0.7F); + protected static final AxisAlignedBB DOWN_AABB = new AxisAlignedBB(0.2F, 0.0F, 0.2F, 0.8F, 0.42F, 0.8F); + protected static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(0.58F, 0.2F, 0.2F, 1.0F, 0.8F, 0.8F); + protected static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0.0F, 0.2F, 0.2F, 0.42F, 0.8F, 0.8F); + protected static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0.2F, 0.2F, 0.0F, 0.8F, 0.8F, 0.42F); + protected static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.2F, 0.2F, 0.58F, 0.8F, 0.8F, 1.0F); public BlockBeamReceiver(String assetName) { @@ -46,6 +53,27 @@ public BlockBeamReceiver(String assetName) this.setSoundType(SoundType.METAL); } + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + switch (state.getValue(FACING)) + { + case UP: + return UP_AABB; + case DOWN: + return DOWN_AABB; + case EAST: + return EAST_AABB; + case WEST: + return WEST_AABB; + case SOUTH: + return SOUTH_AABB; + default: + case NORTH: + return NORTH_AABB; + } + } + @SideOnly(Side.CLIENT) @Override public CreativeTabs getCreativeTabToDisplayOn() diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java index 63bac75fe0..c4230aefa0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReflector.java @@ -18,7 +18,9 @@ import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -27,6 +29,8 @@ public class BlockBeamReflector extends BlockTileGC implements IShiftDescription, ISortableBlock { + protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.25, 0.0, 0.25, 0.75, 0.8, 0.75); + public BlockBeamReflector(String assetName) { super(Material.IRON); @@ -34,6 +38,12 @@ public BlockBeamReflector(String assetName) this.setSoundType(SoundType.METAL); } + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + return AABB; + } + @SideOnly(Side.CLIENT) @Override public CreativeTabs getCreativeTabToDisplayOn() diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java index bbaaaf9c5f..e4af89d3d0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java @@ -24,8 +24,10 @@ import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -34,6 +36,8 @@ public class BlockShortRangeTelepad extends BlockTileGC implements IShiftDescription, ISortableBlock { + protected static final AxisAlignedBB AABB_TELEPAD = new AxisAlignedBB(0.0F, 0.0F, 0.0F, 1.0F, 0.45F, 1.0F); + protected BlockShortRangeTelepad(String assetName) { super(Material.IRON); @@ -73,6 +77,12 @@ public TileEntity createNewTileEntity(World world, int meta) return new TileEntityShortRangeTelepad(); } + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + return AABB_TELEPAD; + } + // @Override // public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) // { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java index a18dc04f4a..e5069b457d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java @@ -19,6 +19,7 @@ import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.Explosion; @@ -31,6 +32,8 @@ public class BlockTelepadFake extends BlockAdvancedTile implements ITileEntityPr { public static final PropertyBool TOP = PropertyBool.create("top"); public static final PropertyBool CONNECTABLE = PropertyBool.create("connectable"); + protected static final AxisAlignedBB AABB_TOP = new AxisAlignedBB(0.0F, 0.55F, 0.0F, 1.0F, 1.0F, 1.0F); + protected static final AxisAlignedBB AABB_BOTTOM = new AxisAlignedBB(0.0F, 0.0F, 0.0F, 1.0F, 0.2F, 1.0F); public BlockTelepadFake(String assetName) { @@ -48,6 +51,12 @@ public boolean isOpaqueCube(IBlockState state) return false; } + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + return state.getValue(TOP) ? AABB_TOP : AABB_BOTTOM; + } + // @Override // public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos) // { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java index da82ef4d14..a7a76071f7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockWalkway.java @@ -1,7 +1,6 @@ package micdoodle8.mods.galacticraft.planets.asteroids.blocks; import micdoodle8.mods.galacticraft.api.transmission.NetworkType; -import micdoodle8.mods.galacticraft.api.vector.Vector3; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.blocks.BlockTransmitter; import micdoodle8.mods.galacticraft.core.blocks.ISortableBlock; @@ -27,6 +26,7 @@ import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -38,8 +38,10 @@ public class BlockWalkway extends BlockTransmitter implements ITileEntityProvider, IShiftDescription, ISortableBlock { public static final PropertyEnum WALKWAY_TYPE = PropertyEnum.create("type", EnumWalkwayType.class); - private Vector3 minVector = new Vector3(0.0, 0.32, 0.0); - private Vector3 maxVector = new Vector3(1.0, 1.0, 1.0); +// private Vector3 minVector = new Vector3(0.0, 0.32, 0.0); +// private Vector3 maxVector = new Vector3(1.0, 1.0, 1.0); + protected static final AxisAlignedBB AABB_UNCONNECTED = new AxisAlignedBB(0.0, 0.32, 0.0, 1.0, 1.0, 1.0); + protected static final AxisAlignedBB AABB_CONNECTED_DOWN = new AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); public enum EnumWalkwayType implements IStringSerializable { @@ -84,15 +86,16 @@ protected BlockWalkway(String assetName) } @Override - public Vector3 getMinVector(IBlockState state) + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { - return this.minVector; - } + state = this.getActualState(state, source, pos); - @Override - public Vector3 getMaxVector(IBlockState state) - { - return this.maxVector; + if (state.getValue(DOWN)) + { + return AABB_CONNECTED_DOWN; + } + + return AABB_UNCONNECTED; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java index 09e7182ab0..c2f146f756 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java @@ -14,6 +14,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.Explosion; @@ -24,12 +25,20 @@ public class BlockCreeperEgg extends BlockDragonEgg implements IShiftDescription, ISortableBlock { + protected static final AxisAlignedBB DRAGON_EGG_AABB = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 1.0D, 0.9375D); + public BlockCreeperEgg(String assetName) { super(); this.setUnlocalizedName(assetName); } + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + return DRAGON_EGG_AABB; + } + @Override public boolean isOpaqueCube(IBlockState state) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java index 1e2647364b..42a77a46ab 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java @@ -26,8 +26,10 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -40,6 +42,7 @@ public class BlockSlimelingEgg extends Block implements ITileEntityProvider, ISh // private IIcon[] icons; public static final PropertyEnum EGG_COLOR = PropertyEnum.create("eggcolor", EnumEggColor.class); public static final PropertyBool BROKEN = PropertyBool.create("broken"); + protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.25, 0.0, 0.25, 0.75, 0.625, 0.75); public enum EnumEggColor implements IStringSerializable { @@ -76,19 +79,11 @@ public BlockSlimelingEgg(String assetName) this.setDefaultState(this.blockState.getBaseState().withProperty(EGG_COLOR, EnumEggColor.RED).withProperty(BROKEN, false)); } - /*@Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { - this.icons = new IIcon[6]; - this.icons[0] = iconRegister.registerIcon(MarsModule.TEXTURE_PREFIX + "redEgg_0"); - this.icons[1] = iconRegister.registerIcon(MarsModule.TEXTURE_PREFIX + "blueEgg_0"); - this.icons[2] = iconRegister.registerIcon(MarsModule.TEXTURE_PREFIX + "yellowEgg_0"); - this.icons[3] = iconRegister.registerIcon(MarsModule.TEXTURE_PREFIX + "redEgg_1"); - this.icons[4] = iconRegister.registerIcon(MarsModule.TEXTURE_PREFIX + "blueEgg_1"); - this.icons[5] = iconRegister.registerIcon(MarsModule.TEXTURE_PREFIX + "yellowEgg_1"); - this.blockIcon = this.icons[0]; - }*/ + return AABB; + } @Override public boolean isFullCube(IBlockState state) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockTier2TreasureChest.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockTier2TreasureChest.java index e9955ee746..fe7eaea2ba 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockTier2TreasureChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockTier2TreasureChest.java @@ -1,11 +1,11 @@ package micdoodle8.mods.galacticraft.planets.mars.blocks; -import micdoodle8.mods.galacticraft.core.blocks.BlockT1TreasureChest; +import micdoodle8.mods.galacticraft.core.blocks.BlockTier1TreasureChest; import micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityTreasureChestMars; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -public class BlockTier2TreasureChest extends BlockT1TreasureChest +public class BlockTier2TreasureChest extends BlockTier1TreasureChest { public BlockTier2TreasureChest(String assetName) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTier3TreasureChest.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTier3TreasureChest.java index d53837b408..5e74d50886 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTier3TreasureChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTier3TreasureChest.java @@ -1,11 +1,11 @@ package micdoodle8.mods.galacticraft.planets.venus.blocks; -import micdoodle8.mods.galacticraft.core.blocks.BlockT1TreasureChest; +import micdoodle8.mods.galacticraft.core.blocks.BlockTier1TreasureChest; import micdoodle8.mods.galacticraft.planets.venus.tile.TileEntityTreasureChestVenus; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -public class BlockTier3TreasureChest extends BlockT1TreasureChest +public class BlockTier3TreasureChest extends BlockTier1TreasureChest { public BlockTier3TreasureChest(String assetName) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java index 2d2392cd89..6ad780f07d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java @@ -33,6 +33,8 @@ public class BlockTorchWeb extends Block implements IShearable, IShiftDescription, ISortableBlock { public static final PropertyEnum WEB_TYPE = PropertyEnum.create("webtype", EnumWebType.class); + protected static final AxisAlignedBB AABB_WEB = new AxisAlignedBB(0.35, 0.0, 0.35, 0.65, 1.0, 0.65); + protected static final AxisAlignedBB AABB_WEB_TORCH = new AxisAlignedBB(0.35, 0.25, 0.35, 0.65, 1.0, 0.65); public enum EnumWebType implements IStringSerializable { @@ -79,7 +81,18 @@ public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) list.add(new ItemStack(itemIn, 1, 1)); } -// @Override + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + if (state.getValue(WEB_TYPE) == EnumWebType.WEB_1) + { + return AABB_WEB_TORCH; + } + + return AABB_WEB; + } + + // @Override // public RayTraceResult collisionRayTrace(World worldIn, BlockPos pos, Vec3d start, Vec3d end) // { // EnumWebType type = (EnumWebType)worldIn.getBlockState(pos).getValue(WEB_TYPE); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java index 005266e8e5..6bed4d11b1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomChestVenus.java @@ -1,6 +1,6 @@ package micdoodle8.mods.galacticraft.planets.venus.world.gen.dungeon; -import micdoodle8.mods.galacticraft.core.blocks.BlockT1TreasureChest; +import micdoodle8.mods.galacticraft.core.blocks.BlockTier1TreasureChest; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.EnumFacing; @@ -30,7 +30,7 @@ public boolean addComponentParts(World worldIn, Random rand, StructureBoundingBo int chestX = this.sizeX / 2; int chestY = 1; int chestZ = this.sizeZ / 2; - this.setBlockState(worldIn, Blocks.CHEST.getDefaultState().withProperty(BlockT1TreasureChest.FACING, this.getDirection().getOpposite()), chestX, chestY, chestZ, boundingBox); + this.setBlockState(worldIn, Blocks.CHEST.getDefaultState().withProperty(BlockTier1TreasureChest.FACING, this.getDirection().getOpposite()), chestX, chestY, chestZ, boundingBox); BlockPos blockpos = new BlockPos(this.getXWithOffset(chestX, chestZ), this.getYWithOffset(chestY), this.getZWithOffset(chestX, chestZ)); TileEntityChest chest = (TileEntityChest) worldIn.getTileEntity(blockpos); From 20e1137e564aa59a035d4e9c0e4f199e0d711560 Mon Sep 17 00:00:00 2001 From: Mitch Date: Wed, 15 Mar 2017 01:53:29 -0400 Subject: [PATCH 008/535] Walls now use forge blockstate file --- .../galacticraft/core/blocks/BlockWallGC.java | 89 ++++- .../blockstates/slab_gc_double.json | 8 +- .../blockstates/slab_gc_half.json | 16 +- .../galacticraftcore/blockstates/wall_gc.json | 309 ++++++------------ .../models/block/gc_wall_n.json | 30 -- .../models/block/gc_wall_ne.json | 41 --- .../models/block/gc_wall_ns.json | 18 - .../models/block/gc_wall_ns_above.json | 30 -- .../models/block/gc_wall_nse.json | 52 --- .../models/block/gc_wall_nsew.json | 63 ---- .../models/block/gc_wall_post.json | 19 -- .../models/block/mars_cobblestone_wall_n.json | 6 - .../block/mars_cobblestone_wall_ne.json | 6 - .../block/mars_cobblestone_wall_ns.json | 6 - .../block/mars_cobblestone_wall_ns_above.json | 6 - .../block/mars_cobblestone_wall_nse.json | 6 - .../block/mars_cobblestone_wall_nsew.json | 6 - .../block/mars_cobblestone_wall_post.json | 6 - .../block/mars_dungeon_brick_wall_n.json | 6 - .../block/mars_dungeon_brick_wall_ne.json | 6 - .../block/mars_dungeon_brick_wall_ns.json | 6 - .../mars_dungeon_brick_wall_ns_above.json | 6 - .../block/mars_dungeon_brick_wall_nse.json | 6 - .../block/mars_dungeon_brick_wall_nsew.json | 6 - .../block/mars_dungeon_brick_wall_post.json | 6 - .../block/moon_dungeon_brick_wall_n.json | 6 - .../block/moon_dungeon_brick_wall_ne.json | 6 - .../block/moon_dungeon_brick_wall_ns.json | 6 - .../moon_dungeon_brick_wall_ns_above.json | 6 - .../block/moon_dungeon_brick_wall_nse.json | 6 - .../block/moon_dungeon_brick_wall_nsew.json | 6 - .../block/moon_dungeon_brick_wall_post.json | 6 - .../models/block/moon_stone_wall_n.json | 6 - .../models/block/moon_stone_wall_ne.json | 6 - .../models/block/moon_stone_wall_ns.json | 6 - .../block/moon_stone_wall_ns_above.json | 6 - .../models/block/moon_stone_wall_nse.json | 6 - .../models/block/moon_stone_wall_nsew.json | 6 - .../models/block/moon_stone_wall_post.json | 6 - .../models/block/tin_1_wall_n.json | 8 - .../models/block/tin_1_wall_ne.json | 8 - .../models/block/tin_1_wall_ns.json | 8 - .../models/block/tin_1_wall_ns_above.json | 8 - .../models/block/tin_1_wall_nse.json | 8 - .../models/block/tin_1_wall_nsew.json | 8 - .../models/block/tin_1_wall_post.json | 8 - .../models/block/tin_2_wall_n.json | 6 - .../models/block/tin_2_wall_ne.json | 6 - .../models/block/tin_2_wall_ns.json | 6 - .../models/block/tin_2_wall_ns_above.json | 6 - .../models/block/tin_2_wall_nse.json | 6 - .../models/block/tin_2_wall_nsew.json | 6 - .../models/block/tin_2_wall_post.json | 6 - .../models/block/wall_post.json | 19 ++ .../models/block/wall_side.json | 18 + 55 files changed, 242 insertions(+), 736 deletions(-) delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/gc_wall_n.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/gc_wall_ne.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/gc_wall_ns.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/gc_wall_ns_above.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/gc_wall_nse.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/gc_wall_nsew.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/gc_wall_post.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_n.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_ne.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_ns.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_ns_above.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_nse.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_nsew.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_post.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_n.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_ne.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_ns.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_ns_above.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_nse.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_nsew.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_post.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_n.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_ne.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_ns.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_ns_above.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_nse.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_nsew.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_post.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_n.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_ne.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_ns.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_ns_above.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_nse.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_nsew.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_post.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_n.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_ne.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_ns.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_ns_above.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_nse.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_nsew.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_post.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_n.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_ne.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_ns.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_ns_above.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_nse.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_nsew.json delete mode 100644 src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_post.json create mode 100644 src/main/resources/assets/galacticraftcore/models/block/wall_post.json create mode 100644 src/main/resources/assets/galacticraftcore/models/block/wall_side.json diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java index 962f2e70a5..7c84eafaa4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java @@ -16,8 +16,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -25,6 +27,43 @@ public class BlockWallGC extends Block /* Do not extend BlockWall */ implements ISortableBlock { + protected static final AxisAlignedBB[] AABB_BY_INDEX = new AxisAlignedBB[] { + new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), + new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), + new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), + new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), + new AxisAlignedBB(0.25D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), + new AxisAlignedBB(0.3125D, 0.0D, 0.0D, 0.6875D, 0.875D, 1.0D), + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D), + new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 0.75D), + new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), + new AxisAlignedBB(0.0D, 0.0D, 0.3125D, 1.0D, 0.875D, 0.6875D), + new AxisAlignedBB(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), + new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), + new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), + new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D) + }; + protected static final AxisAlignedBB[] CLIP_AABB_BY_INDEX = new AxisAlignedBB[] { + AABB_BY_INDEX[0].setMaxY(1.5D), + AABB_BY_INDEX[1].setMaxY(1.5D), + AABB_BY_INDEX[2].setMaxY(1.5D), + AABB_BY_INDEX[3].setMaxY(1.5D), + AABB_BY_INDEX[4].setMaxY(1.5D), + AABB_BY_INDEX[5].setMaxY(1.5D), + AABB_BY_INDEX[6].setMaxY(1.5D), + AABB_BY_INDEX[7].setMaxY(1.5D), + AABB_BY_INDEX[8].setMaxY(1.5D), + AABB_BY_INDEX[9].setMaxY(1.5D), + AABB_BY_INDEX[10].setMaxY(1.5D), + AABB_BY_INDEX[11].setMaxY(1.5D), + AABB_BY_INDEX[12].setMaxY(1.5D), + AABB_BY_INDEX[13].setMaxY(1.5D), + AABB_BY_INDEX[14].setMaxY(1.5D), + AABB_BY_INDEX[15].setMaxY(1.5D) + }; + public static PropertyBool UP = PropertyBool.create("up"); public static PropertyBool NORTH = PropertyBool.create("north"); public static PropertyBool EAST = PropertyBool.create("east"); @@ -37,7 +76,7 @@ public BlockWallGC(String name) super(Material.ROCK); this.setHardness(1.5F); this.setResistance(2.5F); - this.setDefaultState(this.getDefaultState().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)).withProperty(VARIANT, BlockType.TIN_1_WALL)); + this.setDefaultState(this.getDefaultState().withProperty(UP, Boolean.FALSE).withProperty(NORTH, Boolean.FALSE).withProperty(EAST, Boolean.FALSE).withProperty(SOUTH, Boolean.FALSE).withProperty(WEST, Boolean.FALSE).withProperty(VARIANT, BlockType.TIN_1_WALL)); this.setUnlocalizedName(name); } @@ -65,6 +104,47 @@ public boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPo return true; } + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) + { + state = this.getActualState(state, source, pos); + return AABB_BY_INDEX[getAABBIndex(state)]; + } + + @Override + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) + { + blockState = this.getActualState(blockState, worldIn, pos); + return CLIP_AABB_BY_INDEX[getAABBIndex(blockState)]; + } + + private static int getAABBIndex(IBlockState state) + { + int i = 0; + + if (state.getValue(NORTH)) + { + i |= 1 << EnumFacing.NORTH.getHorizontalIndex(); + } + + if (state.getValue(EAST)) + { + i |= 1 << EnumFacing.EAST.getHorizontalIndex(); + } + + if (state.getValue(SOUTH)) + { + i |= 1 << EnumFacing.SOUTH.getHorizontalIndex(); + } + + if (state.getValue(WEST)) + { + i |= 1 << EnumFacing.WEST.getHorizontalIndex(); + } + + return i; + } + // @Override // public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos) // { @@ -168,7 +248,12 @@ public int getMetaFromState(IBlockState state) @Override public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) { - return state.withProperty(UP, Boolean.valueOf(this.canConnectTo(world, pos.up()))).withProperty(NORTH, Boolean.valueOf(this.canConnectTo(world, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(world, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(world, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(world, pos.west()))); + boolean flag = this.canConnectTo(world, pos.north()); + boolean flag1 = this.canConnectTo(world, pos.east()); + boolean flag2 = this.canConnectTo(world, pos.south()); + boolean flag3 = this.canConnectTo(world, pos.west()); + boolean flag4 = flag && !flag1 && flag2 && !flag3 || !flag && flag1 && !flag2 && flag3; + return state.withProperty(UP, Boolean.valueOf(!flag4 || !world.isAirBlock(pos.up()))).withProperty(NORTH, Boolean.valueOf(flag)).withProperty(EAST, Boolean.valueOf(flag1)).withProperty(SOUTH, Boolean.valueOf(flag2)).withProperty(WEST, Boolean.valueOf(flag3)); } @Override diff --git a/src/main/resources/assets/galacticraftcore/blockstates/slab_gc_double.json b/src/main/resources/assets/galacticraftcore/blockstates/slab_gc_double.json index 2bf60b5b46..e483768bcc 100644 --- a/src/main/resources/assets/galacticraftcore/blockstates/slab_gc_double.json +++ b/src/main/resources/assets/galacticraftcore/blockstates/slab_gc_double.json @@ -4,9 +4,9 @@ "inventory": [{ "model": "galacticraftcore:deco_block_0_model" }], "variant=tin_slab_1": { "model": "galacticraftcore:deco_block_0_model" }, "variant=tin_slab_2": { "model": "galacticraftcore:deco_block_1_model" }, - "variant=moon_stone_slab": { "model": "galacticraftcore:moon_stone_model" }, - "variant=moon_dungeon_brick_slab": { "model": "galacticraftcore:moon_dungeon_brick_model" }, - "variant=mars_cobblestone_slab": { "model": "galacticraftplanets:cobblestone_model" }, - "variant=mars_dungeon_slab": { "model": "galacticraftplanets:dungeon_brick_model" } + "variant=moon_slab": { "model": "galacticraftcore:moon_stone_model" }, + "variant=moon_bricks_slab": { "model": "galacticraftcore:moon_dungeon_brick_model" }, + "variant=mars_slab": { "model": "galacticraftplanets:cobblestone_model" }, + "variant=mars_bricks_slab": { "model": "galacticraftplanets:dungeon_brick_model" } } } diff --git a/src/main/resources/assets/galacticraftcore/blockstates/slab_gc_half.json b/src/main/resources/assets/galacticraftcore/blockstates/slab_gc_half.json index 15bf2f3af5..1b0f9e66c6 100644 --- a/src/main/resources/assets/galacticraftcore/blockstates/slab_gc_half.json +++ b/src/main/resources/assets/galacticraftcore/blockstates/slab_gc_half.json @@ -4,16 +4,16 @@ "inventory": [{ "model": "galacticraftcore:half_slab_tin_1" }], "half=bottom,variant=tin_slab_1": { "model": "galacticraftcore:half_slab_tin_1" }, "half=bottom,variant=tin_slab_2": { "model": "galacticraftcore:half_slab_tin_2" }, - "half=bottom,variant=moon_stone_slab": { "model": "galacticraftcore:half_slab_moon_stone" }, - "half=bottom,variant=moon_dungeon_brick_slab": { "model": "galacticraftcore:half_slab_moon_dungeon_brick" }, - "half=bottom,variant=mars_cobblestone_slab": { "model": "galacticraftcore:half_slab_mars_cobblestone" }, - "half=bottom,variant=mars_dungeon_slab": { "model": "galacticraftcore:half_slab_mars_dungeon_brick" }, + "half=bottom,variant=moon_slab": { "model": "galacticraftcore:half_slab_moon_stone" }, + "half=bottom,variant=moon_bricks_slab": { "model": "galacticraftcore:half_slab_moon_dungeon_brick" }, + "half=bottom,variant=mars_slab": { "model": "galacticraftcore:half_slab_mars_cobblestone" }, + "half=bottom,variant=mars_bricks_slab": { "model": "galacticraftcore:half_slab_mars_dungeon_brick" }, "half=top,variant=tin_slab_1": { "model": "galacticraftcore:upper_slab_tin_1" }, "half=top,variant=tin_slab_2": { "model": "galacticraftcore:upper_slab_tin_2" }, - "half=top,variant=moon_stone_slab": { "model": "galacticraftcore:upper_slab_moon_stone" }, - "half=top,variant=moon_dungeon_brick_slab": { "model": "galacticraftcore:upper_slab_moon_dungeon_brick" }, - "half=top,variant=mars_cobblestone_slab": { "model": "galacticraftcore:upper_slab_mars_cobblestone" }, - "half=top,variant=mars_dungeon_slab": { "model": "galacticraftcore:upper_slab_mars_dungeon_brick" } + "half=top,variant=moon_slab": { "model": "galacticraftcore:upper_slab_moon_stone" }, + "half=top,variant=moon_bricks_slab": { "model": "galacticraftcore:upper_slab_moon_dungeon_brick" }, + "half=top,variant=mars_slab": { "model": "galacticraftcore:upper_slab_mars_cobblestone" }, + "half=top,variant=mars_bricks_slab": { "model": "galacticraftcore:upper_slab_mars_dungeon_brick" } } } diff --git a/src/main/resources/assets/galacticraftcore/blockstates/wall_gc.json b/src/main/resources/assets/galacticraftcore/blockstates/wall_gc.json index c135c1f166..6af933c924 100644 --- a/src/main/resources/assets/galacticraftcore/blockstates/wall_gc.json +++ b/src/main/resources/assets/galacticraftcore/blockstates/wall_gc.json @@ -1,204 +1,107 @@ { - "forge_marker": 1, - "variants": { - "inventory": [{ "model": "galacticraftcore:tin_1_wall_post" }], - - "east=false,north=false,south=false,up=false,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_post" }, - "east=false,north=true,south=false,up=false,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_n" }, - "east=true,north=false,south=false,up=false,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_n", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=false,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_n", "y": 180, "uvlock": true }, - "east=false,north=false,south=false,up=false,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_n", "y": 270, "uvlock": true }, - "east=true,north=true,south=false,up=false,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_ne" }, - "east=true,north=false,south=true,up=false,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_ne", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=false,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_ne", "y": 180, "uvlock": true }, - "east=false,north=true,south=false,up=false,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_ne", "y": 270, "uvlock": true }, - "east=false,north=true,south=true,up=false,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_ns" }, - "east=true,north=false,south=false,up=false,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_ns", "y": 90, "uvlock": true }, - "east=true,north=true,south=true,up=false,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_nse" }, - "east=true,north=false,south=true,up=false,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_nse", "y": 90, "uvlock": true }, - "east=false,north=true,south=true,up=false,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_nse", "y": 180, "uvlock": true }, - "east=true,north=true,south=false,up=false,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_nse", "y": 270, "uvlock": true }, - "east=true,north=true,south=true,up=false,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_nsew" }, - "east=false,north=false,south=false,up=true,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_post" }, - "east=false,north=true,south=false,up=true,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_n" }, - "east=true,north=false,south=false,up=true,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_n", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=true,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_n", "y": 180, "uvlock": true }, - "east=false,north=false,south=false,up=true,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_n", "y": 270, "uvlock": true }, - "east=true,north=true,south=false,up=true,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_ne" }, - "east=true,north=false,south=true,up=true,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_ne", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=true,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_ne", "y": 180, "uvlock": true }, - "east=false,north=true,south=false,up=true,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_ne", "y": 270, "uvlock": true }, - "east=false,north=true,south=true,up=true,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_ns_above" }, - "east=true,north=false,south=false,up=true,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_ns_above", "y": 90, "uvlock": true }, - "east=true,north=true,south=true,up=true,variant=tin_1_wall,west=false": { "model": "galacticraftcore:tin_1_wall_nse" }, - "east=true,north=false,south=true,up=true,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_nse", "y": 90, "uvlock": true }, - "east=false,north=true,south=true,up=true,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_nse", "y": 180, "uvlock": true }, - "east=true,north=true,south=false,up=true,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_nse", "y": 270, "uvlock": true }, - "east=true,north=true,south=true,up=true,variant=tin_1_wall,west=true": { "model": "galacticraftcore:tin_1_wall_nsew" }, - - "east=false,north=false,south=false,up=false,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_post" }, - "east=false,north=true,south=false,up=false,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_n" }, - "east=true,north=false,south=false,up=false,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_n", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=false,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_n", "y": 180, "uvlock": true }, - "east=false,north=false,south=false,up=false,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_n", "y": 270, "uvlock": true }, - "east=true,north=true,south=false,up=false,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_ne" }, - "east=true,north=false,south=true,up=false,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_ne", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=false,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_ne", "y": 180, "uvlock": true }, - "east=false,north=true,south=false,up=false,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_ne", "y": 270, "uvlock": true }, - "east=false,north=true,south=true,up=false,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_ns" }, - "east=true,north=false,south=false,up=false,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_ns", "y": 90, "uvlock": true }, - "east=true,north=true,south=true,up=false,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_nse" }, - "east=true,north=false,south=true,up=false,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_nse", "y": 90, "uvlock": true }, - "east=false,north=true,south=true,up=false,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_nse", "y": 180, "uvlock": true }, - "east=true,north=true,south=false,up=false,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_nse", "y": 270, "uvlock": true }, - "east=true,north=true,south=true,up=false,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_nsew" }, - "east=false,north=false,south=false,up=true,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_post" }, - "east=false,north=true,south=false,up=true,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_n" }, - "east=true,north=false,south=false,up=true,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_n", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=true,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_n", "y": 180, "uvlock": true }, - "east=false,north=false,south=false,up=true,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_n", "y": 270, "uvlock": true }, - "east=true,north=true,south=false,up=true,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_ne" }, - "east=true,north=false,south=true,up=true,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_ne", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=true,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_ne", "y": 180, "uvlock": true }, - "east=false,north=true,south=false,up=true,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_ne", "y": 270, "uvlock": true }, - "east=false,north=true,south=true,up=true,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_ns_above" }, - "east=true,north=false,south=false,up=true,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_ns_above", "y": 90, "uvlock": true }, - "east=true,north=true,south=true,up=true,variant=tin_2_wall,west=false": { "model": "galacticraftcore:tin_2_wall_nse" }, - "east=true,north=false,south=true,up=true,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_nse", "y": 90, "uvlock": true }, - "east=false,north=true,south=true,up=true,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_nse", "y": 180, "uvlock": true }, - "east=true,north=true,south=false,up=true,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_nse", "y": 270, "uvlock": true }, - "east=true,north=true,south=true,up=true,variant=tin_2_wall,west=true": { "model": "galacticraftcore:tin_2_wall_nsew" }, - - "east=false,north=false,south=false,up=false,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_post" }, - "east=false,north=true,south=false,up=false,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_n" }, - "east=true,north=false,south=false,up=false,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_n", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=false,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_n", "y": 180, "uvlock": true }, - "east=false,north=false,south=false,up=false,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_n", "y": 270, "uvlock": true }, - "east=true,north=true,south=false,up=false,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_ne" }, - "east=true,north=false,south=true,up=false,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_ne", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=false,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_ne", "y": 180, "uvlock": true }, - "east=false,north=true,south=false,up=false,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_ne", "y": 270, "uvlock": true }, - "east=false,north=true,south=true,up=false,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_ns" }, - "east=true,north=false,south=false,up=false,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_ns", "y": 90, "uvlock": true }, - "east=true,north=true,south=true,up=false,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_nse" }, - "east=true,north=false,south=true,up=false,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_nse", "y": 90, "uvlock": true }, - "east=false,north=true,south=true,up=false,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_nse", "y": 180, "uvlock": true }, - "east=true,north=true,south=false,up=false,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_nse", "y": 270, "uvlock": true }, - "east=true,north=true,south=true,up=false,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_nsew" }, - "east=false,north=false,south=false,up=true,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_post" }, - "east=false,north=true,south=false,up=true,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_n" }, - "east=true,north=false,south=false,up=true,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_n", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=true,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_n", "y": 180, "uvlock": true }, - "east=false,north=false,south=false,up=true,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_n", "y": 270, "uvlock": true }, - "east=true,north=true,south=false,up=true,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_ne" }, - "east=true,north=false,south=true,up=true,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_ne", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=true,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_ne", "y": 180, "uvlock": true }, - "east=false,north=true,south=false,up=true,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_ne", "y": 270, "uvlock": true }, - "east=false,north=true,south=true,up=true,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_ns_above" }, - "east=true,north=false,south=false,up=true,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_ns_above", "y": 90, "uvlock": true }, - "east=true,north=true,south=true,up=true,variant=moon_stone_wall,west=false": { "model": "galacticraftcore:moon_stone_wall_nse" }, - "east=true,north=false,south=true,up=true,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_nse", "y": 90, "uvlock": true }, - "east=false,north=true,south=true,up=true,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_nse", "y": 180, "uvlock": true }, - "east=true,north=true,south=false,up=true,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_nse", "y": 270, "uvlock": true }, - "east=true,north=true,south=true,up=true,variant=moon_stone_wall,west=true": { "model": "galacticraftcore:moon_stone_wall_nsew" }, - - "east=false,north=false,south=false,up=false,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_post" }, - "east=false,north=true,south=false,up=false,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_n" }, - "east=true,north=false,south=false,up=false,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_n", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=false,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_n", "y": 180, "uvlock": true }, - "east=false,north=false,south=false,up=false,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_n", "y": 270, "uvlock": true }, - "east=true,north=true,south=false,up=false,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_ne" }, - "east=true,north=false,south=true,up=false,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_ne", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=false,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_ne", "y": 180, "uvlock": true }, - "east=false,north=true,south=false,up=false,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_ne", "y": 270, "uvlock": true }, - "east=false,north=true,south=true,up=false,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_ns" }, - "east=true,north=false,south=false,up=false,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_ns", "y": 90, "uvlock": true }, - "east=true,north=true,south=true,up=false,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_nse" }, - "east=true,north=false,south=true,up=false,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_nse", "y": 90, "uvlock": true }, - "east=false,north=true,south=true,up=false,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_nse", "y": 180, "uvlock": true }, - "east=true,north=true,south=false,up=false,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_nse", "y": 270, "uvlock": true }, - "east=true,north=true,south=true,up=false,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_nsew" }, - "east=false,north=false,south=false,up=true,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_post" }, - "east=false,north=true,south=false,up=true,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_n" }, - "east=true,north=false,south=false,up=true,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_n", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=true,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_n", "y": 180, "uvlock": true }, - "east=false,north=false,south=false,up=true,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_n", "y": 270, "uvlock": true }, - "east=true,north=true,south=false,up=true,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_ne" }, - "east=true,north=false,south=true,up=true,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_ne", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=true,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_ne", "y": 180, "uvlock": true }, - "east=false,north=true,south=false,up=true,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_ne", "y": 270, "uvlock": true }, - "east=false,north=true,south=true,up=true,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_ns_above" }, - "east=true,north=false,south=false,up=true,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_ns_above", "y": 90, "uvlock": true }, - "east=true,north=true,south=true,up=true,variant=moon_dungeon_brick_wall,west=false": { "model": "galacticraftcore:moon_dungeon_brick_wall_nse" }, - "east=true,north=false,south=true,up=true,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_nse", "y": 90, "uvlock": true }, - "east=false,north=true,south=true,up=true,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_nse", "y": 180, "uvlock": true }, - "east=true,north=true,south=false,up=true,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_nse", "y": 270, "uvlock": true }, - "east=true,north=true,south=true,up=true,variant=moon_dungeon_brick_wall,west=true": { "model": "galacticraftcore:moon_dungeon_brick_wall_nsew" }, - - "east=false,north=false,south=false,up=false,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_post" }, - "east=false,north=true,south=false,up=false,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_n" }, - "east=true,north=false,south=false,up=false,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_n", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=false,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_n", "y": 180, "uvlock": true }, - "east=false,north=false,south=false,up=false,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_n", "y": 270, "uvlock": true }, - "east=true,north=true,south=false,up=false,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_ne" }, - "east=true,north=false,south=true,up=false,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_ne", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=false,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_ne", "y": 180, "uvlock": true }, - "east=false,north=true,south=false,up=false,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_ne", "y": 270, "uvlock": true }, - "east=false,north=true,south=true,up=false,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_ns" }, - "east=true,north=false,south=false,up=false,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_ns", "y": 90, "uvlock": true }, - "east=true,north=true,south=true,up=false,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_nse" }, - "east=true,north=false,south=true,up=false,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_nse", "y": 90, "uvlock": true }, - "east=false,north=true,south=true,up=false,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_nse", "y": 180, "uvlock": true }, - "east=true,north=true,south=false,up=false,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_nse", "y": 270, "uvlock": true }, - "east=true,north=true,south=true,up=false,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_nsew" }, - "east=false,north=false,south=false,up=true,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_post" }, - "east=false,north=true,south=false,up=true,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_n" }, - "east=true,north=false,south=false,up=true,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_n", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=true,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_n", "y": 180, "uvlock": true }, - "east=false,north=false,south=false,up=true,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_n", "y": 270, "uvlock": true }, - "east=true,north=true,south=false,up=true,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_ne" }, - "east=true,north=false,south=true,up=true,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_ne", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=true,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_ne", "y": 180, "uvlock": true }, - "east=false,north=true,south=false,up=true,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_ne", "y": 270, "uvlock": true }, - "east=false,north=true,south=true,up=true,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_ns_above" }, - "east=true,north=false,south=false,up=true,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_ns_above", "y": 90, "uvlock": true }, - "east=true,north=true,south=true,up=true,variant=mars_cobblestone_wall,west=false": { "model": "galacticraftcore:mars_cobblestone_wall_nse" }, - "east=true,north=false,south=true,up=true,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_nse", "y": 90, "uvlock": true }, - "east=false,north=true,south=true,up=true,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_nse", "y": 180, "uvlock": true }, - "east=true,north=true,south=false,up=true,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_nse", "y": 270, "uvlock": true }, - "east=true,north=true,south=true,up=true,variant=mars_cobblestone_wall,west=true": { "model": "galacticraftcore:mars_cobblestone_wall_nsew" }, - - "east=false,north=false,south=false,up=false,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_post" }, - "east=false,north=true,south=false,up=false,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_n" }, - "east=true,north=false,south=false,up=false,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_n", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=false,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_n", "y": 180, "uvlock": true }, - "east=false,north=false,south=false,up=false,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_n", "y": 270, "uvlock": true }, - "east=true,north=true,south=false,up=false,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_ne" }, - "east=true,north=false,south=true,up=false,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_ne", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=false,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_ne", "y": 180, "uvlock": true }, - "east=false,north=true,south=false,up=false,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_ne", "y": 270, "uvlock": true }, - "east=false,north=true,south=true,up=false,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_ns" }, - "east=true,north=false,south=false,up=false,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_ns", "y": 90, "uvlock": true }, - "east=true,north=true,south=true,up=false,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_nse" }, - "east=true,north=false,south=true,up=false,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_nse", "y": 90, "uvlock": true }, - "east=false,north=true,south=true,up=false,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_nse", "y": 180, "uvlock": true }, - "east=true,north=true,south=false,up=false,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_nse", "y": 270, "uvlock": true }, - "east=true,north=true,south=true,up=false,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_nsew" }, - "east=false,north=false,south=false,up=true,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_post" }, - "east=false,north=true,south=false,up=true,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_n" }, - "east=true,north=false,south=false,up=true,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_n", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=true,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_n", "y": 180, "uvlock": true }, - "east=false,north=false,south=false,up=true,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_n", "y": 270, "uvlock": true }, - "east=true,north=true,south=false,up=true,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_ne" }, - "east=true,north=false,south=true,up=true,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_ne", "y": 90, "uvlock": true }, - "east=false,north=false,south=true,up=true,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_ne", "y": 180, "uvlock": true }, - "east=false,north=true,south=false,up=true,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_ne", "y": 270, "uvlock": true }, - "east=false,north=true,south=true,up=true,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_ns_above" }, - "east=true,north=false,south=false,up=true,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_ns_above", "y": 90, "uvlock": true }, - "east=true,north=true,south=true,up=true,variant=mars_dungeon_brick_wall,west=false": { "model": "galacticraftcore:mars_dungeon_brick_wall_nse" }, - "east=true,north=false,south=true,up=true,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_nse", "y": 90, "uvlock": true }, - "east=false,north=true,south=true,up=true,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_nse", "y": 180, "uvlock": true }, - "east=true,north=true,south=false,up=true,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_nse", "y": 270, "uvlock": true }, - "east=true,north=true,south=true,up=true,variant=mars_dungeon_brick_wall,west=true": { "model": "galacticraftcore:mars_dungeon_brick_wall_nsew" } - } -} + "forge_marker": 1, + "defaults": { + "textures": { + "wall": "galacticraftcore:blocks/deco_block_side", + "wall_bot": "galacticraftcore:blocks/deco_block_up", + "wall_top": "galacticraftcore:blocks/deco_block" + }, + "uvlock": true + }, + "variants": { + "north": { + "true": { + "submodel": { + "north": { "model": "galacticraftcore:wall_side" } + } + }, + "false": { + + } + }, + "east": { + "true": { + "submodel": { + "east": { "model": "galacticraftcore:wall_side", "y": 90, "uvlock": true } + } + }, + "false": { + + } + }, + "south": { + "true": { + "submodel": { + "south": { "model": "galacticraftcore:wall_side", "y": 180, "uvlock": true } + } + }, + "false": { + + } + }, + "west": { + "true": { + "submodel": { + "west": { "model": "galacticraftcore:wall_side", "y": 270, "uvlock": true } + } + }, + "false": { + + } + }, + "up": { + "true": { + "submodel": { + "up": { "model": "galacticraftcore:wall_post" } + } + }, + "false": { + + } + }, + "variant": { + "tin_1_wall": { + "textures": { + "wall": "galacticraftcore:blocks/deco_block_side", + "wall_bot": "galacticraftcore:blocks/deco_block_up", + "wall_top": "galacticraftcore:blocks/deco_block" + } + }, + "tin_2_wall": { + "textures": { + "wall": "galacticraftcore:blocks/deco_block", + "wall_bot": "galacticraftcore:blocks/deco_block", + "wall_top": "galacticraftcore:blocks/deco_block" + } + }, + "moon_stone_wall": { + "textures": { + "wall": "galacticraftcore:blocks/bottom", + "wall_bot": "galacticraftcore:blocks/bottom", + "wall_top": "galacticraftcore:blocks/bottom" + } + }, + "moon_dungeon_brick_wall": { + "textures": { + "wall": "galacticraftcore:blocks/brick", + "wall_bot": "galacticraftcore:blocks/brick", + "wall_top": "galacticraftcore:blocks/brick" + } + }, + "mars_cobblestone_wall": { + "textures": { + "wall": "galacticraftplanets:blocks/cobblestone", + "wall_bot": "galacticraftplanets:blocks/cobblestone", + "wall_top": "galacticraftplanets:blocks/cobblestone" + } + }, + "mars_dungeon_brick_wall": { + "textures": { + "wall": "galacticraftplanets:blocks/brick", + "wall_bot": "galacticraftplanets:blocks/brick", + "wall_top": "galacticraftplanets:blocks/brick" + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_n.json b/src/main/resources/assets/galacticraftcore/models/block/gc_wall_n.json deleted file mode 100644 index 834310ba2c..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_n.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "textures": { - "particle": "#wall" - }, - "elements": [ - { "from": [ 4, 0, 4 ], - "to": [ 12, 16, 12 ], - "faces": { - "down": { "uv": [ 4, 4, 12, 12 ], "texture": "#wall_bot", "cullface": "down" }, - "up": { "uv": [ 4, 4, 12, 12 ], "texture": "#wall_top", "cullface": "up" }, - "north": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "south": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "west": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "east": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" } - }, - "__comment": "Center post" - }, - { "from": [ 5, 0, 0 ], - "to": [ 11, 13, 4 ], - "faces": { - "down": { "uv": [ 5, 0, 11, 4 ], "texture": "#wall_bot", "cullface": "down" }, - "up": { "uv": [ 5, 0, 11, 4 ], "texture": "#wall_top" }, - "north": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall", "cullface": "north" }, - "west": { "uv": [ 0, 3, 4, 16 ], "texture": "#wall" }, - "east": { "uv": [ 0, 3, 4, 16 ], "texture": "#wall" } - }, - "__comment": "North wall" - } - ] -} diff --git a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_ne.json b/src/main/resources/assets/galacticraftcore/models/block/gc_wall_ne.json deleted file mode 100644 index bb54c00130..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_ne.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "textures": { - "particle": "#wall" - }, - "elements": [ - { "from": [ 4, 0, 4 ], - "to": [ 12, 16, 12 ], - "faces": { - "down": { "uv": [ 4, 4, 12, 12 ], "texture": "#wall_bot", "cullface": "down" }, - "up": { "uv": [ 4, 4, 12, 12 ], "texture": "#wall_top", "cullface": "up" }, - "north": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "south": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "west": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "east": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" } - }, - "__comment": "Center post" - }, - { "from": [ 5, 0, 0 ], - "to": [ 11, 13, 4 ], - "faces": { - "down": { "uv": [ 5, 0, 11, 4 ], "texture": "#wall_bot", "cullface": "down" }, - "up": { "uv": [ 5, 0, 11, 4 ], "texture": "#wall_top" }, - "north": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall", "cullface": "north" }, - "west": { "uv": [ 0, 3, 4, 16 ], "texture": "#wall" }, - "east": { "uv": [ 0, 3, 4, 16 ], "texture": "#wall" } - }, - "__comment": "North wall" - }, - { "from": [ 12, 0, 5 ], - "to": [ 16, 13, 11 ], - "faces": { - "down": { "uv": [ 5, 12, 11, 16 ], "texture": "#wall_bot", "rotation": 90, "cullface": "down" }, - "up": { "uv": [ 5, 12, 11, 16 ], "texture": "#wall_top", "rotation": 90 }, - "north": { "uv": [ 12, 3, 16, 16 ], "texture": "#wall" }, - "south": { "uv": [ 12, 3, 16, 16 ], "texture": "#wall" }, - "east": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall", "cullface": "east" } - }, - "__comment": "East wall" - } - ] -} diff --git a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_ns.json b/src/main/resources/assets/galacticraftcore/models/block/gc_wall_ns.json deleted file mode 100644 index be00ce34f4..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_ns.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "textures": { - "particle": "#wall" - }, - "elements": [ - { "from": [ 5, 0, 0 ], - "to": [ 11, 13, 16 ], - "faces": { - "down": { "uv": [ 5, 0, 11, 16 ], "texture": "#wall_bot", "cullface": "down" }, - "up": { "uv": [ 5, 0, 11, 16 ], "texture": "#wall_top" }, - "north": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall", "cullface": "north" }, - "south": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall", "cullface": "south" }, - "west": { "uv": [ 0, 3, 16, 16 ], "texture": "#wall" }, - "east": { "uv": [ 0, 3, 16, 16 ], "texture": "#wall" } - } - } - ] -} diff --git a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_ns_above.json b/src/main/resources/assets/galacticraftcore/models/block/gc_wall_ns_above.json deleted file mode 100644 index 6159257443..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_ns_above.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "textures": { - "particle": "#wall" - }, - "elements": [ - { "from": [ 4, 0, 4 ], - "to": [ 12, 16, 12 ], - "faces": { - "down": { "uv": [ 4, 4, 12, 12 ], "texture": "#wall_bot", "cullface": "down" }, - "up": { "uv": [ 4, 4, 12, 12 ], "texture": "#wall_top", "cullface": "up" }, - "north": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "south": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "west": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "east": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" } - }, - "__comment": "Center post" - }, - { "from": [ 5, 0, 0 ], - "to": [ 11, 13, 16 ], - "faces": { - "down": { "uv": [ 5, 0, 11, 16 ], "texture": "#wall_bot", "cullface": "down" }, - "up": { "uv": [ 5, 0, 11, 16 ], "texture": "#wall_top" }, - "north": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall", "cullface": "north" }, - "south": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall", "cullface": "south" }, - "west": { "uv": [ 0, 3, 16, 16 ], "texture": "#wall" }, - "east": { "uv": [ 0, 3, 16, 16 ], "texture": "#wall" } - } - } - ] -} diff --git a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_nse.json b/src/main/resources/assets/galacticraftcore/models/block/gc_wall_nse.json deleted file mode 100644 index a8a9e566ac..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_nse.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "textures": { - "particle": "#wall" - }, - "elements": [ - { "from": [ 4, 0, 4 ], - "to": [ 12, 16, 12 ], - "faces": { - "down": { "uv": [ 4, 4, 12, 12 ], "texture": "#wall_bot", "cullface": "down" }, - "up": { "uv": [ 4, 4, 12, 12 ], "texture": "#wall_top", "cullface": "up" }, - "north": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "south": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "west": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "east": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" } - }, - "__comment": "Center post" - }, - { "from": [ 5, 0, 0 ], - "to": [ 11, 13, 4 ], - "faces": { - "down": { "uv": [ 5, 0, 11, 4 ], "texture": "#wall_bot", "cullface": "down" }, - "up": { "uv": [ 5, 0, 11, 4 ], "texture": "#wall_top" }, - "north": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall", "cullface": "north" }, - "west": { "uv": [ 0, 3, 4, 16 ], "texture": "#wall" }, - "east": { "uv": [ 0, 3, 4, 16 ], "texture": "#wall" } - }, - "__comment": "North wall" - }, - { "from": [ 5, 0, 12 ], - "to": [ 11, 13, 16 ], - "faces": { - "down": { "uv": [ 5, 12, 11, 16 ], "texture": "#wall_bot", "cullface": "down" }, - "up": { "uv": [ 5, 12, 11, 16 ], "texture": "#wall_top" }, - "south": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall", "cullface": "south" }, - "west": { "uv": [ 12, 3, 16, 16 ], "texture": "#wall" }, - "east": { "uv": [ 12, 3, 16, 16 ], "texture": "#wall" } - }, - "__comment": "South wall" - }, - { "from": [ 12, 0, 5 ], - "to": [ 16, 13, 11 ], - "faces": { - "down": { "uv": [ 5, 12, 11, 16 ], "texture": "#wall_bot", "rotation": 90, "cullface": "down" }, - "up": { "uv": [ 5, 12, 11, 16 ], "texture": "#wall_top", "rotation": 90 }, - "north": { "uv": [ 12, 3, 16, 16 ], "texture": "#wall" }, - "south": { "uv": [ 12, 3, 16, 16 ], "texture": "#wall" }, - "east": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall", "cullface": "east" } - }, - "__comment": "East wall" - } - ] -} diff --git a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_nsew.json b/src/main/resources/assets/galacticraftcore/models/block/gc_wall_nsew.json deleted file mode 100644 index 983bd4502e..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_nsew.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "textures": { - "particle": "#wall" - }, - "elements": [ - { "from": [ 4, 0, 4 ], - "to": [ 12, 16, 12 ], - "faces": { - "down": { "uv": [ 4, 4, 12, 12 ], "texture": "#wall_bot", "cullface": "down" }, - "up": { "uv": [ 4, 4, 12, 12 ], "texture": "#wall_top", "cullface": "up" }, - "north": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "south": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "west": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "east": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" } - }, - "__comment": "Center post" - }, - { "from": [ 5, 0, 0 ], - "to": [ 11, 13, 4 ], - "faces": { - "down": { "uv": [ 5, 0, 11, 4 ], "texture": "#wall_bot", "cullface": "down" }, - "up": { "uv": [ 5, 0, 11, 4 ], "texture": "#wall_top" }, - "north": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall", "cullface": "north" }, - "west": { "uv": [ 0, 3, 4, 16 ], "texture": "#wall" }, - "east": { "uv": [ 0, 3, 4, 16 ], "texture": "#wall" } - }, - "__comment": "North wall" - }, - { "from": [ 5, 0, 12 ], - "to": [ 11, 13, 16 ], - "faces": { - "down": { "uv": [ 5, 12, 11, 16 ], "texture": "#wall_bot", "cullface": "down" }, - "up": { "uv": [ 5, 12, 11, 16 ], "texture": "#wall_top" }, - "south": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall", "cullface": "south" }, - "west": { "uv": [ 12, 3, 16, 16 ], "texture": "#wall" }, - "east": { "uv": [ 12, 3, 16, 16 ], "texture": "#wall" } - }, - "__comment": "South wall" - }, - { "from": [ 12, 0, 5 ], - "to": [ 16, 13, 11 ], - "faces": { - "down": { "uv": [ 5, 12, 11, 16 ], "texture": "#wall_bot", "rotation": 90, "cullface": "down" }, - "up": { "uv": [ 5, 12, 11, 16 ], "texture": "#wall_top", "rotation": 90 }, - "north": { "uv": [ 12, 3, 16, 16 ], "texture": "#wall" }, - "south": { "uv": [ 12, 3, 16, 16 ], "texture": "#wall" }, - "east": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall", "cullface": "east" } - }, - "__comment": "East wall" - }, - { "from": [ 0, 0, 5 ], - "to": [ 4, 13, 11 ], - "faces": { - "down": { "uv": [ 5, 0, 11, 4 ], "texture": "#wall_bot", "rotation": 90, "cullface": "down" }, - "up": { "uv": [ 5, 0, 11, 4 ], "texture": "#wall_top", "rotation": 90 }, - "north": { "uv": [ 0, 3, 4, 16 ], "texture": "#wall" }, - "south": { "uv": [ 0, 3, 4, 16 ], "texture": "#wall" }, - "west": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall", "cullface": "west" } - }, - "__comment": "West wall" - } - ] -} diff --git a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_post.json b/src/main/resources/assets/galacticraftcore/models/block/gc_wall_post.json deleted file mode 100644 index 0e31c86c8b..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/gc_wall_post.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "textures": { - "particle": "#wall" - }, - "elements": [ - { "from": [ 4, 0, 4 ], - "to": [ 12, 16, 12 ], - "faces": { - "down": { "uv": [ 4, 4, 12, 12 ], "texture": "#wall_bot", "cullface": "down" }, - "up": { "uv": [ 4, 4, 12, 12 ], "texture": "#wall_top", "cullface": "up" }, - "north": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "south": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "west": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" }, - "east": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall" } - }, - "__comment": "Center post" - } - ] -} diff --git a/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_n.json b/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_n.json deleted file mode 100644 index 5f2454975c..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_n.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_n", - "textures": { - "wall": "galacticraftplanets:blocks/cobblestone" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_ne.json b/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_ne.json deleted file mode 100644 index 4cdc804a67..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_ne.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_ne", - "textures": { - "wall": "galacticraftplanets:blocks/cobblestone" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_ns.json b/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_ns.json deleted file mode 100644 index 6c22382797..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_ns.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_ns", - "textures": { - "wall": "galacticraftplanets:blocks/cobblestone" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_ns_above.json b/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_ns_above.json deleted file mode 100644 index f591f2a838..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_ns_above.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_ns_above", - "textures": { - "wall": "galacticraftplanets:blocks/cobblestone" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_nse.json b/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_nse.json deleted file mode 100644 index 2b71d3530f..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_nse.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_nse", - "textures": { - "wall": "galacticraftplanets:blocks/cobblestone" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_nsew.json b/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_nsew.json deleted file mode 100644 index 5a305918f6..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_nsew.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_nsew", - "textures": { - "wall": "galacticraftplanets:blocks/cobblestone" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_post.json b/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_post.json deleted file mode 100644 index 78299e67fa..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/mars_cobblestone_wall_post.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_post", - "textures": { - "wall": "galacticraftplanets:blocks/cobblestone" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_n.json b/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_n.json deleted file mode 100644 index 0739a56d51..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_n.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_n", - "textures": { - "wall": "galacticraftplanets:blocks/brick" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_ne.json b/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_ne.json deleted file mode 100644 index edf0695dac..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_ne.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_ne", - "textures": { - "wall": "galacticraftplanets:blocks/brick" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_ns.json b/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_ns.json deleted file mode 100644 index 0d9c3cd11f..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_ns.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_ns", - "textures": { - "wall": "galacticraftplanets:blocks/brick" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_ns_above.json b/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_ns_above.json deleted file mode 100644 index b5a43411fd..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_ns_above.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_ns_above", - "textures": { - "wall": "galacticraftplanets:blocks/brick" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_nse.json b/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_nse.json deleted file mode 100644 index 65f8e1c995..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_nse.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_nse", - "textures": { - "wall": "galacticraftplanets:blocks/brick" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_nsew.json b/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_nsew.json deleted file mode 100644 index 6dd4be9f3c..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_nsew.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_nsew", - "textures": { - "wall": "galacticraftplanets:blocks/brick" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_post.json b/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_post.json deleted file mode 100644 index a1598fab80..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/mars_dungeon_brick_wall_post.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_post", - "textures": { - "wall": "galacticraftplanets:blocks/brick" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_n.json b/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_n.json deleted file mode 100644 index 3d53ce8692..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_n.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_n", - "textures": { - "wall": "galacticraftcore:blocks/brick" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_ne.json b/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_ne.json deleted file mode 100644 index fff7cd086b..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_ne.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_ne", - "textures": { - "wall": "galacticraftcore:blocks/brick" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_ns.json b/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_ns.json deleted file mode 100644 index f5f9183f68..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_ns.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_ns", - "textures": { - "wall": "galacticraftcore:blocks/brick" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_ns_above.json b/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_ns_above.json deleted file mode 100644 index 92fe5be8c5..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_ns_above.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_ns_above", - "textures": { - "wall": "galacticraftcore:blocks/brick" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_nse.json b/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_nse.json deleted file mode 100644 index c4c9755510..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_nse.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_nse", - "textures": { - "wall": "galacticraftcore:blocks/brick" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_nsew.json b/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_nsew.json deleted file mode 100644 index 4e5677dd92..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_nsew.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_nsew", - "textures": { - "wall": "galacticraftcore:blocks/brick" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_post.json b/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_post.json deleted file mode 100644 index d25e24942c..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/moon_dungeon_brick_wall_post.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_post", - "textures": { - "wall": "galacticraftcore:blocks/brick" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_n.json b/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_n.json deleted file mode 100644 index 3417ca28f3..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_n.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_n", - "textures": { - "wall": "galacticraftcore:blocks/bottom" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_ne.json b/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_ne.json deleted file mode 100644 index 4bfec33d01..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_ne.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_ne", - "textures": { - "wall": "galacticraftcore:blocks/bottom" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_ns.json b/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_ns.json deleted file mode 100644 index 6c3c9feeff..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_ns.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_ns", - "textures": { - "wall": "galacticraftcore:blocks/bottom" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_ns_above.json b/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_ns_above.json deleted file mode 100644 index a0cf6ea214..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_ns_above.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_ns_above", - "textures": { - "wall": "galacticraftcore:blocks/bottom" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_nse.json b/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_nse.json deleted file mode 100644 index 1c6a4e6c90..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_nse.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_nse", - "textures": { - "wall": "galacticraftcore:blocks/bottom" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_nsew.json b/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_nsew.json deleted file mode 100644 index a8fe1ea483..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_nsew.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_nsew", - "textures": { - "wall": "galacticraftcore:blocks/bottom" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_post.json b/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_post.json deleted file mode 100644 index 494c6cc9c7..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/moon_stone_wall_post.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_post", - "textures": { - "wall": "galacticraftcore:blocks/bottom" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_n.json b/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_n.json deleted file mode 100644 index 6dd66a1e77..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_n.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "parent": "galacticraftcore:block/gc_wall_n", - "textures": { - "wall": "galacticraftcore:blocks/deco_block_side", - "wall_bot": "galacticraftcore:blocks/deco_block_up", - "wall_top": "galacticraftcore:blocks/deco_block" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_ne.json b/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_ne.json deleted file mode 100644 index 849b077491..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_ne.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "parent": "galacticraftcore:block/gc_wall_ne", - "textures": { - "wall": "galacticraftcore:blocks/deco_block_side", - "wall_bot": "galacticraftcore:blocks/deco_block_up", - "wall_top": "galacticraftcore:blocks/deco_block" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_ns.json b/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_ns.json deleted file mode 100644 index be587049f1..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_ns.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "parent": "galacticraftcore:block/gc_wall_ns", - "textures": { - "wall": "galacticraftcore:blocks/deco_block_side", - "wall_bot": "galacticraftcore:blocks/deco_block_up", - "wall_top": "galacticraftcore:blocks/deco_block" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_ns_above.json b/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_ns_above.json deleted file mode 100644 index b01e7401ce..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_ns_above.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "parent": "galacticraftcore:block/gc_wall_ns_above", - "textures": { - "wall": "galacticraftcore:blocks/deco_block_side", - "wall_bot": "galacticraftcore:blocks/deco_block_up", - "wall_top": "galacticraftcore:blocks/deco_block" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_nse.json b/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_nse.json deleted file mode 100644 index 07c8228d81..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_nse.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "parent": "galacticraftcore:block/gc_wall_nse", - "textures": { - "wall": "galacticraftcore:blocks/deco_block_side", - "wall_bot": "galacticraftcore:blocks/deco_block_up", - "wall_top": "galacticraftcore:blocks/deco_block" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_nsew.json b/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_nsew.json deleted file mode 100644 index d0e105012b..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_nsew.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "parent": "galacticraftcore:block/gc_wall_nsew", - "textures": { - "wall": "galacticraftcore:blocks/deco_block_side", - "wall_bot": "galacticraftcore:blocks/deco_block_up", - "wall_top": "galacticraftcore:blocks/deco_block" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_post.json b/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_post.json deleted file mode 100644 index 3228903b6d..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/tin_1_wall_post.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "parent": "galacticraftcore:block/gc_wall_post", - "textures": { - "wall": "galacticraftcore:blocks/deco_block_side", - "wall_bot": "galacticraftcore:blocks/deco_block_up", - "wall_top": "galacticraftcore:blocks/deco_block" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_n.json b/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_n.json deleted file mode 100644 index e5e5150477..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_n.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_n", - "textures": { - "wall": "galacticraftcore:blocks/deco_block" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_ne.json b/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_ne.json deleted file mode 100644 index 08d08d78fb..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_ne.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_ne", - "textures": { - "wall": "galacticraftcore:blocks/deco_block" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_ns.json b/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_ns.json deleted file mode 100644 index 1ecdcf9c64..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_ns.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_ns", - "textures": { - "wall": "galacticraftcore:blocks/deco_block" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_ns_above.json b/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_ns_above.json deleted file mode 100644 index ed87313608..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_ns_above.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_ns_above", - "textures": { - "wall": "galacticraftcore:blocks/deco_block" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_nse.json b/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_nse.json deleted file mode 100644 index 4529dc7990..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_nse.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_nse", - "textures": { - "wall": "galacticraftcore:blocks/deco_block" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_nsew.json b/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_nsew.json deleted file mode 100644 index 7370dc1ae6..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_nsew.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_nsew", - "textures": { - "wall": "galacticraftcore:blocks/deco_block" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_post.json b/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_post.json deleted file mode 100644 index 8872f45a24..0000000000 --- a/src/main/resources/assets/galacticraftcore/models/block/tin_2_wall_post.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "parent": "block/wall_post", - "textures": { - "wall": "galacticraftcore:blocks/deco_block" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/models/block/wall_post.json b/src/main/resources/assets/galacticraftcore/models/block/wall_post.json new file mode 100644 index 0000000000..1fa78d4fa5 --- /dev/null +++ b/src/main/resources/assets/galacticraftcore/models/block/wall_post.json @@ -0,0 +1,19 @@ +{ + "textures": { + "particle": "#wall" + }, + "elements": [ + { "from": [ 4, 0, 4 ], + "to": [ 12, 16, 12 ], + "faces": { + "down": { "texture": "#wall_bot", "cullface": "down" }, + "up": { "texture": "#wall_top", "cullface": "up" }, + "north": { "texture": "#wall" }, + "south": { "texture": "#wall" }, + "west": { "texture": "#wall" }, + "east": { "texture": "#wall" } + }, + "__comment": "Center post" + } + ] +} diff --git a/src/main/resources/assets/galacticraftcore/models/block/wall_side.json b/src/main/resources/assets/galacticraftcore/models/block/wall_side.json new file mode 100644 index 0000000000..7da73fda76 --- /dev/null +++ b/src/main/resources/assets/galacticraftcore/models/block/wall_side.json @@ -0,0 +1,18 @@ +{ + "textures": { + "particle": "#wall" + }, + "elements": [ + { "from": [ 5, 0, 0 ], + "to": [ 11, 14, 8 ], + "faces": { + "down": { "texture": "#wall_bot", "cullface": "down" }, + "up": { "texture": "#wall_top" }, + "north": { "texture": "#wall", "cullface": "north" }, + "west": { "texture": "#wall" }, + "east": { "texture": "#wall" } + }, + "__comment": "wall" + } + ] +} From 4133b1a4552ce8c92b76c0497a95d1bebbe6ba35 Mon Sep 17 00:00:00 2001 From: Mitch Date: Wed, 15 Mar 2017 02:27:25 -0400 Subject: [PATCH 009/535] Add missing @Override annotations --- .../prefab/entity/EntitySpaceshipBase.java | 3 + .../gui/screen/GuiPreLaunchChecklist.java | 1 + .../entities/layer/LayerThermalPadding.java | 1 + .../core/entities/EntityAlienVillager.java | 3 + .../core/entities/EntitySkeletonBoss.java | 1 + .../core/entities/player/StatsCapability.java | 145 ++++++++++++++++++ .../core/proxy/ClientProxyCore.java | 1 + .../mods/galacticraft/core/util/MapGen.java | 2 + .../core/world/gen/ChunkProviderMoon.java | 1 + .../gen/layer_mapping/GenLayerAddIsland.java | 1 + .../GenLayerAddMushroomIsland.java | 1 + .../gen/layer_mapping/GenLayerAddSnow.java | 1 + .../gen/layer_mapping/GenLayerBiome.java | 1 + .../gen/layer_mapping/GenLayerBiomeEdge.java | 1 + .../gen/layer_mapping/GenLayerDeepOcean.java | 1 + .../world/gen/layer_mapping/GenLayerEdge.java | 1 + .../gen/layer_mapping/GenLayerFuzzyZoom.java | 1 + .../gen/layer_mapping/GenLayerGCMap.java | 7 + .../gen/layer_mapping/GenLayerHills.java | 1 + .../gen/layer_mapping/GenLayerIsland.java | 1 + .../gen/layer_mapping/GenLayerRareBiome.java | 1 + .../GenLayerRemoveTooMuchOcean.java | 1 + .../gen/layer_mapping/GenLayerRiver.java | 1 + .../gen/layer_mapping/GenLayerRiverInit.java | 1 + .../gen/layer_mapping/GenLayerRiverMix.java | 2 + .../gen/layer_mapping/GenLayerShore.java | 1 + .../gen/layer_mapping/GenLayerSmooth.java | 1 + .../layer_mapping/GenLayerVoronoiZoom.java | 1 + .../world/gen/layer_mapping/GenLayerZoom.java | 1 + .../planets/mars/blocks/BlockMachineMars.java | 1 + .../mars/entities/EntitySludgeling.java | 3 + .../planets/venus/blocks/BlockSpout.java | 2 + .../planets/venus/entities/EntityJuicer.java | 4 + 33 files changed, 195 insertions(+) diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java index e0e21501bf..17006a882f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntitySpaceshipBase.java @@ -612,6 +612,7 @@ public ArrayList getTelemetry() return returnList; } + @Override public void transmitData(int[] data) { data[0] = this.timeUntilLaunch; @@ -621,6 +622,7 @@ public void transmitData(int[] data) data[4] = (int) this.rotationPitch; } + @Override public void receiveData(int[] data, String[] str) { //Spaceships: @@ -637,6 +639,7 @@ public void receiveData(int[] data, String[] str) str[4] = GCCoreUtil.translate("gui.message.fuel.name") + ": " + data[3] + "%"; } + @Override public void adjustDisplay(int[] data) { GL11.glRotatef(data[4], -1, 0, 0); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiPreLaunchChecklist.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiPreLaunchChecklist.java index 9c9166ba1c..29e40231ae 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiPreLaunchChecklist.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiPreLaunchChecklist.java @@ -242,6 +242,7 @@ public NextPageButton(int id, int x, int y, boolean forward) this.forward = forward; } + @Override public void drawButton(Minecraft mc, int mouseX, int mouseY) { if (this.visible) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/layer/LayerThermalPadding.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/layer/LayerThermalPadding.java index 7dc773f724..e36bb13b46 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/layer/LayerThermalPadding.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/layer/LayerThermalPadding.java @@ -92,6 +92,7 @@ public ItemStack getItemStackFromSlot(EntityLivingBase living, EntityEquipmentSl return null; } + @Override public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { this.renderArmorLayer(entitylivingbaseIn, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale, EntityEquipmentSlot.CHEST); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAlienVillager.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAlienVillager.java index 42cff4f3c5..db76ff9856 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAlienVillager.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAlienVillager.java @@ -263,16 +263,19 @@ protected float getSoundPitch() return (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 0.5F; } + @Override protected SoundEvent getAmbientSound() { return this.isTrading() ? SoundEvents.ENTITY_VILLAGER_TRADING : SoundEvents.ENTITY_VILLAGER_AMBIENT; } + @Override protected SoundEvent getHurtSound() { return SoundEvents.ENTITY_VILLAGER_HURT; } + @Override protected SoundEvent getDeathSound() { return SoundEvents.ENTITY_VILLAGER_DEATH; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntitySkeletonBoss.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntitySkeletonBoss.java index 4374d28bd6..979d14a29c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntitySkeletonBoss.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntitySkeletonBoss.java @@ -337,6 +337,7 @@ public boolean shouldIgnoreShiftExit() return true; } + @Override public ItemStack getGuaranteedLoot(Random rand) { List stackList = GalacticraftRegistry.getDungeonLoot(1); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsCapability.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsCapability.java index b3fdf57901..3878596e15 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsCapability.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsCapability.java @@ -132,701 +132,841 @@ public class StatsCapability implements IStatsCapability public int glassColor2 = -1; public int glassColor3 = -1; + @Override public WeakReference getPlayer() { return player; } + @Override public void setPlayer(WeakReference player) { this.player = player; } + @Override public InventoryExtended getExtendedInventory() { return extendedInventory; } + @Override public void setExtendedInventory(InventoryExtended extendedInventory) { this.extendedInventory = extendedInventory; } + @Override public int getAirRemaining() { return airRemaining; } + @Override public void setAirRemaining(int airRemaining) { this.airRemaining = airRemaining; } + @Override public int getAirRemaining2() { return airRemaining2; } + @Override public void setAirRemaining2(int airRemaining2) { this.airRemaining2 = airRemaining2; } + @Override public int getThermalLevel() { return thermalLevel; } + @Override public void setThermalLevel(int thermalLevel) { this.thermalLevel = thermalLevel; } + @Override public boolean isThermalLevelNormalising() { return thermalLevelNormalising; } + @Override public void setThermalLevelNormalising(boolean thermalLevelNormalising) { this.thermalLevelNormalising = thermalLevelNormalising; } + @Override public int getDamageCounter() { return damageCounter; } + @Override public void setDamageCounter(int damageCounter) { this.damageCounter = damageCounter; } + @Override public int getSpaceshipTier() { return spaceshipTier; } + @Override public void setSpaceshipTier(int spaceshipTier) { this.spaceshipTier = spaceshipTier; } + @Override public ItemStack[] getRocketStacks() { return rocketStacks; } + @Override public void setRocketStacks(ItemStack[] rocketStacks) { this.rocketStacks = rocketStacks; } + @Override public int getRocketType() { return rocketType; } + @Override public void setRocketType(int rocketType) { this.rocketType = rocketType; } + @Override public int getFuelLevel() { return fuelLevel; } + @Override public void setFuelLevel(int fuelLevel) { this.fuelLevel = fuelLevel; } + @Override public Item getRocketItem() { return rocketItem; } + @Override public void setRocketItem(Item rocketItem) { this.rocketItem = rocketItem; } + @Override public ItemStack getLaunchpadStack() { return launchpadStack; } + @Override public void setLaunchpadStack(ItemStack launchpadStack) { this.launchpadStack = launchpadStack; } + @Override public int getAstroMinerCount() { return astroMinerCount; } + @Override public void setAstroMinerCount(int astroMinerCount) { this.astroMinerCount = astroMinerCount; } + @Override public boolean isUsingParachute() { return usingParachute; } + @Override public void setUsingParachute(boolean usingParachute) { this.usingParachute = usingParachute; } + @Override public ItemStack getParachuteInSlot() { return parachuteInSlot; } + @Override public void setParachuteInSlot(ItemStack parachuteInSlot) { this.parachuteInSlot = parachuteInSlot; } + @Override public ItemStack getLastParachuteInSlot() { return lastParachuteInSlot; } + @Override public void setLastParachuteInSlot(ItemStack lastParachuteInSlot) { this.lastParachuteInSlot = lastParachuteInSlot; } + @Override public ItemStack getFrequencyModuleInSlot() { return frequencyModuleInSlot; } + @Override public void setFrequencyModuleInSlot(ItemStack frequencyModuleInSlot) { this.frequencyModuleInSlot = frequencyModuleInSlot; } + @Override public ItemStack getLastFrequencyModuleInSlot() { return lastFrequencyModuleInSlot; } + @Override public void setLastFrequencyModuleInSlot(ItemStack lastFrequencyModuleInSlot) { this.lastFrequencyModuleInSlot = lastFrequencyModuleInSlot; } + @Override public ItemStack getMaskInSlot() { return maskInSlot; } + @Override public void setMaskInSlot(ItemStack maskInSlot) { this.maskInSlot = maskInSlot; } + @Override public ItemStack getLastMaskInSlot() { return lastMaskInSlot; } + @Override public void setLastMaskInSlot(ItemStack lastMaskInSlot) { this.lastMaskInSlot = lastMaskInSlot; } + @Override public ItemStack getGearInSlot() { return gearInSlot; } + @Override public void setGearInSlot(ItemStack gearInSlot) { this.gearInSlot = gearInSlot; } + @Override public ItemStack getLastGearInSlot() { return lastGearInSlot; } + @Override public void setLastGearInSlot(ItemStack lastGearInSlot) { this.lastGearInSlot = lastGearInSlot; } + @Override public ItemStack getTankInSlot1() { return tankInSlot1; } + @Override public void setTankInSlot1(ItemStack tankInSlot1) { this.tankInSlot1 = tankInSlot1; } + @Override public ItemStack getLastTankInSlot1() { return lastTankInSlot1; } + @Override public void setLastTankInSlot1(ItemStack lastTankInSlot1) { this.lastTankInSlot1 = lastTankInSlot1; } + @Override public ItemStack getTankInSlot2() { return tankInSlot2; } + @Override public void setTankInSlot2(ItemStack tankInSlot2) { this.tankInSlot2 = tankInSlot2; } + @Override public ItemStack getLastTankInSlot2() { return lastTankInSlot2; } + @Override public void setLastTankInSlot2(ItemStack lastTankInSlot2) { this.lastTankInSlot2 = lastTankInSlot2; } + @Override public ItemStack getThermalHelmetInSlot() { return thermalHelmetInSlot; } + @Override public void setThermalHelmetInSlot(ItemStack thermalHelmetInSlot) { this.thermalHelmetInSlot = thermalHelmetInSlot; } + @Override public ItemStack getLastThermalHelmetInSlot() { return lastThermalHelmetInSlot; } + @Override public void setLastThermalHelmetInSlot(ItemStack lastThermalHelmetInSlot) { this.lastThermalHelmetInSlot = lastThermalHelmetInSlot; } + @Override public ItemStack getThermalChestplateInSlot() { return thermalChestplateInSlot; } + @Override public void setThermalChestplateInSlot(ItemStack thermalChestplateInSlot) { this.thermalChestplateInSlot = thermalChestplateInSlot; } + @Override public ItemStack getLastThermalChestplateInSlot() { return lastThermalChestplateInSlot; } + @Override public void setLastThermalChestplateInSlot(ItemStack lastThermalChestplateInSlot) { this.lastThermalChestplateInSlot = lastThermalChestplateInSlot; } + @Override public ItemStack getThermalLeggingsInSlot() { return thermalLeggingsInSlot; } + @Override public void setThermalLeggingsInSlot(ItemStack thermalLeggingsInSlot) { this.thermalLeggingsInSlot = thermalLeggingsInSlot; } + @Override public ItemStack getLastThermalLeggingsInSlot() { return lastThermalLeggingsInSlot; } + @Override public void setLastThermalLeggingsInSlot(ItemStack lastThermalLeggingsInSlot) { this.lastThermalLeggingsInSlot = lastThermalLeggingsInSlot; } + @Override public ItemStack getThermalBootsInSlot() { return thermalBootsInSlot; } + @Override public void setThermalBootsInSlot(ItemStack thermalBootsInSlot) { this.thermalBootsInSlot = thermalBootsInSlot; } + @Override public ItemStack getLastThermalBootsInSlot() { return lastThermalBootsInSlot; } + @Override public void setLastThermalBootsInSlot(ItemStack lastThermalBootsInSlot) { this.lastThermalBootsInSlot = lastThermalBootsInSlot; } + @Override public ItemStack getShieldControllerInSlot() { return shieldControllerInSlot; } + @Override public void setShieldControllerInSlot(ItemStack shieldControllerInSlot) { this.shieldControllerInSlot = shieldControllerInSlot; } + @Override public ItemStack getLastShieldControllerInSlot() { return lastShieldControllerInSlot; } + @Override public void setLastShieldControllerInSlot(ItemStack lastShieldControllerInSlot) { this.lastShieldControllerInSlot = lastShieldControllerInSlot; } + @Override public int getLaunchAttempts() { return launchAttempts; } + @Override public void setLaunchAttempts(int launchAttempts) { this.launchAttempts = launchAttempts; } + @Override public int getSpaceRaceInviteTeamID() { return spaceRaceInviteTeamID; } + @Override public void setSpaceRaceInviteTeamID(int spaceRaceInviteTeamID) { this.spaceRaceInviteTeamID = spaceRaceInviteTeamID; } + @Override public boolean isUsingPlanetSelectionGui() { return usingPlanetSelectionGui; } + @Override public void setUsingPlanetSelectionGui(boolean usingPlanetSelectionGui) { this.usingPlanetSelectionGui = usingPlanetSelectionGui; } + @Override public String getSavedPlanetList() { return savedPlanetList; } + @Override public void setSavedPlanetList(String savedPlanetList) { this.savedPlanetList = savedPlanetList; } + @Override public int getOpenPlanetSelectionGuiCooldown() { return openPlanetSelectionGuiCooldown; } + @Override public void setOpenPlanetSelectionGuiCooldown(int openPlanetSelectionGuiCooldown) { this.openPlanetSelectionGuiCooldown = openPlanetSelectionGuiCooldown; } + @Override public boolean hasOpenedPlanetSelectionGui() { return hasOpenedPlanetSelectionGui; } + @Override public void setHasOpenedPlanetSelectionGui(boolean hasOpenedPlanetSelectionGui) { this.hasOpenedPlanetSelectionGui = hasOpenedPlanetSelectionGui; } + @Override public int getChestSpawnCooldown() { return chestSpawnCooldown; } + @Override public void setChestSpawnCooldown(int chestSpawnCooldown) { this.chestSpawnCooldown = chestSpawnCooldown; } + @Override public Vector3 getChestSpawnVector() { return chestSpawnVector; } + @Override public void setChestSpawnVector(Vector3 chestSpawnVector) { this.chestSpawnVector = chestSpawnVector; } + @Override public int getTeleportCooldown() { return teleportCooldown; } + @Override public void setTeleportCooldown(int teleportCooldown) { this.teleportCooldown = teleportCooldown; } + @Override public int getChatCooldown() { return chatCooldown; } + @Override public void setChatCooldown(int chatCooldown) { this.chatCooldown = chatCooldown; } + @Override public double getDistanceSinceLastStep() { return distanceSinceLastStep; } + @Override public void setDistanceSinceLastStep(double distanceSinceLastStep) { this.distanceSinceLastStep = distanceSinceLastStep; } + @Override public int getLastStep() { return lastStep; } + @Override public void setLastStep(int lastStep) { this.lastStep = lastStep; } + @Override public double getCoordsTeleportedFromX() { return coordsTeleportedFromX; } + @Override public void setCoordsTeleportedFromX(double coordsTeleportedFromX) { this.coordsTeleportedFromX = coordsTeleportedFromX; } + @Override public double getCoordsTeleportedFromZ() { return coordsTeleportedFromZ; } + @Override public void setCoordsTeleportedFromZ(double coordsTeleportedFromZ) { this.coordsTeleportedFromZ = coordsTeleportedFromZ; } + @Override public HashMap getSpaceStationDimensionData() { return spaceStationDimensionData; } + @Override public void setSpaceStationDimensionData(HashMap spaceStationDimensionData) { this.spaceStationDimensionData = spaceStationDimensionData; } + @Override public boolean isOxygenSetupValid() { return oxygenSetupValid; } + @Override public void setOxygenSetupValid(boolean oxygenSetupValid) { this.oxygenSetupValid = oxygenSetupValid; } + @Override public boolean isLastOxygenSetupValid() { return lastOxygenSetupValid; } + @Override public void setLastOxygenSetupValid(boolean lastOxygenSetupValid) { this.lastOxygenSetupValid = lastOxygenSetupValid; } + @Override public boolean isTouchedGround() { return touchedGround; } + @Override public void setTouchedGround(boolean touchedGround) { this.touchedGround = touchedGround; } + @Override public boolean isLastOnGround() { return lastOnGround; } + @Override public void setLastOnGround(boolean lastOnGround) { this.lastOnGround = lastOnGround; } + @Override public boolean isInLander() { return inLander; } + @Override public void setInLander(boolean inLander) { this.inLander = inLander; } + @Override public boolean hasJustLanded() { return justLanded; } + @Override public void setJustLanded(boolean justLanded) { this.justLanded = justLanded; } + @Override public ArrayList getUnlockedSchematics() { return unlockedSchematics; } + @Override public void setUnlockedSchematics(ArrayList unlockedSchematics) { this.unlockedSchematics = unlockedSchematics; } + @Override public ArrayList getLastUnlockedSchematics() { return lastUnlockedSchematics; } + @Override public void setLastUnlockedSchematics(ArrayList lastUnlockedSchematics) { this.lastUnlockedSchematics = lastUnlockedSchematics; } + @Override public int getCryogenicChamberCooldown() { return cryogenicChamberCooldown; } + @Override public void setCryogenicChamberCooldown(int cryogenicChamberCooldown) { this.cryogenicChamberCooldown = cryogenicChamberCooldown; } + @Override public boolean hasReceivedSoundWarning() { return receivedSoundWarning; } + @Override public void setReceivedSoundWarning(boolean receivedSoundWarning) { this.receivedSoundWarning = receivedSoundWarning; } + @Override public boolean hasReceivedBedWarning() { return receivedBedWarning; } + @Override public void setReceivedBedWarning(boolean receivedBedWarning) { this.receivedBedWarning = receivedBedWarning; } + @Override public boolean hasOpenedSpaceRaceManager() { return openedSpaceRaceManager; } + @Override public void setOpenedSpaceRaceManager(boolean openedSpaceRaceManager) { this.openedSpaceRaceManager = openedSpaceRaceManager; } + @Override public boolean isSentFlags() { return sentFlags; } + @Override public void setSentFlags(boolean sentFlags) { this.sentFlags = sentFlags; } + @Override public boolean isNewInOrbit() { return newInOrbit; } + @Override public void setNewInOrbit(boolean newInOrbit) { this.newInOrbit = newInOrbit; } + @Override public boolean isNewAdventureSpawn() { return newAdventureSpawn; } + @Override public void setNewAdventureSpawn(boolean newAdventureSpawn) { this.newAdventureSpawn = newAdventureSpawn; } + @Override public int getBuildFlags() { return buildFlags; } + @Override public void setBuildFlags(int buildFlags) { this.buildFlags = buildFlags; } + @Override public int getIncrementalDamage() { return incrementalDamage; } + @Override public void setIncrementalDamage(int incrementalDamage) { this.incrementalDamage = incrementalDamage; } + @Override public String getStartDimension() { return startDimension; } + @Override public void setStartDimension(String startDimension) { this.startDimension = startDimension; @@ -1080,6 +1220,7 @@ public void loadNBTData(NBTTagCompound nbt) GCLog.debug("Finished loading GC player data for " + player.get().getGameProfile().getName() + " : " + this.buildFlags); } + @Override public void copyFrom(IStatsCapability oldData, boolean keepInv) { if (keepInv) @@ -1098,6 +1239,7 @@ public void copyFrom(IStatsCapability oldData, boolean keepInv) this.sentFlags = false; } + @Override public void setGlassColors(int color1, int color2, int color3) { boolean changes = false; @@ -1120,16 +1262,19 @@ public void setGlassColors(int color1, int color2, int color3) ColorUtil.sendUpdatedColorsToPlayer(this); } + @Override public int getGlassColor1() { return glassColor1; } + @Override public int getGlassColor2() { return glassColor2; } + @Override public int getGlassColor3() { return glassColor3; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java index 6f72ec7ba2..e0a2d094e5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java @@ -154,6 +154,7 @@ public void init(FMLInitializationEvent event) Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(new IBlockColor() { + @Override public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) { return BlockFallenMeteor.colorMultiplier(worldIn, pos); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java index f67c90361d..8b63f2f0a1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java @@ -106,6 +106,7 @@ public MapGen(World world, int sx, int sz, int cx, int cz, int scale, File file) this.initialise(seed); } + @Override public void run() { //Allow some time for the pause on any other map gen thread to become effective @@ -508,6 +509,7 @@ private void func_147423_a(int cx, int cy, int cz) * REPLICATES method in WorldChunkManager * Returns an array of biomes for the location input, used for generating the height map */ + @Override public Biome[] getBiomesForGeneration(Biome[] biomes, int x, int z, int width, int height) { IntCache.resetIntCache(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java index 7d657bca5a..f03ef0a6d3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/ChunkProviderMoon.java @@ -66,6 +66,7 @@ public ChunkProviderMoon(World par1World, long par2, boolean par4) this.noiseGen4 = new Gradient(this.rand.nextLong(), 1, 0.25F); } + @Override public void setBlocksInChunk(int chunkX, int chunkZ, ChunkPrimer primer) { this.noiseGen1.setFrequency(0.0125F); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddIsland.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddIsland.java index 2327d404a0..58ddfd5f4b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddIsland.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddIsland.java @@ -12,6 +12,7 @@ public GenLayerAddIsland(long p_i2119_1_, GenLayerGCMap p_i2119_3_) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int i = areaX - 1; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddMushroomIsland.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddMushroomIsland.java index 9c3509ba4a..7b43520692 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddMushroomIsland.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddMushroomIsland.java @@ -15,6 +15,7 @@ public GenLayerAddMushroomIsland(long p_i2120_1_, GenLayerGCMap p_i2120_3_) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int i = areaX - 1; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddSnow.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddSnow.java index 0048b59e39..ca790fcdc7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddSnow.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerAddSnow.java @@ -12,6 +12,7 @@ public GenLayerAddSnow(long p_i2121_1_, GenLayerGCMap p_i2121_3_) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int i = areaX - 1; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiome.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiome.java index e56ffdd460..927b7f1562 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiome.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiome.java @@ -57,6 +57,7 @@ else if (p_i45560_4_ == WorldType.CUSTOMIZED) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int[] aint = this.parent.getInts(areaX, areaY, areaWidth, areaHeight); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiomeEdge.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiomeEdge.java index d2c758481f..e581b9d802 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiomeEdge.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerBiomeEdge.java @@ -15,6 +15,7 @@ public GenLayerBiomeEdge(long p_i45475_1_, GenLayerGCMap p_i45475_3_) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int[] aint = this.parent.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerDeepOcean.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerDeepOcean.java index 550f190eb8..930b4697fb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerDeepOcean.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerDeepOcean.java @@ -15,6 +15,7 @@ public GenLayerDeepOcean(long p_i45472_1_, GenLayerGCMap p_i45472_3_) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int i = areaX - 1; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerEdge.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerEdge.java index cbbf299d7a..6ac4cae4af 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerEdge.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerEdge.java @@ -15,6 +15,7 @@ public GenLayerEdge(long p_i45474_1_, GenLayerGCMap p_i45474_3_, GenLayerEdge.Mo * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { switch (this.field_151627_c) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerFuzzyZoom.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerFuzzyZoom.java index 88b095c8be..fefd4879ed 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerFuzzyZoom.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerFuzzyZoom.java @@ -10,6 +10,7 @@ public GenLayerFuzzyZoom(long p_i2123_1_, GenLayerGCMap p_i2123_3_) /** * returns the most frequently occurring number of the set, or a random number from those provided */ + @Override protected int selectModeOrRandom(int p_151617_1_, int p_151617_2_, int p_151617_3_, int p_151617_4_) { return this.selectRandom(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_}); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerGCMap.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerGCMap.java index 32e55db13c..dd48410958 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerGCMap.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerGCMap.java @@ -121,6 +121,7 @@ public GenLayerGCMap(long p_i2125_1_) * Initialize layer's local worldGenSeed based on its own baseSeed and the world's global seed (passed in as an * argument). */ + @Override public void initWorldGenSeed(long seed) { this.worldGenSeed = seed; @@ -141,6 +142,7 @@ public void initWorldGenSeed(long seed) /** * Initialize layer's current chunkSeed based on the local worldGenSeed and the (x,z) chunk coordinates. */ + @Override public void initChunkSeed(long p_75903_1_, long p_75903_3_) { this.chunkSeed = this.worldGenSeed; @@ -157,6 +159,7 @@ public void initChunkSeed(long p_75903_1_, long p_75903_3_) /** * returns a LCG pseudo random number from [0, x). Args: int x */ + @Override protected int nextInt(int p_75902_1_) { int i = (int)((this.chunkSeed >> 24) % (long)p_75902_1_); @@ -175,6 +178,7 @@ protected int nextInt(int p_75902_1_) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public abstract int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight); protected static boolean biomesEqualOrMesaPlateau(int biomeIDA, int biomeIDB) @@ -232,6 +236,7 @@ protected static boolean isBiomeOceanic(int p_151618_0_) /** * selects a random integer from a set of provided integers */ + @Override protected int selectRandom(int... p_151619_1_) { return p_151619_1_[this.nextInt(p_151619_1_.length)]; @@ -240,12 +245,14 @@ protected int selectRandom(int... p_151619_1_) /** * returns the most frequently occurring number of the set, or a random number from those provided */ + @Override protected int selectModeOrRandom(int p_151617_1_, int p_151617_2_, int p_151617_3_, int p_151617_4_) { return p_151617_2_ == p_151617_3_ && p_151617_3_ == p_151617_4_ ? p_151617_2_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_3_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_1_ == p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_2_ && p_151617_3_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_3_ && p_151617_2_ != p_151617_4_ ? p_151617_1_ : (p_151617_1_ == p_151617_4_ && p_151617_2_ != p_151617_3_ ? p_151617_1_ : (p_151617_2_ == p_151617_3_ && p_151617_1_ != p_151617_4_ ? p_151617_2_ : (p_151617_2_ == p_151617_4_ && p_151617_1_ != p_151617_3_ ? p_151617_2_ : (p_151617_3_ == p_151617_4_ && p_151617_1_ != p_151617_2_ ? p_151617_3_ : this.selectRandom(new int[] {p_151617_1_, p_151617_2_, p_151617_3_, p_151617_4_})))))))))); } /* ======================================== FORGE START =====================================*/ + @Override protected long nextLong(long par1) { long j = (this.chunkSeed >> 24) % par1; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerHills.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerHills.java index 370494ab69..ae43618cc6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerHills.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerHills.java @@ -21,6 +21,7 @@ public GenLayerHills(long p_i45479_1_, GenLayerGCMap p_i45479_3_, GenLayerGCMap * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int[] aint = this.parent.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerIsland.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerIsland.java index 83f18691ba..ff132989ac 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerIsland.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerIsland.java @@ -11,6 +11,7 @@ public GenLayerIsland(long p_i2124_1_) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int[] aint = IntCache.getIntCache(areaWidth * areaHeight); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRareBiome.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRareBiome.java index 165613333e..4d77fbfccb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRareBiome.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRareBiome.java @@ -15,6 +15,7 @@ public GenLayerRareBiome(long p_i45478_1_, GenLayerGCMap p_i45478_3_) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int[] aint = this.parent.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRemoveTooMuchOcean.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRemoveTooMuchOcean.java index 9679db1c63..41d36015a9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRemoveTooMuchOcean.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRemoveTooMuchOcean.java @@ -12,6 +12,7 @@ public GenLayerRemoveTooMuchOcean(long p_i45480_1_, GenLayerGCMap p_i45480_3_) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int i = areaX - 1; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiver.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiver.java index bf21cb3b45..b839938e00 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiver.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiver.java @@ -15,6 +15,7 @@ public GenLayerRiver(long p_i2128_1_, GenLayerGCMap p_i2128_3_) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int i = areaX - 1; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverInit.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverInit.java index ec1cabc91e..5f4141aaa0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverInit.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverInit.java @@ -12,6 +12,7 @@ public GenLayerRiverInit(long p_i2127_1_, GenLayerGCMap p_i2127_3_) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int[] aint = this.parent.getInts(areaX, areaY, areaWidth, areaHeight); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverMix.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverMix.java index 283c32f811..9b0056e7a4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverMix.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerRiverMix.java @@ -19,6 +19,7 @@ public GenLayerRiverMix(long p_i2129_1_, GenLayerGCMap p_i2129_3_, GenLayerGCMap * Initialize layer's local worldGenSeed based on its own baseSeed and the world's global seed (passed in as an * argument). */ + @Override public void initWorldGenSeed(long seed) { this.biomePatternGeneratorChain.initWorldGenSeed(seed); @@ -30,6 +31,7 @@ public void initWorldGenSeed(long seed) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int[] aint = this.biomePatternGeneratorChain.getInts(areaX, areaY, areaWidth, areaHeight); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerShore.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerShore.java index e92969ea84..59712a96df 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerShore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerShore.java @@ -17,6 +17,7 @@ public GenLayerShore(long p_i2130_1_, GenLayerGCMap p_i2130_3_) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int[] aint = this.parent.getInts(areaX - 1, areaY - 1, areaWidth + 2, areaHeight + 2); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerSmooth.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerSmooth.java index cc2732f36f..dac3b7d79f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerSmooth.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerSmooth.java @@ -12,6 +12,7 @@ public GenLayerSmooth(long p_i2131_1_, GenLayerGCMap p_i2131_3_) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int i = areaX - 1; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerVoronoiZoom.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerVoronoiZoom.java index 02a5e11ecc..c40d27580a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerVoronoiZoom.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerVoronoiZoom.java @@ -12,6 +12,7 @@ public GenLayerVoronoiZoom(long p_i2133_1_, GenLayerGCMap p_i2133_3_) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { areaX = areaX - 2; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerZoom.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerZoom.java index 397746d185..5d3ed6a3a5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerZoom.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/layer_mapping/GenLayerZoom.java @@ -12,6 +12,7 @@ public GenLayerZoom(long p_i2134_1_, GenLayerGCMap p_i2134_3_) * Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall * amounts, or biomeList[] indices based on the particular GenLayer subclass. */ + @Override public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { int i = areaX >> 1; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java index cb910efbef..a18245d717 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java @@ -393,6 +393,7 @@ public EnumSortCategoryBlock getCategory(int meta) return EnumSortCategoryBlock.MACHINE; } + @Override public boolean isSealed(World world, BlockPos pos, EnumFacing direction) { return world.getBlockState(pos).getValue(TYPE) != EnumMachineType.CRYOGENIC_CHAMBER; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java index 1581ed4f73..729bf31bdd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySludgeling.java @@ -57,16 +57,19 @@ protected boolean canTriggerWalking() return false; } + @Override protected SoundEvent getAmbientSound() { return SoundEvents.ENTITY_SILVERFISH_AMBIENT; } + @Override protected SoundEvent getHurtSound() { return SoundEvents.ENTITY_SILVERFISH_HURT; } + @Override protected SoundEvent getDeathSound() { return SoundEvents.ENTITY_SILVERFISH_DEATH; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSpout.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSpout.java index 9bcb07a60a..1c8e644d4b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSpout.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockSpout.java @@ -51,11 +51,13 @@ public TileEntity createNewTileEntity(World worldIn, int meta) return new TileEntitySpout(); } + @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Item.getItemFromBlock(VenusBlocks.venusBlock); } + @Override public int damageDropped(IBlockState state) { return BlockBasicVenus.EnumBlockBasicVenus.ROCK_SOFT.getMeta(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java index e202de83bd..1f788297a6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntityJuicer.java @@ -90,21 +90,25 @@ protected void applyEntityAttributes() this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.30000001192092896D); } + @Override protected SoundEvent getAmbientSound() { return SoundEvents.ENTITY_SPIDER_AMBIENT; } + @Override protected SoundEvent getHurtSound() { return SoundEvents.ENTITY_SPIDER_HURT; } + @Override protected SoundEvent getDeathSound() { return SoundEvents.ENTITY_SPIDER_DEATH; } + @Override protected void playStepSound(BlockPos pos, Block blockIn) { this.playSound(SoundEvents.ENTITY_SPIDER_STEP, 0.15F, 1.0F); From 44b01254c658fa3cc65d33ae6a4231c4ddbc826a Mon Sep 17 00:00:00 2001 From: Mitch Date: Sat, 18 Mar 2017 02:22:11 -0400 Subject: [PATCH 010/535] Various 1.10 fixes --- .../api/prefab/entity/EntityTieredRocket.java | 5 +++++ .../galacticraft/core/TransformerHooks.java | 16 ++++++++++++++++ .../core/client/fx/ParticleLaunchFlame.java | 12 ++++-------- .../core/client/fx/ParticleLaunchSmoke.java | 19 ++++++++++--------- .../render/entities/RenderTier1Rocket.java | 3 ++- .../client/render/item/ItemModelBuggy.java | 10 +++++++--- .../client/render/item/ItemModelFlag.java | 3 +++ .../client/render/item/ItemModelRocket.java | 16 ++++++++++++---- .../core/entities/EntityTier1Rocket.java | 8 ++++---- .../core/entities/player/GCPlayerHandler.java | 7 ++----- .../core/network/PacketSimple.java | 9 ++++++--- .../core/tick/TickHandlerClient.java | 12 ++++++------ .../galacticraft/core/util/ClientUtil.java | 4 ++-- .../render/entity/RenderTier3Rocket.java | 4 ++-- .../render/item/ItemModelAstroMiner.java | 14 +++++++++++--- .../render/item/ItemModelBeamReceiver.java | 10 ++++++++-- .../render/item/ItemModelBeamReflector.java | 8 +++++++- .../render/item/ItemModelCargoRocket.java | 14 +++++++++++--- .../client/render/item/ItemModelGrapple.java | 4 ++++ .../client/render/item/ItemModelRocketT3.java | 18 +++++++++++++----- .../asteroids/entities/EntityTier3Rocket.java | 4 ++-- .../render/entity/RenderTier2Rocket.java | 3 ++- .../client/render/item/ItemModelRocketT2.java | 18 +++++++++++++----- .../mars/entities/EntityTier2Rocket.java | 2 +- 24 files changed, 153 insertions(+), 70 deletions(-) diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java index b71ae5660c..7c08c05c7d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityTieredRocket.java @@ -412,6 +412,11 @@ protected boolean shouldMoveClientSide() @Override public boolean processInitialInteract(EntityPlayer player, @Nullable ItemStack stack, EnumHand hand) { + if (hand != EnumHand.MAIN_HAND) + { + return false; + } + if (this.launchPhase == EnumLaunchPhase.LAUNCHED.ordinal()) { return false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java b/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java index 904c07e296..f165705099 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java @@ -1,6 +1,7 @@ package micdoodle8.mods.galacticraft.core; import micdoodle8.mods.galacticraft.api.entity.IAntiGrav; +import micdoodle8.mods.galacticraft.api.entity.ICameraZoomEntity; import micdoodle8.mods.galacticraft.api.item.IArmorGravity; import micdoodle8.mods.galacticraft.api.prefab.entity.EntitySpaceshipBase; import micdoodle8.mods.galacticraft.api.prefab.entity.EntityTieredRocket; @@ -14,6 +15,7 @@ import micdoodle8.mods.galacticraft.core.entities.player.IStatsClientCapability; import micdoodle8.mods.galacticraft.core.proxy.ClientProxyCore; import micdoodle8.mods.galacticraft.core.util.*; +import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.Tessellator; @@ -652,4 +654,18 @@ public static void renderFootprints(float partialTicks) FootprintRenderer.renderFootprints(ClientProxyCore.mc.thePlayer, partialTicks); MinecraftForge.EVENT_BUS.post(new ClientProxyCore.EventSpecialRender(partialTicks)); } + + @SideOnly(Side.CLIENT) + public static double getCameraZoom(double previous) + { + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + if (player.getRidingEntity() != null && player.getRidingEntity() instanceof ICameraZoomEntity) + { + if(!ConfigManagerCore.disableVehicleCameraChanges) + { + return ((ICameraZoomEntity) player.getRidingEntity()).getCameraZoom(); + } + } + return previous; + } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchFlame.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchFlame.java index 2025107ed6..5dafdad4a8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchFlame.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchFlame.java @@ -25,17 +25,13 @@ public class ParticleLaunchFlame extends Particle public ParticleLaunchFlame(World par1World, Vector3 position, Vector3 motion, boolean launched, EntityLivingBase ridingEntity) { super(par1World, position.x, position.y, position.z, 0.0D, 0.0D, 0.0D); - this.motionX *= 0.10000000149011612D; - this.motionY *= 0.10000000149011612D; - this.motionZ *= 0.10000000149011612D; - this.motionX += motion.x; - this.motionY += motion.y; - this.motionZ += motion.z; + this.motionX = motion.x; + this.motionY = motion.y; + this.motionZ = motion.z; this.particleRed = 255F / 255F; this.particleGreen = 120F / 255F + this.rand.nextFloat() / 3; this.particleBlue = 55F / 255F; - this.particleScale *= 2F; - this.particleScale *= 1F * 2; + this.particleScale *= launched ? 4F : 0.1F; this.smokeParticleScale = this.particleScale; this.particleMaxAge = (int) (this.particleMaxAge * 1F); this.canCollide = true; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchSmoke.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchSmoke.java index 471ae3a739..1202b8d0e8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchSmoke.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchSmoke.java @@ -84,16 +84,17 @@ public void onUpdate() } this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); - this.motionY -= 0.002D; this.moveEntity(this.motionX, this.motionY, this.motionZ); - if (this.posY == this.prevPosY) - { - this.motionX *= 1.1D; - this.motionZ *= 1.1D; - } - - this.motionX *= 0.99D; - this.motionZ *= 0.99D; +// if (this.posY == this.prevPosY) +// { +//// this.motionX *= 1.0001D; +//// this.motionZ *= 1.0001D; +// } +// else +// { +// this.motionX *= 0.99D; +// this.motionZ *= 0.99D; +// } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderTier1Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderTier1Rocket.java index 2f6edb60d5..21506ac71e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderTier1Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderTier1Rocket.java @@ -49,10 +49,11 @@ public void doRender(EntitySpaceshipBase entity, double par2, double par4, doubl final float var24 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9; final float var25 = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par9; - GL11.glTranslatef((float) par2, (float) par4 + entity.getRenderOffsetY(), (float) par6); + GL11.glTranslatef((float) par2, (float) par4, (float) par6); GL11.glRotatef(180.0F - par8, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-var24, 0.0F, 0.0F, 1.0F); GL11.glRotatef(-var25, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(0.0F, entity.getRenderOffsetY(), 0.0F); final float var28 = entity.rollAmplitude - par9; if (var28 > 0.0F) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java index 8c553d23ef..ec6503e2b0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java @@ -47,7 +47,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.setScale(0.35F); + mul.setScale(0.15F); ret.mul(mul); mul.setIdentity(); mul.setTranslation(trans); @@ -57,18 +57,22 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) { - Vector3f trans = new Vector3f(0.0F, 0.0F, 0.6F); + Vector3f trans = new Vector3f(0.0F, -0.3F, 0.6F); Matrix4f ret = new Matrix4f(); ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(75, 15, 0)); + mul.setRotation(rot); + ret.mul(mul); + mul.setIdentity(); mul.setScale(0.35F); ret.mul(mul); mul.setIdentity(); mul.rotY((float) (Math.PI / 2.0F)); ret.mul(mul); mul.setIdentity(); - mul.rotX(0.2F); + mul.rotX((float) (0.2F - Math.PI)); ret.mul(mul); mul.setIdentity(); mul.rotZ(0.5F); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java index 2a1aa7d055..046cea255d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java @@ -47,6 +47,9 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); + mul.rotY(1.5F); + ret.mul(mul); + mul.setIdentity(); mul.rotY((float) -(Math.PI / 3.0F)); ret.mul(mul); mul.setIdentity(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java index 1d2d7f2bee..3003d9c294 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java @@ -60,12 +60,16 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) { - Vector3f trans = new Vector3f(0.5F, -1.2F, -0.8F); + Vector3f trans = new Vector3f(0.5F, -3.2F, -2.6F); Matrix4f ret = new Matrix4f(); ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.setScale(4.0F); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(0, 45, 0)); + mul.setRotation(rot); + ret.mul(mul); + mul.setIdentity(); + mul.setScale(0.5F); ret.mul(mul); mul.setIdentity(); mul.rotX((float) (Math.PI / 2.0F)); @@ -81,15 +85,19 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) { - Vector3f trans = new Vector3f(0.4F, -1.8F, 0.8F); + Vector3f trans = new Vector3f(0.4F, -2.8F, 1.2F); Matrix4f ret = new Matrix4f(); ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(75, 0, 0)); + mul.setRotation(rot); + ret.mul(mul); + mul.setIdentity(); mul.setScale(0.5F); ret.mul(mul); mul.setIdentity(); - mul.rotZ((float) (Math.PI / 2.0F)); + mul.rotZ((float) (-Math.PI / 2.0F)); ret.mul(mul); mul.setIdentity(); mul.rotY((float) (Math.PI / 2.0F)); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityTier1Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityTier1Rocket.java index 348432f583..f6bbb1a6b2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityTier1Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityTier1Rocket.java @@ -197,10 +197,10 @@ protected void spawnParticles(boolean launched) } else { - GalacticraftCore.proxy.spawnParticle("launchFlameIdle", new Vector3(x2 + 0.4 - this.rand.nextDouble() / 10, y, z2 + 0.4 - this.rand.nextDouble() / 10), new Vector3(x1 + 0.7, y1 - 1D, z1 + 0.7), new Object[] { riddenByEntity }); - GalacticraftCore.proxy.spawnParticle("launchFlameIdle", new Vector3(x2 - 0.4 + this.rand.nextDouble() / 10, y, z2 + 0.4 - this.rand.nextDouble() / 10), new Vector3(x1 - 0.7, y1 - 1D, z1 + 0.7), new Object[] { riddenByEntity }); - GalacticraftCore.proxy.spawnParticle("launchFlameIdle", new Vector3(x2 - 0.4 + this.rand.nextDouble() / 10, y, z2 - 0.4 + this.rand.nextDouble() / 10), new Vector3(x1 - 0.7, y1 - 1D, z1 - 0.7), new Object[] { riddenByEntity }); - GalacticraftCore.proxy.spawnParticle("launchFlameIdle", new Vector3(x2 + 0.4 - this.rand.nextDouble() / 10, y, z2 - 0.4 + this.rand.nextDouble() / 10), new Vector3(x1 + 0.7, y1 - 1D, z1 - 0.7), new Object[] { riddenByEntity }); + GalacticraftCore.proxy.spawnParticle("launchFlameIdle", new Vector3(x2 + 0.4 - this.rand.nextDouble() / 10, y + 0.9, z2 + 0.4 - this.rand.nextDouble() / 10), new Vector3(this.rand.nextDouble() / 2.0 - 0.25, 0.0, this.rand.nextDouble() / 2.0 - 0.25), new Object[] { riddenByEntity }); + GalacticraftCore.proxy.spawnParticle("launchFlameIdle", new Vector3(x2 - 0.4 + this.rand.nextDouble() / 10, y + 0.9, z2 + 0.4 - this.rand.nextDouble() / 10), new Vector3(this.rand.nextDouble() / 2.0 - 0.25, 0.0, this.rand.nextDouble() / 2.0 - 0.25), new Object[] { riddenByEntity }); + GalacticraftCore.proxy.spawnParticle("launchFlameIdle", new Vector3(x2 - 0.4 + this.rand.nextDouble() / 10, y + 0.9, z2 - 0.4 + this.rand.nextDouble() / 10), new Vector3(this.rand.nextDouble() / 2.0 - 0.25, 0.0, this.rand.nextDouble() / 2.0 - 0.25), new Object[] { riddenByEntity }); + GalacticraftCore.proxy.spawnParticle("launchFlameIdle", new Vector3(x2 + 0.4 - this.rand.nextDouble() / 10, y + 0.9, z2 - 0.4 + this.rand.nextDouble() / 10), new Vector3(this.rand.nextDouble() / 2.0 - 0.25, 0.0, this.rand.nextDouble() / 2.0 - 0.25), new Object[] { riddenByEntity }); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java index d6240743ff..f44813e4bf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java @@ -686,12 +686,9 @@ protected void checkShield(EntityPlayerMP playerMP, IStatsCapability playerStats { for (ItemStack armor : playerMP.getArmorInventoryList()) { - if (armor.getItem() instanceof ItemArmor) + if (armor != null && armor.getItem() instanceof ItemArmor) { - if (armor != null) - { - armor.damageItem(1, playerMP); - } + armor.damageItem(1, playerMP); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java index 9405ff0ca5..aee4b9bb16 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java @@ -863,10 +863,13 @@ public void handleServerSide(EntityPlayer player) ship.igniteCheckingCooldown(); stats.setLaunchAttempts(0); } - else if (stats.getChatCooldown() == 0 && stats.getLaunchAttempts() == 0) + else if (stats.getLaunchAttempts() == 0) { - player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.noparachute"))); - stats.setChatCooldown(250); + if (stats.getChatCooldown() == 0) + { + player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.noparachute"))); + stats.setChatCooldown(100); + } stats.setLaunchAttempts(1); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java index 0906397faa..b355ada2bb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java @@ -504,19 +504,19 @@ else if (world.provider instanceof WorldProviderMoon) final EntitySpaceshipBase ship = (EntitySpaceshipBase) player.getRidingEntity(); boolean hasChanged = false; - if (minecraft.gameSettings.keyBindLeft.isPressed()) + if (minecraft.gameSettings.keyBindLeft.isKeyDown()) { ship.turnYaw(-1.0F); hasChanged = true; } - if (minecraft.gameSettings.keyBindRight.isPressed()) + if (minecraft.gameSettings.keyBindRight.isKeyDown()) { ship.turnYaw(1.0F); hasChanged = true; } - if (minecraft.gameSettings.keyBindForward.isPressed()) + if (minecraft.gameSettings.keyBindForward.isKeyDown()) { if (ship.getLaunched()) { @@ -525,7 +525,7 @@ else if (world.provider instanceof WorldProviderMoon) } } - if (minecraft.gameSettings.keyBindBack.isPressed()) + if (minecraft.gameSettings.keyBindBack.isKeyDown()) { if (ship.getLaunched()) { @@ -570,7 +570,7 @@ else if (world.provider instanceof WorldProviderMoon) world.setRainStrength(0.0F); } - boolean isPressed = KeyHandlerClient.spaceKey.isPressed(); + boolean isPressed = KeyHandlerClient.spaceKey.isKeyDown(); if (!isPressed) { @@ -620,7 +620,7 @@ private boolean alreadyContainsBlock(int x1, int y1, int z1) public static void zoom(float value) { // FMLClientHandler.instance().getClient().entityRenderer.thirdPersonDistance = value; - FMLClientHandler.instance().getClient().entityRenderer.thirdPersonDistancePrev = value; +// FMLClientHandler.instance().getClient().entityRenderer.thirdPersonDistancePrev = value; } private void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/ClientUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/ClientUtil.java index ec12f8ba6b..8bc29466e1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/ClientUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/ClientUtil.java @@ -158,7 +158,7 @@ public static void drawBakedModel(IBakedModel model) { Tessellator tessellator = Tessellator.getInstance(); VertexBuffer worldrenderer = tessellator.getBuffer(); - worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM); for (BakedQuad bakedquad : model.getQuads(null, null, 0)) { @@ -172,7 +172,7 @@ public static void drawBakedModelColored(IBakedModel model, int color) { Tessellator tessellator = Tessellator.getInstance(); VertexBuffer worldrenderer = tessellator.getBuffer(); - worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM); for (BakedQuad bakedquad : model.getQuads(null, null, 0)) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderTier3Rocket.java index 1f26c811fe..2aea6ec4f9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderTier3Rocket.java @@ -9,7 +9,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.ModelResourceLocation; @@ -71,9 +70,10 @@ public void doRender(EntityTier3Rocket entity, double par2, double par4, double final float var24 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9 + 180; final float var25 = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par9 + 45; - GL11.glTranslatef((float) par2, (float) par4 + entity.getRenderOffsetY(), (float) par6); + GL11.glTranslatef((float) par2, (float) par4, (float) par6); GL11.glRotatef(180.0F - par8, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-var24, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(0.0F, entity.getRenderOffsetY(), 0.0F); final float var28 = entity.rollAmplitude / 3 - par9; if (var28 > 0.0F) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java index 594cd1b9d1..38ef393cf6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java @@ -54,11 +54,15 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) { - Vector3f trans = new Vector3f(0.5F, -0.2F, -1.1F); + Vector3f trans = new Vector3f(0.5F, 0.0F, -1.7F); Matrix4f ret = new Matrix4f(); ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(0, 45, 0)); + mul.setRotation(rot); + ret.mul(mul); + mul.setIdentity(); mul.setScale(4.0F); ret.mul(mul); mul.setIdentity(); @@ -78,15 +82,19 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) { - Vector3f trans = new Vector3f(-0.2F, -0.0F, 0.7F); + Vector3f trans = new Vector3f(-0.2F, -0.0F, 1.2F); Matrix4f ret = new Matrix4f(); ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(75, 15, 0)); + mul.setRotation(rot); + ret.mul(mul); + mul.setIdentity(); mul.setScale(0.8F); ret.mul(mul); mul.setIdentity(); - mul.rotZ((float) (Math.PI / 2.0F)); + mul.rotZ((float) -(Math.PI / 2.0F)); ret.mul(mul); mul.setIdentity(); mul.rotY((float) (Math.PI / 2.0F)); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReceiver.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReceiver.java index ce8c1f2fca..92c3a12829 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReceiver.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReceiver.java @@ -3,8 +3,10 @@ import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraftforge.common.model.TRSRTransformation; import javax.vecmath.Matrix4f; +import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; public class ItemModelBeamReceiver extends ModelTransformWrapper @@ -37,10 +39,14 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.rotY((float) (Math.PI)); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(0, 180, 0)); + mul.setRotation(rot); ret.mul(mul); mul.setIdentity(); - mul.setTranslation(new Vector3f(0.0F, 0.1F, 0.2F)); + mul.rotY((float) -(Math.PI)); + ret.mul(mul); + mul.setIdentity(); + mul.setTranslation(new Vector3f(0.9F, 0.1F, -0.6F)); ret.mul(mul); return ret; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReflector.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReflector.java index 43e739d5d4..cc7b305b68 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReflector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelBeamReflector.java @@ -3,8 +3,10 @@ import micdoodle8.mods.galacticraft.core.wrappers.ModelTransformWrapper; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraftforge.common.model.TRSRTransformation; import javax.vecmath.Matrix4f; +import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; public class ItemModelBeamReflector extends ModelTransformWrapper @@ -37,10 +39,14 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(0, 180, 0)); + mul.setRotation(rot); + ret.mul(mul); + mul.setIdentity(); mul.rotY((float) (Math.PI)); ret.mul(mul); mul.setIdentity(); - mul.setTranslation(new Vector3f(0.0F, 0.1F, 0.2F)); + mul.setTranslation(new Vector3f(0.0F, 0.1F, -0.6F)); ret.mul(mul); return ret; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java index f246d26e61..b61c0a0416 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java @@ -60,18 +60,22 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) { - Vector3f trans = new Vector3f(0.5F, 0.5F, -1.5F); + Vector3f trans = new Vector3f(-2.5F, 1.8F, -3.0F); Matrix4f ret = new Matrix4f(); ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(0, 45, 0)); + mul.setRotation(rot); + ret.mul(mul); + mul.setIdentity(); mul.setScale(4.0F); ret.mul(mul); mul.setIdentity(); mul.rotX((float) (Math.PI / 2.0F)); ret.mul(mul); mul.setIdentity(); - mul.rotZ(-0.65F); + mul.rotZ((float) (-0.65F + Math.PI)); ret.mul(mul); mul.setIdentity(); mul.setTranslation(trans); @@ -87,11 +91,15 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) { - Vector3f trans = new Vector3f(0.3F, -0.5F, -0.8F); + Vector3f trans = new Vector3f(1.2F, -2.5F, 1.0F); Matrix4f ret = new Matrix4f(); ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(75, 15, 0)); + mul.setRotation(rot); + ret.mul(mul); + mul.setIdentity(); mul.setScale(0.5F); ret.mul(mul); mul.setIdentity(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java index 6dbe3bdf05..b024ff8101 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java @@ -64,6 +64,10 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(0, 45, 0)); + mul.setRotation(rot); + ret.mul(mul); + mul.setIdentity(); mul.setScale(1.8F); ret.mul(mul); mul.setIdentity(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java index e6d66e3e7c..7bf3ecb1c2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java @@ -60,18 +60,22 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) { - Vector3f trans = new Vector3f(0.5F, 0.5F, -1.2F); + Vector3f trans = new Vector3f(0.5F, 3.2F, -3.6F); Matrix4f ret = new Matrix4f(); ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.setScale(4.0F); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(0, 45, 0)); + mul.setRotation(rot); + ret.mul(mul); + mul.setIdentity(); + mul.setScale(0.45F); ret.mul(mul); mul.setIdentity(); mul.rotX((float) (Math.PI / 2.0F)); ret.mul(mul); mul.setIdentity(); - mul.rotZ(-0.65F); + mul.rotZ((float) (-0.65F + Math.PI)); ret.mul(mul); mul.setIdentity(); mul.setTranslation(trans); @@ -82,13 +86,17 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } - if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) + if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND || cameraTransformType == TransformType.THIRD_PERSON_LEFT_HAND) { - Vector3f trans = new Vector3f(0.0F, -0.4F, -0.3F); + Vector3f trans = new Vector3f(1.0F, -2.4F, 1.2F); Matrix4f ret = new Matrix4f(); ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(75, 15, 0)); + mul.setRotation(rot); + ret.mul(mul); + mul.setIdentity(); mul.setScale(0.6F); ret.mul(mul); mul.setIdentity(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityTier3Rocket.java index db2092a424..04d8f97c0f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityTier3Rocket.java @@ -68,7 +68,7 @@ public double getMountedYOffset() @Override public float getRotateOffset() { - return 0.35F; + return 1.5F; } @Override @@ -338,6 +338,6 @@ public void clear() @Override public float getRenderOffsetY() { - return 1.1F; + return -1F; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderTier2Rocket.java index 7657d36bd4..bcf6dd3b54 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderTier2Rocket.java @@ -56,9 +56,10 @@ public void doRender(EntityTier2Rocket entity, double par2, double par4, double GL11.glPushMatrix(); final float var24 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9 + 180; - GL11.glTranslatef((float) par2, (float) par4 + entity.getRenderOffsetY(), (float) par6); + GL11.glTranslatef((float) par2, (float) par4, (float) par6); GL11.glRotatef(180.0F - par8, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-var24, 0.0F, 0.0F, 1.0F); + GL11.glTranslatef(0.0F, entity.getRenderOffsetY(), 0.0F); final float var28 = entity.rollAmplitude / 3 - par9; if (var28 > 0.0F) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java index bf64f6ac7e..dd34f60bda 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java @@ -60,18 +60,22 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) if (cameraTransformType == TransformType.FIRST_PERSON_RIGHT_HAND) { - Vector3f trans = new Vector3f(0.5F, 1.2F, -1.2F); + Vector3f trans = new Vector3f(0.5F, 4.2F, -3.6F); Matrix4f ret = new Matrix4f(); ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); - mul.setScale(4.0F); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(0, 45, 0)); + mul.setRotation(rot); + ret.mul(mul); + mul.setIdentity(); + mul.setScale(0.5F); ret.mul(mul); mul.setIdentity(); mul.rotX((float) (Math.PI / 2.0F)); ret.mul(mul); mul.setIdentity(); - mul.rotZ(-0.65F); + mul.rotZ((float) (-0.65F + Math.PI)); ret.mul(mul); mul.setIdentity(); mul.setTranslation(trans); @@ -84,15 +88,19 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) { - Vector3f trans = new Vector3f(0.0F, -0.9F, -0.3F); + Vector3f trans = new Vector3f(0.0F, -3.9F, 1.5F); Matrix4f ret = new Matrix4f(); ret.setIdentity(); Matrix4f mul = new Matrix4f(); mul.setIdentity(); + Quat4f rot = TRSRTransformation.quatFromXYZDegrees(new Vector3f(75, 15, 0)); + mul.setRotation(rot); + ret.mul(mul); + mul.setIdentity(); mul.setScale(0.5F); ret.mul(mul); mul.setIdentity(); - mul.rotX((float) (Math.PI / 3.0F)); + mul.rotX((float) (Math.PI / 2.0F)); ret.mul(mul); mul.setIdentity(); mul.rotZ((float) (-Math.PI / 2.0F)); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityTier2Rocket.java index a42ed6feb1..4c46acdfe3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityTier2Rocket.java @@ -71,7 +71,7 @@ public double getMountedYOffset() @Override public float getRotateOffset() { - return -0.55F; + return 0.4F; } @Override From 4c4e060c3b22ab0a92ce31979a2e67dbf913960e Mon Sep 17 00:00:00 2001 From: Mitch Date: Sat, 18 Mar 2017 17:24:24 -0400 Subject: [PATCH 011/535] Fix several errors in 1.10 --- .../galacticraft/api/block/package-info.java | 2 +- .../galacticraft/api/entity/package-info.java | 2 +- .../api/event/client/package-info.java | 2 +- .../api/event/oxygen/package-info.java | 2 +- .../api/event/wgen/package-info.java | 2 +- .../api/galaxies/package-info.java | 2 +- .../galacticraft/api/item/package-info.java | 2 +- .../mods/galacticraft/api/package-info.java | 2 +- .../galacticraft/api/power/package-info.java | 2 +- .../api/prefab/core/package-info.java | 2 +- .../api/prefab/entity/package-info.java | 2 +- .../galacticraft/api/prefab/package-info.java | 2 +- .../api/prefab/world/gen/package-info.java | 2 +- .../galacticraft/api/recipe/package-info.java | 2 +- .../galacticraft/api/tile/package-info.java | 2 +- .../api/transmission/grid/package-info.java | 2 +- .../api/transmission/package-info.java | 2 +- .../api/transmission/tile/package-info.java | 2 +- .../galacticraft/api/vector/package-info.java | 2 +- .../galacticraft/api/world/package-info.java | 2 +- .../mods/galacticraft/core/Constants.java | 4 +-- .../galacticraft/core/GalacticraftCore.java | 3 ++ .../galacticraft/core/TransformerHooks.java | 11 +++--- .../core/entities/EntityEvolvedCreeper.java | 7 ++++ .../core/tile/TileEntityDungeonSpawner.java | 7 +++- .../galacticraft/core/util/GCCoreUtil.java | 2 ++ .../galacticraft/core/util/WorldUtil.java | 5 +-- .../core/world/gen/dungeon/RoomSpawner.java | 9 ++--- .../planets/asteroids/AsteroidsModule.java | 7 +++- .../galacticraft/planets/mars/MarsModule.java | 15 +++++--- .../planets/venus/VenusModule.java | 18 +++++++--- .../world/gen/dungeon/RoomSpawnerVenus.java | 9 ++--- .../assets/galacticraftcore/lang/cs_CZ.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/cy_GB.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/de_DE.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/en_GB.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/en_US.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/es_ES.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/fi_FI.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/fr_CA.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/fr_FR.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/hr_HR.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/hu_HU.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/it_IT.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/ja_JP.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/ko_KR.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/nl_NL.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/pl_PL.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/pt_BR.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/pt_PT.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/ru_RU.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/sv_SE.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/th_TH.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/tr_TR.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/zh_CN.lang | 34 +++++++++---------- .../assets/galacticraftcore/lang/zh_TW.lang | 34 +++++++++---------- .../galacticraftplanets/lang/cs_CZ.lang | 24 ++++++------- .../galacticraftplanets/lang/cy_GB.lang | 24 ++++++------- .../galacticraftplanets/lang/de_DE.lang | 24 ++++++------- .../galacticraftplanets/lang/en_GB.lang | 24 ++++++------- .../galacticraftplanets/lang/en_US.lang | 32 ++++++++--------- .../galacticraftplanets/lang/es_ES.lang | 24 ++++++------- .../galacticraftplanets/lang/fi_FI.lang | 24 ++++++------- .../galacticraftplanets/lang/fr_CA.lang | 24 ++++++------- .../galacticraftplanets/lang/fr_FR.lang | 24 ++++++------- .../galacticraftplanets/lang/hr_HR.lang | 24 ++++++------- .../galacticraftplanets/lang/hu_HU.lang | 24 ++++++------- .../galacticraftplanets/lang/it_IT.lang | 24 ++++++------- .../galacticraftplanets/lang/ja_JP.lang | 24 ++++++------- .../galacticraftplanets/lang/ko_KR.lang | 24 ++++++------- .../galacticraftplanets/lang/nl_NL.lang | 24 ++++++------- .../galacticraftplanets/lang/pl_PL.lang | 24 ++++++------- .../galacticraftplanets/lang/pt_BR.lang | 24 ++++++------- .../galacticraftplanets/lang/pt_PT.lang | 24 ++++++------- .../galacticraftplanets/lang/ru_RU.lang | 32 ++++++++--------- .../galacticraftplanets/lang/sv_SE.lang | 24 ++++++------- .../galacticraftplanets/lang/th_TH.lang | 32 ++++++++--------- .../galacticraftplanets/lang/tr_TR.lang | 24 ++++++------- .../galacticraftplanets/lang/zh_CN.lang | 24 ++++++------- .../galacticraftplanets/lang/zh_TW.lang | 24 ++++++------- 80 files changed, 797 insertions(+), 756 deletions(-) diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/block/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/block/package-info.java index 2dedda907d..6688603267 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/block/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/block/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "1.1", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.block; +@API(apiVersion = "1.1", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.block; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/entity/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/entity/package-info.java index 0bebfec801..556b81c2a4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/entity/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/entity/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "1.0", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.entity; +@API(apiVersion = "1.0", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.entity; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/event/client/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/event/client/package-info.java index ca29400903..7456e77b19 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/event/client/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/event/client/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "1.1", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.event.client; +@API(apiVersion = "1.1", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.event.client; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/event/oxygen/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/event/oxygen/package-info.java index f71e41d9aa..8a7e3879bb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/event/oxygen/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/event/oxygen/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "1.0", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.event.oxygen; +@API(apiVersion = "1.0", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.event.oxygen; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/event/wgen/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/event/wgen/package-info.java index 64fb1353ca..d9d0b388ca 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/event/wgen/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/event/wgen/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "1.0", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.event.wgen; +@API(apiVersion = "1.0", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.event.wgen; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/galaxies/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/galaxies/package-info.java index 399805391b..67d41ed395 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/galaxies/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/galaxies/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "1.3", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.galaxies; +@API(apiVersion = "1.3", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.galaxies; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/item/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/item/package-info.java index e353d23cc8..4deb03d1d3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/item/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/item/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "1.2", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.item; +@API(apiVersion = "1.2", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.item; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/package-info.java index b773ce62df..3c362e4dc7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/package-info.java @@ -1,3 +1,3 @@ -@API(apiVersion = "1.0", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api; +@API(apiVersion = "1.0", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/power/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/power/package-info.java index cd8f12d97b..c9377369f3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/power/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/power/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "1.1", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.power; +@API(apiVersion = "1.1", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.power; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/core/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/core/package-info.java index 816be3c434..1087fd620f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/core/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/core/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "1.0", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.prefab.core; +@API(apiVersion = "1.0", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.prefab.core; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/package-info.java index 009c2a219e..66aa89a1b2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "1.1", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.prefab.entity; +@API(apiVersion = "1.1", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.prefab.entity; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/package-info.java index 40874a0ccd..40d42a5c6a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/package-info.java @@ -1,3 +1,3 @@ -@API(apiVersion = "1.0", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.prefab; +@API(apiVersion = "1.0", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.prefab; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/package-info.java index b204576fcc..e13886c59e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/world/gen/package-info.java @@ -1,3 +1,3 @@ -@API(apiVersion = "1.1", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.prefab.world.gen; +@API(apiVersion = "1.1", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.prefab.world.gen; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/recipe/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/recipe/package-info.java index 698c3a08c6..2268a46959 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/recipe/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/recipe/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "1.1", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.recipe; +@API(apiVersion = "1.1", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.recipe; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/tile/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/tile/package-info.java index 95b2eaef6a..52384795ae 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/tile/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/tile/package-info.java @@ -1,3 +1,3 @@ -@API(apiVersion = "1.0", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.tile; +@API(apiVersion = "1.0", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.tile; import net.minecraftforge.fml.common.API; \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/transmission/grid/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/transmission/grid/package-info.java index 9e56ed818e..a26ff98e07 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/transmission/grid/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/transmission/grid/package-info.java @@ -1,4 +1,4 @@ -@API(apiVersion = "1.0", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.transmission.grid; +@API(apiVersion = "1.0", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.transmission.grid; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/transmission/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/transmission/package-info.java index f465e8d0a4..a2e86231b7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/transmission/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/transmission/package-info.java @@ -1,3 +1,3 @@ -@API(apiVersion = "1.0", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.transmission; +@API(apiVersion = "1.0", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.transmission; import net.minecraftforge.fml.common.API; \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/transmission/tile/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/transmission/tile/package-info.java index 8279749e21..965e380fd1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/transmission/tile/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/transmission/tile/package-info.java @@ -1,3 +1,3 @@ -@API(apiVersion = "1.0", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.transmission.tile; +@API(apiVersion = "1.0", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.transmission.tile; import net.minecraftforge.fml.common.API; \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/vector/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/vector/package-info.java index 18199eb5bb..7e34fb43fe 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/vector/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/vector/package-info.java @@ -1,3 +1,3 @@ -@API(apiVersion = "1.0", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.vector; +@API(apiVersion = "1.0", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.vector; import net.minecraftforge.fml.common.API; \ No newline at end of file diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/world/package-info.java b/src/main/java/micdoodle8/mods/galacticraft/api/world/package-info.java index f8dc2f562b..c4948f6e64 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/world/package-info.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/world/package-info.java @@ -1,3 +1,3 @@ -@API(apiVersion = "1.1", owner = "GalacticraftCore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.world; +@API(apiVersion = "1.1", owner = "galacticraftcore", provides = "Galacticraft API") package micdoodle8.mods.galacticraft.api.world; import net.minecraftforge.fml.common.API; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/Constants.java b/src/main/java/micdoodle8/mods/galacticraft/core/Constants.java index d0f02625c0..12ffd6af22 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/Constants.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/Constants.java @@ -2,8 +2,8 @@ public class Constants { - public static final String MOD_ID_CORE = "GalacticraftCore"; - public static final String MOD_ID_PLANETS = "GalacticraftPlanets"; + public static final String MOD_ID_CORE = "galacticraftcore"; + public static final String MOD_ID_PLANETS = "galacticraftplanets"; public static final String MOD_NAME_SIMPLE = "Galacticraft"; public static final int LOCALMAJVERSION = 4; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java index 910c5f86f2..fcbca10358 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java @@ -266,6 +266,9 @@ public void init(FMLInitializationEvent event) GalacticraftCore.proxy.registerFluidTexture(GCFluids.fluidOil, new ResourceLocation(Constants.ASSET_PREFIX, "textures/misc/underoil.png")); GalacticraftCore.proxy.registerFluidTexture(GCFluids.fluidFuel, new ResourceLocation(Constants.ASSET_PREFIX, "textures/misc/underfuel.png")); + Biome.registerBiome(ConfigManagerCore.biomeIDbase, Constants.TEXTURE_PREFIX + BiomeMoon.moonFlat.getBiomeName(), BiomeMoon.moonFlat); + Biome.registerBiome(ConfigManagerCore.biomeIDbase + 3, Constants.TEXTURE_PREFIX + BiomeOrbit.space.getBiomeName(), BiomeOrbit.space); + // switch (this.getSlotIndex()) // { // case 0: diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java b/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java index f165705099..351af52a91 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java @@ -658,14 +658,17 @@ public static void renderFootprints(float partialTicks) @SideOnly(Side.CLIENT) public static double getCameraZoom(double previous) { + if (ConfigManagerCore.disableVehicleCameraChanges) + { + return previous; + } + EntityPlayer player = Minecraft.getMinecraft().thePlayer; if (player.getRidingEntity() != null && player.getRidingEntity() instanceof ICameraZoomEntity) { - if(!ConfigManagerCore.disableVehicleCameraChanges) - { - return ((ICameraZoomEntity) player.getRidingEntity()).getCameraZoom(); - } + return ((ICameraZoomEntity) player.getRidingEntity()).getCameraZoom(); } + return previous; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedCreeper.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedCreeper.java index bca41fe35f..65bff18582 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedCreeper.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedCreeper.java @@ -49,6 +49,13 @@ public EntityEvolvedCreeper(World par1World) this.setSize(0.7F, 2.2F); } + @Override + protected void entityInit() + { + super.entityInit(); + this.dataManager.register(IS_CHILD, false); + } + @Override protected void applyEntityAttributes() { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java index 07b6f07ab6..25782e3a44 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java @@ -185,7 +185,12 @@ public void readFromNBT(NBTTagCompound nbt) } catch (Exception e) { - e.printStackTrace(); + // This exception will be thrown when read is called from TileEntity.handleUpdateTag + // but we only care if an exception is thrown on server side read + if (!this.worldObj.isRemote) + { + e.printStackTrace(); + } } this.roomCoords = new Vector3(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/GCCoreUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/GCCoreUtil.java index 563cff55b0..6598de6beb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/GCCoreUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/GCCoreUtil.java @@ -1,5 +1,6 @@ package micdoodle8.mods.galacticraft.core.util; +import micdoodle8.mods.galacticraft.core.Constants; import micdoodle8.mods.galacticraft.core.GalacticraftCore; import micdoodle8.mods.galacticraft.core.entities.EntityLanderBase; import micdoodle8.mods.galacticraft.core.inventory.ContainerBuggy; @@ -79,6 +80,7 @@ public static void registerGalacticraftCreature(Class clazz, S int nextEggID = getNextValidID(); if (nextEggID < 65536) { + name = Constants.MOD_ID_CORE + "." + name; EntityList.ID_TO_CLASS.put(nextEggID, clazz); EntityList.CLASS_TO_ID.put(clazz, nextEggID); EntityList.ENTITY_EGGS.put(name, new EntityList.EntityEggInfo(name, back, fore)); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java index dfb5270322..aba4cd5dd6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java @@ -694,8 +694,9 @@ private static Entity teleportEntity(World worldNew, Entity entity, int dimID, I } else if (entity.getRidingEntity() instanceof EntityCelestialFake) { - entity.getRidingEntity().removePassengers(); - entity.getRidingEntity().setDead(); + Entity e = entity.getRidingEntity(); + e.removePassengers(); + e.setDead(); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java index 1924b4c330..1d2e79af49 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/dungeon/RoomSpawner.java @@ -1,5 +1,6 @@ package micdoodle8.mods.galacticraft.core.world.gen.dungeon; +import micdoodle8.mods.galacticraft.core.Constants; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityMobSpawner; @@ -70,14 +71,14 @@ private static String getMob(Random rand) switch (rand.nextInt(4)) { case 0: - return "GalacticraftCore.evolved_spider"; + return Constants.MOD_ID_CORE + ".evolved_spider"; case 1: - return "GalacticraftCore.evolved_creeper"; + return Constants.MOD_ID_CORE + ".evolved_creeper"; case 2: - return "GalacticraftCore.evolved_skeleton"; + return Constants.MOD_ID_CORE + ".evolved_skeleton"; case 3: default: - return "GalacticraftCore.evolved_zombie"; + return Constants.MOD_ID_CORE + ".evolved_zombie"; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java index 87fa0606e7..764b7e1967 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java @@ -12,6 +12,7 @@ import micdoodle8.mods.galacticraft.core.command.CommandGCAstroMiner; import micdoodle8.mods.galacticraft.core.items.ItemCanisterGeneric; import micdoodle8.mods.galacticraft.core.recipe.NasaWorkbenchRecipe; +import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.core.util.CreativeTabGC; import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import micdoodle8.mods.galacticraft.planets.GuiIdsPlanets; @@ -32,15 +33,17 @@ import micdoodle8.mods.galacticraft.planets.asteroids.schematic.SchematicTier3Rocket; import micdoodle8.mods.galacticraft.planets.asteroids.tick.AsteroidsTickHandlerServer; import micdoodle8.mods.galacticraft.planets.asteroids.tile.*; +import micdoodle8.mods.galacticraft.planets.asteroids.world.gen.BiomeAsteroids; import micdoodle8.mods.galacticraft.planets.mars.MarsModule; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.biome.Biome; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fluids.Fluid; @@ -241,6 +244,8 @@ public void init(FMLInitializationEvent event) GalacticraftRegistry.registerGear(Constants.GEAR_ID_THERMAL_PADDING_T1_CHESTPLATE, EnumExtendedInventorySlot.THERMAL_CHESTPLATE, new ItemStack(AsteroidsItems.thermalPadding, 1, 1)); GalacticraftRegistry.registerGear(Constants.GEAR_ID_THERMAL_PADDING_T1_LEGGINGS, EnumExtendedInventorySlot.THERMAL_LEGGINGS, new ItemStack(AsteroidsItems.thermalPadding, 1, 2)); GalacticraftRegistry.registerGear(Constants.GEAR_ID_THERMAL_PADDING_T1_BOOTS, EnumExtendedInventorySlot.THERMAL_BOOTS, new ItemStack(AsteroidsItems.thermalPadding, 1, 3)); + + Biome.registerBiome(ConfigManagerCore.biomeIDbase + 2, GalacticraftPlanets.TEXTURE_PREFIX + BiomeAsteroids.asteroid.getBiomeName(), BiomeAsteroids.asteroid); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java index 59b863551b..145d9cb86a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java @@ -32,6 +32,7 @@ import micdoodle8.mods.galacticraft.planets.mars.schematic.SchematicCargoRocket; import micdoodle8.mods.galacticraft.planets.mars.schematic.SchematicTier2Rocket; import micdoodle8.mods.galacticraft.planets.mars.tile.*; +import micdoodle8.mods.galacticraft.planets.mars.world.gen.BiomeMars; import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; @@ -45,6 +46,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.biome.Biome; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fluids.Fluid; @@ -141,6 +143,8 @@ public void init(FMLInitializationEvent event) CompressorRecipes.addShapelessRecipe(new ItemStack(MarsItems.marsItemBasic, 1, 5), ConfigManagerCore.recipesRequireGCAdvancedMetals ? new ItemStack(MarsItems.marsItemBasic, 1, 2) : "ingotDesh"); GalacticraftCore.proxy.registerFluidTexture(MarsModule.sludge, new ResourceLocation(GalacticraftPlanets.ASSET_PREFIX, "textures/misc/underbecterial.png")); + + Biome.registerBiome(ConfigManagerCore.biomeIDbase + 1, GalacticraftPlanets.TEXTURE_PREFIX + BiomeMars.marsFlat.getBiomeName(), BiomeMars.marsFlat); } @Override @@ -219,15 +223,16 @@ public void registerOtherEntities() MarsModule.registerGalacticraftNonMobEntity(EntityCargoRocket.class, "rocket_cargo", 150, 1, false); } - public void registerGalacticraftCreature(Class var0, String var1, int back, int fore) + public void registerGalacticraftCreature(Class clazz, String name, int back, int fore) { - MarsModule.registerGalacticraftNonMobEntity(var0, var1, 80, 3, true); + MarsModule.registerGalacticraftNonMobEntity(clazz, name, 80, 3, true); int nextEggID = GCCoreUtil.getNextValidID(); if (nextEggID < 65536) { - EntityList.ID_TO_CLASS.put(nextEggID, var0); - EntityList.CLASS_TO_ID.put(var0, nextEggID); - EntityList.ENTITY_EGGS.put(var1, new EntityList.EntityEggInfo(var1, back, fore)); + name = Constants.MOD_ID_PLANETS + "." + name; + EntityList.ID_TO_CLASS.put(nextEggID, clazz); + EntityList.CLASS_TO_ID.put(clazz, nextEggID); + EntityList.ENTITY_EGGS.put(name, new EntityList.EntityEggInfo(name, back, fore)); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java index c3ea38261b..8738a91567 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java @@ -11,6 +11,7 @@ import micdoodle8.mods.galacticraft.core.items.ItemBlockDesc; import micdoodle8.mods.galacticraft.core.items.ItemBucketGC; import micdoodle8.mods.galacticraft.core.util.ColorUtil; +import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.core.util.GCLog; import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; @@ -28,6 +29,7 @@ import micdoodle8.mods.galacticraft.planets.venus.inventory.ContainerGeothermal; import micdoodle8.mods.galacticraft.planets.venus.recipe.RecipeManagerVenus; import micdoodle8.mods.galacticraft.planets.venus.tile.*; +import micdoodle8.mods.galacticraft.planets.venus.world.gen.BiomeVenus; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialLiquid; @@ -40,6 +42,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.biome.Biome; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fluids.Fluid; @@ -131,6 +134,10 @@ public void init(FMLInitializationEvent event) GalacticraftRegistry.registerGear(Constants.GEAR_ID_THERMAL_PADDING_T2_BOOTS, EnumExtendedInventorySlot.THERMAL_BOOTS, new ItemStack(VenusItems.thermalPaddingTier2, 1, 3)); GalacticraftCore.proxy.registerFluidTexture(VenusModule.sulphuricAcid, new ResourceLocation(GalacticraftPlanets.ASSET_PREFIX, "textures/misc/underacid.png")); + + Biome.registerBiome(ConfigManagerCore.biomeIDbase + 4, GalacticraftPlanets.TEXTURE_PREFIX + BiomeVenus.venusFlat.getBiomeName(), BiomeVenus.venusFlat); + Biome.registerBiome(ConfigManagerCore.biomeIDbase + 5, GalacticraftPlanets.TEXTURE_PREFIX + BiomeVenus.venusMountain.getBiomeName(), BiomeVenus.venusMountain); + Biome.registerBiome(ConfigManagerCore.biomeIDbase + 6, GalacticraftPlanets.TEXTURE_PREFIX + BiomeVenus.venusValley.getBiomeName(), BiomeVenus.venusValley); } @Override @@ -214,15 +221,16 @@ public void syncConfig() ConfigManagerVenus.syncConfig(false, false); } - public void registerGalacticraftCreature(Class var0, String var1, int back, int fore) + public void registerGalacticraftCreature(Class clazz, String name, int back, int fore) { - VenusModule.registerGalacticraftNonMobEntity(var0, var1, 80, 3, true); + VenusModule.registerGalacticraftNonMobEntity(clazz, name, 80, 3, true); int nextEggID = GCCoreUtil.getNextValidID(); if (nextEggID < 65536) { - EntityList.ID_TO_CLASS.put(nextEggID, var0); - EntityList.CLASS_TO_ID.put(var0, nextEggID); - EntityList.ENTITY_EGGS.put(var1, new EntityList.EntityEggInfo(var1, back, fore)); + name = Constants.MOD_ID_PLANETS + "." + name; + EntityList.ID_TO_CLASS.put(nextEggID, clazz); + EntityList.CLASS_TO_ID.put(clazz, nextEggID); + EntityList.ENTITY_EGGS.put(name, new EntityList.EntityEggInfo(name, back, fore)); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java index 3688b7f288..7b0d7eada9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/dungeon/RoomSpawnerVenus.java @@ -1,5 +1,6 @@ package micdoodle8.mods.galacticraft.planets.venus.world.gen.dungeon; +import micdoodle8.mods.galacticraft.core.Constants; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntityMobSpawner; import net.minecraft.util.math.BlockPos; @@ -69,14 +70,14 @@ private static String getMob(Random rand) switch (rand.nextInt(4)) { case 0: - return "GalacticraftCore.evolved_spider"; + return Constants.MOD_ID_CORE + ".evolved_spider"; case 1: - return "GalacticraftCore.evolved_creeper"; + return Constants.MOD_ID_CORE + ".evolved_creeper"; case 2: - return "GalacticraftCore.evolved_skeleton"; + return Constants.MOD_ID_CORE + ".evolved_skeleton"; case 3: default: - return "GalacticraftCore.evolved_zombie"; + return Constants.MOD_ID_CORE + ".evolved_zombie"; } } } \ No newline at end of file diff --git a/src/main/resources/assets/galacticraftcore/lang/cs_CZ.lang b/src/main/resources/assets/galacticraftcore/lang/cs_CZ.lang index dae5b5dea3..7338ee6538 100644 --- a/src/main/resources/assets/galacticraftcore/lang/cs_CZ.lang +++ b/src/main/resources/assets/galacticraftcore/lang/cs_CZ.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s zapoměl skafandr. dimension.moon.name=Měsic dimension.overworld.name=Zemský povrh dimension.sun.name=Slunce -entity.alien_villager.name=Mimozemšťan -entity.buggy.name=Bugina -entity.celestial_screen.name=Obrazovka vesmírných těles -entity.evolved_creeper.name=Vyvinutý syčák -entity.evolved_skeleton.name=Vyvinutý kostlivec -entity.evolved_skeleton_boss.name=Vyvinutý kostlivec (Boss) -entity.evolved_spider.name=Vyvinutý pavouk -entity.evolved_zombie.name=Vyvinutý zombie -entity.flag.name=Vlajka -entity.gcflag.name=Vlajka -entity.gravity_arrow.name=Šíp -entity.lander.name=Přistávací modul -entity.meteor.name=Meteorit -entity.meteor_chunk.name=Úlomek meteoritu -entity.oxygen_bubble.name=Kyslíková bublina -entity.para_chest.name=Truhla na padáku -entity.rocket_t1.name=Raketa typ 1 +entity.galacticraftcore.alien_villager.name=Mimozemšťan +entity.galacticraftcore.buggy.name=Bugina +entity.galacticraftcore.celestial_screen.name=Obrazovka vesmírných těles +entity.galacticraftcore.evolved_creeper.name=Vyvinutý syčák +entity.galacticraftcore.evolved_skeleton.name=Vyvinutý kostlivec +entity.galacticraftcore.evolved_skeleton_boss.name=Vyvinutý kostlivec (Boss) +entity.galacticraftcore.evolved_spider.name=Vyvinutý pavouk +entity.galacticraftcore.evolved_zombie.name=Vyvinutý zombie +entity.galacticraftcore.flag.name=Vlajka +entity.galacticraftcore.gcflag.name=Vlajka +entity.galacticraftcore.gravity_arrow.name=Šíp +entity.galacticraftcore.lander.name=Přistávací modul +entity.galacticraftcore.meteor.name=Meteorit +entity.galacticraftcore.meteor_chunk.name=Úlomek meteoritu +entity.galacticraftcore.oxygen_bubble.name=Kyslíková bublina +entity.galacticraftcore.para_chest.name=Truhla na padáku +entity.galacticraftcore.rocket_t1.name=Raketa typ 1 galaxy.milky_way=Mléčná dráha gc.configgui.alternate_canister_recipe=Alternativní láhve gc.configgui.asteroids_start=Režim výzvy (Asteroidy) diff --git a/src/main/resources/assets/galacticraftcore/lang/cy_GB.lang b/src/main/resources/assets/galacticraftcore/lang/cy_GB.lang index f5e45f3e04..a3649916af 100644 --- a/src/main/resources/assets/galacticraftcore/lang/cy_GB.lang +++ b/src/main/resources/assets/galacticraftcore/lang/cy_GB.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s forgot thermal protection ##NEEDS TRANSLATE## dimension.moon.name= Moon dimension.overworld.name= overworld dimension.sun.name= Sun -entity.alien_villager.name= Pentrefwr Alien -entity.buggy.name= Buggy -entity.celestial_screen.name=Celestial Screen ##NEEDS TRANSLATE## -entity.evolved_creeper.name= esblygu Dringwr Bach -entity.evolved_skeleton.name= esblygu Sgerbwd -entity.evolved_skeleton_boss.name= esblygu Sgerbwd Boss -entity.evolved_spider.name= esblygu Spider -entity.evolved_zombie.name= esblygu Zombie -entity.flag.name= Flag -entity.gcflag.name=Flag ##NEEDS TRANSLATE## -entity.gravity_arrow.name= Arrow -entity.lander.name= Gofod Lander -entity.meteor.name= Meteor -entity.meteor_chunk.name=Meteor Chunk ##NEEDS TRANSLATE## -entity.oxygen_bubble.name= Ocsigen Bubble -entity.para_chest.name= Parachest -entity.rocket_t1.name= Haen 1 Roced +entity.galacticraftcore.alien_villager.name= Pentrefwr Alien +entity.galacticraftcore.buggy.name= Buggy +entity.galacticraftcore.celestial_screen.name=Celestial Screen ##NEEDS TRANSLATE## +entity.galacticraftcore.evolved_creeper.name= esblygu Dringwr Bach +entity.galacticraftcore.evolved_skeleton.name= esblygu Sgerbwd +entity.galacticraftcore.evolved_skeleton_boss.name= esblygu Sgerbwd Boss +entity.galacticraftcore.evolved_spider.name= esblygu Spider +entity.galacticraftcore.evolved_zombie.name= esblygu Zombie +entity.galacticraftcore.flag.name= Flag +entity.galacticraftcore.gcflag.name=Flag ##NEEDS TRANSLATE## +entity.galacticraftcore.gravity_arrow.name= Arrow +entity.galacticraftcore.lander.name= Gofod Lander +entity.galacticraftcore.meteor.name= Meteor +entity.galacticraftcore.meteor_chunk.name=Meteor Chunk ##NEEDS TRANSLATE## +entity.galacticraftcore.oxygen_bubble.name= Ocsigen Bubble +entity.galacticraftcore.para_chest.name= Parachest +entity.galacticraftcore.rocket_t1.name= Haen 1 Roced galaxy.milky_way=Milky Way ##NEEDS TRANSLATE## gc.configgui.alternate_canister_recipe=Alternate Canister Recipe gc.configgui.asteroids_start=Challenge Mode (Asteroids start) ##NEEDS TRANSLATE## diff --git a/src/main/resources/assets/galacticraftcore/lang/de_DE.lang b/src/main/resources/assets/galacticraftcore/lang/de_DE.lang index d36dbbd25d..7710799c7b 100644 --- a/src/main/resources/assets/galacticraftcore/lang/de_DE.lang +++ b/src/main/resources/assets/galacticraftcore/lang/de_DE.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s hat vergessen, dass Temperaturen nicht überall gleich dimension.moon.name=Mond dimension.overworld.name=Oberwelt dimension.sun.name=Sonne -entity.alien_villager.name=Alien-Dorfbewohner -entity.buggy.name=Mondrover -entity.celestial_screen.name=Celestial Screen ##NEEDS TRANSLATE## -entity.evolved_creeper.name=Entwickelter Creeper -entity.evolved_skeleton.name=Entwickeltes Skelett -entity.evolved_skeleton_boss.name=Entwickelter Skelett-Boss -entity.evolved_spider.name=Entwickelte Spinne -entity.evolved_zombie.name=Entwickelter Zombie -entity.flag.name=Flagge -entity.gcflag.name=Flagge -entity.gravity_arrow.name=Pfeil -entity.lander.name=Weltraum-Landekapsel -entity.meteor.name=Meteor -entity.meteor_chunk.name=Meteorbrocken -entity.oxygen_bubble.name=Sauerstoffblase -entity.para_chest.name=Paratruhe -entity.rocket_t1.name=Raumschiff +entity.galacticraftcore.alien_villager.name=Alien-Dorfbewohner +entity.galacticraftcore.buggy.name=Mondrover +entity.galacticraftcore.celestial_screen.name=Celestial Screen ##NEEDS TRANSLATE## +entity.galacticraftcore.evolved_creeper.name=Entwickelter Creeper +entity.galacticraftcore.evolved_skeleton.name=Entwickeltes Skelett +entity.galacticraftcore.evolved_skeleton_boss.name=Entwickelter Skelett-Boss +entity.galacticraftcore.evolved_spider.name=Entwickelte Spinne +entity.galacticraftcore.evolved_zombie.name=Entwickelter Zombie +entity.galacticraftcore.flag.name=Flagge +entity.galacticraftcore.gcflag.name=Flagge +entity.galacticraftcore.gravity_arrow.name=Pfeil +entity.galacticraftcore.lander.name=Weltraum-Landekapsel +entity.galacticraftcore.meteor.name=Meteor +entity.galacticraftcore.meteor_chunk.name=Meteorbrocken +entity.galacticraftcore.oxygen_bubble.name=Sauerstoffblase +entity.galacticraftcore.para_chest.name=Paratruhe +entity.galacticraftcore.rocket_t1.name=Raumschiff galaxy.milky_way=Milchstraße gc.configgui.alternate_canister_recipe=Alternatives Kanister-Rezept gc.configgui.asteroids_start=Herausforderungsmodus (Asteroiden-Start) diff --git a/src/main/resources/assets/galacticraftcore/lang/en_GB.lang b/src/main/resources/assets/galacticraftcore/lang/en_GB.lang index 189d8c57a6..7ca47d0d63 100644 --- a/src/main/resources/assets/galacticraftcore/lang/en_GB.lang +++ b/src/main/resources/assets/galacticraftcore/lang/en_GB.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s forgot thermal protection dimension.moon.name=Moon dimension.overworld.name=Overworld dimension.sun.name=Sun -entity.alien_villager.name=Alien Villager -entity.buggy.name=Buggy -entity.celestial_screen.name=Celestial Screen ##NEEDS TRANSLATE## -entity.evolved_creeper.name=Evolved Creeper -entity.evolved_skeleton.name=Evolved Skeleton -entity.evolved_skeleton_boss.name=Evolved Skeleton Boss -entity.evolved_spider.name=Evolved Spider -entity.evolved_zombie.name=Evolved Zombie -entity.flag.name=Flag -entity.gcflag.name=Flag -entity.gravity_arrow.name=Arrow -entity.lander.name=Space Lander -entity.meteor.name=Meteor -entity.meteor_chunk.name=Meteor Chunk -entity.oxygen_bubble.name=Oxygen Bubble -entity.para_chest.name=Parachest -entity.rocket_t1.name=Tier 1 Rocket +entity.galacticraftcore.alien_villager.name=Alien Villager +entity.galacticraftcore.buggy.name=Buggy +entity.galacticraftcore.celestial_screen.name=Celestial Screen ##NEEDS TRANSLATE## +entity.galacticraftcore.evolved_creeper.name=Evolved Creeper +entity.galacticraftcore.evolved_skeleton.name=Evolved Skeleton +entity.galacticraftcore.evolved_skeleton_boss.name=Evolved Skeleton Boss +entity.galacticraftcore.evolved_spider.name=Evolved Spider +entity.galacticraftcore.evolved_zombie.name=Evolved Zombie +entity.galacticraftcore.flag.name=Flag +entity.galacticraftcore.gcflag.name=Flag +entity.galacticraftcore.gravity_arrow.name=Arrow +entity.galacticraftcore.lander.name=Space Lander +entity.galacticraftcore.meteor.name=Meteor +entity.galacticraftcore.meteor_chunk.name=Meteor Chunk +entity.galacticraftcore.oxygen_bubble.name=Oxygen Bubble +entity.galacticraftcore.para_chest.name=Parachest +entity.galacticraftcore.rocket_t1.name=Tier 1 Rocket galaxy.milky_way=Milky Way gc.configgui.alternate_canister_recipe=Alternate Canister Recipe gc.configgui.asteroids_start=Herausforderungsmodus (Asteroiden-Start) diff --git a/src/main/resources/assets/galacticraftcore/lang/en_US.lang b/src/main/resources/assets/galacticraftcore/lang/en_US.lang index b7367039d8..24a19f0d9a 100644 --- a/src/main/resources/assets/galacticraftcore/lang/en_US.lang +++ b/src/main/resources/assets/galacticraftcore/lang/en_US.lang @@ -33,23 +33,23 @@ death.attack.thermal=%1$s forgot thermal protection dimension.moon.name=Moon dimension.overworld.name=Overworld dimension.sun.name=Sun -entity.alien_villager.name=Alien Villager -entity.buggy.name=Buggy -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=Evolved Creeper -entity.evolved_skeleton.name=Evolved Skeleton -entity.evolved_skeleton_boss.name=Evolved Skeleton Boss -entity.evolved_spider.name=Evolved Spider -entity.evolved_zombie.name=Evolved Zombie -entity.flag.name=Flag -entity.gcflag.name=Flag -entity.gravity_arrow.name=Arrow -entity.lander.name=Space Lander -entity.meteor.name=Meteor -entity.meteor_chunk.name=Meteor Chunk -entity.oxygen_bubble.name=Oxygen Bubble -entity.para_chest.name=Parachest -entity.rocket_t1.name=Tier 1 Rocket +entity.galacticraftcore.alien_villager.name=Alien Villager +entity.galacticraftcore.buggy.name=Buggy +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=Evolved Creeper +entity.galacticraftcore.evolved_skeleton.name=Evolved Skeleton +entity.galacticraftcore.evolved_skeleton_boss.name=Evolved Skeleton Boss +entity.galacticraftcore.evolved_spider.name=Evolved Spider +entity.galacticraftcore.evolved_zombie.name=Evolved Zombie +entity.galacticraftcore.flag.name=Flag +entity.galacticraftcore.gcflag.name=Flag +entity.galacticraftcore.gravity_arrow.name=Arrow +entity.galacticraftcore.lander.name=Space Lander +entity.galacticraftcore.meteor.name=Meteor +entity.galacticraftcore.meteor_chunk.name=Meteor Chunk +entity.galacticraftcore.oxygen_bubble.name=Oxygen Bubble +entity.galacticraftcore.para_chest.name=Parachest +entity.galacticraftcore.rocket_t1.name=Tier 1 Rocket galaxy.milky_way=Milky Way gc.configgui.alternate_canister_recipe=Alternate Canister Recipe gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/es_ES.lang b/src/main/resources/assets/galacticraftcore/lang/es_ES.lang index abea7c3445..a0412709f7 100644 --- a/src/main/resources/assets/galacticraftcore/lang/es_ES.lang +++ b/src/main/resources/assets/galacticraftcore/lang/es_ES.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s olvidó la protección térmica dimension.moon.name=Luna dimension.overworld.name=Mundo principal dimension.sun.name=Sol -entity.alien_villager.name=Aldeano alien -entity.buggy.name=Buggy -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=Creeper evolucionado -entity.evolved_skeleton.name=Esqueleto evolucionado -entity.evolved_skeleton_boss.name=Jefe esqueleto evolucionado -entity.evolved_spider.name=Araña evolucionada -entity.evolved_zombie.name=Zombie evolucionado -entity.flag.name=Bandera -entity.gcflag.name=Bandera -entity.gravity_arrow.name=Flecha -entity.lander.name=Aterrizador -entity.meteor.name=Meteorito -entity.meteor_chunk.name=Trozo de meteorito -entity.oxygen_bubble.name=Burbuja de oxígeno -entity.para_chest.name=Cofre-paraca -entity.rocket_t1.name=Cohete nivel 1 +entity.galacticraftcore.alien_villager.name=Aldeano alien +entity.galacticraftcore.buggy.name=Buggy +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=Creeper evolucionado +entity.galacticraftcore.evolved_skeleton.name=Esqueleto evolucionado +entity.galacticraftcore.evolved_skeleton_boss.name=Jefe esqueleto evolucionado +entity.galacticraftcore.evolved_spider.name=Araña evolucionada +entity.galacticraftcore.evolved_zombie.name=Zombie evolucionado +entity.galacticraftcore.flag.name=Bandera +entity.galacticraftcore.gcflag.name=Bandera +entity.galacticraftcore.gravity_arrow.name=Flecha +entity.galacticraftcore.lander.name=Aterrizador +entity.galacticraftcore.meteor.name=Meteorito +entity.galacticraftcore.meteor_chunk.name=Trozo de meteorito +entity.galacticraftcore.oxygen_bubble.name=Burbuja de oxígeno +entity.galacticraftcore.para_chest.name=Cofre-paraca +entity.galacticraftcore.rocket_t1.name=Cohete nivel 1 galaxy.milky_way=Vía Láctea gc.configgui.alternate_canister_recipe=Alternar receta de bote gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/fi_FI.lang b/src/main/resources/assets/galacticraftcore/lang/fi_FI.lang index 6ffc300af3..d5e2b3d22e 100644 --- a/src/main/resources/assets/galacticraftcore/lang/fi_FI.lang +++ b/src/main/resources/assets/galacticraftcore/lang/fi_FI.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s forgot thermal protection ##NEEDS TRANSLATE## dimension.moon.name=Moon ##NEEDS TRANSLATE## dimension.overworld.name=Overworld dimension.sun.name=Sun -entity.alien_villager.name=Alien Villager -entity.buggy.name=Buggy -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=Evolved Creeper -entity.evolved_skeleton.name=Evolved Skeleton -entity.evolved_skeleton_boss.name=Evolved Skeleton Boss -entity.evolved_spider.name=Evolved Spider -entity.evolved_zombie.name=Evolved Zombie -entity.flag.name=Flag -entity.gcflag.name=Flag ##NEEDS TRANSLATE## -entity.gravity_arrow.name=Arrow -entity.lander.name=Space Lander -entity.meteor.name=Pudonnut meteoriitti -entity.meteor_chunk.name=Meteor Chunk ##NEEDS TRANSLATE## -entity.oxygen_bubble.name=Oxygen Bubble -entity.para_chest.name=Parachest -entity.rocket_t1.name=Tason 1 raketti +entity.galacticraftcore.alien_villager.name=Alien Villager +entity.galacticraftcore.buggy.name=Buggy +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=Evolved Creeper +entity.galacticraftcore.evolved_skeleton.name=Evolved Skeleton +entity.galacticraftcore.evolved_skeleton_boss.name=Evolved Skeleton Boss +entity.galacticraftcore.evolved_spider.name=Evolved Spider +entity.galacticraftcore.evolved_zombie.name=Evolved Zombie +entity.galacticraftcore.flag.name=Flag +entity.galacticraftcore.gcflag.name=Flag ##NEEDS TRANSLATE## +entity.galacticraftcore.gravity_arrow.name=Arrow +entity.galacticraftcore.lander.name=Space Lander +entity.galacticraftcore.meteor.name=Pudonnut meteoriitti +entity.galacticraftcore.meteor_chunk.name=Meteor Chunk ##NEEDS TRANSLATE## +entity.galacticraftcore.oxygen_bubble.name=Oxygen Bubble +entity.galacticraftcore.para_chest.name=Parachest +entity.galacticraftcore.rocket_t1.name=Tason 1 raketti galaxy.milky_way=Milky Way ##NEEDS TRANSLATE## gc.configgui.alternate_canister_recipe=Alternate Canister Recipe gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/fr_CA.lang b/src/main/resources/assets/galacticraftcore/lang/fr_CA.lang index 1a93b9f39d..46dcb0892e 100644 --- a/src/main/resources/assets/galacticraftcore/lang/fr_CA.lang +++ b/src/main/resources/assets/galacticraftcore/lang/fr_CA.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s forgot thermal protection ##NEEDS TRANSLATE## dimension.moon.name=Moon ##NEEDS TRANSLATE## dimension.overworld.name=Overworld dimension.sun.name=Sun -entity.alien_villager.name=Alien Villager -entity.buggy.name=Buggy -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=Evolved Creeper -entity.evolved_skeleton.name=Evolved Skeleton -entity.evolved_skeleton_boss.name=Evolved Skeleton Boss -entity.evolved_spider.name=Evolved Spider -entity.evolved_zombie.name=Evolved Zombie -entity.flag.name=Flag -entity.gcflag.name=Flag ##NEEDS TRANSLATE## -entity.gravity_arrow.name=Arrow -entity.lander.name=Space Lander -entity.meteor.name=Meteor -entity.meteor_chunk.name=Meteor Chunk ##NEEDS TRANSLATE## -entity.oxygen_bubble.name=Oxygen Bubble -entity.para_chest.name=Parachest -entity.rocket_t1.name=Tier 1 Rocket +entity.galacticraftcore.alien_villager.name=Alien Villager +entity.galacticraftcore.buggy.name=Buggy +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=Evolved Creeper +entity.galacticraftcore.evolved_skeleton.name=Evolved Skeleton +entity.galacticraftcore.evolved_skeleton_boss.name=Evolved Skeleton Boss +entity.galacticraftcore.evolved_spider.name=Evolved Spider +entity.galacticraftcore.evolved_zombie.name=Evolved Zombie +entity.galacticraftcore.flag.name=Flag +entity.galacticraftcore.gcflag.name=Flag ##NEEDS TRANSLATE## +entity.galacticraftcore.gravity_arrow.name=Arrow +entity.galacticraftcore.lander.name=Space Lander +entity.galacticraftcore.meteor.name=Meteor +entity.galacticraftcore.meteor_chunk.name=Meteor Chunk ##NEEDS TRANSLATE## +entity.galacticraftcore.oxygen_bubble.name=Oxygen Bubble +entity.galacticraftcore.para_chest.name=Parachest +entity.galacticraftcore.rocket_t1.name=Tier 1 Rocket galaxy.milky_way=Milky Way ##NEEDS TRANSLATE## gc.configgui.alternate_canister_recipe=Alternate Canister Recipe gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/fr_FR.lang b/src/main/resources/assets/galacticraftcore/lang/fr_FR.lang index e1df11bd21..9722b3799e 100644 --- a/src/main/resources/assets/galacticraftcore/lang/fr_FR.lang +++ b/src/main/resources/assets/galacticraftcore/lang/fr_FR.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s a oublié sa protection thermique ! dimension.moon.name=Lune dimension.overworld.name=Terre dimension.sun.name=Soleil -entity.alien_villager.name=Villageois alien -entity.buggy.name=Boghei -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=Creeper évolué -entity.evolved_skeleton.name=Squelette évolué -entity.evolved_skeleton_boss.name=Boss squelette évolué -entity.evolved_spider.name=Araignée évolué -entity.evolved_zombie.name=Zombie évolué -entity.flag.name=Drapeau -entity.gcflag.name=Drapeau -entity.gravity_arrow.name=Flèche -entity.lander.name=Atterrisseur spatial -entity.meteor.name=Météore -entity.meteor_chunk.name=Morceau de météore -entity.oxygen_bubble.name=Bulle d'oxygène -entity.para_chest.name=Coffre parachuté -entity.rocket_t1.name=Fusée Niveau 1 +entity.galacticraftcore.alien_villager.name=Villageois alien +entity.galacticraftcore.buggy.name=Boghei +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=Creeper évolué +entity.galacticraftcore.evolved_skeleton.name=Squelette évolué +entity.galacticraftcore.evolved_skeleton_boss.name=Boss squelette évolué +entity.galacticraftcore.evolved_spider.name=Araignée évolué +entity.galacticraftcore.evolved_zombie.name=Zombie évolué +entity.galacticraftcore.flag.name=Drapeau +entity.galacticraftcore.gcflag.name=Drapeau +entity.galacticraftcore.gravity_arrow.name=Flèche +entity.galacticraftcore.lander.name=Atterrisseur spatial +entity.galacticraftcore.meteor.name=Météore +entity.galacticraftcore.meteor_chunk.name=Morceau de météore +entity.galacticraftcore.oxygen_bubble.name=Bulle d'oxygène +entity.galacticraftcore.para_chest.name=Coffre parachuté +entity.galacticraftcore.rocket_t1.name=Fusée Niveau 1 galaxy.milky_way=Voie lactée gc.configgui.alternate_canister_recipe=Recette alternative des bouteilles gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/hr_HR.lang b/src/main/resources/assets/galacticraftcore/lang/hr_HR.lang index e8f767fb7a..f6daa4151e 100644 --- a/src/main/resources/assets/galacticraftcore/lang/hr_HR.lang +++ b/src/main/resources/assets/galacticraftcore/lang/hr_HR.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s je zaboravio termalnu zaštitu! dimension.moon.name=Mjesec dimension.overworld.name=Minecraftia dimension.sun.name=Sunce -entity.alien_villager.name=Vanzemaljac -entity.buggy.name=Rover -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=Evoulirani Kriper -entity.evolved_skeleton.name=Evoulirani Kostur -entity.evolved_skeleton_boss.name=Evoulirani Kralj Kostura -entity.evolved_spider.name=Evoulirani Pauk -entity.evolved_zombie.name=Evoulirani Zombi -entity.flag.name=Zastava -entity.gcflag.name=Zastava -entity.gravity_arrow.name=Strijela -entity.lander.name=Lander -entity.meteor.name=Meteor -entity.meteor_chunk.name=Meteor Chunk -entity.oxygen_bubble.name=Zračni Balon -entity.para_chest.name=PadoŠkrinja -entity.rocket_t1.name=Raketa Ranga 1 +entity.galacticraftcore.alien_villager.name=Vanzemaljac +entity.galacticraftcore.buggy.name=Rover +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=Evoulirani Kriper +entity.galacticraftcore.evolved_skeleton.name=Evoulirani Kostur +entity.galacticraftcore.evolved_skeleton_boss.name=Evoulirani Kralj Kostura +entity.galacticraftcore.evolved_spider.name=Evoulirani Pauk +entity.galacticraftcore.evolved_zombie.name=Evoulirani Zombi +entity.galacticraftcore.flag.name=Zastava +entity.galacticraftcore.gcflag.name=Zastava +entity.galacticraftcore.gravity_arrow.name=Strijela +entity.galacticraftcore.lander.name=Lander +entity.galacticraftcore.meteor.name=Meteor +entity.galacticraftcore.meteor_chunk.name=Meteor Chunk +entity.galacticraftcore.oxygen_bubble.name=Zračni Balon +entity.galacticraftcore.para_chest.name=PadoŠkrinja +entity.galacticraftcore.rocket_t1.name=Raketa Ranga 1 galaxy.milky_way=Mliječni Put gc.configgui.alternate_canister_recipe=Alternate Canister Recipe gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/hu_HU.lang b/src/main/resources/assets/galacticraftcore/lang/hu_HU.lang index a979cb5ec0..6a5cdf2183 100644 --- a/src/main/resources/assets/galacticraftcore/lang/hu_HU.lang +++ b/src/main/resources/assets/galacticraftcore/lang/hu_HU.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s forgot thermal protection ##NEEDS TRANSLATE## dimension.moon.name=Hold dimension.overworld.name=Föld dimension.sun.name=Nap -entity.alien_villager.name=Idegen Falusi -entity.buggy.name=Rover -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=Fejlett Creeper -entity.evolved_skeleton.name=Fejlett Csontváz -entity.evolved_skeleton_boss.name=Fejlett Csontváz-Főgonosz -entity.evolved_spider.name=Fejlett Pók -entity.evolved_zombie.name=Fejlett Zombi -entity.flag.name=Zászló -entity.gcflag.name=Zászló -entity.gravity_arrow.name=Nyílvessző -entity.lander.name=Leszállóegység -entity.meteor.name=Meteor -entity.meteor_chunk.name=Meteordarab -entity.oxygen_bubble.name=Légbuborék -entity.para_chest.name=Utánpótlás-Szállító Láda -entity.rocket_t1.name=1-Es Szintű Rakéta +entity.galacticraftcore.alien_villager.name=Idegen Falusi +entity.galacticraftcore.buggy.name=Rover +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=Fejlett Creeper +entity.galacticraftcore.evolved_skeleton.name=Fejlett Csontváz +entity.galacticraftcore.evolved_skeleton_boss.name=Fejlett Csontváz-Főgonosz +entity.galacticraftcore.evolved_spider.name=Fejlett Pók +entity.galacticraftcore.evolved_zombie.name=Fejlett Zombi +entity.galacticraftcore.flag.name=Zászló +entity.galacticraftcore.gcflag.name=Zászló +entity.galacticraftcore.gravity_arrow.name=Nyílvessző +entity.galacticraftcore.lander.name=Leszállóegység +entity.galacticraftcore.meteor.name=Meteor +entity.galacticraftcore.meteor_chunk.name=Meteordarab +entity.galacticraftcore.oxygen_bubble.name=Légbuborék +entity.galacticraftcore.para_chest.name=Utánpótlás-Szállító Láda +entity.galacticraftcore.rocket_t1.name=1-Es Szintű Rakéta galaxy.milky_way=Tejútrendszer gc.configgui.alternate_canister_recipe=Alternate Canister Recipe gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/it_IT.lang b/src/main/resources/assets/galacticraftcore/lang/it_IT.lang index bd267fc17a..d50019cf68 100644 --- a/src/main/resources/assets/galacticraftcore/lang/it_IT.lang +++ b/src/main/resources/assets/galacticraftcore/lang/it_IT.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$ ha dimenticato la protezione per le alte temperature. dimension.moon.name=Luna dimension.overworld.name=Terra dimension.sun.name=Sole -entity.alien_villager.name=Paesano alieno -entity.buggy.name=Rover -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=Creeper evoluto -entity.evolved_skeleton.name=Scheletro evoluto -entity.evolved_skeleton_boss.name=Scheletro-boss evoluto -entity.evolved_spider.name=Ragno evoluto -entity.evolved_zombie.name=Zombie evoluto -entity.flag.name=Bandiera -entity.gcflag.name=Bandiera -entity.gravity_arrow.name=Freccia -entity.lander.name=Space Lander -entity.meteor.name=Meteora -entity.meteor_chunk.name=Pezzo di meteorite -entity.oxygen_bubble.name=Bolla di ossigeno -entity.para_chest.name=Cassa del razzo -entity.rocket_t1.name=Razzo di livello 1 +entity.galacticraftcore.alien_villager.name=Paesano alieno +entity.galacticraftcore.buggy.name=Rover +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=Creeper evoluto +entity.galacticraftcore.evolved_skeleton.name=Scheletro evoluto +entity.galacticraftcore.evolved_skeleton_boss.name=Scheletro-boss evoluto +entity.galacticraftcore.evolved_spider.name=Ragno evoluto +entity.galacticraftcore.evolved_zombie.name=Zombie evoluto +entity.galacticraftcore.flag.name=Bandiera +entity.galacticraftcore.gcflag.name=Bandiera +entity.galacticraftcore.gravity_arrow.name=Freccia +entity.galacticraftcore.lander.name=Space Lander +entity.galacticraftcore.meteor.name=Meteora +entity.galacticraftcore.meteor_chunk.name=Pezzo di meteorite +entity.galacticraftcore.oxygen_bubble.name=Bolla di ossigeno +entity.galacticraftcore.para_chest.name=Cassa del razzo +entity.galacticraftcore.rocket_t1.name=Razzo di livello 1 galaxy.milky_way=Via lattea gc.configgui.alternate_canister_recipe=Alternate Canister Recipe gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/ja_JP.lang b/src/main/resources/assets/galacticraftcore/lang/ja_JP.lang index 79921d9c29..9ca1ee138a 100644 --- a/src/main/resources/assets/galacticraftcore/lang/ja_JP.lang +++ b/src/main/resources/assets/galacticraftcore/lang/ja_JP.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$は熱保護を忘れた dimension.moon.name=月 dimension.overworld.name=地球 dimension.sun.name=火星 -entity.alien_villager.name=宇宙の村人 -entity.buggy.name=バギー -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=宇宙のクリーパー -entity.evolved_skeleton.name=宇宙のスケルトン -entity.evolved_skeleton_boss.name=スケルトンキング -entity.evolved_spider.name=宇宙のクモ -entity.evolved_zombie.name=宇宙のゾンビ -entity.flag.name=旗 -entity.gcflag.name=旗 -entity.gravity_arrow.name=矢 -entity.lander.name=ランダー -entity.meteor.name=流星 -entity.meteor_chunk.name=流星チャンク -entity.oxygen_bubble.name=酸素バブル -entity.para_chest.name=パラシュートチェスト -entity.rocket_t1.name=レベル1 ロケット +entity.galacticraftcore.alien_villager.name=宇宙の村人 +entity.galacticraftcore.buggy.name=バギー +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=宇宙のクリーパー +entity.galacticraftcore.evolved_skeleton.name=宇宙のスケルトン +entity.galacticraftcore.evolved_skeleton_boss.name=スケルトンキング +entity.galacticraftcore.evolved_spider.name=宇宙のクモ +entity.galacticraftcore.evolved_zombie.name=宇宙のゾンビ +entity.galacticraftcore.flag.name=旗 +entity.galacticraftcore.gcflag.name=旗 +entity.galacticraftcore.gravity_arrow.name=矢 +entity.galacticraftcore.lander.name=ランダー +entity.galacticraftcore.meteor.name=流星 +entity.galacticraftcore.meteor_chunk.name=流星チャンク +entity.galacticraftcore.oxygen_bubble.name=酸素バブル +entity.galacticraftcore.para_chest.name=パラシュートチェスト +entity.galacticraftcore.rocket_t1.name=レベル1 ロケット galaxy.milky_way=天の川 gc.configgui.alternate_canister_recipe=Alternate Canister Recipe gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/ko_KR.lang b/src/main/resources/assets/galacticraftcore/lang/ko_KR.lang index 7596f4b16e..50dccdda37 100644 --- a/src/main/resources/assets/galacticraftcore/lang/ko_KR.lang +++ b/src/main/resources/assets/galacticraftcore/lang/ko_KR.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s 님, 열보호 장비를 잊으셨군요. dimension.moon.name=달 dimension.overworld.name=오버월드 (지구) dimension.sun.name=해 -entity.alien_villager.name=외계주민 -entity.buggy.name=버기 -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=진화한 크리퍼 -entity.evolved_skeleton.name=진화한 스켈레톤 -entity.evolved_skeleton_boss.name=진화한 스켈레톤 보스 -entity.evolved_spider.name=진화한 거미 -entity.evolved_zombie.name=진화한 좀비 -entity.flag.name=깃발 -entity.gcflag.name=깃발 -entity.gravity_arrow.name=화살 -entity.lander.name=착륙기 -entity.meteor.name=운석 -entity.meteor_chunk.name=운석 덩어리 -entity.oxygen_bubble.name=산소 기포 -entity.para_chest.name=낙하상자 -entity.rocket_t1.name=1티어 로켓 +entity.galacticraftcore.alien_villager.name=외계주민 +entity.galacticraftcore.buggy.name=버기 +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=진화한 크리퍼 +entity.galacticraftcore.evolved_skeleton.name=진화한 스켈레톤 +entity.galacticraftcore.evolved_skeleton_boss.name=진화한 스켈레톤 보스 +entity.galacticraftcore.evolved_spider.name=진화한 거미 +entity.galacticraftcore.evolved_zombie.name=진화한 좀비 +entity.galacticraftcore.flag.name=깃발 +entity.galacticraftcore.gcflag.name=깃발 +entity.galacticraftcore.gravity_arrow.name=화살 +entity.galacticraftcore.lander.name=착륙기 +entity.galacticraftcore.meteor.name=운석 +entity.galacticraftcore.meteor_chunk.name=운석 덩어리 +entity.galacticraftcore.oxygen_bubble.name=산소 기포 +entity.galacticraftcore.para_chest.name=낙하상자 +entity.galacticraftcore.rocket_t1.name=1티어 로켓 galaxy.milky_way=은하수 (우리 은하) gc.configgui.alternate_canister_recipe=대체 깡통 레시피 gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/nl_NL.lang b/src/main/resources/assets/galacticraftcore/lang/nl_NL.lang index 6f6071311f..222524547d 100644 --- a/src/main/resources/assets/galacticraftcore/lang/nl_NL.lang +++ b/src/main/resources/assets/galacticraftcore/lang/nl_NL.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s Vergat Thermische Bescherming dimension.moon.name=Maan dimension.overworld.name=Overwereld dimension.sun.name=Zon -entity.alien_villager.name=Alien Dorpeling -entity.buggy.name=Buggy -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=Geëvolueerde Creeper -entity.evolved_skeleton.name=Geëvolueerde Skeleton -entity.evolved_skeleton_boss.name=Geëvolueerde Skeleton Boss -entity.evolved_spider.name=Geëvolueerde Spin -entity.evolved_zombie.name=Geëvolueerde Zombie -entity.flag.name=Vlag -entity.gcflag.name=Vlag -entity.gravity_arrow.name=Pijl -entity.lander.name=Ruimte Lander -entity.meteor.name=Meteoor -entity.meteor_chunk.name=Meteoor Brokstuk -entity.oxygen_bubble.name=Zuurstof Bel -entity.para_chest.name=Parakist -entity.rocket_t1.name=Raket +entity.galacticraftcore.alien_villager.name=Alien Dorpeling +entity.galacticraftcore.buggy.name=Buggy +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=Geëvolueerde Creeper +entity.galacticraftcore.evolved_skeleton.name=Geëvolueerde Skeleton +entity.galacticraftcore.evolved_skeleton_boss.name=Geëvolueerde Skeleton Boss +entity.galacticraftcore.evolved_spider.name=Geëvolueerde Spin +entity.galacticraftcore.evolved_zombie.name=Geëvolueerde Zombie +entity.galacticraftcore.flag.name=Vlag +entity.galacticraftcore.gcflag.name=Vlag +entity.galacticraftcore.gravity_arrow.name=Pijl +entity.galacticraftcore.lander.name=Ruimte Lander +entity.galacticraftcore.meteor.name=Meteoor +entity.galacticraftcore.meteor_chunk.name=Meteoor Brokstuk +entity.galacticraftcore.oxygen_bubble.name=Zuurstof Bel +entity.galacticraftcore.para_chest.name=Parakist +entity.galacticraftcore.rocket_t1.name=Raket galaxy.milky_way=Melkweg gc.configgui.alternate_canister_recipe=Alternate Canister Recipe gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/pl_PL.lang b/src/main/resources/assets/galacticraftcore/lang/pl_PL.lang index 039ced795f..ae178c51c0 100644 --- a/src/main/resources/assets/galacticraftcore/lang/pl_PL.lang +++ b/src/main/resources/assets/galacticraftcore/lang/pl_PL.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s zapomniał ochrony termalnej! dimension.moon.name=Księżyc dimension.overworld.name=Ziemia dimension.sun.name=Słońce -entity.alien_villager.name=Kosmita-Wieśniak -entity.buggy.name=Buggy -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=Kosmiczny Creeper -entity.evolved_skeleton.name=Kosmiczny Szkielet -entity.evolved_skeleton_boss.name=Kosmiczny Szkielet-Gigant -entity.evolved_spider.name=Kosmiczny Pająk -entity.evolved_zombie.name=Kosmiczny Zombie -entity.flag.name=Flaga -entity.gcflag.name=Flaga -entity.gravity_arrow.name=Strzała -entity.lander.name=Lądownik Kosmiczny -entity.meteor.name=Meteor -entity.meteor_chunk.name=Kawałek Meteorytu -entity.oxygen_bubble.name=Bańka Tlenowa -entity.para_chest.name=Paraskrzynia -entity.rocket_t1.name=Statek Kosmiczny +entity.galacticraftcore.alien_villager.name=Kosmita-Wieśniak +entity.galacticraftcore.buggy.name=Buggy +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=Kosmiczny Creeper +entity.galacticraftcore.evolved_skeleton.name=Kosmiczny Szkielet +entity.galacticraftcore.evolved_skeleton_boss.name=Kosmiczny Szkielet-Gigant +entity.galacticraftcore.evolved_spider.name=Kosmiczny Pająk +entity.galacticraftcore.evolved_zombie.name=Kosmiczny Zombie +entity.galacticraftcore.flag.name=Flaga +entity.galacticraftcore.gcflag.name=Flaga +entity.galacticraftcore.gravity_arrow.name=Strzała +entity.galacticraftcore.lander.name=Lądownik Kosmiczny +entity.galacticraftcore.meteor.name=Meteor +entity.galacticraftcore.meteor_chunk.name=Kawałek Meteorytu +entity.galacticraftcore.oxygen_bubble.name=Bańka Tlenowa +entity.galacticraftcore.para_chest.name=Paraskrzynia +entity.galacticraftcore.rocket_t1.name=Statek Kosmiczny galaxy.milky_way=Droga Mleczna gc.configgui.alternate_canister_recipe=Alternatywna Receptura dla Kanistra gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/pt_BR.lang b/src/main/resources/assets/galacticraftcore/lang/pt_BR.lang index 7419b8c706..8375ba3c5f 100644 --- a/src/main/resources/assets/galacticraftcore/lang/pt_BR.lang +++ b/src/main/resources/assets/galacticraftcore/lang/pt_BR.lang @@ -33,23 +33,23 @@ death.attack.thermal=%1$s se esqueceu da proteção térmica. dimension.moon.name=Lua dimension.overworld.name=Mundo Principal dimension.sun.name=Sol -entity.alien_villager.name=Aldeão Alienígena -entity.buggy.name=Buggy -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=Creeper Evoluído -entity.evolved_skeleton.name=Esqueleto Evoluído -entity.evolved_skeleton_boss.name=Esqueleto-Chefe Evoluído -entity.evolved_spider.name=Aranha Evoluída -entity.evolved_zombie.name=Zumbi Evoluído -entity.flag.name=Bandeira -entity.gcflag.name=Bandeira -entity.gravity_arrow.name=Flecha -entity.lander.name=Módulo Espacial -entity.meteor.name=Meteoro -entity.meteor_chunk.name=Pedaço de Meteoro -entity.oxygen_bubble.name=Bolha de Oxigênio -entity.para_chest.name=Para-baú -entity.rocket_t1.name=Foguete Nível 1 +entity.galacticraftcore.alien_villager.name=Aldeão Alienígena +entity.galacticraftcore.buggy.name=Buggy +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=Creeper Evoluído +entity.galacticraftcore.evolved_skeleton.name=Esqueleto Evoluído +entity.galacticraftcore.evolved_skeleton_boss.name=Esqueleto-Chefe Evoluído +entity.galacticraftcore.evolved_spider.name=Aranha Evoluída +entity.galacticraftcore.evolved_zombie.name=Zumbi Evoluído +entity.galacticraftcore.flag.name=Bandeira +entity.galacticraftcore.gcflag.name=Bandeira +entity.galacticraftcore.gravity_arrow.name=Flecha +entity.galacticraftcore.lander.name=Módulo Espacial +entity.galacticraftcore.meteor.name=Meteoro +entity.galacticraftcore.meteor_chunk.name=Pedaço de Meteoro +entity.galacticraftcore.oxygen_bubble.name=Bolha de Oxigênio +entity.galacticraftcore.para_chest.name=Para-baú +entity.galacticraftcore.rocket_t1.name=Foguete Nível 1 galaxy.milky_way=Via Láctea gc.configgui.alternate_canister_recipe=Alternate Canister Recipe gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/pt_PT.lang b/src/main/resources/assets/galacticraftcore/lang/pt_PT.lang index fd83a33548..cc8624f618 100644 --- a/src/main/resources/assets/galacticraftcore/lang/pt_PT.lang +++ b/src/main/resources/assets/galacticraftcore/lang/pt_PT.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s se esqueceu da proteção térmica. dimension.moon.name=Lua dimension.overworld.name=Mundo Principal dimension.sun.name=Sol -entity.alien_villager.name=Aldeão Alienígena -entity.buggy.name=Buggy -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=Creeper Evoluído -entity.evolved_skeleton.name=Esqueleto Evoluído -entity.evolved_skeleton_boss.name=Esqueleto-Chefe Evoluído -entity.evolved_spider.name=Aranha Evoluída -entity.evolved_zombie.name=Zumbi Evoluído -entity.flag.name=Bandeira -entity.gcflag.name=Bandeira -entity.gravity_arrow.name=Flecha -entity.lander.name=Módulo Espacial -entity.meteor.name=Meteoro -entity.meteor_chunk.name=Pedaço de Meteoro -entity.oxygen_bubble.name=Bolha de Oxigénio -entity.para_chest.name=Para-baú -entity.rocket_t1.name=Foguetão Nível 1 +entity.galacticraftcore.alien_villager.name=Aldeão Alienígena +entity.galacticraftcore.buggy.name=Buggy +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=Creeper Evoluído +entity.galacticraftcore.evolved_skeleton.name=Esqueleto Evoluído +entity.galacticraftcore.evolved_skeleton_boss.name=Esqueleto-Chefe Evoluído +entity.galacticraftcore.evolved_spider.name=Aranha Evoluída +entity.galacticraftcore.evolved_zombie.name=Zumbi Evoluído +entity.galacticraftcore.flag.name=Bandeira +entity.galacticraftcore.gcflag.name=Bandeira +entity.galacticraftcore.gravity_arrow.name=Flecha +entity.galacticraftcore.lander.name=Módulo Espacial +entity.galacticraftcore.meteor.name=Meteoro +entity.galacticraftcore.meteor_chunk.name=Pedaço de Meteoro +entity.galacticraftcore.oxygen_bubble.name=Bolha de Oxigénio +entity.galacticraftcore.para_chest.name=Para-baú +entity.galacticraftcore.rocket_t1.name=Foguetão Nível 1 galaxy.milky_way=Via Láctea gc.configgui.alternate_canister_recipe=Alternate Canister Recipe gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/ru_RU.lang b/src/main/resources/assets/galacticraftcore/lang/ru_RU.lang index c609a4b85e..7a997d1822 100644 --- a/src/main/resources/assets/galacticraftcore/lang/ru_RU.lang +++ b/src/main/resources/assets/galacticraftcore/lang/ru_RU.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s забыл тепловую защиту dimension.moon.name=Луна dimension.overworld.name=Земля dimension.sun.name=Солнце -entity.alien_villager.name=Инопланетный житель -entity.buggy.name=Багги -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=Эволюционировавший крипер -entity.evolved_skeleton.name=Эволюционировавший скелет -entity.evolved_skeleton_boss.name=Эволюционировавший скелет-босс -entity.evolved_spider.name=Эволюционировавший паук -entity.evolved_zombie.name=Эволюционировавший зомби -entity.flag.name=Флаг -entity.gcflag.name=Флаг -entity.gravity_arrow.name=Стрелка -entity.lander.name=Посадочный модуль -entity.meteor.name=Метеорит -entity.meteor_chunk.name=Кусок метеорита -entity.oxygen_bubble.name=Кислородный пузырь -entity.para_chest.name=Сундук с парашютом -entity.rocket_t1.name=Ракета 1-го уровня +entity.galacticraftcore.alien_villager.name=Инопланетный житель +entity.galacticraftcore.buggy.name=Багги +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=Эволюционировавший крипер +entity.galacticraftcore.evolved_skeleton.name=Эволюционировавший скелет +entity.galacticraftcore.evolved_skeleton_boss.name=Эволюционировавший скелет-босс +entity.galacticraftcore.evolved_spider.name=Эволюционировавший паук +entity.galacticraftcore.evolved_zombie.name=Эволюционировавший зомби +entity.galacticraftcore.flag.name=Флаг +entity.galacticraftcore.gcflag.name=Флаг +entity.galacticraftcore.gravity_arrow.name=Стрелка +entity.galacticraftcore.lander.name=Посадочный модуль +entity.galacticraftcore.meteor.name=Метеорит +entity.galacticraftcore.meteor_chunk.name=Кусок метеорита +entity.galacticraftcore.oxygen_bubble.name=Кислородный пузырь +entity.galacticraftcore.para_chest.name=Сундук с парашютом +entity.galacticraftcore.rocket_t1.name=Ракета 1-го уровня galaxy.milky_way=Млечный Путь gc.configgui.alternate_canister_recipe=Альтернативный рецепт канистры gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/sv_SE.lang b/src/main/resources/assets/galacticraftcore/lang/sv_SE.lang index 9c12eef9aa..8122197e21 100644 --- a/src/main/resources/assets/galacticraftcore/lang/sv_SE.lang +++ b/src/main/resources/assets/galacticraftcore/lang/sv_SE.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s avsaknade temperaturkontroll. dimension.moon.name=Månen dimension.overworld.name=Midgård dimension.sun.name=Solen -entity.alien_villager.name=Utomjordisk bybo -entity.buggy.name=Månbil -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=Rymdsmygare -entity.evolved_skeleton.name=Rymdskelett -entity.evolved_skeleton_boss.name=Månhålehärskare -entity.evolved_spider.name=Rymdspindel -entity.evolved_zombie.name=Rymdzombie -entity.flag.name=Flagga -entity.gcflag.name=Flagga -entity.gravity_arrow.name=Pil -entity.lander.name=Månlandare -entity.meteor.name=Meteor -entity.meteor_chunk.name=Meteorsten -entity.oxygen_bubble.name=Luftbubbla -entity.para_chest.name=Fallskärmskista -entity.rocket_t1.name=Rymdskepp +entity.galacticraftcore.alien_villager.name=Utomjordisk bybo +entity.galacticraftcore.buggy.name=Månbil +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=Rymdsmygare +entity.galacticraftcore.evolved_skeleton.name=Rymdskelett +entity.galacticraftcore.evolved_skeleton_boss.name=Månhålehärskare +entity.galacticraftcore.evolved_spider.name=Rymdspindel +entity.galacticraftcore.evolved_zombie.name=Rymdzombie +entity.galacticraftcore.flag.name=Flagga +entity.galacticraftcore.gcflag.name=Flagga +entity.galacticraftcore.gravity_arrow.name=Pil +entity.galacticraftcore.lander.name=Månlandare +entity.galacticraftcore.meteor.name=Meteor +entity.galacticraftcore.meteor_chunk.name=Meteorsten +entity.galacticraftcore.oxygen_bubble.name=Luftbubbla +entity.galacticraftcore.para_chest.name=Fallskärmskista +entity.galacticraftcore.rocket_t1.name=Rymdskepp galaxy.milky_way=Vintergatan gc.configgui.alternate_canister_recipe=Alternate Canister Recipe gc.configgui.asteroids_start=Challenge Mode (Asteroids start) diff --git a/src/main/resources/assets/galacticraftcore/lang/th_TH.lang b/src/main/resources/assets/galacticraftcore/lang/th_TH.lang index 933b82afc2..e7b53b9c8a 100644 --- a/src/main/resources/assets/galacticraftcore/lang/th_TH.lang +++ b/src/main/resources/assets/galacticraftcore/lang/th_TH.lang @@ -33,23 +33,23 @@ death.attack.thermal=%1$s ลืมใส่เกราะกันอุณห dimension.moon.name=ดวงจันทร์ dimension.overworld.name=โลก dimension.sun.name=ดวงอาทิตย์ -entity.alien_villager.name=ชาวบ้านอวกาศ -entity.buggy.name=บักกี้ -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=คริปเปอร์อวกาศ -entity.evolved_skeleton.name=โครงกระดูกอวกาศ -entity.evolved_skeleton_boss.name=บอสโครงกระดูกอวกาศ -entity.evolved_spider.name=แมงมุมอวกาศ -entity.evolved_zombie.name=ผีดิบอวกาศ -entity.flag.name=ธง -entity.gcflag.name=ธง -entity.gravity_arrow.name=ธนู -entity.lander.name=ยานลงจอด -entity.meteor.name=อุกกาบาต -entity.meteor_chunk.name=เศษอุกกาบาต -entity.oxygen_bubble.name=ฟองออกซิเจน -entity.para_chest.name=กล่องสัมภาระ -entity.rocket_t1.name=จรวด +entity.galacticraftcore.alien_villager.name=ชาวบ้านอวกาศ +entity.galacticraftcore.buggy.name=บักกี้ +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=คริปเปอร์อวกาศ +entity.galacticraftcore.evolved_skeleton.name=โครงกระดูกอวกาศ +entity.galacticraftcore.evolved_skeleton_boss.name=บอสโครงกระดูกอวกาศ +entity.galacticraftcore.evolved_spider.name=แมงมุมอวกาศ +entity.galacticraftcore.evolved_zombie.name=ผีดิบอวกาศ +entity.galacticraftcore.flag.name=ธง +entity.galacticraftcore.gcflag.name=ธง +entity.galacticraftcore.gravity_arrow.name=ธนู +entity.galacticraftcore.lander.name=ยานลงจอด +entity.galacticraftcore.meteor.name=อุกกาบาต +entity.galacticraftcore.meteor_chunk.name=เศษอุกกาบาต +entity.galacticraftcore.oxygen_bubble.name=ฟองออกซิเจน +entity.galacticraftcore.para_chest.name=กล่องสัมภาระ +entity.galacticraftcore.rocket_t1.name=จรวด galaxy.milky_way=กาแลคซีทางช้างเผือก gc.configgui.alternate_canister_recipe=เปลี่ยนวิธีการคราฟกระป๋อง gc.configgui.asteroids_start=โหมดท้าทาย (เริ่มที่ดาวเคราะห์น้อย) diff --git a/src/main/resources/assets/galacticraftcore/lang/tr_TR.lang b/src/main/resources/assets/galacticraftcore/lang/tr_TR.lang index b63324636e..66a20c2627 100644 --- a/src/main/resources/assets/galacticraftcore/lang/tr_TR.lang +++ b/src/main/resources/assets/galacticraftcore/lang/tr_TR.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s termal koruması olmadığı için öldü. dimension.moon.name=Ay dimension.overworld.name=Dünya dimension.sun.name=Güneş -entity.alien_villager.name=Uzaylı Köylü -entity.buggy.name=Buggy -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=Gelişmiş Creeper -entity.evolved_skeleton.name=Gelişmiş İskelet -entity.evolved_skeleton_boss.name=Gelişmiş İskelet Patronu -entity.evolved_spider.name=Gelişmiş Örümcek -entity.evolved_zombie.name=Gelişmiş Zombi -entity.flag.name=Bayrak -entity.gcflag.name=Bayrak -entity.gravity_arrow.name=Ok -entity.lander.name=Uzay Lander -entity.meteor.name=Meteor -entity.meteor_chunk.name=Meteor Parçası -entity.oxygen_bubble.name=Oksijen Kabarcığı -entity.para_chest.name=Para Sandık -entity.rocket_t1.name=Tier 1 Roket +entity.galacticraftcore.alien_villager.name=Uzaylı Köylü +entity.galacticraftcore.buggy.name=Buggy +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=Gelişmiş Creeper +entity.galacticraftcore.evolved_skeleton.name=Gelişmiş İskelet +entity.galacticraftcore.evolved_skeleton_boss.name=Gelişmiş İskelet Patronu +entity.galacticraftcore.evolved_spider.name=Gelişmiş Örümcek +entity.galacticraftcore.evolved_zombie.name=Gelişmiş Zombi +entity.galacticraftcore.flag.name=Bayrak +entity.galacticraftcore.gcflag.name=Bayrak +entity.galacticraftcore.gravity_arrow.name=Ok +entity.galacticraftcore.lander.name=Uzay Lander +entity.galacticraftcore.meteor.name=Meteor +entity.galacticraftcore.meteor_chunk.name=Meteor Parçası +entity.galacticraftcore.oxygen_bubble.name=Oksijen Kabarcığı +entity.galacticraftcore.para_chest.name=Para Sandık +entity.galacticraftcore.rocket_t1.name=Tier 1 Roket galaxy.milky_way=Samanyolu gc.configgui.alternate_canister_recipe=Alternate Canister Recipe gc.configgui.asteroids_start=โหมดท้าทาย (เริ่มที่ดาวเคราะห์น้อย) diff --git a/src/main/resources/assets/galacticraftcore/lang/zh_CN.lang b/src/main/resources/assets/galacticraftcore/lang/zh_CN.lang index f10d46c3c5..537d3c5a81 100644 --- a/src/main/resources/assets/galacticraftcore/lang/zh_CN.lang +++ b/src/main/resources/assets/galacticraftcore/lang/zh_CN.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s忘记了高温保护 dimension.moon.name=月球 dimension.overworld.name=地球 dimension.sun.name=太阳 -entity.alien_villager.name=外星村民 -entity.buggy.name=星球车 -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=苦力怕(进化体) -entity.evolved_skeleton.name=骷髅(进化体) -entity.evolved_skeleton_boss.name=骷髅王(进化体) -entity.evolved_spider.name=蜘蛛(进化体) -entity.evolved_zombie.name=僵尸(进化体) -entity.flag.name=旗帜 -entity.gcflag.name=Bayrak -entity.gravity_arrow.name=箭 -entity.lander.name=登陆舱 -entity.meteor.name=陨石 -entity.meteor_chunk.name=陨石块 -entity.oxygen_bubble.name=氧气泡沫 -entity.para_chest.name=伞降箱 -entity.rocket_t1.name=Tier 1 Roket +entity.galacticraftcore.alien_villager.name=外星村民 +entity.galacticraftcore.buggy.name=星球车 +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=苦力怕(进化体) +entity.galacticraftcore.evolved_skeleton.name=骷髅(进化体) +entity.galacticraftcore.evolved_skeleton_boss.name=骷髅王(进化体) +entity.galacticraftcore.evolved_spider.name=蜘蛛(进化体) +entity.galacticraftcore.evolved_zombie.name=僵尸(进化体) +entity.galacticraftcore.flag.name=旗帜 +entity.galacticraftcore.gcflag.name=Bayrak +entity.galacticraftcore.gravity_arrow.name=箭 +entity.galacticraftcore.lander.name=登陆舱 +entity.galacticraftcore.meteor.name=陨石 +entity.galacticraftcore.meteor_chunk.name=陨石块 +entity.galacticraftcore.oxygen_bubble.name=氧气泡沫 +entity.galacticraftcore.para_chest.name=伞降箱 +entity.galacticraftcore.rocket_t1.name=Tier 1 Roket galaxy.milky_way=银河系 gc.configgui.alternate_canister_recipe=Alternate Canister Recipe(罐的其它合成配方) gc.configgui.asteroids_start=โหมดท้าทาย (เริ่มที่ดาวเคราะห์น้อย) diff --git a/src/main/resources/assets/galacticraftcore/lang/zh_TW.lang b/src/main/resources/assets/galacticraftcore/lang/zh_TW.lang index 19efc1cedc..875e0f2575 100644 --- a/src/main/resources/assets/galacticraftcore/lang/zh_TW.lang +++ b/src/main/resources/assets/galacticraftcore/lang/zh_TW.lang @@ -29,23 +29,23 @@ death.attack.thermal=%1$s 忘記了高溫保護 dimension.moon.name=月球 dimension.overworld.name=主世界(地球) dimension.sun.name=太陽 -entity.alien_villager.name=外星村民 -entity.buggy.name=星球車 -entity.celestial_screen.name=Celestial Screen -entity.evolved_creeper.name=爬行者(進化體) -entity.evolved_skeleton.name=骷髏(進化體) -entity.evolved_skeleton_boss.name=骷髏王(進化體) -entity.evolved_spider.name=蜘蛛(進化體) -entity.evolved_zombie.name=僵尸(進化體) -entity.flag.name=旗幟 -entity.gcflag.name=旗 -entity.gravity_arrow.name=箭 -entity.lander.name=登陸艙 -entity.meteor.name=隕石 -entity.meteor_chunk.name=隕石塊 -entity.oxygen_bubble.name=氧氣泡沫 -entity.para_chest.name=傘降箱 -entity.rocket_t1.name=火箭(1級) +entity.galacticraftcore.alien_villager.name=外星村民 +entity.galacticraftcore.buggy.name=星球車 +entity.galacticraftcore.celestial_screen.name=Celestial Screen +entity.galacticraftcore.evolved_creeper.name=爬行者(進化體) +entity.galacticraftcore.evolved_skeleton.name=骷髏(進化體) +entity.galacticraftcore.evolved_skeleton_boss.name=骷髏王(進化體) +entity.galacticraftcore.evolved_spider.name=蜘蛛(進化體) +entity.galacticraftcore.evolved_zombie.name=僵尸(進化體) +entity.galacticraftcore.flag.name=旗幟 +entity.galacticraftcore.gcflag.name=旗 +entity.galacticraftcore.gravity_arrow.name=箭 +entity.galacticraftcore.lander.name=登陸艙 +entity.galacticraftcore.meteor.name=隕石 +entity.galacticraftcore.meteor_chunk.name=隕石塊 +entity.galacticraftcore.oxygen_bubble.name=氧氣泡沫 +entity.galacticraftcore.para_chest.name=傘降箱 +entity.galacticraftcore.rocket_t1.name=火箭(1級) galaxy.milky_way=銀河系 gc.configgui.alternate_canister_recipe=Alternate Canister Recipe gc.configgui.asteroids_start=โหมดท้าทาย (เริ่มที่ดาวเคราะห์น้อย) diff --git a/src/main/resources/assets/galacticraftplanets/lang/cs_CZ.lang b/src/main/resources/assets/galacticraftplanets/lang/cs_CZ.lang index 253e3d878a..4585606034 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/cs_CZ.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/cs_CZ.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Přistávací balóny container.short_range_telepad.name=Transportér krátkého dosahu container.tile_terraformer.name=Terraformer dimension.mars.name=Mars -entity.astro_miner.name=Těžební souprava -entity.creeper_boss.name=Vyvinutý creeper - Boss -entity.entry_pod.name=Přistávací modul -entity.grapple_hook.name=Hák -entity.landing_balloons.name=Přistávací balóny -entity.projectile_tnt.name=TNT projektil -entity.rocket_cargo.name=Nákladní raketa -entity.rocket_t2.name=Raketa typ 2 -entity.rocket_t3.name=Raketa typ 3 -entity.slimeling.name=Slizoun -entity.sludgeling.name=Bahenní vcela -entity.small_asteroid.name=Malý asteroid +entity.galacticraftplanets.astro_miner.name=Těžební souprava +entity.galacticraftplanets.creeper_boss.name=Vyvinutý creeper - Boss +entity.galacticraftplanets.entry_pod.name=Přistávací modul +entity.galacticraftplanets.grapple_hook.name=Hák +entity.galacticraftplanets.landing_balloons.name=Přistávací balóny +entity.galacticraftplanets.projectile_tnt.name=TNT projektil +entity.galacticraftplanets.rocket_cargo.name=Nákladní raketa +entity.galacticraftplanets.rocket_t2.name=Raketa typ 2 +entity.galacticraftplanets.rocket_t3.name=Raketa typ 3 +entity.galacticraftplanets.slimeling.name=Slizoun +entity.galacticraftplanets.sludgeling.name=Bahenní vcela +entity.galacticraftplanets.small_asteroid.name=Malý asteroid fluid.argon=Plynný argon fluid.atmosphericgases=Atmosferické plyny fluid.bacterialsludge=Infikované bláto diff --git a/src/main/resources/assets/galacticraftplanets/lang/cy_GB.lang b/src/main/resources/assets/galacticraftplanets/lang/cy_GB.lang index 0627a3f71f..281f2655a3 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/cy_GB.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/cy_GB.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Landing Balloons ##NEEDS TRANSLATE## container.short_range_telepad.name=Short Range Telepad ##NEEDS TRANSLATE## container.tile_terraformer.name=Terraformer ##NEEDS TRANSLATE## dimension.mars.name=Mars ##NEEDS TRANSLATE## -entity.astro_miner.name=Astro Miner ##NEEDS TRANSLATE## -entity.creeper_boss.name=Evolved Creeper Boss ##NEEDS TRANSLATE## -entity.entry_pod.name=Entry Pod ##NEEDS TRANSLATE## -entity.grapple_hook.name=Grapple Hook ##NEEDS TRANSLATE## -entity.landing_balloons.name=Landing Balloons ##NEEDS TRANSLATE## -entity.projectile_tnt.name=Projectile TNT ##NEEDS TRANSLATE## -entity.rocket_cargo.name=Cargo Rocket ##NEEDS TRANSLATE## -entity.rocket_t2.name=Tier 2 Rocket ##NEEDS TRANSLATE## -entity.rocket_t3.name=Tier 3 Rocket ##NEEDS TRANSLATE## -entity.slimeling.name=Slimeling ##NEEDS TRANSLATE## -entity.sludgeling.name=Sludgeling ##NEEDS TRANSLATE## -entity.small_asteroid.name=Small Asteroid ##NEEDS TRANSLATE## +entity.galacticraftplanets.astro_miner.name=Astro Miner ##NEEDS TRANSLATE## +entity.galacticraftplanets.creeper_boss.name=Evolved Creeper Boss ##NEEDS TRANSLATE## +entity.galacticraftplanets.entry_pod.name=Entry Pod ##NEEDS TRANSLATE## +entity.galacticraftplanets.grapple_hook.name=Grapple Hook ##NEEDS TRANSLATE## +entity.galacticraftplanets.landing_balloons.name=Landing Balloons ##NEEDS TRANSLATE## +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT ##NEEDS TRANSLATE## +entity.galacticraftplanets.rocket_cargo.name=Cargo Rocket ##NEEDS TRANSLATE## +entity.galacticraftplanets.rocket_t2.name=Tier 2 Rocket ##NEEDS TRANSLATE## +entity.galacticraftplanets.rocket_t3.name=Tier 3 Rocket ##NEEDS TRANSLATE## +entity.galacticraftplanets.slimeling.name=Slimeling ##NEEDS TRANSLATE## +entity.galacticraftplanets.sludgeling.name=Sludgeling ##NEEDS TRANSLATE## +entity.galacticraftplanets.small_asteroid.name=Small Asteroid ##NEEDS TRANSLATE## fluid.argon=Argon Gas ##NEEDS TRANSLATE## fluid.atmosphericgases=Atmospheric Gases ##NEEDS TRANSLATE## fluid.bacterialsludge=Bacterial Sludge ##NEEDS TRANSLATE## diff --git a/src/main/resources/assets/galacticraftplanets/lang/de_DE.lang b/src/main/resources/assets/galacticraftplanets/lang/de_DE.lang index 6569c46828..8cdda488d7 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/de_DE.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/de_DE.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Landeballons container.short_range_telepad.name=Kurzreichweiten-Telepad container.tile_terraformer.name=Terraformer dimension.mars.name=Mars -entity.astro_miner.name=Astrominer -entity.creeper_boss.name=Entwickelter Creeper-Boss -entity.entry_pod.name=Eintrittskapsel -entity.grapple_hook.name=Greifhaken -entity.landing_balloons.name=Landeballons -entity.projectile_tnt.name=Projectile TNT ##NEEDS TRANSLATE## -entity.rocket_cargo.name=Automatische Güterrakete -entity.rocket_t2.name=Rakete (Stufe 2) -entity.rocket_t3.name=Rakete (Stufe 3) -entity.slimeling.name=Schleimling -entity.sludgeling.name=Schlammling -entity.small_asteroid.name=Kleiner Asteroid +entity.galacticraftplanets.astro_miner.name=Astrominer +entity.galacticraftplanets.creeper_boss.name=Entwickelter Creeper-Boss +entity.galacticraftplanets.entry_pod.name=Eintrittskapsel +entity.galacticraftplanets.grapple_hook.name=Greifhaken +entity.galacticraftplanets.landing_balloons.name=Landeballons +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT ##NEEDS TRANSLATE## +entity.galacticraftplanets.rocket_cargo.name=Automatische Güterrakete +entity.galacticraftplanets.rocket_t2.name=Rakete (Stufe 2) +entity.galacticraftplanets.rocket_t3.name=Rakete (Stufe 3) +entity.galacticraftplanets.slimeling.name=Schleimling +entity.galacticraftplanets.sludgeling.name=Schlammling +entity.galacticraftplanets.small_asteroid.name=Kleiner Asteroid fluid.argon=Argon fluid.atmosphericgases=Atmosphärische Gase fluid.bacterialsludge=Bakterieller Schlamm diff --git a/src/main/resources/assets/galacticraftplanets/lang/en_GB.lang b/src/main/resources/assets/galacticraftplanets/lang/en_GB.lang index 987ec356f9..3ade5a0a27 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/en_GB.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/en_GB.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Landing Balloons container.short_range_telepad.name=Short Range Telepad container.tile_terraformer.name=Terraformer dimension.mars.name=Mars -entity.astro_miner.name=Astro Miner -entity.creeper_boss.name=Evolved Creeper Boss -entity.entry_pod.name=Entry Pod -entity.grapple_hook.name=Grapple Hook -entity.landing_balloons.name=Landing Balloons -entity.projectile_tnt.name=Projectile TNT ##NEEDS TRANSLATE## -entity.rocket_cargo.name=Cargo Rocket -entity.rocket_t2.name=Tier 2 Rocket -entity.rocket_t3.name=Tier 3 Rocket -entity.slimeling.name=Slimeling -entity.sludgeling.name=Sludgeling -entity.small_asteroid.name=Small Asteroid +entity.galacticraftplanets.astro_miner.name=Astro Miner +entity.galacticraftplanets.creeper_boss.name=Evolved Creeper Boss +entity.galacticraftplanets.entry_pod.name=Entry Pod +entity.galacticraftplanets.grapple_hook.name=Grapple Hook +entity.galacticraftplanets.landing_balloons.name=Landing Balloons +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT ##NEEDS TRANSLATE## +entity.galacticraftplanets.rocket_cargo.name=Cargo Rocket +entity.galacticraftplanets.rocket_t2.name=Tier 2 Rocket +entity.galacticraftplanets.rocket_t3.name=Tier 3 Rocket +entity.galacticraftplanets.slimeling.name=Slimeling +entity.galacticraftplanets.sludgeling.name=Sludgeling +entity.galacticraftplanets.small_asteroid.name=Small Asteroid fluid.argon=Argon Gas fluid.atmosphericgases=Atmospheric Gases fluid.bacterialsludge=Bacterial Sludge diff --git a/src/main/resources/assets/galacticraftplanets/lang/en_US.lang b/src/main/resources/assets/galacticraftplanets/lang/en_US.lang index ee2868dca3..39f202bdbb 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/en_US.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/en_US.lang @@ -10,22 +10,22 @@ container.mars_lander.name=Landing Balloons container.short_range_telepad.name=Short Range Telepad container.tile_terraformer.name=Terraformer dimension.mars.name=Mars -entity.astro_miner.name=Astro Miner -entity.creeper_boss.name=Evolved Creeper Boss -entity.entry_pod.name=Entry Pod -entity.entry_pod_venus.name=Venus Entry Pod -entity.grapple_hook.name=Grapple Hook -entity.juicer.name=Juicer -entity.landing_balloons.name=Landing Balloons -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=Cargo Rocket -entity.rocket_t2.name=Tier 2 Rocket -entity.rocket_t3.name=Tier 3 Rocket -entity.slimeling.name=Slimeling -entity.sludgeling.name=Sludgeling -entity.small_asteroid.name=Small Asteroid -entity.spider_queen.name=Spider Queen -entity.web_shot.name=Web Shot +entity.galacticraftplanets.astro_miner.name=Astro Miner +entity.galacticraftplanets.creeper_boss.name=Evolved Creeper Boss +entity.galacticraftplanets.entry_pod.name=Entry Pod +entity.galacticraftplanets.entry_pod_venus.name=Venus Entry Pod +entity.galacticraftplanets.grapple_hook.name=Grapple Hook +entity.galacticraftplanets.juicer.name=Juicer +entity.galacticraftplanets.landing_balloons.name=Landing Balloons +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=Cargo Rocket +entity.galacticraftplanets.rocket_t2.name=Tier 2 Rocket +entity.galacticraftplanets.rocket_t3.name=Tier 3 Rocket +entity.galacticraftplanets.slimeling.name=Slimeling +entity.galacticraftplanets.sludgeling.name=Sludgeling +entity.galacticraftplanets.small_asteroid.name=Small Asteroid +entity.galacticraftplanets.spider_queen.name=Spider Queen +entity.galacticraftplanets.web_shot.name=Web Shot fluid.argon=Argon Gas fluid.atmosphericgases=Atmospheric Gases fluid.bacterialsludge=Bacterial Sludge diff --git a/src/main/resources/assets/galacticraftplanets/lang/es_ES.lang b/src/main/resources/assets/galacticraftplanets/lang/es_ES.lang index 362dd2b8ea..510703a3e5 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/es_ES.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/es_ES.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Globos de aterrizaje container.short_range_telepad.name=Teletransportador de corto alcance container.tile_terraformer.name=Terraformador dimension.mars.name=Marte -entity.astro_miner.name=AstroMinador -entity.creeper_boss.name=Jefe creeper evolucionado -entity.entry_pod.name=Entry Pod -entity.grapple_hook.name=Grapple Hook -entity.landing_balloons.name=Globos de aterrizaje -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=Cargo Rocket -entity.rocket_t2.name=Tier 2 Rocket -entity.rocket_t3.name=Tier 3 Rocket -entity.slimeling.name=Slimeling -entity.sludgeling.name=Gusano de lodo -entity.small_asteroid.name=Small Asteroid +entity.galacticraftplanets.astro_miner.name=AstroMinador +entity.galacticraftplanets.creeper_boss.name=Jefe creeper evolucionado +entity.galacticraftplanets.entry_pod.name=Entry Pod +entity.galacticraftplanets.grapple_hook.name=Grapple Hook +entity.galacticraftplanets.landing_balloons.name=Globos de aterrizaje +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=Cargo Rocket +entity.galacticraftplanets.rocket_t2.name=Tier 2 Rocket +entity.galacticraftplanets.rocket_t3.name=Tier 3 Rocket +entity.galacticraftplanets.slimeling.name=Slimeling +entity.galacticraftplanets.sludgeling.name=Gusano de lodo +entity.galacticraftplanets.small_asteroid.name=Small Asteroid fluid.argon=Argón fluid.atmosphericgases=Gases atmosféricos fluid.bacterialsludge=Lodo bacteriano diff --git a/src/main/resources/assets/galacticraftplanets/lang/fi_FI.lang b/src/main/resources/assets/galacticraftplanets/lang/fi_FI.lang index 3b36140934..502a1f0f65 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/fi_FI.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/fi_FI.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Landing Balloons ##NEEDS TRANSLATE## container.short_range_telepad.name=Short Range Telepad ##NEEDS TRANSLATE## container.tile_terraformer.name=Terraformer ##NEEDS TRANSLATE## dimension.mars.name=Mars ##NEEDS TRANSLATE## -entity.astro_miner.name=Astro Miner ##NEEDS TRANSLATE## -entity.creeper_boss.name=Evolved Creeper Boss ##NEEDS TRANSLATE## -entity.entry_pod.name=Entry Pod ##NEEDS TRANSLATE## -entity.grapple_hook.name=Grapple Hook ##NEEDS TRANSLATE## -entity.landing_balloons.name=Landing Balloons ##NEEDS TRANSLATE## -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=Cargo Rocket ##NEEDS TRANSLATE## -entity.rocket_t2.name=Tier 2 Rocket ##NEEDS TRANSLATE## -entity.rocket_t3.name=Tier 3 Rocket ##NEEDS TRANSLATE## -entity.slimeling.name=Slimeling ##NEEDS TRANSLATE## -entity.sludgeling.name=Sludgeling ##NEEDS TRANSLATE## -entity.small_asteroid.name=Small Asteroid ##NEEDS TRANSLATE## +entity.galacticraftplanets.astro_miner.name=Astro Miner ##NEEDS TRANSLATE## +entity.galacticraftplanets.creeper_boss.name=Evolved Creeper Boss ##NEEDS TRANSLATE## +entity.galacticraftplanets.entry_pod.name=Entry Pod ##NEEDS TRANSLATE## +entity.galacticraftplanets.grapple_hook.name=Grapple Hook ##NEEDS TRANSLATE## +entity.galacticraftplanets.landing_balloons.name=Landing Balloons ##NEEDS TRANSLATE## +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=Cargo Rocket ##NEEDS TRANSLATE## +entity.galacticraftplanets.rocket_t2.name=Tier 2 Rocket ##NEEDS TRANSLATE## +entity.galacticraftplanets.rocket_t3.name=Tier 3 Rocket ##NEEDS TRANSLATE## +entity.galacticraftplanets.slimeling.name=Slimeling ##NEEDS TRANSLATE## +entity.galacticraftplanets.sludgeling.name=Sludgeling ##NEEDS TRANSLATE## +entity.galacticraftplanets.small_asteroid.name=Small Asteroid ##NEEDS TRANSLATE## fluid.argon=Argon Gas ##NEEDS TRANSLATE## fluid.atmosphericgases=Atmospheric Gases ##NEEDS TRANSLATE## fluid.bacterialsludge=Bacterial Sludge ##NEEDS TRANSLATE## diff --git a/src/main/resources/assets/galacticraftplanets/lang/fr_CA.lang b/src/main/resources/assets/galacticraftplanets/lang/fr_CA.lang index 75664cef34..abe704afae 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/fr_CA.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/fr_CA.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Landing Balloons ##NEEDS TRANSLATE## container.short_range_telepad.name=Short Range Telepad ##NEEDS TRANSLATE## container.tile_terraformer.name=Terraformer ##NEEDS TRANSLATE## dimension.mars.name=Mars ##NEEDS TRANSLATE## -entity.astro_miner.name=Astro Miner ##NEEDS TRANSLATE## -entity.creeper_boss.name=Boss Creeper évolué -entity.entry_pod.name=Entry Pod ##NEEDS TRANSLATE## -entity.grapple_hook.name=Grappin crochet -entity.landing_balloons.name=Landing Balloons ##NEEDS TRANSLATE## -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=Cargo Rocket ##NEEDS TRANSLATE## -entity.rocket_t2.name=Tier 2 Rocket ##NEEDS TRANSLATE## -entity.rocket_t3.name=Fusée Niveau 3 -entity.slimeling.name=Vaseux -entity.sludgeling.name=Boueux -entity.small_asteroid.name=Petit astéroïde +entity.galacticraftplanets.astro_miner.name=Astro Miner ##NEEDS TRANSLATE## +entity.galacticraftplanets.creeper_boss.name=Boss Creeper évolué +entity.galacticraftplanets.entry_pod.name=Entry Pod ##NEEDS TRANSLATE## +entity.galacticraftplanets.grapple_hook.name=Grappin crochet +entity.galacticraftplanets.landing_balloons.name=Landing Balloons ##NEEDS TRANSLATE## +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=Cargo Rocket ##NEEDS TRANSLATE## +entity.galacticraftplanets.rocket_t2.name=Tier 2 Rocket ##NEEDS TRANSLATE## +entity.galacticraftplanets.rocket_t3.name=Fusée Niveau 3 +entity.galacticraftplanets.slimeling.name=Vaseux +entity.galacticraftplanets.sludgeling.name=Boueux +entity.galacticraftplanets.small_asteroid.name=Petit astéroïde fluid.argon=Argon Gas ##NEEDS TRANSLATE## fluid.atmosphericgases=Atmospheric Gases ##NEEDS TRANSLATE## fluid.bacterialsludge=Bacterial Sludge ##NEEDS TRANSLATE## diff --git a/src/main/resources/assets/galacticraftplanets/lang/fr_FR.lang b/src/main/resources/assets/galacticraftplanets/lang/fr_FR.lang index aa2dd732c4..7e5895c0ef 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/fr_FR.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/fr_FR.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Ballons d'atterissage container.short_range_telepad.name=Téléporteur à courte portée container.tile_terraformer.name=Terraformeur dimension.mars.name=Mars -entity.astro_miner.name=Astro-mineur -entity.creeper_boss.name=Boss Creeper évolué -entity.entry_pod.name=Sas d'entrée -entity.grapple_hook.name=Grappin -entity.landing_balloons.name=Ballons d'atterissage -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=Fusée de transport de marchandise -entity.rocket_t2.name=Fusée de niveau 2 -entity.rocket_t3.name=Fusée Niveau 3 -entity.slimeling.name=Vaseux -entity.sludgeling.name=Boueux -entity.small_asteroid.name=Petit astéroïde +entity.galacticraftplanets.astro_miner.name=Astro-mineur +entity.galacticraftplanets.creeper_boss.name=Boss Creeper évolué +entity.galacticraftplanets.entry_pod.name=Sas d'entrée +entity.galacticraftplanets.grapple_hook.name=Grappin +entity.galacticraftplanets.landing_balloons.name=Ballons d'atterissage +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=Fusée de transport de marchandise +entity.galacticraftplanets.rocket_t2.name=Fusée de niveau 2 +entity.galacticraftplanets.rocket_t3.name=Fusée Niveau 3 +entity.galacticraftplanets.slimeling.name=Vaseux +entity.galacticraftplanets.sludgeling.name=Boueux +entity.galacticraftplanets.small_asteroid.name=Petit astéroïde fluid.argon=Argon fluid.atmosphericgases=Gas atmosphériques fluid.bacterialsludge=Bourbe bactérienne diff --git a/src/main/resources/assets/galacticraftplanets/lang/hr_HR.lang b/src/main/resources/assets/galacticraftplanets/lang/hr_HR.lang index b209927a69..e379289056 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/hr_HR.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/hr_HR.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Baloni za slijetanje container.short_range_telepad.name=Teleporter s Malom Daljinom container.tile_terraformer.name=Teraformer dimension.mars.name=Mars -entity.astro_miner.name=Astro Rudar -entity.creeper_boss.name=Evoulirani Boss Kripera -entity.entry_pod.name=Kapsula za ulaz -entity.grapple_hook.name=Kuka -entity.landing_balloons.name=Baloni za sletanje -entity.projectile_tnt.name=Projektilni TNT -entity.rocket_cargo.name=Teretna Raketa -entity.rocket_t2.name=Raketa Ranga 2 -entity.rocket_t3.name=Rang 3 Raketa -entity.slimeling.name=Slimeling -entity.sludgeling.name=Sludgeling -entity.small_asteroid.name=Mali Asteroid +entity.galacticraftplanets.astro_miner.name=Astro Rudar +entity.galacticraftplanets.creeper_boss.name=Evoulirani Boss Kripera +entity.galacticraftplanets.entry_pod.name=Kapsula za ulaz +entity.galacticraftplanets.grapple_hook.name=Kuka +entity.galacticraftplanets.landing_balloons.name=Baloni za sletanje +entity.galacticraftplanets.projectile_tnt.name=Projektilni TNT +entity.galacticraftplanets.rocket_cargo.name=Teretna Raketa +entity.galacticraftplanets.rocket_t2.name=Raketa Ranga 2 +entity.galacticraftplanets.rocket_t3.name=Rang 3 Raketa +entity.galacticraftplanets.slimeling.name=Slimeling +entity.galacticraftplanets.sludgeling.name=Sludgeling +entity.galacticraftplanets.small_asteroid.name=Mali Asteroid fluid.argon=Argon fluid.atmosphericgases=Atmosferni Plinovi fluid.bacterialsludge=Bakterijska Sluz diff --git a/src/main/resources/assets/galacticraftplanets/lang/hu_HU.lang b/src/main/resources/assets/galacticraftplanets/lang/hu_HU.lang index a9326c6b61..3ed3490f8e 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/hu_HU.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/hu_HU.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Landing Balloons ##NEEDS TRANSLATE## container.short_range_telepad.name=Rövidtávú Teleporter container.tile_terraformer.name=Növényülteto dimension.mars.name=Mars -entity.astro_miner.name=Astro Miner ##NEEDS TRANSLATE## -entity.creeper_boss.name=Vejlett Creeper-Fogonosz -entity.entry_pod.name=Kapsula za ulaz -entity.grapple_hook.name=Kuka -entity.landing_balloons.name=Landing Balloons ##NEEDS TRANSLATE## -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=Teretna Raketa -entity.rocket_t2.name=Raketa Ranga 2 -entity.rocket_t3.name=Rang 3 Raketa -entity.slimeling.name=Nyálkahernyó -entity.sludgeling.name=Iszaphernyó -entity.small_asteroid.name=Mali Asteroid +entity.galacticraftplanets.astro_miner.name=Astro Miner ##NEEDS TRANSLATE## +entity.galacticraftplanets.creeper_boss.name=Vejlett Creeper-Fogonosz +entity.galacticraftplanets.entry_pod.name=Kapsula za ulaz +entity.galacticraftplanets.grapple_hook.name=Kuka +entity.galacticraftplanets.landing_balloons.name=Landing Balloons ##NEEDS TRANSLATE## +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=Teretna Raketa +entity.galacticraftplanets.rocket_t2.name=Raketa Ranga 2 +entity.galacticraftplanets.rocket_t3.name=Rang 3 Raketa +entity.galacticraftplanets.slimeling.name=Nyálkahernyó +entity.galacticraftplanets.sludgeling.name=Iszaphernyó +entity.galacticraftplanets.small_asteroid.name=Mali Asteroid fluid.argon=Argongáz fluid.atmosphericgases=Légköri Gázok fluid.bacterialsludge=Bacterial Sludge ##NEEDS TRANSLATE## diff --git a/src/main/resources/assets/galacticraftplanets/lang/it_IT.lang b/src/main/resources/assets/galacticraftplanets/lang/it_IT.lang index f286d76490..bc36ce9930 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/it_IT.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/it_IT.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Palloni da Atterraggio container.short_range_telepad.name=Teletrasportatore a corto raggio container.tile_terraformer.name=Terraformer dimension.mars.name=Marte -entity.astro_miner.name=Astro Miner -entity.creeper_boss.name=Creeper Boss Evoluto -entity.entry_pod.name=Entry Pod -entity.grapple_hook.name=Uncino del Rampino -entity.landing_balloons.name=Palloni da Atterraggio -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=Razzo-Cargo -entity.rocket_t2.name=Razzo di Livello 2 -entity.rocket_t3.name=Razzo di Livello 3 -entity.slimeling.name=Slimeling -entity.sludgeling.name=Sludgeling -entity.small_asteroid.name=Asteroide Piccolo +entity.galacticraftplanets.astro_miner.name=Astro Miner +entity.galacticraftplanets.creeper_boss.name=Creeper Boss Evoluto +entity.galacticraftplanets.entry_pod.name=Entry Pod +entity.galacticraftplanets.grapple_hook.name=Uncino del Rampino +entity.galacticraftplanets.landing_balloons.name=Palloni da Atterraggio +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=Razzo-Cargo +entity.galacticraftplanets.rocket_t2.name=Razzo di Livello 2 +entity.galacticraftplanets.rocket_t3.name=Razzo di Livello 3 +entity.galacticraftplanets.slimeling.name=Slimeling +entity.galacticraftplanets.sludgeling.name=Sludgeling +entity.galacticraftplanets.small_asteroid.name=Asteroide Piccolo fluid.argon=Argon fluid.atmosphericgases=Gas Atmosferici fluid.bacterialsludge=Fango Batterico diff --git a/src/main/resources/assets/galacticraftplanets/lang/ja_JP.lang b/src/main/resources/assets/galacticraftplanets/lang/ja_JP.lang index cc0d9a8e3f..97eb1b8e96 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/ja_JP.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/ja_JP.lang @@ -4,18 +4,18 @@ container.mars_lander.name=着陸風船 container.short_range_telepad.name=短距離テレポートパッド container.tile_terraformer.name=造園機 dimension.mars.name=火星 -entity.astro_miner.name=アストロ採掘機 -entity.creeper_boss.name=宇宙のクリーパーキング -entity.entry_pod.name=突入ポッド -entity.grapple_hook.name=グラップリングフック -entity.landing_balloons.name=着陸風船 -entity.projectile_tnt.name=TNT弾 -entity.rocket_cargo.name=貨物ロケット -entity.rocket_t2.name=レベル2 ロケット -entity.rocket_t3.name=レベル3 ロケット -entity.slimeling.name=スライムリング -entity.sludgeling.name=スラッジリング -entity.small_asteroid.name=小型小惑星 +entity.galacticraftplanets.astro_miner.name=アストロ採掘機 +entity.galacticraftplanets.creeper_boss.name=宇宙のクリーパーキング +entity.galacticraftplanets.entry_pod.name=突入ポッド +entity.galacticraftplanets.grapple_hook.name=グラップリングフック +entity.galacticraftplanets.landing_balloons.name=着陸風船 +entity.galacticraftplanets.projectile_tnt.name=TNT弾 +entity.galacticraftplanets.rocket_cargo.name=貨物ロケット +entity.galacticraftplanets.rocket_t2.name=レベル2 ロケット +entity.galacticraftplanets.rocket_t3.name=レベル3 ロケット +entity.galacticraftplanets.slimeling.name=スライムリング +entity.galacticraftplanets.sludgeling.name=スラッジリング +entity.galacticraftplanets.small_asteroid.name=小型小惑星 fluid.argon=アルゴンガス fluid.atmosphericgases=大気ガス fluid.bacterialsludge=細菌の汚泥 diff --git a/src/main/resources/assets/galacticraftplanets/lang/ko_KR.lang b/src/main/resources/assets/galacticraftplanets/lang/ko_KR.lang index b6bb0a7262..9985652425 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/ko_KR.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/ko_KR.lang @@ -4,18 +4,18 @@ container.mars_lander.name=착륙 기구 container.short_range_telepad.name=단거리 텔레포터 container.tile_terraformer.name=테라포머 dimension.mars.name=화성 -entity.astro_miner.name=천체 광업기계 -entity.creeper_boss.name=진화한 크리퍼 보스 -entity.entry_pod.name=Entry Pod -entity.grapple_hook.name=Uncino del Rampino -entity.landing_balloons.name=착륙 기구 -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=Razzo-Cargo -entity.rocket_t2.name=Razzo di Livello 2 -entity.rocket_t3.name=Razzo di Livello 3 -entity.slimeling.name=슬라임링 -entity.sludgeling.name=슬러지링 -entity.small_asteroid.name=Asteroide Piccolo +entity.galacticraftplanets.astro_miner.name=천체 광업기계 +entity.galacticraftplanets.creeper_boss.name=진화한 크리퍼 보스 +entity.galacticraftplanets.entry_pod.name=Entry Pod +entity.galacticraftplanets.grapple_hook.name=Uncino del Rampino +entity.galacticraftplanets.landing_balloons.name=착륙 기구 +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=Razzo-Cargo +entity.galacticraftplanets.rocket_t2.name=Razzo di Livello 2 +entity.galacticraftplanets.rocket_t3.name=Razzo di Livello 3 +entity.galacticraftplanets.slimeling.name=슬라임링 +entity.galacticraftplanets.sludgeling.name=슬러지링 +entity.galacticraftplanets.small_asteroid.name=Asteroide Piccolo fluid.argon=아르곤 가스 fluid.atmosphericgases=대기 가스 fluid.bacterialsludge=세균 슬러지 diff --git a/src/main/resources/assets/galacticraftplanets/lang/nl_NL.lang b/src/main/resources/assets/galacticraftplanets/lang/nl_NL.lang index e9613425fc..4bb646f98b 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/nl_NL.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/nl_NL.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Landing Balonnen container.short_range_telepad.name=Klein Bereik Teleporter container.tile_terraformer.name=Terraformer dimension.mars.name=Mars -entity.astro_miner.name=Astroïde Mijner -entity.creeper_boss.name=Geëvolueerde Creeper Baas -entity.entry_pod.name=Astroïde Lander -entity.grapple_hook.name=Werpanker -entity.landing_balloons.name=Landing Balonnen -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=Vracht Raket -entity.rocket_t2.name=Tier 2 Raket -entity.rocket_t3.name=Tier 3 Raket -entity.slimeling.name=Slimeling ##NEEDS TRANSLATE## -entity.sludgeling.name=Sludgeling ##NEEDS TRANSLATE## -entity.small_asteroid.name=Kleine Asteroïde +entity.galacticraftplanets.astro_miner.name=Astroïde Mijner +entity.galacticraftplanets.creeper_boss.name=Geëvolueerde Creeper Baas +entity.galacticraftplanets.entry_pod.name=Astroïde Lander +entity.galacticraftplanets.grapple_hook.name=Werpanker +entity.galacticraftplanets.landing_balloons.name=Landing Balonnen +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=Vracht Raket +entity.galacticraftplanets.rocket_t2.name=Tier 2 Raket +entity.galacticraftplanets.rocket_t3.name=Tier 3 Raket +entity.galacticraftplanets.slimeling.name=Slimeling ##NEEDS TRANSLATE## +entity.galacticraftplanets.sludgeling.name=Sludgeling ##NEEDS TRANSLATE## +entity.galacticraftplanets.small_asteroid.name=Kleine Asteroïde fluid.argon=Argon Gas fluid.atmosphericgases=Atmosferische gassen fluid.bacterialsludge=Bacteriele Modder diff --git a/src/main/resources/assets/galacticraftplanets/lang/pl_PL.lang b/src/main/resources/assets/galacticraftplanets/lang/pl_PL.lang index a3105e5ebe..40b6264796 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/pl_PL.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/pl_PL.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Balony Lądownicze container.short_range_telepad.name=Krótko-dystansowy Teleporter container.tile_terraformer.name=Terraformator dimension.mars.name=Mars -entity.astro_miner.name=Dron Górniczy -entity.creeper_boss.name=Kosmiczny Creeper Boss -entity.entry_pod.name=Lądownik -entity.grapple_hook.name=Hak Chwytaka -entity.landing_balloons.name=Balony Lądujące -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=Rakieta Transportowa -entity.rocket_t2.name=Rakieta Poziomu 2 -entity.rocket_t3.name=Rakieta Poziomu 3 -entity.slimeling.name=Slimeling -entity.sludgeling.name=Sludgeling -entity.small_asteroid.name=Mała Asteroida +entity.galacticraftplanets.astro_miner.name=Dron Górniczy +entity.galacticraftplanets.creeper_boss.name=Kosmiczny Creeper Boss +entity.galacticraftplanets.entry_pod.name=Lądownik +entity.galacticraftplanets.grapple_hook.name=Hak Chwytaka +entity.galacticraftplanets.landing_balloons.name=Balony Lądujące +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=Rakieta Transportowa +entity.galacticraftplanets.rocket_t2.name=Rakieta Poziomu 2 +entity.galacticraftplanets.rocket_t3.name=Rakieta Poziomu 3 +entity.galacticraftplanets.slimeling.name=Slimeling +entity.galacticraftplanets.sludgeling.name=Sludgeling +entity.galacticraftplanets.small_asteroid.name=Mała Asteroida fluid.argon=Argon (Gaz) fluid.atmosphericgases=Gazy Atmosferyczne fluid.bacterialsludge=Szlam Bakteryjny diff --git a/src/main/resources/assets/galacticraftplanets/lang/pt_BR.lang b/src/main/resources/assets/galacticraftplanets/lang/pt_BR.lang index 2b30323c6a..b49c398fe5 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/pt_BR.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/pt_BR.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Balões de Aterrissagem container.short_range_telepad.name=Telebase de Curto Alcance container.tile_terraformer.name=Terraformador dimension.mars.name=Marte -entity.astro_miner.name=Astrominerador -entity.creeper_boss.name=Creeper-Chefe Evoluído -entity.entry_pod.name=Cápsula de Entrada -entity.grapple_hook.name=Gancho -entity.landing_balloons.name=Balões de Aterrissagem -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=Foguete de Carga -entity.rocket_t2.name=Foguete Nível 2 -entity.rocket_t3.name=Foguete Nível 3 -entity.slimeling.name=Slimeling -entity.sludgeling.name=Sludgeling -entity.small_asteroid.name=Asteroides Menores +entity.galacticraftplanets.astro_miner.name=Astrominerador +entity.galacticraftplanets.creeper_boss.name=Creeper-Chefe Evoluído +entity.galacticraftplanets.entry_pod.name=Cápsula de Entrada +entity.galacticraftplanets.grapple_hook.name=Gancho +entity.galacticraftplanets.landing_balloons.name=Balões de Aterrissagem +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=Foguete de Carga +entity.galacticraftplanets.rocket_t2.name=Foguete Nível 2 +entity.galacticraftplanets.rocket_t3.name=Foguete Nível 3 +entity.galacticraftplanets.slimeling.name=Slimeling +entity.galacticraftplanets.sludgeling.name=Sludgeling +entity.galacticraftplanets.small_asteroid.name=Asteroides Menores fluid.argon=Gás Argônio fluid.atmosphericgases=Gases Atmosféricos fluid.bacterialsludge=Lodo Bacterial diff --git a/src/main/resources/assets/galacticraftplanets/lang/pt_PT.lang b/src/main/resources/assets/galacticraftplanets/lang/pt_PT.lang index 29310bed89..6d49e8bebe 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/pt_PT.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/pt_PT.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Almofada de Aterragem container.short_range_telepad.name=Telebase de Curto Alcance container.tile_terraformer.name=Terraformador dimension.mars.name=Marte -entity.astro_miner.name=Astrominerador -entity.creeper_boss.name=Creeper-Chefe Evoluído -entity.entry_pod.name=Cápsula de Entrada -entity.grapple_hook.name=Gancho -entity.landing_balloons.name=Almofada de Aterragem -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=Foguetão de Carga -entity.rocket_t2.name=Foguetão Nível 2 -entity.rocket_t3.name=Foguetão Nível 3 -entity.slimeling.name=Slimeling -entity.sludgeling.name=Sludgeling -entity.small_asteroid.name=Asteroides Menores +entity.galacticraftplanets.astro_miner.name=Astrominerador +entity.galacticraftplanets.creeper_boss.name=Creeper-Chefe Evoluído +entity.galacticraftplanets.entry_pod.name=Cápsula de Entrada +entity.galacticraftplanets.grapple_hook.name=Gancho +entity.galacticraftplanets.landing_balloons.name=Almofada de Aterragem +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=Foguetão de Carga +entity.galacticraftplanets.rocket_t2.name=Foguetão Nível 2 +entity.galacticraftplanets.rocket_t3.name=Foguetão Nível 3 +entity.galacticraftplanets.slimeling.name=Slimeling +entity.galacticraftplanets.sludgeling.name=Sludgeling +entity.galacticraftplanets.small_asteroid.name=Asteroides Menores fluid.argon=Gás Árgon fluid.atmosphericgases=Gases Atmosféricos fluid.bacterialsludge=Lodo Bacterial diff --git a/src/main/resources/assets/galacticraftplanets/lang/ru_RU.lang b/src/main/resources/assets/galacticraftplanets/lang/ru_RU.lang index 174ae661f8..39d85c312b 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/ru_RU.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/ru_RU.lang @@ -10,22 +10,22 @@ container.mars_lander.name=Посадочные шары container.short_range_telepad.name=Короткодистанционный телепорт container.tile_terraformer.name=Терраформер dimension.mars.name=Марс -entity.astro_miner.name=Астрономический шахтёр -entity.creeper_boss.name=Эволюционировавший крипер-босс -entity.entry_pod.name=Посадочная капсула -entity.entry_pod_venus.name=Венерианская посадочная капсула -entity.grapple_hook.name=Крюк -entity.juicer.name=Соковыжиматель -entity.landing_balloons.name=Посадочные шары -entity.projectile_tnt.name=Снаряд ТНТ -entity.rocket_cargo.name=Грузовая ракета -entity.rocket_t2.name=Ракета 2-го уровня -entity.rocket_t3.name=Ракета 3-го уровня -entity.slimeling.name=Слаймлинг -entity.sludgeling.name=Сладжлинг -entity.small_asteroid.name=Маленький астероид -entity.spider_queen.name=Королева пауков -entity.web_shot.name=Паутина +entity.galacticraftplanets.astro_miner.name=Астрономический шахтёр +entity.galacticraftplanets.creeper_boss.name=Эволюционировавший крипер-босс +entity.galacticraftplanets.entry_pod.name=Посадочная капсула +entity.galacticraftplanets.entry_pod_venus.name=Венерианская посадочная капсула +entity.galacticraftplanets.grapple_hook.name=Крюк +entity.galacticraftplanets.juicer.name=Соковыжиматель +entity.galacticraftplanets.landing_balloons.name=Посадочные шары +entity.galacticraftplanets.projectile_tnt.name=Снаряд ТНТ +entity.galacticraftplanets.rocket_cargo.name=Грузовая ракета +entity.galacticraftplanets.rocket_t2.name=Ракета 2-го уровня +entity.galacticraftplanets.rocket_t3.name=Ракета 3-го уровня +entity.galacticraftplanets.slimeling.name=Слаймлинг +entity.galacticraftplanets.sludgeling.name=Сладжлинг +entity.galacticraftplanets.small_asteroid.name=Маленький астероид +entity.galacticraftplanets.spider_queen.name=Королева пауков +entity.galacticraftplanets.web_shot.name=Паутина fluid.argon=Аргон fluid.atmosphericgases=Атмосферные газы fluid.bacterialsludge=Бактериальный осадок diff --git a/src/main/resources/assets/galacticraftplanets/lang/sv_SE.lang b/src/main/resources/assets/galacticraftplanets/lang/sv_SE.lang index 412127f147..9f9e463118 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/sv_SE.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/sv_SE.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Landningskudde container.short_range_telepad.name=Kortdistansteleporterare container.tile_terraformer.name=Terraformare dimension.mars.name=Mars -entity.astro_miner.name=Astrobrytare -entity.creeper_boss.name=Marshålehärskare -entity.entry_pod.name=Inträdeskapsel -entity.grapple_hook.name=Änterhake -entity.landing_balloons.name=Landningskudde -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=Fraktraket -entity.rocket_t2.name=N2-raket -entity.rocket_t3.name=N3-raket -entity.slimeling.name=Slemvarelse -entity.sludgeling.name=Sörjigel -entity.small_asteroid.name=Liten asteroid +entity.galacticraftplanets.astro_miner.name=Astrobrytare +entity.galacticraftplanets.creeper_boss.name=Marshålehärskare +entity.galacticraftplanets.entry_pod.name=Inträdeskapsel +entity.galacticraftplanets.grapple_hook.name=Änterhake +entity.galacticraftplanets.landing_balloons.name=Landningskudde +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=Fraktraket +entity.galacticraftplanets.rocket_t2.name=N2-raket +entity.galacticraftplanets.rocket_t3.name=N3-raket +entity.galacticraftplanets.slimeling.name=Slemvarelse +entity.galacticraftplanets.sludgeling.name=Sörjigel +entity.galacticraftplanets.small_asteroid.name=Liten asteroid fluid.argon=Argon fluid.atmosphericgases=Atmosfärsgaser fluid.bacterialsludge=Bakteriell sörja diff --git a/src/main/resources/assets/galacticraftplanets/lang/th_TH.lang b/src/main/resources/assets/galacticraftplanets/lang/th_TH.lang index 39751d3b69..f08bddec97 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/th_TH.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/th_TH.lang @@ -10,22 +10,22 @@ container.mars_lander.name=ยานลงจอดบอลลูน container.short_range_telepad.name=เครื่องเทเลพอร์ตระยะใกล้ container.tile_terraformer.name=เทอราฟอร์มเมอร์ dimension.mars.name=ดาวอังคาร -entity.astro_miner.name=แอสโทรไมน์เนอร์ -entity.creeper_boss.name=บอสคริปเปอร์อวกาศ -entity.entry_pod.name=ยานลงจอด -entity.entry_pod_venus.name=ยานลงจอดดาวศุกร์ -entity.grapple_hook.name=ตะขอ -entity.juicer.name=จุยเซอร์ -entity.landing_balloons.name=ยานลงจอดบอลลูน -entity.projectile_tnt.name=ลูก TNT -entity.rocket_cargo.name=จรวดขนส่ง -entity.rocket_t2.name=จรวด เทียร์ 2 -entity.rocket_t3.name=จรวด เทียร์ 3 -entity.slimeling.name=สไลม์ลิ่ง -entity.sludgeling.name=หนอนแบคทีเรีย -entity.small_asteroid.name=ดาวเคราะห์น้อยขนาดเล็ก -entity.spider_queen.name=ราชินีแมงมุม -entity.web_shot.name=ลูกกระสุนใยแมงมุม +entity.galacticraftplanets.astro_miner.name=แอสโทรไมน์เนอร์ +entity.galacticraftplanets.creeper_boss.name=บอสคริปเปอร์อวกาศ +entity.galacticraftplanets.entry_pod.name=ยานลงจอด +entity.galacticraftplanets.entry_pod_venus.name=ยานลงจอดดาวศุกร์ +entity.galacticraftplanets.grapple_hook.name=ตะขอ +entity.galacticraftplanets.juicer.name=จุยเซอร์ +entity.galacticraftplanets.landing_balloons.name=ยานลงจอดบอลลูน +entity.galacticraftplanets.projectile_tnt.name=ลูก TNT +entity.galacticraftplanets.rocket_cargo.name=จรวดขนส่ง +entity.galacticraftplanets.rocket_t2.name=จรวด เทียร์ 2 +entity.galacticraftplanets.rocket_t3.name=จรวด เทียร์ 3 +entity.galacticraftplanets.slimeling.name=สไลม์ลิ่ง +entity.galacticraftplanets.sludgeling.name=หนอนแบคทีเรีย +entity.galacticraftplanets.small_asteroid.name=ดาวเคราะห์น้อยขนาดเล็ก +entity.galacticraftplanets.spider_queen.name=ราชินีแมงมุม +entity.galacticraftplanets.web_shot.name=ลูกกระสุนใยแมงมุม fluid.argon=ก๊าซอาร์กอน fluid.atmosphericgases=ก๊าซชั้นบรรยากาศ fluid.bacterialsludge=ตะกอนแบคทีเรีย diff --git a/src/main/resources/assets/galacticraftplanets/lang/tr_TR.lang b/src/main/resources/assets/galacticraftplanets/lang/tr_TR.lang index 816b66aecd..bd6d9a6482 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/tr_TR.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/tr_TR.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Landing Balonları container.short_range_telepad.name=Kısa Menzilli Telepad container.tile_terraformer.name=Terraformer dimension.mars.name=Mars -entity.astro_miner.name=Astro Maden Makinesi -entity.creeper_boss.name=Evrimleşmiş Creeper Patronu -entity.entry_pod.name=Giriş Bölmesi -entity.grapple_hook.name=Çeneli Kanca -entity.landing_balloons.name=Landing Balonları -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=Kargo Roketi -entity.rocket_t2.name=Tier 2 Roketi -entity.rocket_t3.name=Tier 3 Roket -entity.slimeling.name=Slimeling -entity.sludgeling.name=Sludgeling -entity.small_asteroid.name=Küçük Asteroit +entity.galacticraftplanets.astro_miner.name=Astro Maden Makinesi +entity.galacticraftplanets.creeper_boss.name=Evrimleşmiş Creeper Patronu +entity.galacticraftplanets.entry_pod.name=Giriş Bölmesi +entity.galacticraftplanets.grapple_hook.name=Çeneli Kanca +entity.galacticraftplanets.landing_balloons.name=Landing Balonları +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=Kargo Roketi +entity.galacticraftplanets.rocket_t2.name=Tier 2 Roketi +entity.galacticraftplanets.rocket_t3.name=Tier 3 Roket +entity.galacticraftplanets.slimeling.name=Slimeling +entity.galacticraftplanets.sludgeling.name=Sludgeling +entity.galacticraftplanets.small_asteroid.name=Küçük Asteroit fluid.argon=Argon Gazı fluid.atmosphericgases=Atmosferik Gazlar fluid.bacterialsludge=Bakteriyel Çamur diff --git a/src/main/resources/assets/galacticraftplanets/lang/zh_CN.lang b/src/main/resources/assets/galacticraftplanets/lang/zh_CN.lang index 0a314855f5..5c5ef38e16 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/zh_CN.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/zh_CN.lang @@ -4,18 +4,18 @@ container.mars_lander.name=着陆气球 container.short_range_telepad.name=短程传送平台 container.tile_terraformer.name=地形改造机 dimension.mars.name=火星 -entity.astro_miner.name=太空采矿机 -entity.creeper_boss.name=进化苦力怕之王 -entity.entry_pod.name=Giriş Bölmesi -entity.grapple_hook.name=Çeneli Kanca -entity.landing_balloons.name=着陆气球 -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=Kargo Roketi -entity.rocket_t2.name=Tier 2 Roketi -entity.rocket_t3.name=Tier 3 Roket -entity.slimeling.name=黏滑怪 -entity.sludgeling.name=泥浆怪 -entity.small_asteroid.name=Küçük Asteroit +entity.galacticraftplanets.astro_miner.name=太空采矿机 +entity.galacticraftplanets.creeper_boss.name=进化苦力怕之王 +entity.galacticraftplanets.entry_pod.name=Giriş Bölmesi +entity.galacticraftplanets.grapple_hook.name=Çeneli Kanca +entity.galacticraftplanets.landing_balloons.name=着陆气球 +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=Kargo Roketi +entity.galacticraftplanets.rocket_t2.name=Tier 2 Roketi +entity.galacticraftplanets.rocket_t3.name=Tier 3 Roket +entity.galacticraftplanets.slimeling.name=黏滑怪 +entity.galacticraftplanets.sludgeling.name=泥浆怪 +entity.galacticraftplanets.small_asteroid.name=Küçük Asteroit fluid.argon=氩气 fluid.atmosphericgases=空气 fluid.bacterialsludge=菌泥 diff --git a/src/main/resources/assets/galacticraftplanets/lang/zh_TW.lang b/src/main/resources/assets/galacticraftplanets/lang/zh_TW.lang index 00272e063b..db578b0a2b 100644 --- a/src/main/resources/assets/galacticraftplanets/lang/zh_TW.lang +++ b/src/main/resources/assets/galacticraftplanets/lang/zh_TW.lang @@ -4,18 +4,18 @@ container.mars_lander.name=Landing Balloons ##NEEDS TRANSLATE## container.short_range_telepad.name=短距離傳送臺 container.tile_terraformer.name=地形改造機 dimension.mars.name=火星 -entity.astro_miner.name=Astro Miner ##NEEDS TRANSLATE## -entity.creeper_boss.name=進化爬行者之王 -entity.entry_pod.name=Entry Pod ##NEEDS TRANSLATE## -entity.grapple_hook.name=抓升鉤 -entity.landing_balloons.name=Landing Balloons ##NEEDS TRANSLATE## -entity.projectile_tnt.name=Projectile TNT -entity.rocket_cargo.name=貨運火箭 -entity.rocket_t2.name=二階火箭 -entity.rocket_t3.name=三階火箭 -entity.slimeling.name=黏滑怪 -entity.sludgeling.name=泥漿怪 -entity.small_asteroid.name=小行星 +entity.galacticraftplanets.astro_miner.name=Astro Miner ##NEEDS TRANSLATE## +entity.galacticraftplanets.creeper_boss.name=進化爬行者之王 +entity.galacticraftplanets.entry_pod.name=Entry Pod ##NEEDS TRANSLATE## +entity.galacticraftplanets.grapple_hook.name=抓升鉤 +entity.galacticraftplanets.landing_balloons.name=Landing Balloons ##NEEDS TRANSLATE## +entity.galacticraftplanets.projectile_tnt.name=Projectile TNT +entity.galacticraftplanets.rocket_cargo.name=貨運火箭 +entity.galacticraftplanets.rocket_t2.name=二階火箭 +entity.galacticraftplanets.rocket_t3.name=三階火箭 +entity.galacticraftplanets.slimeling.name=黏滑怪 +entity.galacticraftplanets.sludgeling.name=泥漿怪 +entity.galacticraftplanets.small_asteroid.name=小行星 fluid.argon=氬氣 fluid.atmosphericgases=空氣 fluid.bacterialsludge=Bacterial Sludge ##NEEDS TRANSLATE## From c1fd88d40fedecebe21ab74b994014f96e2d5b42 Mon Sep 17 00:00:00 2001 From: Mitch Date: Sat, 18 Mar 2017 21:31:09 -0400 Subject: [PATCH 012/535] Fix various problems in 1.10 --- .../core/blocks/BlockAdvanced.java | 5 --- .../galacticraft/core/blocks/BlockMulti.java | 4 +- .../player/GCEntityClientPlayerMP.java | 6 +-- .../entities/player/GCEntityPlayerMP.java | 18 ++++---- .../core/entities/player/IPlayerClient.java | 2 +- .../core/entities/player/IPlayerServer.java | 4 +- .../core/entities/player/PlayerClient.java | 8 ++-- .../core/entities/player/PlayerServer.java | 45 ++++++++----------- .../core/event/EventHandlerGC.java | 5 +++ .../core/items/ItemMeteorChunk.java | 2 +- .../galacticraftcore/models/item/air_fan.json | 2 +- .../models/item/air_vent.json | 2 +- .../models/item/aluminum_wire.json | 2 +- .../models/item/aluminum_wire_heavy.json | 2 +- .../models/item/aluminum_wire_switch.json | 2 +- .../item/aluminum_wire_switch_heavy.json | 2 +- .../item/ambient_thermal_controller.json | 2 +- .../models/item/basic_item.json | 2 +- .../galacticraftcore/models/item/battery.json | 2 +- .../models/item/bucket_fuel.json | 2 +- .../models/item/bucket_oil.json | 14 +----- .../models/item/buggymat.json | 2 +- .../models/item/canister.json | 2 +- .../models/item/canister_copper.json | 2 +- .../galacticraftcore/models/item/canvas.json | 2 +- .../models/item/cheese_curd.json | 2 +- .../models/item/compressed_aluminum.json | 2 +- .../models/item/compressed_bronze.json | 2 +- .../models/item/compressed_copper.json | 2 +- .../models/item/compressed_iron.json | 2 +- .../models/item/compressed_meteoric_iron.json | 2 +- .../models/item/compressed_steel.json | 2 +- .../models/item/compressed_tin.json | 2 +- .../models/item/dehydrated_apple.json | 2 +- .../models/item/dehydrated_carrot.json | 2 +- .../models/item/dehydrated_melon.json | 2 +- .../models/item/dehydrated_potato.json | 2 +- .../galacticraftcore/models/item/engine.json | 2 +- .../models/item/frequency_module.json | 2 +- .../models/item/fuel_canister_partial.json | 2 +- .../models/item/fuel_canister_partial_1.json | 2 +- .../models/item/fuel_canister_partial_2.json | 2 +- .../models/item/fuel_canister_partial_3.json | 2 +- .../models/item/fuel_canister_partial_4.json | 2 +- .../models/item/fuel_canister_partial_5.json | 2 +- .../models/item/fuel_canister_partial_6.json | 2 +- .../models/item/glowstone_torch.json | 2 +- .../models/item/heavy_plating.json | 2 +- .../models/item/infinite_battery.json | 2 +- .../models/item/infinite_oxygen.json | 2 +- .../models/item/ingot_aluminum.json | 2 +- .../models/item/ingot_copper.json | 2 +- .../models/item/ingot_tin.json | 2 +- .../models/item/item_basic_moon.json | 2 +- .../models/item/lunar_sapphire.json | 2 +- .../models/item/meteoric_iron_raw.json | 2 +- .../models/item/nose_cone.json | 2 +- .../models/item/oil_canister_partial.json | 2 +- .../models/item/oil_canister_partial_1.json | 2 +- .../models/item/oil_canister_partial_2.json | 2 +- .../models/item/oil_canister_partial_3.json | 2 +- .../models/item/oil_canister_partial_4.json | 2 +- .../models/item/oil_canister_partial_5.json | 2 +- .../models/item/oil_canister_partial_6.json | 2 +- .../models/item/oxygen_concentrator.json | 2 +- .../models/item/oxygen_gear.json | 2 +- .../models/item/oxygen_mask.json | 2 +- .../models/item/oxygen_tank_heavy_full.json | 2 +- .../models/item/oxygen_tank_light_full.json | 2 +- .../models/item/oxygen_tank_med_full.json | 2 +- .../models/item/parachute.json | 2 +- .../models/item/parachute_black.json | 2 +- .../models/item/parachute_blue.json | 2 +- .../models/item/parachute_brown.json | 2 +- .../models/item/parachute_darkblue.json | 2 +- .../models/item/parachute_darkgray.json | 2 +- .../models/item/parachute_darkgreen.json | 2 +- .../models/item/parachute_gray.json | 2 +- .../models/item/parachute_lime.json | 2 +- .../models/item/parachute_magenta.json | 2 +- .../models/item/parachute_orange.json | 2 +- .../models/item/parachute_pink.json | 2 +- .../models/item/parachute_purple.json | 2 +- .../models/item/parachute_red.json | 2 +- .../models/item/parachute_teal.json | 2 +- .../models/item/parachute_yellow.json | 2 +- .../models/item/prelaunch_checklist.json | 2 +- .../models/item/raw_silicon.json | 2 +- .../models/item/rocket_fins.json | 2 +- .../models/item/schematic.json | 2 +- .../models/item/schematic_rocket_t2.json | 2 +- .../galacticraftcore/models/item/seat.json | 2 +- .../models/item/sensor_glasses.json | 2 +- .../models/item/sensor_lens.json | 2 +- .../models/item/solar_module_1.json | 2 +- .../models/item/standard_wrench.json | 2 +- .../models/item/steel_axe.json | 2 +- .../models/item/steel_boots.json | 2 +- .../models/item/steel_chestplate.json | 2 +- .../models/item/steel_helmet.json | 2 +- .../models/item/steel_hoe.json | 2 +- .../models/item/steel_leggings.json | 2 +- .../models/item/steel_pickaxe.json | 2 +- .../models/item/steel_pole.json | 2 +- .../models/item/steel_shovel.json | 2 +- .../models/item/steel_sword.json | 2 +- .../galacticraftcore/models/item/storage.json | 2 +- .../models/item/tier1booster.json | 2 +- .../models/item/unlit_torch.json | 2 +- .../models/item/unlit_torch_lit.json | 2 +- .../models/item/unlit_torch_stone.json | 2 +- .../models/item/unlit_torch_stone_lit.json | 2 +- .../models/item/wafer_advanced.json | 2 +- .../models/item/wafer_basic.json | 2 +- .../models/item/wafer_solar.json | 2 +- .../assets/galacticraftcore/sounds.json | 36 +++++++-------- .../models/item/astro_miner.json | 2 +- .../models/item/atmospheric_valve.json | 2 +- .../models/item/beam_core.json | 2 +- .../models/item/beam_receiver.json | 2 +- .../models/item/beam_reflector.json | 2 +- .../models/item/bucket_sludge.json | 2 +- .../models/item/bucket_sulphuric_acid.json | 2 +- .../models/item/canister_partial_ln2.json | 2 +- .../models/item/canister_partial_ln2_1.json | 2 +- .../models/item/canister_partial_ln2_2.json | 2 +- .../models/item/canister_partial_ln2_3.json | 2 +- .../models/item/canister_partial_ln2_4.json | 2 +- .../models/item/canister_partial_ln2_5.json | 2 +- .../models/item/canister_partial_ln2_6.json | 2 +- .../models/item/canister_partial_lox.json | 2 +- .../models/item/canister_partial_lox_1.json | 2 +- .../models/item/canister_partial_lox_2.json | 2 +- .../models/item/canister_partial_lox_3.json | 2 +- .../models/item/canister_partial_lox_4.json | 2 +- .../models/item/canister_partial_lox_5.json | 2 +- .../models/item/canister_partial_lox_6.json | 2 +- .../models/item/carbon_fragments.json | 2 +- .../models/item/compressed_desh.json | 2 +- .../models/item/compressed_titanium.json | 2 +- .../models/item/desh_axe.json | 2 +- .../models/item/desh_boots.json | 2 +- .../models/item/desh_chestplate.json | 2 +- .../models/item/desh_helmet.json | 2 +- .../models/item/desh_hoe.json | 2 +- .../models/item/desh_leggings.json | 2 +- .../models/item/desh_pick.json | 2 +- .../models/item/desh_pick_slime.json | 2 +- .../models/item/desh_spade.json | 2 +- .../models/item/desh_stick.json | 2 +- .../models/item/desh_sword.json | 2 +- .../models/item/engine_t2.json | 2 +- .../models/item/fluid_manip.json | 2 +- .../models/item/grapple.json | 2 +- .../models/item/heavy_nose_cone.json | 2 +- .../models/item/ingot_desh.json | 2 +- .../models/item/ingot_lead.json | 2 +- .../models/item/ingot_titanium.json | 2 +- .../models/item/item_basic_asteroids.json | 2 +- .../models/item/methane_canister_partial.json | 2 +- .../item/methane_canister_partial_1.json | 2 +- .../item/methane_canister_partial_2.json | 2 +- .../item/methane_canister_partial_3.json | 2 +- .../item/methane_canister_partial_4.json | 2 +- .../item/methane_canister_partial_5.json | 2 +- .../item/methane_canister_partial_6.json | 2 +- .../models/item/orion_drive.json | 2 +- .../models/item/raw_desh.json | 2 +- .../models/item/reinforced_plate_t2.json | 2 +- .../models/item/rocket_cargo.json | 2 +- .../models/item/rocket_fins_t2.json | 2 +- .../models/item/rocket_t2.json | 2 +- .../models/item/rocket_t3.json | 2 +- .../models/item/schematic_astro_miner.json | 2 +- .../models/item/schematic_rocket_cargo.json | 2 +- .../models/item/schematic_rocket_t3.json | 2 +- .../models/item/shard_iron.json | 2 +- .../models/item/shard_titanium.json | 2 +- .../models/item/shield_controller.json | 2 +- .../models/item/slimeling_cargo.json | 2 +- .../models/item/telepad_short.json | 2 +- .../models/item/thermal_boots.json | 2 +- .../models/item/thermal_boots_t2.json | 2 +- .../models/item/thermal_chestplate.json | 2 +- .../models/item/thermal_chestplate_t2.json | 2 +- .../models/item/thermal_cloth.json | 2 +- .../models/item/thermal_helm_t2.json | 2 +- .../models/item/thermal_leggings.json | 2 +- .../models/item/thermal_leggings_t2.json | 2 +- .../models/item/thermal_padding.json | 2 +- .../models/item/titanium_axe.json | 2 +- .../models/item/titanium_boots.json | 2 +- .../models/item/titanium_chestplate.json | 2 +- .../models/item/titanium_helmet.json | 2 +- .../models/item/titanium_hoe.json | 2 +- .../models/item/titanium_leggings.json | 2 +- .../models/item/titanium_pickaxe.json | 2 +- .../models/item/titanium_shovel.json | 2 +- .../models/item/titanium_sword.json | 2 +- .../models/item/vine_0.json | 2 +- .../models/item/vine_1.json | 2 +- .../models/item/vine_2.json | 2 +- .../models/item/volcanic_pickaxe.json | 2 +- .../models/item/web_torch_0.json | 2 +- .../models/item/web_torch_1.json | 2 +- 205 files changed, 256 insertions(+), 279 deletions(-) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java index 3d7b0f6588..29acb088c9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java @@ -58,11 +58,6 @@ public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, } } - if (!worldIn.isRemote) - { - return false; - } - if (playerIn.isSneaking()) { if (this.onSneakMachineActivated(worldIn, pos, playerIn, hand, heldItem, side, hitX, hitY, hitZ)) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java index 29c6dc5b99..96c51aaf7f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java @@ -287,7 +287,7 @@ public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World wo if (Blocks.AIR != mainBlockID) { - return mainBlockID.getPickBlock(state, target, world, pos, player); + return mainBlockID.getPickBlock(state, target, world, mainBlockPosition, player); } } } @@ -324,7 +324,7 @@ public boolean isBed(IBlockState state, IBlockAccess world, BlockPos pos, Entity if (mainBlockPosition != null && !mainBlockPosition.equals(pos)) { IBlockState mainState = world.getBlockState(mainBlockPosition); - return mainState.getBlock().isBed(state, world, pos, player); + return mainState.getBlock().isBed(state, world, mainBlockPosition, player); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityClientPlayerMP.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityClientPlayerMP.java index 79f0ffbd10..2cf78aacf3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityClientPlayerMP.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityClientPlayerMP.java @@ -19,11 +19,11 @@ public GCEntityClientPlayerMP(Minecraft mcIn, World worldIn, NetHandlerPlayClien } @Override - public void wakeUpPlayer(boolean par1, boolean par2, boolean par3) + public void wakeUpPlayer(boolean immediately, boolean updateWorldFlag, boolean setSpawn) { - if (!ClientProxyCore.playerClientHandler.wakeUpPlayer(this, par1, par2, par3)) + if (!ClientProxyCore.playerClientHandler.wakeUpPlayer(this, immediately, updateWorldFlag, setSpawn)) { - super.wakeUpPlayer(par1, par2, par3); + super.wakeUpPlayer(immediately, updateWorldFlag, setSpawn); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityPlayerMP.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityPlayerMP.java index 6a10978762..d2e94f84b6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityPlayerMP.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCEntityPlayerMP.java @@ -18,9 +18,9 @@ */ public class GCEntityPlayerMP extends EntityPlayerMP { - public GCEntityPlayerMP(MinecraftServer server, WorldServer world, GameProfile profile, PlayerInteractionManager itemInWorldManager) + public GCEntityPlayerMP(MinecraftServer server, WorldServer world, GameProfile profile, PlayerInteractionManager interactionManager) { - super(server, WorldUtil.getStartWorld(world), profile, itemInWorldManager); + super(server, WorldUtil.getStartWorld(world), profile, interactionManager); if (this.worldObj != world) { this.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null).setStartDimension(WorldUtil.getDimensionName(this.worldObj.provider)); @@ -45,14 +45,12 @@ public void updateRidden() } @Override - public boolean startRiding(Entity entityIn, boolean force) + public void dismountRidingEntity() { - if (!GalacticraftCore.proxy.player.mountEntity(this, entityIn)) + if (!GalacticraftCore.proxy.player.dismountEntity(this, this.getRidingEntity())) { - return super.startRiding(entityIn, force); + super.dismountRidingEntity(); } - - return false; } @Override @@ -63,11 +61,11 @@ public void moveEntity(double par1, double par3, double par5) } @Override - public void wakeUpPlayer(boolean par1, boolean par2, boolean par3) + public void wakeUpPlayer(boolean immediately, boolean updateWorldFlag, boolean setSpawn) { - if (!GalacticraftCore.proxy.player.wakeUpPlayer(this, par1, par2, par3)) + if (!GalacticraftCore.proxy.player.wakeUpPlayer(this, immediately, updateWorldFlag, setSpawn)) { - super.wakeUpPlayer(par1, par2, par3); + super.wakeUpPlayer(immediately, updateWorldFlag, setSpawn); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IPlayerClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IPlayerClient.java index a44c318b82..b8fc53dc6b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IPlayerClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IPlayerClient.java @@ -16,7 +16,7 @@ public interface IPlayerClient boolean isEntityInsideOpaqueBlock(EntityPlayerSP player, boolean vanillaInside); - boolean wakeUpPlayer(EntityPlayerSP player, boolean par1, boolean par2, boolean par3); + boolean wakeUpPlayer(EntityPlayerSP player, boolean immediately, boolean updateWorldFlag, boolean setSpawn); void onBuild(int i, EntityPlayerSP player); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IPlayerServer.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IPlayerServer.java index 19d44227ea..fd699545b5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IPlayerServer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/IPlayerServer.java @@ -13,11 +13,11 @@ public interface IPlayerServer void updateRiddenPost(EntityPlayerMP player); - boolean mountEntity(EntityPlayerMP player, Entity par1Entity); + boolean dismountEntity(EntityPlayerMP player, Entity par1Entity); void moveEntity(EntityPlayerMP player, double par1, double par3, double par5); - boolean wakeUpPlayer(EntityPlayerMP player, boolean par1, boolean par2, boolean par3); + boolean wakeUpPlayer(EntityPlayerMP player, boolean immediately, boolean updateWorldFlag, boolean setSpawn); float attackEntityFrom(EntityPlayerMP player, DamageSource par1DamageSource, float par2); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java index c1c1d9ec1d..64a7940681 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java @@ -50,9 +50,9 @@ public void moveEntity(EntityPlayerSP player, double par1, double par3, double p } @Override - public boolean wakeUpPlayer(EntityPlayerSP player, boolean par1, boolean par2, boolean par3) + public boolean wakeUpPlayer(EntityPlayerSP player, boolean immediately, boolean updateWorldFlag, boolean setSpawn) { - return this.wakeUpPlayer(player, par1, par2, par3, false); + return this.wakeUpPlayer(player, immediately, updateWorldFlag, setSpawn, false); } @Override @@ -321,13 +321,13 @@ private void updateFeet(EntityPlayerSP player, double motionX, double motionZ) } } - public boolean wakeUpPlayer(EntityPlayerSP player, boolean par1, boolean par2, boolean par3, boolean bypass) + public boolean wakeUpPlayer(EntityPlayerSP player, boolean immediately, boolean updateWorldFlag, boolean setSpawn, boolean bypass) { BlockPos c = player.bedLocation; if (c != null) { - EventWakePlayer event = new EventWakePlayer(player, c, par1, par2, par3, bypass); + EventWakePlayer event = new EventWakePlayer(player, c, immediately, updateWorldFlag, setSpawn, bypass); MinecraftForge.EVENT_BUS.post(event); if (bypass || event.result == null || event.result == EntityPlayer.SleepResult.OK) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java index f24435d69d..a85894bf60 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerServer.java @@ -22,7 +22,7 @@ public class PlayerServer implements IPlayerServer { - boolean updatingRidden = false; + private boolean updatingRidden = false; @Override public void clonePlayer(EntityPlayerMP player, EntityPlayer oldPlayer, boolean keepInv) @@ -49,14 +49,10 @@ public void updateRiddenPost(EntityPlayerMP player) } @Override - public boolean mountEntity(EntityPlayerMP player, Entity par1Entity) + public boolean dismountEntity(EntityPlayerMP player, Entity par1Entity) { - if (updatingRidden && player.getRidingEntity() instanceof IIgnoreShift && ((IIgnoreShift) player.getRidingEntity()).shouldIgnoreShiftExit()) - { - return true; - } + return updatingRidden && player.getRidingEntity() instanceof IIgnoreShift && ((IIgnoreShift) player.getRidingEntity()).shouldIgnoreShiftExit(); - return false; } @Override @@ -70,9 +66,22 @@ public void moveEntity(EntityPlayerMP player, double par1, double par3, double p } @Override - public boolean wakeUpPlayer(EntityPlayerMP player, boolean par1, boolean par2, boolean par3) + public boolean wakeUpPlayer(EntityPlayerMP player, boolean immediately, boolean updateWorldFlag, boolean setSpawn) { - return this.wakeUpPlayer(player, par1, par2, par3, false); + BlockPos c = player.bedLocation; + + if (c != null) + { + EventWakePlayer event = new EventWakePlayer(player, c, immediately, updateWorldFlag, setSpawn, false); + MinecraftForge.EVENT_BUS.post(event); + + if (event.result == null || event.result == EntityPlayer.SleepResult.OK) + { + return false; + } + } + + return true; } @Override @@ -161,22 +170,4 @@ public void knockBack(EntityPlayerMP player, Entity p_70653_1_, float p_70653_2_ } } } - - public boolean wakeUpPlayer(EntityPlayerMP player, boolean par1, boolean par2, boolean par3, boolean bypass) - { - BlockPos c = player.bedLocation; - - if (c != null) - { - EventWakePlayer event = new EventWakePlayer(player, c, par1, par2, par3, bypass); - MinecraftForge.EVENT_BUS.post(event); - - if (bypass || event.result == null || event.result == EntityPlayer.SleepResult.OK) - { - return false; - } - } - - return true; - } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java index f5284411d2..6070cb7ed5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java @@ -381,6 +381,11 @@ private ItemStack fillBucket(World world, RayTraceResult position) public void onBucketFill(FillBucketEvent event) { RayTraceResult pos = event.getTarget(); + if (pos == null) + { + return; + } + ItemStack ret = fillBucket(event.getWorld(), pos); if (ret == null) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemMeteorChunk.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemMeteorChunk.java index 55b17cf252..d8d8429b2a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemMeteorChunk.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemMeteorChunk.java @@ -158,7 +158,7 @@ public ActionResult onItemRightClick(ItemStack itemStack, World world world.spawnEntityInWorld(meteor); } - player.swingArm(player.getActiveHand()); + player.swingArm(hand); return new ActionResult<>(EnumActionResult.SUCCESS, itemStack); } diff --git a/src/main/resources/assets/galacticraftcore/models/item/air_fan.json b/src/main/resources/assets/galacticraftcore/models/item/air_fan.json index 5bb53e8f6a..23961a7207 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/air_fan.json +++ b/src/main/resources/assets/galacticraftcore/models/item/air_fan.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/airFan" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/air_vent.json b/src/main/resources/assets/galacticraftcore/models/item/air_vent.json index 4e9cef6bf6..69916ad9fd 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/air_vent.json +++ b/src/main/resources/assets/galacticraftcore/models/item/air_vent.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/airVent" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire.json b/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire.json index ba209c03b3..da1449e9b5 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire.json +++ b/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:blocks/aluminumWire" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire_heavy.json b/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire_heavy.json index fa226cc575..23de8b36b6 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire_heavy.json +++ b/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire_heavy.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:blocks/aluminumWireHeavy" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire_switch.json b/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire_switch.json index e23cbf8007..363d91932e 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire_switch.json +++ b/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire_switch.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:blocks/aluminumWireSwitch" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire_switch_heavy.json b/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire_switch_heavy.json index d6bc3cb0cd..a1033e9872 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire_switch_heavy.json +++ b/src/main/resources/assets/galacticraftcore/models/item/aluminum_wire_switch_heavy.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:blocks/aluminumWireHeavySwitch" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/ambient_thermal_controller.json b/src/main/resources/assets/galacticraftcore/models/item/ambient_thermal_controller.json index 517bd14639..be1bd79fc2 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/ambient_thermal_controller.json +++ b/src/main/resources/assets/galacticraftcore/models/item/ambient_thermal_controller.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.ambientThermalController" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/basic_item.json b/src/main/resources/assets/galacticraftcore/models/item/basic_item.json index 53dd17123e..f35051f40d 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/basic_item.json +++ b/src/main/resources/assets/galacticraftcore/models/item/basic_item.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.solar_module_0" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/battery.json b/src/main/resources/assets/galacticraftcore/models/item/battery.json index a98b6212c3..190f6f7017 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/battery.json +++ b/src/main/resources/assets/galacticraftcore/models/item/battery.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/battery" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/bucket_fuel.json b/src/main/resources/assets/galacticraftcore/models/item/bucket_fuel.json index c7e7fad98c..8cb61fc717 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/bucket_fuel.json +++ b/src/main/resources/assets/galacticraftcore/models/item/bucket_fuel.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/bucketFuel" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/bucket_oil.json b/src/main/resources/assets/galacticraftcore/models/item/bucket_oil.json index 631cfda770..b5a45ccc85 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/bucket_oil.json +++ b/src/main/resources/assets/galacticraftcore/models/item/bucket_oil.json @@ -1,18 +1,6 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/bucketOil" - }, - "display": { - "thirdperson": { - "rotation": [ -90, 0, 0 ], - "translation": [ 0, 1, -3 ], - "scale": [ 0.55, 0.55, 0.55 ] - }, - "firstperson": { - "rotation": [ 0, -135, 25 ], - "translation": [ 0, 4, 2 ], - "scale": [ 1.7, 1.7, 1.7 ] - } } } diff --git a/src/main/resources/assets/galacticraftcore/models/item/buggymat.json b/src/main/resources/assets/galacticraftcore/models/item/buggymat.json index c4460d389f..8133355701 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/buggymat.json +++ b/src/main/resources/assets/galacticraftcore/models/item/buggymat.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/buggymat.wheel" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/canister.json b/src/main/resources/assets/galacticraftcore/models/item/canister.json index 78dbff8b06..cba23dc169 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/canister.json +++ b/src/main/resources/assets/galacticraftcore/models/item/canister.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/canister.tin" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/canister_copper.json b/src/main/resources/assets/galacticraftcore/models/item/canister_copper.json index 5ed0801302..f283fe3f08 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/canister_copper.json +++ b/src/main/resources/assets/galacticraftcore/models/item/canister_copper.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/canister.copper" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/canvas.json b/src/main/resources/assets/galacticraftcore/models/item/canvas.json index c539936ea6..266d311301 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/canvas.json +++ b/src/main/resources/assets/galacticraftcore/models/item/canvas.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/canvas" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/cheese_curd.json b/src/main/resources/assets/galacticraftcore/models/item/cheese_curd.json index 198ce4582e..23870c2a6d 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/cheese_curd.json +++ b/src/main/resources/assets/galacticraftcore/models/item/cheese_curd.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/cheese_curd" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/compressed_aluminum.json b/src/main/resources/assets/galacticraftcore/models/item/compressed_aluminum.json index b6ac392ee8..843910f0f4 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/compressed_aluminum.json +++ b/src/main/resources/assets/galacticraftcore/models/item/compressed_aluminum.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.compressedAluminum" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/compressed_bronze.json b/src/main/resources/assets/galacticraftcore/models/item/compressed_bronze.json index 4dc27d9f0c..199c2103c9 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/compressed_bronze.json +++ b/src/main/resources/assets/galacticraftcore/models/item/compressed_bronze.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.compressedBronze" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/compressed_copper.json b/src/main/resources/assets/galacticraftcore/models/item/compressed_copper.json index 4b95ed99f3..d09f0c5cc6 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/compressed_copper.json +++ b/src/main/resources/assets/galacticraftcore/models/item/compressed_copper.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.compressedCopper" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/compressed_iron.json b/src/main/resources/assets/galacticraftcore/models/item/compressed_iron.json index 3f671c5d09..5e8a733918 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/compressed_iron.json +++ b/src/main/resources/assets/galacticraftcore/models/item/compressed_iron.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.compressedIron" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/compressed_meteoric_iron.json b/src/main/resources/assets/galacticraftcore/models/item/compressed_meteoric_iron.json index b0573ac762..f2a5d9602b 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/compressed_meteoric_iron.json +++ b/src/main/resources/assets/galacticraftcore/models/item/compressed_meteoric_iron.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/compressedMeteoricIron" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/compressed_steel.json b/src/main/resources/assets/galacticraftcore/models/item/compressed_steel.json index f24ec36f23..19b7c5c496 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/compressed_steel.json +++ b/src/main/resources/assets/galacticraftcore/models/item/compressed_steel.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.compressedSteel" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/compressed_tin.json b/src/main/resources/assets/galacticraftcore/models/item/compressed_tin.json index 628b749c1a..3c254f4b9b 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/compressed_tin.json +++ b/src/main/resources/assets/galacticraftcore/models/item/compressed_tin.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.compressedTin" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/dehydrated_apple.json b/src/main/resources/assets/galacticraftcore/models/item/dehydrated_apple.json index b9e56aa8ba..8874989bd4 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/dehydrated_apple.json +++ b/src/main/resources/assets/galacticraftcore/models/item/dehydrated_apple.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.dehydratedApple" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/dehydrated_carrot.json b/src/main/resources/assets/galacticraftcore/models/item/dehydrated_carrot.json index 7a239f51f2..07c5a1c923 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/dehydrated_carrot.json +++ b/src/main/resources/assets/galacticraftcore/models/item/dehydrated_carrot.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.dehydratedCarrot" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/dehydrated_melon.json b/src/main/resources/assets/galacticraftcore/models/item/dehydrated_melon.json index 78fd932629..55b5f587d1 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/dehydrated_melon.json +++ b/src/main/resources/assets/galacticraftcore/models/item/dehydrated_melon.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.dehydratedMelon" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/dehydrated_potato.json b/src/main/resources/assets/galacticraftcore/models/item/dehydrated_potato.json index b3273804fe..a21a4ddfca 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/dehydrated_potato.json +++ b/src/main/resources/assets/galacticraftcore/models/item/dehydrated_potato.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.dehydratedPotato" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/engine.json b/src/main/resources/assets/galacticraftcore/models/item/engine.json index 14b6f4f862..22474456bf 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/engine.json +++ b/src/main/resources/assets/galacticraftcore/models/item/engine.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/engine.tier1engine" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/frequency_module.json b/src/main/resources/assets/galacticraftcore/models/item/frequency_module.json index 9b6b20f1da..19addf0172 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/frequency_module.json +++ b/src/main/resources/assets/galacticraftcore/models/item/frequency_module.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.frequencyModule" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial.json b/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial.json index 3cfe01fa31..dbd71f34ce 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial.json +++ b/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/fuel_canister_partial_0" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_1.json b/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_1.json index fd9f7fa014..f8bf423823 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_1.json +++ b/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_1.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/fuel_canister_partial_1" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_2.json b/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_2.json index e7d31fb5cd..5ae292bdb6 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_2.json +++ b/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/fuel_canister_partial_2" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_3.json b/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_3.json index 7a65850afd..dfa80aa9f4 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_3.json +++ b/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_3.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/fuel_canister_partial_3" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_4.json b/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_4.json index c3b8d22491..9e05c46f7c 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_4.json +++ b/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_4.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/fuel_canister_partial_4" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_5.json b/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_5.json index a0bf9038aa..8d7958f398 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_5.json +++ b/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_5.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/fuel_canister_partial_5" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_6.json b/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_6.json index dbb9513ef7..c1a9725d63 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_6.json +++ b/src/main/resources/assets/galacticraftcore/models/item/fuel_canister_partial_6.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/fuel_canister_partial_6" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/glowstone_torch.json b/src/main/resources/assets/galacticraftcore/models/item/glowstone_torch.json index 0963d96c02..5ca9e15c6b 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/glowstone_torch.json +++ b/src/main/resources/assets/galacticraftcore/models/item/glowstone_torch.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:blocks/glowstoneTorch" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/heavy_plating.json b/src/main/resources/assets/galacticraftcore/models/item/heavy_plating.json index 5e1e44906d..790e205cf0 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/heavy_plating.json +++ b/src/main/resources/assets/galacticraftcore/models/item/heavy_plating.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/heavyPlating" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/infinite_battery.json b/src/main/resources/assets/galacticraftcore/models/item/infinite_battery.json index a98b6212c3..190f6f7017 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/infinite_battery.json +++ b/src/main/resources/assets/galacticraftcore/models/item/infinite_battery.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/battery" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/infinite_oxygen.json b/src/main/resources/assets/galacticraftcore/models/item/infinite_oxygen.json index c463882b4e..6cf48ad135 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/infinite_oxygen.json +++ b/src/main/resources/assets/galacticraftcore/models/item/infinite_oxygen.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/oxygenTankHeavyFull" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/ingot_aluminum.json b/src/main/resources/assets/galacticraftcore/models/item/ingot_aluminum.json index 6a9368917c..2c94c0c587 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/ingot_aluminum.json +++ b/src/main/resources/assets/galacticraftcore/models/item/ingot_aluminum.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.ingotAluminum" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/ingot_copper.json b/src/main/resources/assets/galacticraftcore/models/item/ingot_copper.json index 59271066ea..9f394dfdbb 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/ingot_copper.json +++ b/src/main/resources/assets/galacticraftcore/models/item/ingot_copper.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.ingotCopper" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/ingot_tin.json b/src/main/resources/assets/galacticraftcore/models/item/ingot_tin.json index 5aa2eaab46..0934fa538c 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/ingot_tin.json +++ b/src/main/resources/assets/galacticraftcore/models/item/ingot_tin.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.ingotTin" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/item_basic_moon.json b/src/main/resources/assets/galacticraftcore/models/item/item_basic_moon.json index a7439e9d20..778cc06b7f 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/item_basic_moon.json +++ b/src/main/resources/assets/galacticraftcore/models/item/item_basic_moon.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/meteoricIronIngot" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/lunar_sapphire.json b/src/main/resources/assets/galacticraftcore/models/item/lunar_sapphire.json index 1f76f4dd1c..c2baa874bb 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/lunar_sapphire.json +++ b/src/main/resources/assets/galacticraftcore/models/item/lunar_sapphire.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/lunar_sapphire" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/meteoric_iron_raw.json b/src/main/resources/assets/galacticraftcore/models/item/meteoric_iron_raw.json index 95318e4d92..cdeb7a5bca 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/meteoric_iron_raw.json +++ b/src/main/resources/assets/galacticraftcore/models/item/meteoric_iron_raw.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/meteoricIronRaw" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/nose_cone.json b/src/main/resources/assets/galacticraftcore/models/item/nose_cone.json index d7b761b408..9ea3362377 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/nose_cone.json +++ b/src/main/resources/assets/galacticraftcore/models/item/nose_cone.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/noseCone" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial.json b/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial.json index 68e7ce0f08..ac52636fd6 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial.json +++ b/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/oil_canister_partial_0" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_1.json b/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_1.json index 7d8126a64a..fa2a8b5b55 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_1.json +++ b/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_1.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/oil_canister_partial_1" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_2.json b/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_2.json index 6a98b61a57..a7c5513e5b 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_2.json +++ b/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/oil_canister_partial_2" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_3.json b/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_3.json index 985e797d51..191ad3fec1 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_3.json +++ b/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_3.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/oil_canister_partial_3" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_4.json b/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_4.json index 19a18123f5..74d30b34b3 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_4.json +++ b/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_4.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/oil_canister_partial_4" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_5.json b/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_5.json index 953eefde9f..bc49f1ef92 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_5.json +++ b/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_5.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/oil_canister_partial_5" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_6.json b/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_6.json index 0909c044c9..12f1d1d8e6 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_6.json +++ b/src/main/resources/assets/galacticraftcore/models/item/oil_canister_partial_6.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/oil_canister_partial_6" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/oxygen_concentrator.json b/src/main/resources/assets/galacticraftcore/models/item/oxygen_concentrator.json index 26962cf427..0e7ba18cd5 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/oxygen_concentrator.json +++ b/src/main/resources/assets/galacticraftcore/models/item/oxygen_concentrator.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/oxygenConcentrator" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/oxygen_gear.json b/src/main/resources/assets/galacticraftcore/models/item/oxygen_gear.json index 09b4749d6b..a1f9692d14 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/oxygen_gear.json +++ b/src/main/resources/assets/galacticraftcore/models/item/oxygen_gear.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/oxygenGear" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/oxygen_mask.json b/src/main/resources/assets/galacticraftcore/models/item/oxygen_mask.json index 5e7133af34..45bf576e0d 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/oxygen_mask.json +++ b/src/main/resources/assets/galacticraftcore/models/item/oxygen_mask.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/oxygenMask" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/oxygen_tank_heavy_full.json b/src/main/resources/assets/galacticraftcore/models/item/oxygen_tank_heavy_full.json index c463882b4e..6cf48ad135 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/oxygen_tank_heavy_full.json +++ b/src/main/resources/assets/galacticraftcore/models/item/oxygen_tank_heavy_full.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/oxygenTankHeavyFull" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/oxygen_tank_light_full.json b/src/main/resources/assets/galacticraftcore/models/item/oxygen_tank_light_full.json index 84ef9315c0..76f0b12437 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/oxygen_tank_light_full.json +++ b/src/main/resources/assets/galacticraftcore/models/item/oxygen_tank_light_full.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/oxygenTankLightFull" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/oxygen_tank_med_full.json b/src/main/resources/assets/galacticraftcore/models/item/oxygen_tank_med_full.json index ab7086c152..c6aaf63e8d 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/oxygen_tank_med_full.json +++ b/src/main/resources/assets/galacticraftcore/models/item/oxygen_tank_med_full.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/oxygenTankMedFull" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute.json b/src/main/resources/assets/galacticraftcore/models/item/parachute.json index edbca14e42..814683ec50 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_plain" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute_black.json b/src/main/resources/assets/galacticraftcore/models/item/parachute_black.json index 1a36c76038..382929aea9 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute_black.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute_black.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_black" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute_blue.json b/src/main/resources/assets/galacticraftcore/models/item/parachute_blue.json index ec728568f8..0b172b1497 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute_blue.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute_blue.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_blue" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute_brown.json b/src/main/resources/assets/galacticraftcore/models/item/parachute_brown.json index 639ca52182..1133118a8f 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute_brown.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute_brown.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_brown" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute_darkblue.json b/src/main/resources/assets/galacticraftcore/models/item/parachute_darkblue.json index 80b1a8e8b5..7b63600bdd 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute_darkblue.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute_darkblue.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_darkblue" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute_darkgray.json b/src/main/resources/assets/galacticraftcore/models/item/parachute_darkgray.json index 5d546a7ee0..e09ea61c25 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute_darkgray.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute_darkgray.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_darkgray" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute_darkgreen.json b/src/main/resources/assets/galacticraftcore/models/item/parachute_darkgreen.json index 88f99b9d5d..574b1ebb2b 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute_darkgreen.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute_darkgreen.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_darkgreen" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute_gray.json b/src/main/resources/assets/galacticraftcore/models/item/parachute_gray.json index ba2ccb318f..da0dc5f687 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute_gray.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute_gray.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_gray" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute_lime.json b/src/main/resources/assets/galacticraftcore/models/item/parachute_lime.json index 18cb9a37c3..5e78ac9162 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute_lime.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute_lime.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_lime" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute_magenta.json b/src/main/resources/assets/galacticraftcore/models/item/parachute_magenta.json index 0287e57ffd..83ba3e3515 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute_magenta.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute_magenta.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_magenta" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute_orange.json b/src/main/resources/assets/galacticraftcore/models/item/parachute_orange.json index 66b5ca9e38..42fde8e63b 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute_orange.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute_orange.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_orange" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute_pink.json b/src/main/resources/assets/galacticraftcore/models/item/parachute_pink.json index 6a439e651f..07a97553ba 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute_pink.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute_pink.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_pink" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute_purple.json b/src/main/resources/assets/galacticraftcore/models/item/parachute_purple.json index 26589702c1..9f23a8de91 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute_purple.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute_purple.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_purple" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute_red.json b/src/main/resources/assets/galacticraftcore/models/item/parachute_red.json index 080a5d84a6..d24916dc1e 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute_red.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute_red.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_red" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute_teal.json b/src/main/resources/assets/galacticraftcore/models/item/parachute_teal.json index c2a5cac2b4..b527e8df3b 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute_teal.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute_teal.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_teal" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/parachute_yellow.json b/src/main/resources/assets/galacticraftcore/models/item/parachute_yellow.json index 1205a12e0a..d5ce068e1e 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/parachute_yellow.json +++ b/src/main/resources/assets/galacticraftcore/models/item/parachute_yellow.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/parachute_yellow" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/prelaunch_checklist.json b/src/main/resources/assets/galacticraftcore/models/item/prelaunch_checklist.json index 725dc9032b..20e41c2112 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/prelaunch_checklist.json +++ b/src/main/resources/assets/galacticraftcore/models/item/prelaunch_checklist.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/prelaunch_checklist" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/raw_silicon.json b/src/main/resources/assets/galacticraftcore/models/item/raw_silicon.json index 9dc486c470..0c95e06923 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/raw_silicon.json +++ b/src/main/resources/assets/galacticraftcore/models/item/raw_silicon.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.rawSilicon" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/rocket_fins.json b/src/main/resources/assets/galacticraftcore/models/item/rocket_fins.json index 96fff86ada..07dd37f163 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/rocket_fins.json +++ b/src/main/resources/assets/galacticraftcore/models/item/rocket_fins.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/rocketFins" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/schematic.json b/src/main/resources/assets/galacticraftcore/models/item/schematic.json index acb22ca70d..8067181ea2 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/schematic.json +++ b/src/main/resources/assets/galacticraftcore/models/item/schematic.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/schematic_buggy" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/schematic_rocket_t2.json b/src/main/resources/assets/galacticraftcore/models/item/schematic_rocket_t2.json index fbacb62592..0a45f2c30c 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/schematic_rocket_t2.json +++ b/src/main/resources/assets/galacticraftcore/models/item/schematic_rocket_t2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/schematic_rocket_t2" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/seat.json b/src/main/resources/assets/galacticraftcore/models/item/seat.json index bd4b276e66..e6ed2fd23f 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/seat.json +++ b/src/main/resources/assets/galacticraftcore/models/item/seat.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/buggymat.seat" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/sensor_glasses.json b/src/main/resources/assets/galacticraftcore/models/item/sensor_glasses.json index bb406352e5..bd7c8ff5ff 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/sensor_glasses.json +++ b/src/main/resources/assets/galacticraftcore/models/item/sensor_glasses.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/sensorGlasses" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/sensor_lens.json b/src/main/resources/assets/galacticraftcore/models/item/sensor_lens.json index 4d9a8ed240..6e6ad1d0f0 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/sensor_lens.json +++ b/src/main/resources/assets/galacticraftcore/models/item/sensor_lens.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/sensorLens" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/solar_module_1.json b/src/main/resources/assets/galacticraftcore/models/item/solar_module_1.json index 1670b1aeda..63cec542f8 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/solar_module_1.json +++ b/src/main/resources/assets/galacticraftcore/models/item/solar_module_1.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.solar_module_1" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/standard_wrench.json b/src/main/resources/assets/galacticraftcore/models/item/standard_wrench.json index eb4960282e..ca936ac5b0 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/standard_wrench.json +++ b/src/main/resources/assets/galacticraftcore/models/item/standard_wrench.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/standardWrench" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/steel_axe.json b/src/main/resources/assets/galacticraftcore/models/item/steel_axe.json index f85dc91195..2b6ce18182 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/steel_axe.json +++ b/src/main/resources/assets/galacticraftcore/models/item/steel_axe.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/steel_axe" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/steel_boots.json b/src/main/resources/assets/galacticraftcore/models/item/steel_boots.json index 601ab7b0e3..4b8d436765 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/steel_boots.json +++ b/src/main/resources/assets/galacticraftcore/models/item/steel_boots.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/steel_boots" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/steel_chestplate.json b/src/main/resources/assets/galacticraftcore/models/item/steel_chestplate.json index 28105c7c94..221c529632 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/steel_chestplate.json +++ b/src/main/resources/assets/galacticraftcore/models/item/steel_chestplate.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/steel_chestplate" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/steel_helmet.json b/src/main/resources/assets/galacticraftcore/models/item/steel_helmet.json index 3c447398ab..977358cb78 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/steel_helmet.json +++ b/src/main/resources/assets/galacticraftcore/models/item/steel_helmet.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/steel_helmet" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/steel_hoe.json b/src/main/resources/assets/galacticraftcore/models/item/steel_hoe.json index 9a470c4405..3988ff25d1 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/steel_hoe.json +++ b/src/main/resources/assets/galacticraftcore/models/item/steel_hoe.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/steel_hoe" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/steel_leggings.json b/src/main/resources/assets/galacticraftcore/models/item/steel_leggings.json index 171262cdc8..c671f1b9ae 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/steel_leggings.json +++ b/src/main/resources/assets/galacticraftcore/models/item/steel_leggings.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/steel_leggings" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/steel_pickaxe.json b/src/main/resources/assets/galacticraftcore/models/item/steel_pickaxe.json index 754cbe4543..ba5997cb40 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/steel_pickaxe.json +++ b/src/main/resources/assets/galacticraftcore/models/item/steel_pickaxe.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/steel_pickaxe" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/steel_pole.json b/src/main/resources/assets/galacticraftcore/models/item/steel_pole.json index 20762ed4e7..33566e16b9 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/steel_pole.json +++ b/src/main/resources/assets/galacticraftcore/models/item/steel_pole.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/steelPole" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/steel_shovel.json b/src/main/resources/assets/galacticraftcore/models/item/steel_shovel.json index 4aab3a98a4..8749583811 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/steel_shovel.json +++ b/src/main/resources/assets/galacticraftcore/models/item/steel_shovel.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/steel_shovel" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/steel_sword.json b/src/main/resources/assets/galacticraftcore/models/item/steel_sword.json index e44884cffc..d34ed8bc68 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/steel_sword.json +++ b/src/main/resources/assets/galacticraftcore/models/item/steel_sword.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/steel_sword" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/storage.json b/src/main/resources/assets/galacticraftcore/models/item/storage.json index 2b32ff7cf7..21ba086a35 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/storage.json +++ b/src/main/resources/assets/galacticraftcore/models/item/storage.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/buggymat.storage" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/tier1booster.json b/src/main/resources/assets/galacticraftcore/models/item/tier1booster.json index a9c289b705..47f326fef2 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/tier1booster.json +++ b/src/main/resources/assets/galacticraftcore/models/item/tier1booster.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/engine.tier1booster" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/unlit_torch.json b/src/main/resources/assets/galacticraftcore/models/item/unlit_torch.json index 97bd27c2e4..8bc1a2c669 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/unlit_torch.json +++ b/src/main/resources/assets/galacticraftcore/models/item/unlit_torch.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "minecraft:blocks/torch_on" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/unlit_torch_lit.json b/src/main/resources/assets/galacticraftcore/models/item/unlit_torch_lit.json index 97bd27c2e4..8bc1a2c669 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/unlit_torch_lit.json +++ b/src/main/resources/assets/galacticraftcore/models/item/unlit_torch_lit.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "minecraft:blocks/torch_on" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/unlit_torch_stone.json b/src/main/resources/assets/galacticraftcore/models/item/unlit_torch_stone.json index 3bd4f92d0a..c009720ce4 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/unlit_torch_stone.json +++ b/src/main/resources/assets/galacticraftcore/models/item/unlit_torch_stone.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:blocks/unlitTorchLit_Stone" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/unlit_torch_stone_lit.json b/src/main/resources/assets/galacticraftcore/models/item/unlit_torch_stone_lit.json index 3bd4f92d0a..c009720ce4 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/unlit_torch_stone_lit.json +++ b/src/main/resources/assets/galacticraftcore/models/item/unlit_torch_stone_lit.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:blocks/unlitTorchLit_Stone" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/wafer_advanced.json b/src/main/resources/assets/galacticraftcore/models/item/wafer_advanced.json index c5a02c5a8b..17de946016 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/wafer_advanced.json +++ b/src/main/resources/assets/galacticraftcore/models/item/wafer_advanced.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.waferAdvanced" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/wafer_basic.json b/src/main/resources/assets/galacticraftcore/models/item/wafer_basic.json index c5acd857d6..592d1000bf 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/wafer_basic.json +++ b/src/main/resources/assets/galacticraftcore/models/item/wafer_basic.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.waferBasic" }, diff --git a/src/main/resources/assets/galacticraftcore/models/item/wafer_solar.json b/src/main/resources/assets/galacticraftcore/models/item/wafer_solar.json index f06e71df08..5a70d5585c 100644 --- a/src/main/resources/assets/galacticraftcore/models/item/wafer_solar.json +++ b/src/main/resources/assets/galacticraftcore/models/item/wafer_solar.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/basicItem.waferSolar" }, diff --git a/src/main/resources/assets/galacticraftcore/sounds.json b/src/main/resources/assets/galacticraftcore/sounds.json index 4a6515d779..b863464c8d 100644 --- a/src/main/resources/assets/galacticraftcore/sounds.json +++ b/src/main/resources/assets/galacticraftcore/sounds.json @@ -3,38 +3,38 @@ "category": "music", "sounds": [ { - "name": "music/mars_JC", + "name": "galacticraftcore:music/mars_JC", "stream": true }, { - "name": "music/mimas_JC", + "name": "galacticraftcore:music/mimas_JC", "stream": true }, { - "name": "music/orbit_JC", + "name": "galacticraftcore:music/orbit_JC", "stream": true }, { - "name": "music/scary_ambience", + "name": "galacticraftcore:music/scary_ambience", "stream": true }, { - "name": "music/spacerace_JC", + "name": "galacticraftcore:music/spacerace_JC", "stream": true } ] }, - "player.unlockchest": { "category":"master", "sounds":[{"name": "player/unlockchest", "stream": false }]}, - "player.parachute": { "category":"master", "sounds":[{"name": "player/parachute", "stream": false }]}, - "player.openairlock": { "category":"master", "sounds":[{"name": "player/openairlock", "stream": false }]}, - "player.closeairlock": { "category":"master", "sounds":[{"name": "player/closeairlock", "stream": false }]}, - "entity.slime_death": { "category":"master", "sounds":[{"name": "entity/slime_death", "stream": false }]}, - "entity.ooh": { "category":"master", "sounds":[{"name": "entity/ooh", "stream": false }]}, - "entity.ouch": { "category":"master", "sounds":[{"name": "entity/ouch", "stream": false }]}, - "entity.bosslaugh": { "category":"master", "sounds":[{"name": "entity/bosslaugh", "stream": false }]}, - "entity.bossdeath": { "category":"master", "sounds":[{"name": "entity/bossdeath", "stream": false }]}, - "entity.astrominer": { "category":"master", "sounds":[{"name": "entity/astrominer", "stream": false }]}, - "ambience.singledrip": { "category":"master", "sounds":[ "ambience/singledrip1", "ambience/singledrip2", "ambience/singledrip3", "ambience/singledrip4", "ambience/singledrip5", "ambience/singledrip6", "ambience/singledrip7", "ambience/singledrip8" ]}, - "ambience.scaryscape": { "category":"master", "sounds":[{"name": "ambience/scaryscape", "stream": false }]}, - "shuttle.shuttle": { "category":"master", "sounds":[{"name": "shuttle/shuttle", "stream": false }]} + "player.unlockchest": { "category":"master", "sounds":[{"name": "galacticraftcore:player/unlockchest", "stream": false }]}, + "player.parachute": { "category":"master", "sounds":[{"name": "galacticraftcore:player/parachute", "stream": false }]}, + "player.openairlock": { "category":"master", "sounds":[{"name": "galacticraftcore:player/openairlock", "stream": false }]}, + "player.closeairlock": { "category":"master", "sounds":[{"name": "galacticraftcore:player/closeairlock", "stream": false }]}, + "entity.slime_death": { "category":"master", "sounds":[{"name": "galacticraftcore:entity/slime_death", "stream": false }]}, + "entity.ooh": { "category":"master", "sounds":[{"name": "galacticraftcore:entity/ooh", "stream": false }]}, + "entity.ouch": { "category":"master", "sounds":[{"name": "galacticraftcore:entity/ouch", "stream": false }]}, + "entity.bosslaugh": { "category":"master", "sounds":[{"name": "galacticraftcore:entity/bosslaugh", "stream": false }]}, + "entity.bossdeath": { "category":"master", "sounds":[{"name": "galacticraftcore:entity/bossdeath", "stream": false }]}, + "entity.astrominer": { "category":"master", "sounds":[{"name": "galacticraftcore:entity/astrominer", "stream": false }]}, + "ambience.singledrip": { "category":"master", "sounds":[ "galacticraftcore:ambience/singledrip1", "galacticraftcore:ambience/singledrip2", "galacticraftcore:ambience/singledrip3", "galacticraftcore:ambience/singledrip4", "galacticraftcore:ambience/singledrip5", "galacticraftcore:ambience/singledrip6", "galacticraftcore:ambience/singledrip7", "galacticraftcore:ambience/singledrip8" ]}, + "ambience.scaryscape": { "category":"master", "sounds":[{"name": "galacticraftcore:ambience/scaryscape", "stream": false }]}, + "shuttle.shuttle": { "category":"master", "sounds":[{"name": "galacticraftcore:shuttle/shuttle", "stream": false }]} } diff --git a/src/main/resources/assets/galacticraftplanets/models/item/astro_miner.json b/src/main/resources/assets/galacticraftplanets/models/item/astro_miner.json index dcae279229..bf582ff603 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/astro_miner.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/astro_miner.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/atmosphericValve" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/atmospheric_valve.json b/src/main/resources/assets/galacticraftplanets/models/item/atmospheric_valve.json index dcae279229..bf582ff603 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/atmospheric_valve.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/atmospheric_valve.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/atmosphericValve" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/beam_core.json b/src/main/resources/assets/galacticraftplanets/models/item/beam_core.json index 8d41febbc7..ad5ba82fcf 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/beam_core.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/beam_core.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/beamCore" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/beam_receiver.json b/src/main/resources/assets/galacticraftplanets/models/item/beam_receiver.json index adaee54411..b94351157f 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/beam_receiver.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/beam_receiver.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:blocks/beamReceiver" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/beam_reflector.json b/src/main/resources/assets/galacticraftplanets/models/item/beam_reflector.json index 80c3be05b2..7ab82010f1 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/beam_reflector.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/beam_reflector.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:blocks/beamReflector" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/bucket_sludge.json b/src/main/resources/assets/galacticraftplanets/models/item/bucket_sludge.json index 2d2a2cfba3..899d25fe41 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/bucket_sludge.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/bucket_sludge.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/bucketSludge" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/bucket_sulphuric_acid.json b/src/main/resources/assets/galacticraftplanets/models/item/bucket_sulphuric_acid.json index 767dbefb04..e55644054e 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/bucket_sulphuric_acid.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/bucket_sulphuric_acid.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/bucket_sulphuric_acid" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2.json b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2.json index 1d4cbbd792..4380e9c918 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/canister_partial_ln2_0" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_1.json b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_1.json index 137d0e2c32..b0e67a9c7f 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_1.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_1.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/canister_partial_ln2_1" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_2.json b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_2.json index 1e680e87e0..c2348f3e8c 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_2.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/canister_partial_ln2_2" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_3.json b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_3.json index d44dee6e9a..5f9a765155 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_3.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_3.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/canister_partial_ln2_3" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_4.json b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_4.json index 60600e2e35..8971445616 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_4.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_4.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/canister_partial_ln2_4" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_5.json b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_5.json index eff0bbbe53..9b010ab7cd 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_5.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_5.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/canister_partial_ln2_5" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_6.json b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_6.json index 712768306d..c6896d53c7 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_6.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_ln2_6.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/canister_partial_ln2_6" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox.json b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox.json index ef34c1c731..b7061107d9 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/canister_partial_lox_0" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_1.json b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_1.json index d4ff52ade5..061787e2ab 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_1.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_1.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/canister_partial_lox_1" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_2.json b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_2.json index 21a9460551..a34c8a098f 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_2.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/canister_partial_lox_2" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_3.json b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_3.json index fdb2f3b03d..e9f3b649ab 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_3.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_3.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/canister_partial_lox_3" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_4.json b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_4.json index 4b2033b8f3..a8dc6bcfc4 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_4.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_4.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/canister_partial_lox_4" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_5.json b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_5.json index 2091edc3c3..7ed5f960fb 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_5.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_5.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/canister_partial_lox_5" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_6.json b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_6.json index b9bdc9f70a..4a6694588f 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_6.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/canister_partial_lox_6.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/canister_partial_lox_6" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/carbon_fragments.json b/src/main/resources/assets/galacticraftplanets/models/item/carbon_fragments.json index 8d82edbb44..f9250178b0 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/carbon_fragments.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/carbon_fragments.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/carbonFragments" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/compressed_desh.json b/src/main/resources/assets/galacticraftplanets/models/item/compressed_desh.json index 442f887f03..c0cecb78c3 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/compressed_desh.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/compressed_desh.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/compressedDesh" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/compressed_titanium.json b/src/main/resources/assets/galacticraftplanets/models/item/compressed_titanium.json index 1499414e9d..8a434f8658 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/compressed_titanium.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/compressed_titanium.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/compressedTitanium" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/desh_axe.json b/src/main/resources/assets/galacticraftplanets/models/item/desh_axe.json index f85dc91195..2b6ce18182 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/desh_axe.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/desh_axe.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/steel_axe" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/desh_boots.json b/src/main/resources/assets/galacticraftplanets/models/item/desh_boots.json index 4934ca1190..f998fb4ada 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/desh_boots.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/desh_boots.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/deshBoots" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/desh_chestplate.json b/src/main/resources/assets/galacticraftplanets/models/item/desh_chestplate.json index e28cf47d76..e693d8cc5c 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/desh_chestplate.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/desh_chestplate.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/deshChestplate" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/desh_helmet.json b/src/main/resources/assets/galacticraftplanets/models/item/desh_helmet.json index 55cb2daec7..3e2b1c8cba 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/desh_helmet.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/desh_helmet.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/deshHelmet" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/desh_hoe.json b/src/main/resources/assets/galacticraftplanets/models/item/desh_hoe.json index 728b072ee9..29ba46f7f8 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/desh_hoe.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/desh_hoe.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/deshHoe" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/desh_leggings.json b/src/main/resources/assets/galacticraftplanets/models/item/desh_leggings.json index 171262cdc8..c671f1b9ae 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/desh_leggings.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/desh_leggings.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/steel_leggings" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/desh_pick.json b/src/main/resources/assets/galacticraftplanets/models/item/desh_pick.json index 4519de29ca..89b90a53da 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/desh_pick.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/desh_pick.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/deshPick" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/desh_pick_slime.json b/src/main/resources/assets/galacticraftplanets/models/item/desh_pick_slime.json index 5fbe472e1d..8f003dabdd 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/desh_pick_slime.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/desh_pick_slime.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/deshPickSlime" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/desh_spade.json b/src/main/resources/assets/galacticraftplanets/models/item/desh_spade.json index b62c4ae86c..234723512d 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/desh_spade.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/desh_spade.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/deshSpade" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/desh_stick.json b/src/main/resources/assets/galacticraftplanets/models/item/desh_stick.json index 56e5d8e882..337647e2f4 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/desh_stick.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/desh_stick.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/deshStick" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/desh_sword.json b/src/main/resources/assets/galacticraftplanets/models/item/desh_sword.json index e44884cffc..d34ed8bc68 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/desh_sword.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/desh_sword.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftcore:items/steel_sword" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/engine_t2.json b/src/main/resources/assets/galacticraftplanets/models/item/engine_t2.json index bea6997f00..8085c165b6 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/engine_t2.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/engine_t2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/engineT2" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/fluid_manip.json b/src/main/resources/assets/galacticraftplanets/models/item/fluid_manip.json index f00118e2d8..0d96b11e5d 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/fluid_manip.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/fluid_manip.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/fluidManip" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/grapple.json b/src/main/resources/assets/galacticraftplanets/models/item/grapple.json index 049956f721..7266fa71ae 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/grapple.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/grapple.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:blocks/grapple" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/heavy_nose_cone.json b/src/main/resources/assets/galacticraftplanets/models/item/heavy_nose_cone.json index bdad651e7b..ffb7169830 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/heavy_nose_cone.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/heavy_nose_cone.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/heavyNoseConeJoined" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/ingot_desh.json b/src/main/resources/assets/galacticraftplanets/models/item/ingot_desh.json index 1adf5f66de..46723d6047 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/ingot_desh.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/ingot_desh.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/ingotDesh" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/ingot_lead.json b/src/main/resources/assets/galacticraftplanets/models/item/ingot_lead.json index f060d0cb8e..e977317db2 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/ingot_lead.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/ingot_lead.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/ingotLead" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/ingot_titanium.json b/src/main/resources/assets/galacticraftplanets/models/item/ingot_titanium.json index cfe4198b36..cf08aa8a22 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/ingot_titanium.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/ingot_titanium.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/ingotTitanium" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/item_basic_asteroids.json b/src/main/resources/assets/galacticraftplanets/models/item/item_basic_asteroids.json index 212e29014a..9bea340a29 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/item_basic_asteroids.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/item_basic_asteroids.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/reinforcedPlateT3" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial.json b/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial.json index aea8445540..80397805fe 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/methane_canister_partial_0" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_1.json b/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_1.json index cc445c7583..90695fa678 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_1.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_1.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/methane_canister_partial_1" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_2.json b/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_2.json index 0571e1a7e4..77edf96481 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_2.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/methane_canister_partial_2" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_3.json b/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_3.json index 84aaa4d305..6b2852c0b3 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_3.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_3.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/methane_canister_partial_3" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_4.json b/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_4.json index f74bc7518b..7ff9e6b449 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_4.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_4.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/methane_canister_partial_4" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_5.json b/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_5.json index 4500041c52..d0e7fbe8ac 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_5.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_5.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/methane_canister_partial_5" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_6.json b/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_6.json index 2ef996d56e..f8ad1ec16b 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_6.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/methane_canister_partial_6.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/methane_canister_partial_6" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/orion_drive.json b/src/main/resources/assets/galacticraftplanets/models/item/orion_drive.json index f7bb60606c..372eccda44 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/orion_drive.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/orion_drive.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/orionDrive" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/raw_desh.json b/src/main/resources/assets/galacticraftplanets/models/item/raw_desh.json index d03a32ade8..2e6ca00bc5 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/raw_desh.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/raw_desh.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/rawDesh" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/reinforced_plate_t2.json b/src/main/resources/assets/galacticraftplanets/models/item/reinforced_plate_t2.json index 64c61ee4a6..a39348917c 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/reinforced_plate_t2.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/reinforced_plate_t2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/reinforcedPlateT2" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/rocket_cargo.json b/src/main/resources/assets/galacticraftplanets/models/item/rocket_cargo.json index 8d82edbb44..f9250178b0 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/rocket_cargo.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/rocket_cargo.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/carbonFragments" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/rocket_fins_t2.json b/src/main/resources/assets/galacticraftplanets/models/item/rocket_fins_t2.json index bee176b256..3463393270 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/rocket_fins_t2.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/rocket_fins_t2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/rocketFinsT2" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/rocket_t2.json b/src/main/resources/assets/galacticraftplanets/models/item/rocket_t2.json index c318691342..625f82a872 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/rocket_t2.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/rocket_t2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/thermalBoots" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/rocket_t3.json b/src/main/resources/assets/galacticraftplanets/models/item/rocket_t3.json index c318691342..625f82a872 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/rocket_t3.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/rocket_t3.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/thermalBoots" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/schematic_astro_miner.json b/src/main/resources/assets/galacticraftplanets/models/item/schematic_astro_miner.json index 032505a35c..bb87764612 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/schematic_astro_miner.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/schematic_astro_miner.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/schematic_astro_miner" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/schematic_rocket_cargo.json b/src/main/resources/assets/galacticraftplanets/models/item/schematic_rocket_cargo.json index 79821ee8f5..2b44bd5785 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/schematic_rocket_cargo.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/schematic_rocket_cargo.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/schematic_rocket_cargo" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/schematic_rocket_t3.json b/src/main/resources/assets/galacticraftplanets/models/item/schematic_rocket_t3.json index da202dbd21..aeb56b4fe9 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/schematic_rocket_t3.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/schematic_rocket_t3.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/schematic_rocket_t3" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/shard_iron.json b/src/main/resources/assets/galacticraftplanets/models/item/shard_iron.json index 9beeb570c4..1a8ee91c55 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/shard_iron.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/shard_iron.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/shardIron" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/shard_titanium.json b/src/main/resources/assets/galacticraftplanets/models/item/shard_titanium.json index 10fb1cf5cd..276aaf5862 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/shard_titanium.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/shard_titanium.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/shardTitanium" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/shield_controller.json b/src/main/resources/assets/galacticraftplanets/models/item/shield_controller.json index afd8f0a0f0..9e7410b83b 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/shield_controller.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/shield_controller.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/shield_controller" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/slimeling_cargo.json b/src/main/resources/assets/galacticraftplanets/models/item/slimeling_cargo.json index d4ad9c6794..8812b37d74 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/slimeling_cargo.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/slimeling_cargo.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/slimelingCargo" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/telepad_short.json b/src/main/resources/assets/galacticraftplanets/models/item/telepad_short.json index 90aba5ec36..11d8ed8476 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/telepad_short.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/telepad_short.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:blocks/telepadShort" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/thermal_boots.json b/src/main/resources/assets/galacticraftplanets/models/item/thermal_boots.json index c318691342..625f82a872 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/thermal_boots.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/thermal_boots.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/thermalBoots" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/thermal_boots_t2.json b/src/main/resources/assets/galacticraftplanets/models/item/thermal_boots_t2.json index b40f98447c..09f5128901 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/thermal_boots_t2.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/thermal_boots_t2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/thermal_boots_t2" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/thermal_chestplate.json b/src/main/resources/assets/galacticraftplanets/models/item/thermal_chestplate.json index 8c4ab62cf0..fb50241998 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/thermal_chestplate.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/thermal_chestplate.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/thermalChestplate" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/thermal_chestplate_t2.json b/src/main/resources/assets/galacticraftplanets/models/item/thermal_chestplate_t2.json index a618ebf1ea..2d0e27941d 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/thermal_chestplate_t2.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/thermal_chestplate_t2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/thermal_chestplate_t2" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/thermal_cloth.json b/src/main/resources/assets/galacticraftplanets/models/item/thermal_cloth.json index 677b1e9199..8efa22ff26 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/thermal_cloth.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/thermal_cloth.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/thermalCloth" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/thermal_helm_t2.json b/src/main/resources/assets/galacticraftplanets/models/item/thermal_helm_t2.json index 91a18d6b93..c2b2921494 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/thermal_helm_t2.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/thermal_helm_t2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/thermal_helm_t2" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/thermal_leggings.json b/src/main/resources/assets/galacticraftplanets/models/item/thermal_leggings.json index 7df57d43f4..361ed029ce 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/thermal_leggings.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/thermal_leggings.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/thermalLeggings" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/thermal_leggings_t2.json b/src/main/resources/assets/galacticraftplanets/models/item/thermal_leggings_t2.json index 17b9634911..9403a37bec 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/thermal_leggings_t2.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/thermal_leggings_t2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/thermal_leggings_t2" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/thermal_padding.json b/src/main/resources/assets/galacticraftplanets/models/item/thermal_padding.json index d6de02d54b..a7333fce49 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/thermal_padding.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/thermal_padding.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/thermalHelm" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/titanium_axe.json b/src/main/resources/assets/galacticraftplanets/models/item/titanium_axe.json index 0617176d02..3ebe429d21 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/titanium_axe.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/titanium_axe.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/titanium_axe" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/titanium_boots.json b/src/main/resources/assets/galacticraftplanets/models/item/titanium_boots.json index a86ad321e0..db2784cf10 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/titanium_boots.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/titanium_boots.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/titanium_boots" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/titanium_chestplate.json b/src/main/resources/assets/galacticraftplanets/models/item/titanium_chestplate.json index 740c1bbe2e..b3de064d7c 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/titanium_chestplate.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/titanium_chestplate.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/titanium_chestplate" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/titanium_helmet.json b/src/main/resources/assets/galacticraftplanets/models/item/titanium_helmet.json index 794721a9c7..b9bd54fd08 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/titanium_helmet.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/titanium_helmet.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/titanium_helmet" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/titanium_hoe.json b/src/main/resources/assets/galacticraftplanets/models/item/titanium_hoe.json index b9eb005bcc..4041ec1cb1 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/titanium_hoe.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/titanium_hoe.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/titanium_hoe" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/titanium_leggings.json b/src/main/resources/assets/galacticraftplanets/models/item/titanium_leggings.json index 1c6f151c48..d51aef72cd 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/titanium_leggings.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/titanium_leggings.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/titanium_leggings" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/titanium_pickaxe.json b/src/main/resources/assets/galacticraftplanets/models/item/titanium_pickaxe.json index 907693185e..dd6766315d 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/titanium_pickaxe.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/titanium_pickaxe.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/titanium_pickaxe" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/titanium_shovel.json b/src/main/resources/assets/galacticraftplanets/models/item/titanium_shovel.json index acd2588e8a..2490306186 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/titanium_shovel.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/titanium_shovel.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/titanium_shovel" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/titanium_sword.json b/src/main/resources/assets/galacticraftplanets/models/item/titanium_sword.json index 724ccc98a0..503aad5a4a 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/titanium_sword.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/titanium_sword.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/titanium_sword" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/vine_0.json b/src/main/resources/assets/galacticraftplanets/models/item/vine_0.json index c99c91ce36..7e3af3c6d4 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/vine_0.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/vine_0.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:blocks/vine_0" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/vine_1.json b/src/main/resources/assets/galacticraftplanets/models/item/vine_1.json index c99c91ce36..7e3af3c6d4 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/vine_1.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/vine_1.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:blocks/vine_0" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/vine_2.json b/src/main/resources/assets/galacticraftplanets/models/item/vine_2.json index c99c91ce36..7e3af3c6d4 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/vine_2.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/vine_2.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:blocks/vine_0" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/volcanic_pickaxe.json b/src/main/resources/assets/galacticraftplanets/models/item/volcanic_pickaxe.json index c2c4006b96..9cdcdc9ea6 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/volcanic_pickaxe.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/volcanic_pickaxe.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:items/volcanic_pickaxe" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/web_torch_0.json b/src/main/resources/assets/galacticraftplanets/models/item/web_torch_0.json index 72a4fdae2d..9e8a60b7d4 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/web_torch_0.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/web_torch_0.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:blocks/web_torch_0" }, diff --git a/src/main/resources/assets/galacticraftplanets/models/item/web_torch_1.json b/src/main/resources/assets/galacticraftplanets/models/item/web_torch_1.json index 935573dee8..7f44c6c139 100644 --- a/src/main/resources/assets/galacticraftplanets/models/item/web_torch_1.json +++ b/src/main/resources/assets/galacticraftplanets/models/item/web_torch_1.json @@ -1,5 +1,5 @@ { - "parent": "builtin/generated", + "parent": "item/generated", "textures": { "layer0": "galacticraftplanets:blocks/web_torch_1" }, From ea33f09676fe4bea388007e78c16271f6a29242a Mon Sep 17 00:00:00 2001 From: Mitch Date: Mon, 20 Mar 2017 20:25:49 -0400 Subject: [PATCH 013/535] Fix startup error --- .../java/micdoodle8/mods/galacticraft/core/util/MapGen.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java index 8b63f2f0a1..ff59a3bcfc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/MapGen.java @@ -516,7 +516,7 @@ public Biome[] getBiomesForGeneration(Biome[] biomes, int x, int z, int width, i int[] aint = this.genBiomes.getInts(x, z, width, height); int size = width * height; - if (biomes.length < size) + if (biomes == null || biomes.length < size) { biomes = new Biome[size]; } From bdae2639b250ef27fcec9395727bc6f7628b680c Mon Sep 17 00:00:00 2001 From: Mitch Date: Mon, 20 Mar 2017 21:38:25 -0400 Subject: [PATCH 014/535] Update build.gradle --- build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index e9ca406f2f..d12b1a70c0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -def mcVersion = "1.8.9" +def mcVersion = "1.10.2" def versionMajor = 4 def versionMinor = 0 def versionRev = 0 @@ -13,7 +13,7 @@ buildscript { } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' + classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT' } } apply plugin: 'net.minecraftforge.gradle.forge' @@ -39,7 +39,7 @@ sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 minecraft { - version = "1.8.9-11.15.1.1764" + version = "1.10.2-12.18.3.2239" runDir = "run" // the mappings can be changed at any time, and must be in the following format. @@ -47,7 +47,7 @@ minecraft { // stable_# stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not allways work. // simply re-run your setup task after changing the mappings to update your workspace. - mappings = "stable_20" + mappings = "snapshot_20161111" makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. } From ceaf047b9eb9b6c523a0cac150f56d14efed1d44 Mon Sep 17 00:00:00 2001 From: Mitch Date: Mon, 20 Mar 2017 23:08:45 -0400 Subject: [PATCH 015/535] Update dependency access transformers --- dependencies/main/resources/ccc_at.cfg | 11 +++-- dependencies/main/resources/cccmod.info | 11 ----- dependencies/main/resources/ccl_at.cfg | 55 ++++++++++++++++++++++--- dependencies/main/resources/nei_at.cfg | 51 +++++++++++++++++------ dependencies/main/resources/neimod.info | 19 --------- 5 files changed, 94 insertions(+), 53 deletions(-) delete mode 100644 dependencies/main/resources/cccmod.info delete mode 100644 dependencies/main/resources/neimod.info diff --git a/dependencies/main/resources/ccc_at.cfg b/dependencies/main/resources/ccc_at.cfg index b624548a25..b55452071d 100644 --- a/dependencies/main/resources/ccc_at.cfg +++ b/dependencies/main/resources/ccc_at.cfg @@ -1,6 +1,9 @@ # CodeChickenCore Access Transformer -public net.minecraft.client.renderer.texture.TextureMap field_94252_e #mapUploadedSprites +public net.minecraft.client.renderer.texture.TextureMap field_94252_e # mapUploadedSprites + public net.minecraft.server.management.PlayerProfileCache$ProfileEntry -public net.minecraft.server.management.PlayerProfileCache field_152661_c #profileCacheMap -public net.minecraft.util.RegistryNamespaced field_148759_a #underlyingIntegerMap -public net.minecraft.util.RegistrySimple field_82596_a #registryObjects +public net.minecraft.server.management.PlayerProfileCache field_152661_c # usernameToProfileEntryMap + +public net.minecraft.util.registry.RegistryNamespaced field_148759_a # underlyingIntegerMap +public net.minecraft.util.registry.RegistrySimple field_82596_a # registryObjects +public net.minecraft.item.Item field_179220_a # BLOCK_TO_ITEM diff --git a/dependencies/main/resources/cccmod.info b/dependencies/main/resources/cccmod.info deleted file mode 100644 index d34e942255..0000000000 --- a/dependencies/main/resources/cccmod.info +++ /dev/null @@ -1,11 +0,0 @@ -[ -{ - "modid": "CodeChickenCore", - "name": "CodeChicken Core", - "description": "Base common code for all chickenbones mods.", - "version": "${version}", - "mcversion": "${mc_version}", - "url": "http://www.minecraftforum.net/topic/909223", - "authorList": [ "ChickenBones" ] -} -] \ No newline at end of file diff --git a/dependencies/main/resources/ccl_at.cfg b/dependencies/main/resources/ccl_at.cfg index a29283738b..b4914b9b6b 100644 --- a/dependencies/main/resources/ccl_at.cfg +++ b/dependencies/main/resources/ccl_at.cfg @@ -1,7 +1,50 @@ # CodeChickenLib Access Transformer -public net.minecraft.world.chunk.Chunk field_150816_i #chunkTileEntityMap -public net.minecraft.world.chunk.Chunk field_76636_d #isChunkLoaded -public net.minecraft.server.management.PlayerManager func_72690_a(IIZ)Lnet/minecraft/server/management/PlayerManager$PlayerInstance; #getOrCreateChunkWatcher -public net.minecraft.server.management.PlayerManager$PlayerInstance -public net.minecraft.server.management.PlayerManager$PlayerInstance func_151251_a(Lnet/minecraft/network/Packet;)V #sendToAllPlayersWatchingChunk -public net.minecraft.server.management.PlayerManager$PlayerInstance field_73263_b #playersWatchingChunk +public net.minecraft.server.management.PlayerProfileCache$ProfileEntry +public net.minecraft.server.management.PlayerProfileCache field_152661_c # usernameToProfileEntryMap + +public net.minecraft.client.renderer.VertexBuffer field_179010_r # isDrawing +public net.minecraft.client.renderer.VertexBuffer func_181667_k()V # nextVertexFormatIndex +public net.minecraft.client.renderer.texture.TextureAtlasSprite func_130102_n()V # resetSprite +public net.minecraft.client.renderer.texture.TextureAtlasSprite func_147962_a([[IIII)[[I # getFrameTextureData +public net.minecraft.client.renderer.texture.TextureAtlasSprite field_110982_k # animationMetadata +public net.minecraft.client.renderer.texture.TextureAtlasSprite func_130099_d(I)V # allocateFrameTextureData +public net.minecraft.client.renderer.texture.TextureMap field_94252_e # mapUploadedSprites + +public net.minecraft.client.renderer.RenderItem field_175059_m # itemModelMesher +public net.minecraft.client.renderer.RenderItem field_175057_n # textureManager +public net.minecraft.client.renderer.RenderItem field_184395_f # itemColors +public net.minecraft.client.renderer.RenderItem func_175041_b()V # registerItems +public net.minecraft.client.renderer.RenderItem func_175048_a(Lnet/minecraft/item/Item;ILjava/lang/String;)V # registerItem +public net.minecraft.client.renderer.RenderItem func_184394_a(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/renderer/block/model/IBakedModel;Lnet/minecraft/client/renderer/block/model/ItemCameraTransforms$TransformType;Z)V # renderItemModel +public net.minecraft.client.renderer.RenderItem func_180452_a(IIZ)V # setupGuiTransform +public net.minecraft.client.renderer.RenderItem func_184390_a(Lnet/minecraft/item/ItemStack;IILnet/minecraft/client/renderer/block/model/IBakedModel;)V # renderItemModelIntoGUI + +public net.minecraft.util.math.RayTraceResult field_178783_e # blockPos + +#Block placement batcher stuff. +public net.minecraft.world.chunk.Chunk field_76652_q # storageArrays +public net.minecraft.world.chunk.Chunk field_76638_b # precipitationHeightMap +public net.minecraft.world.chunk.Chunk field_76634_f # heightMap + +public net.minecraft.world.chunk.Chunk func_76615_h(III)V # relightBlock +public net.minecraft.world.chunk.Chunk func_76595_e(II)V # propagateSkylightOcclusion + +#GlStateManagerHelper stuff. +public net.minecraft.client.renderer.GlStateManager field_179160_a # alphaState +public net.minecraft.client.renderer.GlStateManager field_179158_b # lightingState +public net.minecraft.client.renderer.GlStateManager field_179157_e # blendState +public net.minecraft.client.renderer.GlStateManager field_179154_f # depthState +public net.minecraft.client.renderer.GlStateManager field_179167_h # cullState +public net.minecraft.client.renderer.GlStateManager field_179172_r # rescaleNormalState + +public net.minecraft.client.renderer.GlStateManager$AlphaState +public net.minecraft.client.renderer.GlStateManager$BooleanState +public net.minecraft.client.renderer.GlStateManager$BlendState +public net.minecraft.client.renderer.GlStateManager$DepthState +public net.minecraft.client.renderer.GlStateManager$CullState + +public net.minecraft.client.renderer.GlStateManager$BooleanState field_179201_b # currentState + +public net.minecraft.client.renderer.GlStateManager func_179107_e(I)V # cullFace + +public net.minecraft.client.Minecraft field_175618_aM # blockRenderDispatcher diff --git a/dependencies/main/resources/nei_at.cfg b/dependencies/main/resources/nei_at.cfg index 47581272ac..8f6103f624 100644 --- a/dependencies/main/resources/nei_at.cfg +++ b/dependencies/main/resources/nei_at.cfg @@ -1,14 +1,39 @@ # NEI Access Transformer configuration file -public net.minecraft.client.gui.inventory.GuiContainer field_146999_f #xSize -public net.minecraft.client.gui.inventory.GuiContainer field_147000_g #ySize -public net.minecraft.client.gui.inventory.GuiContainer field_147003_i #guiLeft -public net.minecraft.client.gui.inventory.GuiContainer field_147009_r #guiTop -public net.minecraft.client.gui.inventory.GuiContainer field_147007_t #spreading -public net.minecraft.client.gui.inventory.GuiContainer field_147008_s #spreadingSlots -public net.minecraft.client.gui.inventory.GuiContainer func_146975_c(II)Lnet/minecraft/inventory/Slot; #getSlotAtPosition - -public net.minecraft.client.gui.GuiScreen field_146292_n #buttonList -public net.minecraft.entity.EntityList field_75624_e #classToIDMapping -public net.minecraft.client.renderer.WorldRenderer field_179010_r #isDrawing -public net.minecraft.client.multiplayer.PlayerControllerMP field_78779_k #currentGameType -public net.minecraft.enchantment.Enchantment field_180311_a #enchantmentsList \ No newline at end of file +public net.minecraft.client.gui.inventory.GuiContainer field_146999_f # xSize +public net.minecraft.client.gui.inventory.GuiContainer field_147000_g # ySize +public net.minecraft.client.gui.inventory.GuiContainer field_147003_i # guiLeft +public net.minecraft.client.gui.inventory.GuiContainer field_147009_r # guiTop +public net.minecraft.client.gui.inventory.GuiContainer field_147007_t # dragSplitting +public net.minecraft.client.gui.inventory.GuiContainer field_147008_s # dragSplittingSlots +public net.minecraft.client.gui.inventory.GuiContainer func_146975_c(II)Lnet/minecraft/inventory/Slot; # getSlotAtPosition + +public net.minecraft.client.gui.GuiScreen field_146292_n # buttonList +public net.minecraft.entity.EntityList field_75624_e # classToIDMapping + +public net.minecraft.client.renderer.VertexBuffer field_179010_r # isDrawing +public net.minecraft.client.gui.inventory.GuiContainerCreative field_147062_A # searchField + +public net.minecraft.client.multiplayer.PlayerControllerMP field_78779_k # currentGameType +#public net.minecraft.enchantment.Enchantment field_180311_a # enchantmentsList + +#PotionHelper Hax +public net.minecraft.potion.PotionHelper field_185213_a # POTION_TYPE_CONVERSIONS +public net.minecraft.potion.PotionHelper field_185214_b # POTION_ITEM_CONVERSIONS +public net.minecraft.potion.PotionHelper field_185215_c # POTION_ITEMS + +public net.minecraft.enchantment.Enchantment field_185263_a # applicableEquipmentTypes + +public net.minecraft.potion.PotionHelper$ItemPredicateInstance # Actual class +public net.minecraft.potion.PotionHelper$ItemPredicateInstance field_185195_a # item +public net.minecraft.potion.PotionHelper$ItemPredicateInstance field_185196_b # meta + +public net.minecraft.potion.PotionHelper$MixPredicate # Actual class +public net.minecraft.potion.PotionHelper$MixPredicate field_185198_a # input +public net.minecraft.potion.PotionHelper$MixPredicate field_185199_b # reagent +public net.minecraft.potion.PotionHelper$MixPredicate field_185200_c # output + +#GuiContainerCreative Hax +public net.minecraft.client.gui.inventory.GuiContainerCreative$ContainerCreative + +public net.minecraft.client.gui.GuiRepair field_147091_w # nameField +public net.minecraft.client.gui.GuiTextField field_146226_p # isEnabled diff --git a/dependencies/main/resources/neimod.info b/dependencies/main/resources/neimod.info deleted file mode 100644 index bbb90b704d..0000000000 --- a/dependencies/main/resources/neimod.info +++ /dev/null @@ -1,19 +0,0 @@ -[ -{ - "modid": "NotEnoughItems", - "name": "Not Enough Items", - "version": "${version}", - "mcversion": "${mc_version}", - "description": "Recipe Viewer, Inventory Manager, Item Spawner, Cheats and more. - - - -Supporters: EmuCraft Team, Victor Zimmer, lexi85, Ace_Trainer_Tullius, Bacon_Donut, Sleement, Ninja 5tyl3", - "url": "http://www.minecraftforum.net/topic/909223", - "credits": "Alexandria - original idea", - "authorList": [ "ChickenBones" ], - "dependencies": [ - "CodeChickenCore" - ] -} -] \ No newline at end of file From 05fa5107c66d6c8ae6e86ac09aa697f5db83c827 Mon Sep 17 00:00:00 2001 From: Mitch Date: Thu, 23 Mar 2017 00:09:37 -0400 Subject: [PATCH 016/535] Change dimension type registration --- .../api/GalacticraftRegistry.java | 9 ++++++- .../galacticraft/core/GalacticraftCore.java | 24 ++++++++++++------- .../core/dimension/GCDimensions.java | 6 ++--- .../planets/GCPlanetDimensions.java | 12 +++------- .../planets/asteroids/AsteroidsModule.java | 4 +++- .../galacticraft/planets/mars/MarsModule.java | 3 +++ .../planets/venus/VenusModule.java | 4 ++++ 7 files changed, 40 insertions(+), 22 deletions(-) diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/GalacticraftRegistry.java b/src/main/java/micdoodle8/mods/galacticraft/api/GalacticraftRegistry.java index 320225c3d2..bce667c99b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/GalacticraftRegistry.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/GalacticraftRegistry.java @@ -208,8 +208,15 @@ public static List getDungeonLoot(int tier) */ public static DimensionType registerDimension(String name, String suffix, int id, Class provider, boolean keepLoaded) throws IllegalArgumentException { + for (DimensionType other : DimensionType.values()) + { + if (other.getId() == id) + { + return null; + } + } + DimensionType type = DimensionType.register(name, suffix, id, provider, keepLoaded); -// DimensionManager.registerDimension(id, type); GalacticraftRegistry.dimensionTypeIDs.add(id); return type; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java index 6d21191c76..1b4c19fa26 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java @@ -43,6 +43,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import net.minecraft.world.DimensionType; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldProviderSurface; import net.minecraft.world.biome.Biome; @@ -216,8 +217,16 @@ public void init(FMLInitializationEvent event) GalaxyRegistry.registerPlanet(GalacticraftCore.planetOverworld); GalaxyRegistry.registerMoon(GalacticraftCore.moonMoon); GalaxyRegistry.registerSatellite(GalacticraftCore.satelliteSpaceStation); - GalacticraftRegistry.registerDimension("Space Station", "_orbit", ConfigManagerCore.idDimensionOverworldOrbit, WorldProviderOverworldOrbit.class, false); - GalacticraftRegistry.registerDimension("Space Station", "_orbit", ConfigManagerCore.idDimensionOverworldOrbitStatic, WorldProviderOverworldOrbit.class, true); + GCDimensions.ORBIT = GalacticraftRegistry.registerDimension("Space Station", "_orbit", ConfigManagerCore.idDimensionOverworldOrbit, WorldProviderOverworldOrbit.class, false); + if (GCDimensions.ORBIT == null) + { + GCLog.severe("Failed to register space station dimension type with ID " + ConfigManagerCore.idDimensionOverworldOrbit); + } + GCDimensions.ORBIT_KEEPLOADED = GalacticraftRegistry.registerDimension("Space Station", "_orbit", ConfigManagerCore.idDimensionOverworldOrbitStatic, WorldProviderOverworldOrbit.class, true); + if (GCDimensions.ORBIT_KEEPLOADED == null) + { + GCLog.severe("Failed to register space station dimension type with ID " + ConfigManagerCore.idDimensionOverworldOrbitStatic); + } GalacticraftRegistry.registerTeleportType(WorldProviderSurface.class, new TeleportTypeOverworld()); GalacticraftRegistry.registerTeleportType(WorldProviderOverworldOrbit.class, new TeleportTypeOrbit()); GalacticraftRegistry.registerTeleportType(WorldProviderMoon.class, new TeleportTypeMoon()); @@ -350,18 +359,17 @@ public void postInit(FMLPostInitializationEvent event) { int id = Arrays.binarySearch(ConfigManagerCore.staticLoadDimensions, body.getDimensionID()); //It's important this is done in the same order as planets will be registered by WorldUtil.registerPlanet(); - try - { - GalacticraftRegistry.registerDimension(body.getLocalizedName(), body.getDimensionSuffix(), body.getDimensionID(), body.getWorldProvider(), body.getForceStaticLoad() || id < 0); - } - catch (IllegalArgumentException e) + DimensionType type = GalacticraftRegistry.registerDimension(body.getLocalizedName(), body.getDimensionSuffix(), body.getDimensionID(), body.getWorldProvider(), body.getForceStaticLoad() || id < 0); + if (type == null) { body.setUnreachable(); - e.printStackTrace(); + GCLog.severe("Tried to register dimension for body: " + body.getLocalizedName() + " hit conflict with ID " + body.getDimensionID()); } } } + GCDimensions.MOON = DimensionType.getById(ConfigManagerCore.idDimensionMoon); + CompatibilityManager.checkForCompatibleMods(); RecipeManagerGC.loadRecipes(); NetworkRegistry.INSTANCE.registerGuiHandler(GalacticraftCore.instance, new GuiHandler()); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/GCDimensions.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/GCDimensions.java index 1343d07473..5abf3570dd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/GCDimensions.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/GCDimensions.java @@ -1,10 +1,10 @@ package micdoodle8.mods.galacticraft.core.dimension; -import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import net.minecraft.world.DimensionType; public class GCDimensions { - public static DimensionType MOON = DimensionType.register("Moon", "moon", ConfigManagerCore.idDimensionMoon, WorldProviderMoon.class, false); - public static DimensionType ORBIT = DimensionType.register("Space Station", "orbit", ConfigManagerCore.idDimensionOverworldOrbit, WorldProviderOverworldOrbit.class, false); + public static DimensionType MOON; + public static DimensionType ORBIT; + public static DimensionType ORBIT_KEEPLOADED; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/GCPlanetDimensions.java b/src/main/java/micdoodle8/mods/galacticraft/planets/GCPlanetDimensions.java index a6372e53ac..14f443a8bf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/GCPlanetDimensions.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/GCPlanetDimensions.java @@ -1,16 +1,10 @@ package micdoodle8.mods.galacticraft.planets; -import micdoodle8.mods.galacticraft.planets.asteroids.ConfigManagerAsteroids; -import micdoodle8.mods.galacticraft.planets.asteroids.dimension.WorldProviderAsteroids; -import micdoodle8.mods.galacticraft.planets.mars.ConfigManagerMars; -import micdoodle8.mods.galacticraft.planets.mars.dimension.WorldProviderMars; -import micdoodle8.mods.galacticraft.planets.venus.ConfigManagerVenus; -import micdoodle8.mods.galacticraft.planets.venus.dimension.WorldProviderVenus; import net.minecraft.world.DimensionType; public class GCPlanetDimensions { - public static DimensionType ASTEROIDS = DimensionType.register("Asteroids", "asteroids", ConfigManagerAsteroids.dimensionIDAsteroids, WorldProviderAsteroids.class, false); - public static DimensionType MARS = DimensionType.register("Mars", "mars", ConfigManagerMars.dimensionIDMars, WorldProviderMars.class, false); - public static DimensionType VENUS = DimensionType.register("Venus", "venus", ConfigManagerVenus.dimensionIDVenus, WorldProviderVenus.class, false); + public static DimensionType ASTEROIDS; + public static DimensionType MARS; + public static DimensionType VENUS; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java index 764b7e1967..5d21c3473c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModule.java @@ -14,6 +14,7 @@ import micdoodle8.mods.galacticraft.core.recipe.NasaWorkbenchRecipe; import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.core.util.CreativeTabGC; +import micdoodle8.mods.galacticraft.planets.GCPlanetDimensions; import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import micdoodle8.mods.galacticraft.planets.GuiIdsPlanets; import micdoodle8.mods.galacticraft.planets.IPlanetsModule; @@ -42,6 +43,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.DimensionType; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraftforge.common.MinecraftForge; @@ -251,7 +253,7 @@ public void init(FMLInitializationEvent event) @Override public void postInit(FMLPostInitializationEvent event) { - + GCPlanetDimensions.ASTEROIDS = DimensionType.getById(ConfigManagerAsteroids.dimensionIDAsteroids); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java index 145d9cb86a..efb503b632 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModule.java @@ -17,6 +17,7 @@ import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.core.util.GCLog; +import micdoodle8.mods.galacticraft.planets.GCPlanetDimensions; import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import micdoodle8.mods.galacticraft.planets.GuiIdsPlanets; import micdoodle8.mods.galacticraft.planets.IPlanetsModule; @@ -45,6 +46,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.DimensionType; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraftforge.common.MinecraftForge; @@ -151,6 +153,7 @@ public void init(FMLInitializationEvent event) public void postInit(FMLPostInitializationEvent event) { RecipeManagerMars.loadRecipes(); + GCPlanetDimensions.MARS = DimensionType.getById(ConfigManagerMars.dimensionIDMars); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java index 8738a91567..70979ba5ac 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModule.java @@ -14,6 +14,7 @@ import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.galacticraft.core.util.GCLog; +import micdoodle8.mods.galacticraft.planets.GCPlanetDimensions; import micdoodle8.mods.galacticraft.planets.GalacticraftPlanets; import micdoodle8.mods.galacticraft.planets.GuiIdsPlanets; import micdoodle8.mods.galacticraft.planets.IPlanetsModule; @@ -41,6 +42,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.DimensionType; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraftforge.common.MinecraftForge; @@ -144,6 +146,8 @@ public void init(FMLInitializationEvent event) public void postInit(FMLPostInitializationEvent event) { RecipeManagerVenus.loadRecipes(); + + GCPlanetDimensions.VENUS = DimensionType.getById(ConfigManagerVenus.dimensionIDVenus); } @Override From 316969131d8ac942f89f711269d1f5b19d9fd686 Mon Sep 17 00:00:00 2001 From: Mitch Date: Thu, 23 Mar 2017 00:10:19 -0400 Subject: [PATCH 017/535] Fix error on evolved zombie spawn --- .../mods/galacticraft/core/entities/EntityEvolvedZombie.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedZombie.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedZombie.java index 781432fa7a..9cafb4980e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedZombie.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedZombie.java @@ -20,7 +20,7 @@ public class EntityEvolvedZombie extends EntityZombie implements IEntityBreathable, ITumblable { - private static final DataParameter SPIN_PITCH = EntityDataManager.createKey(EntityEvolvedSkeleton.class, DataSerializers.FLOAT); + private static final DataParameter SPIN_PITCH = EntityDataManager.createKey(EntityEvolvedZombie.class, DataSerializers.FLOAT); private int conversionTime = 0; private float tumbling = 0F; private float tumbleAngle = 0F; From 5b427f1cfdd57c9a3af78e2ebd4f15c52decdda6 Mon Sep 17 00:00:00 2001 From: Mitch Date: Thu, 23 Mar 2017 00:10:47 -0400 Subject: [PATCH 018/535] Fix inability to teleport to space stations. --- .../core/client/gui/screen/GuiCelestialSelection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiCelestialSelection.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiCelestialSelection.java index 48f53c99bd..ed042117c1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiCelestialSelection.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiCelestialSelection.java @@ -592,7 +592,7 @@ protected boolean teleportToSelectedBody() WorldProvider spacestation = WorldUtil.getProviderForDimensionClient(spacestationID); if (spacestation != null) { - dimension = WorldUtil.getDimensionName(spacestation); + dimension = "Space Station " + mapping; } else { From 5c855e7a2e82388cfddfc117d6f150942d9d8840 Mon Sep 17 00:00:00 2001 From: Mitch Date: Thu, 23 Mar 2017 00:28:20 -0400 Subject: [PATCH 019/535] Tweak custom item models --- .../client/render/item/ItemModelBuggy.java | 11 ++++++++++ .../client/render/item/ItemModelFlag.java | 11 ++++++++++ .../client/render/item/ItemModelRocket.java | 11 ++++++++++ .../render/item/ItemModelAstroMiner.java | 11 ++++++++++ .../render/item/ItemModelCargoRocket.java | 11 ++++++++++ .../client/render/item/ItemModelGrapple.java | 13 ++++++++++- .../client/render/item/ItemModelRocketT3.java | 11 ++++++++++ .../client/render/item/ItemModelTelepad.java | 22 +++++++++++++++++++ .../client/render/item/ItemModelRocketT2.java | 11 ++++++++++ 9 files changed, 111 insertions(+), 1 deletion(-) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java index ec6503e2b0..993de855f0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelBuggy.java @@ -86,6 +86,17 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } + if (cameraTransformType == TransformType.GROUND) + { + Matrix4f ret = new Matrix4f(); + ret.setIdentity(); + Matrix4f mul = new Matrix4f(); + mul.setIdentity(); + mul.setScale(0.1F); + ret.mul(mul); + return ret; + } + return null; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java index 046cea255d..0266cb61b4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelFlag.java @@ -110,6 +110,17 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } + if (cameraTransformType == TransformType.GROUND) + { + Matrix4f ret = new Matrix4f(); + ret.setIdentity(); + Matrix4f mul = new Matrix4f(); + mul.setIdentity(); + mul.setScale(0.1F); + ret.mul(mul); + return ret; + } + return null; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java index 3003d9c294..f804c054a8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/item/ItemModelRocket.java @@ -117,6 +117,17 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } + if (cameraTransformType == TransformType.GROUND) + { + Matrix4f ret = new Matrix4f(); + ret.setIdentity(); + Matrix4f mul = new Matrix4f(); + mul.setIdentity(); + mul.setScale(0.1F); + ret.mul(mul); + return ret; + } + return null; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java index 38ef393cf6..4f1818ded4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelAstroMiner.java @@ -120,6 +120,17 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } + if (cameraTransformType == TransformType.GROUND) + { + Matrix4f ret = new Matrix4f(); + ret.setIdentity(); + Matrix4f mul = new Matrix4f(); + mul.setIdentity(); + mul.setScale(0.1F); + ret.mul(mul); + return ret; + } + return null; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java index b61c0a0416..fcb6efd78d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelCargoRocket.java @@ -120,6 +120,17 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } + if (cameraTransformType == TransformType.GROUND) + { + Matrix4f ret = new Matrix4f(); + ret.setIdentity(); + Matrix4f mul = new Matrix4f(); + mul.setIdentity(); + mul.setScale(0.1F); + ret.mul(mul); + return ret; + } + return null; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java index b024ff8101..645be41fc1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelGrapple.java @@ -49,7 +49,7 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) mul.setScale(0.4F); ret.mul(mul); mul.setIdentity(); - mul.setTranslation(new Vector3f(0.3F, -0.1F, 0.0F)); + mul.setTranslation(new Vector3f(0.3F, -0.1F, 0.8F)); ret.mul(mul); mul.setIdentity(); mul.rotY((float) (-Math.PI / 2.0F)); @@ -80,6 +80,17 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } + if (cameraTransformType == TransformType.GROUND) + { + Matrix4f ret = new Matrix4f(); + ret.setIdentity(); + Matrix4f mul = new Matrix4f(); + mul.setIdentity(); + mul.setScale(0.4F); + ret.mul(mul); + return ret; + } + return null; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java index 7bf3ecb1c2..794277a91d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelRocketT3.java @@ -114,6 +114,17 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } + if (cameraTransformType == TransformType.GROUND) + { + Matrix4f ret = new Matrix4f(); + ret.setIdentity(); + Matrix4f mul = new Matrix4f(); + mul.setIdentity(); + mul.setScale(0.1F); + ret.mul(mul); + return ret; + } + return null; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelTelepad.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelTelepad.java index 9a41db733d..fcf59e533b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelTelepad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/item/ItemModelTelepad.java @@ -37,6 +37,28 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } + if (cameraTransformType == TransformType.THIRD_PERSON_RIGHT_HAND) + { + Matrix4f ret = new Matrix4f(); + ret.setIdentity(); + Matrix4f mul = new Matrix4f(); + mul.setIdentity(); + mul.setScale(0.17F); + ret.mul(mul); + return ret; + } + + if (cameraTransformType == TransformType.GROUND) + { + Matrix4f ret = new Matrix4f(); + ret.setIdentity(); + Matrix4f mul = new Matrix4f(); + mul.setIdentity(); + mul.setScale(0.1F); + ret.mul(mul); + return ret; + } + return null; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java index dd34f60bda..4c59368171 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/item/ItemModelRocketT2.java @@ -114,6 +114,17 @@ protected Matrix4f getTransformForPerspective(TransformType cameraTransformType) return ret; } + if (cameraTransformType == TransformType.GROUND) + { + Matrix4f ret = new Matrix4f(); + ret.setIdentity(); + Matrix4f mul = new Matrix4f(); + mul.setIdentity(); + mul.setScale(0.1F); + ret.mul(mul); + return ret; + } + return null; } } From fbcb009c21f07897034335c7648652ecab929552 Mon Sep 17 00:00:00 2001 From: micdoodle8 Date: Sun, 26 Mar 2017 15:04:13 -0400 Subject: [PATCH 020/535] Begin 1.11.2 update --- .../lib/inventory/InventoryUtils.java | 2 +- .../java/codechicken/lib/util/ItemUtils.java | 4 +- .../api/prefab/entity/EntityAutoRocket.java | 50 ++++---- .../api/recipe/CompressorRecipes.java | 2 +- .../api/recipe/SpaceStationRecipe.java | 12 +- .../galacticraft/api/vector/BlockVec3.java | 2 +- .../galacticraft/core/GalacticraftCore.java | 9 +- .../galacticraft/core/TransformerHooks.java | 6 +- .../core/blocks/BlockAdvanced.java | 4 +- .../core/blocks/BlockAdvancedTile.java | 10 +- .../core/blocks/BlockAirLockFrame.java | 8 +- .../core/blocks/BlockAirLockWall.java | 2 +- .../core/blocks/BlockAluminumWire.java | 11 +- .../galacticraft/core/blocks/BlockBasic.java | 3 +- .../core/blocks/BlockBasicMoon.java | 5 +- .../core/blocks/BlockBossSpawner.java | 2 +- .../core/blocks/BlockBreathableAir.java | 6 - .../core/blocks/BlockBrightAir.java | 6 - .../core/blocks/BlockBrightBreathableAir.java | 6 - .../core/blocks/BlockBrightLamp.java | 16 ++- .../core/blocks/BlockCargoLoader.java | 9 +- .../galacticraft/core/blocks/BlockCheese.java | 4 +- .../galacticraft/core/blocks/BlockDish.java | 2 +- .../core/blocks/BlockEnclosed.java | 33 +++--- .../core/blocks/BlockFluidGC.java | 4 +- .../core/blocks/BlockFluidPipe.java | 12 +- .../core/blocks/BlockFluidTank.java | 8 +- .../core/blocks/BlockFuelLoader.java | 2 +- .../core/blocks/BlockGlowstoneTorch.java | 5 +- .../core/blocks/BlockLandingPad.java | 5 +- .../core/blocks/BlockLandingPadFull.java | 2 +- .../core/blocks/BlockMachine.java | 13 +- .../core/blocks/BlockMachine2.java | 15 +-- .../core/blocks/BlockMachine3.java | 7 +- .../core/blocks/BlockMachineTiered.java | 13 +- .../galacticraft/core/blocks/BlockMulti.java | 2 +- .../core/blocks/BlockNasaWorkbench.java | 5 +- .../core/blocks/BlockOxygenCollector.java | 2 +- .../core/blocks/BlockOxygenCompressor.java | 9 +- .../core/blocks/BlockOxygenDistributor.java | 2 +- .../core/blocks/BlockOxygenSealer.java | 2 +- .../core/blocks/BlockParaChest.java | 12 +- .../core/blocks/BlockRefinery.java | 12 +- .../galacticraft/core/blocks/BlockScreen.java | 2 +- .../galacticraft/core/blocks/BlockSlabGC.java | 3 +- .../galacticraft/core/blocks/BlockSolar.java | 9 +- .../core/blocks/BlockSpaceGlass.java | 9 +- .../core/blocks/BlockSpinThruster.java | 2 +- .../core/blocks/BlockTelemetry.java | 10 +- .../core/blocks/BlockTier1TreasureChest.java | 8 +- .../core/blocks/BlockTransmitter.java | 2 +- .../core/blocks/BlockUnlitTorch.java | 9 +- .../galacticraft/core/blocks/BlockWallGC.java | 5 +- .../core/client/EventHandlerClient.java | 2 +- .../core/client/SkyProviderMoon.java | 2 +- .../core/client/SkyProviderOverworld.java | 2 +- .../core/client/fx/EffectHandler.java | 18 +-- .../core/client/fx/ParticleLanderFlame.java | 6 +- .../core/client/fx/ParticleLaunchFlame.java | 6 +- .../core/client/fx/ParticleLaunchSmoke.java | 2 +- .../core/client/fx/ParticleOilDrip.java | 8 +- .../core/client/fx/ParticleSmokeSmall.java | 2 +- .../core/client/fx/ParticleSparks.java | 4 +- .../core/client/gui/GuiHandler.java | 2 +- .../gui/container/GuiAirLockController.java | 14 +-- .../gui/container/GuiCargoUnloader.java | 2 +- .../gui/container/GuiOxygenDistributor.java | 2 +- .../client/gui/container/GuiOxygenSealer.java | 2 +- .../client/gui/container/GuiRefinery.java | 2 +- .../gui/container/GuiSchematicInput.java | 2 +- .../core/client/gui/container/GuiSolar.java | 2 +- .../gui/screen/GuiCelestialSelection.java | 8 +- .../client/gui/screen/GuiJoinSpaceRace.java | 4 +- .../client/gui/screen/GuiNewSpaceRace.java | 8 +- .../render/entities/RenderTier1Rocket.java | 2 +- .../core/command/CommandGCAstroMiner.java | 6 +- .../core/command/CommandGCHelp.java | 2 +- .../core/command/CommandKeepDim.java | 6 +- .../command/CommandSpaceStationAddOwner.java | 8 +- .../CommandSpaceStationChangeOwner.java | 2 +- .../CommandSpaceStationRemoveOwner.java | 2 +- .../core/dimension/SpaceRaceManager.java | 2 +- .../core/dimension/SpinManager.java | 2 +- .../core/dimension/TeleportTypeMoon.java | 2 +- .../dimension/TeleportTypeSpaceStation.java | 2 +- .../energy/tile/TileBaseElectricBlock.java | 4 +- .../TileBaseElectricBlockWithInventory.java | 112 ++++++------------ .../core/entities/EntityAlienVillager.java | 14 +-- .../core/entities/EntityBossBase.java | 6 +- .../core/entities/EntityBuggy.java | 32 ++--- .../core/entities/EntityEvolvedSkeleton.java | 2 +- .../core/entities/EntityEvolvedSpider.java | 2 +- .../core/entities/EntityParachest.java | 10 +- .../core/entities/EntitySkeletonBoss.java | 4 +- .../core/entities/EntityTier1Rocket.java | 4 +- .../core/entities/InventoryEntity.java | 8 +- .../core/entities/player/FreefallHandler.java | 56 ++++----- .../core/entities/player/GCPlayerHandler.java | 36 +++--- .../core/entities/player/GCPlayerStats.java | 4 +- .../core/entities/player/PlayerClient.java | 12 +- .../core/entities/player/StatsCapability.java | 2 +- .../core/event/EventHandlerGC.java | 2 +- .../core/inventory/ContainerBuggy.java | 2 +- .../core/inventory/ContainerBuggyBench.java | 6 +- .../core/inventory/ContainerCargoLoader.java | 4 +- .../inventory/ContainerCircuitFabricator.java | 4 +- .../inventory/ContainerCoalGenerator.java | 4 +- .../inventory/ContainerElectricFurnace.java | 4 +- .../ContainerElectricIngotCompressor.java | 4 +- .../ContainerEnergyStorageModule.java | 4 +- .../inventory/ContainerExtendedInventory.java | 6 +- .../core/inventory/ContainerFuelLoader.java | 4 +- .../inventory/ContainerIngotCompressor.java | 4 +- .../inventory/ContainerOxygenCollector.java | 4 +- .../inventory/ContainerOxygenCompressor.java | 4 +- .../ContainerOxygenDecompressor.java | 4 +- .../inventory/ContainerOxygenDistributor.java | 4 +- .../core/inventory/ContainerOxygenSealer.java | 4 +- .../ContainerOxygenStorageModule.java | 4 +- .../core/inventory/ContainerParaChest.java | 2 +- .../core/inventory/ContainerRefinery.java | 4 +- .../inventory/ContainerRocketInventory.java | 2 +- .../core/inventory/ContainerSchematic.java | 2 +- .../ContainerSchematicTier1Rocket.java | 6 +- .../core/inventory/ContainerSolar.java | 4 +- .../core/inventory/InventoryBuggyBench.java | 6 +- .../core/inventory/InventoryExtended.java | 8 +- .../core/inventory/InventoryRocketBench.java | 6 +- .../core/inventory/InventorySchematic.java | 6 +- .../inventory/InventoryTreasureChest.java | 2 +- .../PersistantInventoryCrafting.java | 6 +- .../galacticraft/core/items/ItemBasic.java | 2 +- .../core/items/ItemBlockEnclosed.java | 2 +- .../galacticraft/core/items/ItemBuggy.java | 4 +- .../core/items/ItemCanisterGeneric.java | 3 +- .../galacticraft/core/items/ItemFlag.java | 6 +- .../core/items/ItemMeteorChunk.java | 2 +- .../core/items/ItemTier1Rocket.java | 4 +- .../core/items/ItemUniversalWrench.java | 2 +- .../core/network/NetworkUtil.java | 2 +- .../core/network/PacketSimple.java | 28 ++--- .../core/proxy/ClientProxyCore.java | 4 +- .../core/tick/KeyHandlerClient.java | 8 +- .../core/tick/TickHandlerClient.java | 8 +- .../core/tile/TileEntityCargoLoader.java | 58 +++++---- .../tile/TileEntityCircuitFabricator.java | 2 +- .../core/tile/TileEntityCoalGenerator.java | 2 +- .../core/tile/TileEntityDish.java | 2 +- .../core/tile/TileEntityDungeonSpawner.java | 2 +- .../TileEntityElectricIngotCompressor.java | 4 +- .../tile/TileEntityEnergyStorageModule.java | 2 +- .../core/tile/TileEntityFluidTank.java | 1 + .../core/tile/TileEntityFuelLoader.java | 1 + .../core/tile/TileEntityIngotCompressor.java | 4 +- .../core/tile/TileEntityOxygenCollector.java | 2 +- .../core/tile/TileEntityOxygenCompressor.java | 2 +- .../tile/TileEntityOxygenDecompressor.java | 2 +- .../tile/TileEntityOxygenDistributor.java | 6 +- .../core/tile/TileEntityOxygenSealer.java | 2 +- .../tile/TileEntityOxygenStorageModule.java | 2 +- .../core/tile/TileEntityParaChest.java | 2 +- .../core/tile/TileEntitySolar.java | 2 +- .../core/tile/TileEntityTreasureChest.java | 2 +- .../galacticraft/core/util/FluidUtil.java | 6 +- .../galacticraft/core/util/OxygenUtil.java | 24 ++-- .../core/util/ThreadVersionCheck.java | 2 +- .../galacticraft/core/util/WorldUtil.java | 12 +- .../core/world/gen/MapGenCavesMoon.java | 12 +- .../core/world/gen/OverworldGenerator.java | 12 +- .../world/gen/StructureComponentVillage.java | 2 +- .../core/world/gen/WorldGenMinableMeta.java | 12 +- .../asteroids/AsteroidsModuleClient.java | 4 +- .../asteroids/blocks/BlockBeamReceiver.java | 4 +- .../asteroids/blocks/BlockMinerBase.java | 2 +- .../asteroids/blocks/BlockMinerBaseFull.java | 2 +- .../blocks/BlockShortRangeTelepad.java | 2 +- .../asteroids/blocks/BlockTelepadFake.java | 4 +- .../client/gui/GuiAstroMinerDock.java | 8 +- .../client/gui/GuiShortRangeTelepad.java | 6 +- .../render/entity/RenderTier3Rocket.java | 2 +- .../dimension/TeleportTypeAsteroids.java | 6 +- .../asteroids/entities/EntityAstroMiner.java | 22 ++-- .../asteroids/entities/EntityTier3Rocket.java | 4 +- .../player/AsteroidsPlayerHandler.java | 2 +- .../InventorySchematicAstroMiner.java | 2 +- .../InventorySchematicTier3Rocket.java | 2 +- .../asteroids/items/ItemAstroMiner.java | 8 +- .../asteroids/items/ItemGrappleHook.java | 4 +- .../asteroids/items/ItemTier3Rocket.java | 2 +- .../asteroids/tile/TileEntityMinerBase.java | 2 +- .../tile/TileEntityShortRangeTelepad.java | 2 +- .../planets/mars/EventHandlerMars.java | 6 +- .../planets/mars/MarsModuleClient.java | 4 +- .../mars/blocks/BlockCavernousVine.java | 2 +- .../planets/mars/blocks/BlockCreeperEgg.java | 4 +- .../planets/mars/blocks/BlockMachineMars.java | 2 +- .../mars/blocks/BlockMachineMarsT2.java | 2 +- .../mars/blocks/BlockSlimelingEgg.java | 2 +- .../planets/mars/blocks/BlockSludge.java | 2 +- .../planets/mars/client/fx/ParticleDrip.java | 2 +- .../mars/client/gui/GuiCargoRocket.java | 2 +- .../mars/client/gui/GuiLaunchController.java | 14 +-- .../mars/client/gui/GuiSlimelingFeed.java | 8 +- .../mars/client/gui/GuiTerraformer.java | 6 +- .../render/entity/RenderTier2Rocket.java | 2 +- .../mars/dimension/TeleportTypeMars.java | 2 +- .../mars/entities/EntityCargoRocket.java | 2 +- .../mars/entities/EntityCreeperBoss.java | 4 +- .../mars/entities/EntitySlimeling.java | 2 +- .../mars/entities/EntityTier2Rocket.java | 4 +- .../InventorySchematicCargoRocket.java | 2 +- .../InventorySchematicTier2Rocket.java | 2 +- .../mars/inventory/InventorySlimeling.java | 2 +- .../planets/mars/items/ItemTier2Rocket.java | 2 +- .../mars/tile/TileEntityCryogenicChamber.java | 2 +- .../mars/tile/TileEntitySlimelingEgg.java | 2 +- .../mars/tile/TileEntityTerraformer.java | 2 +- .../mars/world/gen/MapGenCaveMars.java | 12 +- .../mars/world/gen/MapGenCavernMars.java | 12 +- .../planets/venus/VenusModuleClient.java | 4 +- .../venus/blocks/BlockCrashedProbe.java | 2 +- .../blocks/BlockGeothermalGenerator.java | 2 +- .../planets/venus/blocks/BlockTorchWeb.java | 2 +- .../venus/client/gui/GuiGeothermal.java | 2 +- .../venus/dimension/TeleportTypeVenus.java | 2 +- .../venus/entities/EntitySpiderQueen.java | 4 +- .../entities/ai/EntityMoveHelperCeiling.java | 2 +- .../entities/ai/PathNavigateCeiling.java | 8 +- .../entities/ai/WalkNodeProcessorCeiling.java | 8 +- .../venus/tile/TileEntityCrashedProbe.java | 2 +- .../tile/TileEntityGeothermalGenerator.java | 2 +- .../venus/world/gen/MapGenCaveVenus.java | 12 +- .../venus/world/gen/MapGenLavaVenus.java | 12 +- 233 files changed, 734 insertions(+), 762 deletions(-) diff --git a/dependencies/main/java/codechicken/lib/inventory/InventoryUtils.java b/dependencies/main/java/codechicken/lib/inventory/InventoryUtils.java index 37ce96c924..02ebc0eefb 100644 --- a/dependencies/main/java/codechicken/lib/inventory/InventoryUtils.java +++ b/dependencies/main/java/codechicken/lib/inventory/InventoryUtils.java @@ -171,7 +171,7 @@ public static void dropItem(ItemStack stack, World world, Vector3 dropLocation) item.motionX = world.rand.nextGaussian() * 0.05; item.motionY = world.rand.nextGaussian() * 0.05 + 0.2F; item.motionZ = world.rand.nextGaussian() * 0.05; - world.spawnEntityInWorld(item); + world.spawnEntity(item); } /** diff --git a/dependencies/main/java/codechicken/lib/util/ItemUtils.java b/dependencies/main/java/codechicken/lib/util/ItemUtils.java index 05e91342e2..fc819ef753 100644 --- a/dependencies/main/java/codechicken/lib/util/ItemUtils.java +++ b/dependencies/main/java/codechicken/lib/util/ItemUtils.java @@ -46,7 +46,7 @@ public static void dropItem(World world, BlockPos pos, ItemStack stack, double v double zVelocity = world.rand.nextFloat() * velocity + (1.0D - velocity) * 0.5D; EntityItem entityItem = new EntityItem(world, pos.getX() + xVelocity, pos.getY() + yVelocity, pos.getZ() + zVelocity, stack); entityItem.setPickupDelay(10); - world.spawnEntityInWorld(entityItem); + world.spawnEntity(entityItem); } /** @@ -125,7 +125,7 @@ public static void ejectItem(World world, BlockPos pos, ItemStack stack, EnumFac } entity.setPickupDelay(10); - world.spawnEntityInWorld(entity); + world.spawnEntity(entity); } /** diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityAutoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityAutoRocket.java index a996a9f6c4..439fc90902 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityAutoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/prefab/entity/EntityAutoRocket.java @@ -302,11 +302,11 @@ public void onUpdate() } if (yDiff < 0.06F) { - int yMin = MathHelper.floor_double(this.getEntityBoundingBox().minY - this.getOnPadYOffset() - 0.45D) - 2; - int yMax = MathHelper.floor_double(this.getEntityBoundingBox().maxY) + 1; - int zMin = MathHelper.floor_double(this.posZ) - 1; - int zMax = MathHelper.floor_double(this.posZ) + 1; - for (int x = MathHelper.floor_double(this.posX) - 1; x <= MathHelper.floor_double(this.posX) + 1; x++) + int yMin = MathHelper.floor(this.getEntityBoundingBox().minY - this.getOnPadYOffset() - 0.45D) - 2; + int yMax = MathHelper.floor(this.getEntityBoundingBox().maxY) + 1; + int zMin = MathHelper.floor(this.posZ) - 1; + int zMax = MathHelper.floor(this.posZ) + 1; + for (int x = MathHelper.floor(this.posX) - 1; x <= MathHelper.floor(this.posX) + 1; x++) { for (int z = zMin; z <= zMax; z++) { @@ -723,11 +723,11 @@ protected void failRocket() BlockPos pos = new BlockPos((int) Math.floor(this.posX), (int) Math.floor(this.posY + i), (int) Math.floor(this.posZ)); if (this.landing && this.targetVec != null && this.worldObj.getTileEntity(pos) instanceof IFuelDock && this.posY - this.targetVec.getY() < 5) { - for (int x = MathHelper.floor_double(this.posX) - 1; x <= MathHelper.floor_double(this.posX) + 1; x++) + for (int x = MathHelper.floor(this.posX) - 1; x <= MathHelper.floor(this.posX) + 1; x++) { - for (int y = MathHelper.floor_double(this.posY - 3.0D); y <= MathHelper.floor_double(this.posY) + 1; y++) + for (int y = MathHelper.floor(this.posY - 3.0D); y <= MathHelper.floor(this.posY) + 1; y++) { - for (int z = MathHelper.floor_double(this.posZ) - 1; z <= MathHelper.floor_double(this.posZ) + 1; z++) + for (int z = MathHelper.floor(this.posZ) - 1; z <= MathHelper.floor(this.posZ) + 1; z++) { BlockPos pos1 = new BlockPos(x, y, z); TileEntity tile = this.worldObj.getTileEntity(pos1); @@ -766,7 +766,7 @@ public void cancelLaunch() this.timeUntilLaunch = 0; if (!this.worldObj.isRemote && !this.getPassengers().isEmpty() && this.getPassengers().get(0) instanceof EntityPlayerMP) { - this.getPassengers().get(0).addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.nogyroscope"))); + this.getPassengers().get(0).sendMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.nogyroscope"))); } } @@ -774,7 +774,7 @@ public void failMessageLaunchController() { if (!this.worldObj.isRemote && !this.getPassengers().isEmpty() && this.getPassengers().get(0) instanceof EntityPlayerMP) { - ((EntityPlayerMP) this.getPassengers().get(0)).addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.launchcontroller"))); + ((EntityPlayerMP) this.getPassengers().get(0)).sendMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.launchcontroller"))); } } @@ -782,7 +782,7 @@ public void failMessageInsufficientFuel() { if (!this.worldObj.isRemote && !this.getPassengers().isEmpty() && this.getPassengers().get(0) instanceof EntityPlayerMP) { - ((EntityPlayerMP) this.getPassengers().get(0)).addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.fuelinsufficient"))); + ((EntityPlayerMP) this.getPassengers().get(0)).sendMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.fuelinsufficient"))); } } @@ -830,11 +830,11 @@ public void onLaunch() int amountRemoved = 0; PADSEARCH: - for (int x = MathHelper.floor_double(this.posX) - 1; x <= MathHelper.floor_double(this.posX) + 1; x++) + for (int x = MathHelper.floor(this.posX) - 1; x <= MathHelper.floor(this.posX) + 1; x++) { - for (int y = MathHelper.floor_double(this.posY) - 3; y <= MathHelper.floor_double(this.posY) + 1; y++) + for (int y = MathHelper.floor(this.posY) - 3; y <= MathHelper.floor(this.posY) + 1; y++) { - for (int z = MathHelper.floor_double(this.posZ) - 1; z <= MathHelper.floor_double(this.posZ) + 1; z++) + for (int z = MathHelper.floor(this.posZ) - 1; z <= MathHelper.floor(this.posZ) + 1; z++) { BlockPos pos = new BlockPos(x, y, z); final Block block = this.worldObj.getBlockState(pos).getBlock(); @@ -942,7 +942,7 @@ protected void readEntityFromNBT(NBTTagCompound nbt) if (nbt.getBoolean("TargetValid") && nbt.hasKey("targetTileX")) { - this.targetVec = new BlockPos(MathHelper.floor_double(nbt.getDouble("targetTileX")), MathHelper.floor_double(nbt.getDouble("targetTileY")), MathHelper.floor_double(nbt.getDouble("targetTileZ"))); + this.targetVec = new BlockPos(MathHelper.floor(nbt.getDouble("targetTileX")), MathHelper.floor(nbt.getDouble("targetTileY")), MathHelper.floor(nbt.getDouble("targetTileZ"))); } this.setWaitForPlayer(nbt.getBoolean("WaitingForPlayer")); @@ -1026,13 +1026,13 @@ public EnumCargoLoadingState addCargo(ItemStack stack, boolean doAdd) { ItemStack stackAt = this.cargoItems[count]; - if (stackAt != null && stackAt.getItem() == stack.getItem() && stackAt.getItemDamage() == stack.getItemDamage() && stackAt.stackSize < stackAt.getMaxStackSize()) + if (stackAt != null && stackAt.getItem() == stack.getItem() && stackAt.getItemDamage() == stack.getItemDamage() && stackAt.getCount() < stackAt.getMaxStackSize()) { - if (stackAt.stackSize + stack.stackSize <= stackAt.getMaxStackSize()) + if (stackAt.getCount() + stack.getCount() <= stackAt.getMaxStackSize()) { if (doAdd) { - this.cargoItems[count].stackSize += stack.stackSize; + this.cargoItems[count].stackSize += stack.getCount(); this.markDirty(); } @@ -1041,8 +1041,8 @@ public EnumCargoLoadingState addCargo(ItemStack stack, boolean doAdd) else { //Part of the stack can fill this slot but there will be some left over - int origSize = stackAt.stackSize; - int surplus = origSize + stack.stackSize - stackAt.getMaxStackSize(); + int origSize = stackAt.getCount(); + int surplus = origSize + stack.getCount() - stackAt.getMaxStackSize(); if (doAdd) { @@ -1102,7 +1102,7 @@ public RemovalResult removeCargo(boolean doRemove) ItemStack resultStack = stackAt.copy(); resultStack.stackSize = 1; - if (doRemove && --stackAt.stackSize <= 0) + if (doRemove && --stackAt.getCount() <= 0) { this.cargoItems[i] = null; } @@ -1138,7 +1138,7 @@ public ItemStack decrStackSize(int par1, int par2) { ItemStack var3; - if (this.cargoItems[par1].stackSize <= par2) + if (this.cargoItems[par1].getCount() <= par2) { var3 = this.cargoItems[par1]; this.cargoItems[par1] = null; @@ -1148,7 +1148,7 @@ public ItemStack decrStackSize(int par1, int par2) { var3 = this.cargoItems[par1].splitStack(par2); - if (this.cargoItems[par1].stackSize == 0) + if (this.cargoItems[par1].getCount() == 0) { this.cargoItems[par1] = null; } @@ -1182,7 +1182,7 @@ public void setInventorySlotContents(int par1, ItemStack par2ItemStack) { this.cargoItems[par1] = par2ItemStack; - if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) + if (par2ItemStack != null && par2ItemStack.getCount() > this.getInventoryStackLimit()) { par2ItemStack.stackSize = this.getInventoryStackLimit(); } @@ -1217,7 +1217,7 @@ public boolean hasCustomName() } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUsableByPlayer(EntityPlayer entityplayer) { return !this.isDead && entityplayer.getDistanceSqToEntity(this) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/recipe/CompressorRecipes.java b/src/main/java/micdoodle8/mods/galacticraft/api/recipe/CompressorRecipes.java index 55a741d11e..0d29c66fb4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/recipe/CompressorRecipes.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/recipe/CompressorRecipes.java @@ -179,7 +179,7 @@ public static ItemStack findMatchingRecipe(IInventory inventory, World par2World } } - if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && itemstack.getItem().isRepairable()) + if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.getCount() == 1 && itemstack1.getCount() == 1 && itemstack.getItem().isRepairable()) { int k = itemstack.getItem().getMaxDamage() - itemstack.getItemDamage(); int l = itemstack.getItem().getMaxDamage() - itemstack1.getItemDamage(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/recipe/SpaceStationRecipe.java b/src/main/java/micdoodle8/mods/galacticraft/api/recipe/SpaceStationRecipe.java index 2b79393104..8f6504feef 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/recipe/SpaceStationRecipe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/recipe/SpaceStationRecipe.java @@ -86,7 +86,7 @@ public boolean matches(EntityPlayer player, boolean remove) { if (SpaceStationRecipe.checkItemEquals((ItemStack) next, slot)) { - amountInInv += slot.stackSize; + amountInInv += slot.getCount(); } } else if (next instanceof ArrayList) @@ -95,7 +95,7 @@ else if (next instanceof ArrayList) { if (SpaceStationRecipe.checkItemEquals(item, slot)) { - amountInInv += slot.stackSize; + amountInInv += slot.getCount(); } } } @@ -142,11 +142,11 @@ public void removeItems(EntityPlayer player) { if (SpaceStationRecipe.checkItemEquals((ItemStack) next, slot)) { - final int amountToRemove = Math.min(slot.stackSize, amountRemaining); + final int amountToRemove = Math.min(slot.getCount(), amountRemaining); ItemStack newStack = slot.copy(); newStack.stackSize -= amountToRemove; - if (newStack.stackSize <= 0) + if (newStack.getCount() <= 0) { newStack = null; } @@ -161,11 +161,11 @@ else if (next instanceof ArrayList) { if (SpaceStationRecipe.checkItemEquals(item, slot)) { - final int amountToRemove = Math.min(slot.stackSize, amountRemaining); + final int amountToRemove = Math.min(slot.getCount(), amountRemaining); ItemStack newStack = slot.copy(); newStack.stackSize -= amountToRemove; - if (newStack.stackSize <= 0) + if (newStack.getCount() <= 0) { newStack = null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java index cf18d45a4a..2f57a605b9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java +++ b/src/main/java/micdoodle8/mods/galacticraft/api/vector/BlockVec3.java @@ -524,7 +524,7 @@ public int distanceTo(BlockVec3 vector) int var2 = vector.x - this.x; int var4 = vector.y - this.y; int var6 = vector.z - this.z; - return MathHelper.floor_double(Math.sqrt(var2 * var2 + var4 * var4 + var6 * var6)); + return MathHelper.floor(Math.sqrt(var2 * var2 + var4 * var4 + var6 * var6)); } public int distanceSquared(BlockVec3 vector) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java index 1b4c19fa26..38f56bb13b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/GalacticraftCore.java @@ -49,6 +49,7 @@ import net.minecraft.world.biome.Biome; import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.common.*; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; @@ -65,7 +66,7 @@ import java.util.Arrays; import java.util.HashMap; -@Mod(name = GalacticraftCore.NAME, version = Constants.LOCALMAJVERSION + "." + Constants.LOCALMINVERSION + "." + Constants.LOCALBUILDVERSION, useMetadata = true, modid = Constants.MOD_ID_CORE, dependencies = "required-after:Forge@[10.12.2.1147,); required-after:FML@[7.2.217.1147,); required-after:Micdoodlecore; after:IC2; after:IC2", guiFactory = "micdoodle8.mods.galacticraft.core.client.gui.screen.ConfigGuiFactoryCore") +@Mod(name = GalacticraftCore.NAME, version = Constants.LOCALMAJVERSION + "." + Constants.LOCALMINVERSION + "." + Constants.LOCALBUILDVERSION, useMetadata = true, modid = Constants.MOD_ID_CORE, dependencies = "required-after:Forge@[13.20.0.2228,); required-after:FML@[7.2.217.1147,); required-after:Micdoodlecore; after:IC2; after:IC2", guiFactory = "micdoodle8.mods.galacticraft.core.client.gui.screen.ConfigGuiFactoryCore") public class GalacticraftCore { public static final String NAME = "Galacticraft Core"; @@ -98,7 +99,6 @@ public class GalacticraftCore public static Moon moonMoon; public static Satellite satelliteSpaceStation; - public static HashMap itemList = new HashMap<>(); public static HashMap blocksList = new HashMap<>(); @@ -106,6 +106,11 @@ public class GalacticraftCore public static ImageWriteParam writeParam; public static boolean enableJPEG = false; + static + { + FluidRegistry.enableUniversalBucket(); + } + @EventHandler public void preInit(FMLPreInitializationEvent event) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java b/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java index 72d0e51853..72104a68cd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/TransformerHooks.java @@ -468,9 +468,9 @@ public static Vec3d getSkyColorHook(World world) f2 = 1.0F; } - int i = MathHelper.floor_double(player.posX); - int j = MathHelper.floor_double(player.posY); - int k = MathHelper.floor_double(player.posZ); + int i = MathHelper.floor(player.posX); + int j = MathHelper.floor(player.posY); + int k = MathHelper.floor(player.posZ); BlockPos pos = new BlockPos(i, j, k); int l = ForgeHooksClient.getSkyBlendColour(world, pos); float f4 = (float) (l >> 16 & 255) / 255.0F; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java index 29acb088c9..81c47ca53c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvanced.java @@ -27,13 +27,15 @@ public BlockAdvanced(Material material) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (hand != EnumHand.MAIN_HAND) { return false; } + ItemStack heldItem = playerIn.getHeldItem(hand); + /** * Check if the player is holding a wrench or an electric item. If so, * call the wrench event. diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvancedTile.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvancedTile.java index 2374646f49..54d3cb5157 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvancedTile.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAdvancedTile.java @@ -61,16 +61,16 @@ public void dropEntireInventory(World worldIn, BlockPos pos, IBlockState state) float var9 = random.nextFloat() * 0.8F + 0.1F; float var10 = random.nextFloat() * 0.8F + 0.1F; - while (var7.stackSize > 0) + while (var7.getCount() > 0) { int var11 = random.nextInt(21) + 10; - if (var11 > var7.stackSize) + if (var11 > var7.getCount()) { - var11 = var7.stackSize; + var11 = var7.getCount(); } - var7.stackSize -= var11; + var7.shrink(var11); EntityItem var12 = new EntityItem(worldIn, pos.getX() + var8, pos.getY() + var9, pos.getZ() + var10, new ItemStack(var7.getItem(), var11, var7.getItemDamage())); if (var7.hasTagCompound()) @@ -82,7 +82,7 @@ public void dropEntireInventory(World worldIn, BlockPos pos, IBlockState state) var12.motionX = (float) random.nextGaussian() * var13; var12.motionY = (float) random.nextGaussian() * var13 + 0.2F; var12.motionZ = (float) random.nextGaussian() * var13; - worldIn.spawnEntityInWorld(var12); + worldIn.spawnEntity(var12); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java index 92b06c95b5..ccfa61d060 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockFrame.java @@ -20,6 +20,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -72,12 +73,11 @@ public BlockAirLockFrame(String assetName) this.setUnlocalizedName(assetName); } - @SideOnly(Side.CLIENT) @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { - par3List.add(new ItemStack(par1, 1, EnumAirLockType.AIR_LOCK_FRAME.getMeta())); - par3List.add(new ItemStack(par1, 1, EnumAirLockType.AIR_LOCK_CONTROLLER.getMeta())); + list.add(new ItemStack(itemIn, 1, EnumAirLockType.AIR_LOCK_FRAME.getMeta())); + list.add(new ItemStack(itemIn, 1, EnumAirLockType.AIR_LOCK_CONTROLLER.getMeta())); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockWall.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockWall.java index 28480bdade..497169e90a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockWall.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAirLockWall.java @@ -54,7 +54,7 @@ public BlockAirLockWall(String assetName) } // @Override -// public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) +// public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) // { // this.setBlockBoundsBasedOnState(worldIn, pos); // return super.getCollisionBoundingBox(worldIn, pos, state); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java index f9c6820e24..9b1999d45d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockAluminumWire.java @@ -19,6 +19,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; @@ -316,12 +317,12 @@ public TileEntity createNewTileEntity(World world, int metadata) @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { - par3List.add(new ItemStack(par1, 1, 0)); - par3List.add(new ItemStack(par1, 1, 1)); - par3List.add(new ItemStack(par1, 1, 2)); - par3List.add(new ItemStack(par1, 1, 3)); + list.add(new ItemStack(itemIn, 1, 0)); + list.add(new ItemStack(itemIn, 1, 1)); + list.add(new ItemStack(itemIn, 1, 2)); + list.add(new ItemStack(itemIn, 1, 3)); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java index 0f61da2dd0..741b32b33f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasic.java @@ -15,6 +15,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.Explosion; @@ -181,7 +182,7 @@ public float getBlockHardness(IBlockState blockState, World worldIn, BlockPos po @SideOnly(Side.CLIENT) @Override - public void getSubBlocks(Item itemIn, CreativeTabs tabs, List list) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { for (int var4 = 3; var4 < 12; ++var4) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java index a34463c18a..cdbc3d6757 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBasicMoon.java @@ -24,6 +24,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.RayTraceResult; @@ -218,11 +219,11 @@ public int quantityDropped(IBlockState state, int fortune, Random random) @SideOnly(Side.CLIENT) @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { for (EnumBlockBasicMoon type : EnumBlockBasicMoon.values()) { - par3List.add(new ItemStack(par1, 1, type.getMeta())); + list.add(new ItemStack(itemIn, 1, type.getMeta())); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBossSpawner.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBossSpawner.java index 512d6ecb78..71a676ece1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBossSpawner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBossSpawner.java @@ -81,7 +81,7 @@ public boolean isOpaqueCube(IBlockState state) } @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBreathableAir.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBreathableAir.java index a0febdd7b8..bde5529b50 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBreathableAir.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBreathableAir.java @@ -30,12 +30,6 @@ public BlockBreathableAir(String assetName) this.setUnlocalizedName(assetName); } - @Override - public boolean canReplace(World world, BlockPos pos, EnumFacing side, ItemStack stack) - { - return true; - } - @Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightAir.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightAir.java index 2dbff573d1..e0a20d08a4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightAir.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightAir.java @@ -23,12 +23,6 @@ public BlockBrightAir(String assetName) this.setLightLevel(1.0F); } - @Override - public boolean canReplace(World worldIn, BlockPos pos, EnumFacing side, ItemStack stack) - { - return true; - } - @Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightBreathableAir.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightBreathableAir.java index 6a44c4908c..851729e969 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightBreathableAir.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightBreathableAir.java @@ -31,12 +31,6 @@ public BlockBrightBreathableAir(String assetName) this.setLightLevel(1.0F); } - @Override - public boolean canReplace(World worldIn, BlockPos pos, EnumFacing side, ItemStack stack) - { - return true; - } - @Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java index 5f21b559b8..115d37cd2e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockBrightLamp.java @@ -27,6 +27,8 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import javax.annotation.Nullable; + public class BlockBrightLamp extends BlockAdvanced implements IShiftDescription, ITileEntityProvider, ISortableBlock { public static final PropertyDirection FACING = PropertyDirection.create("facing"); @@ -87,7 +89,7 @@ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) } @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { double boundsMin = 0.2D; double boundsMax = 0.8D; @@ -122,12 +124,18 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) } @Override - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + super.onBlockPlacedBy(worldIn, pos, state, placer, stack); + } + + @Override + public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { EnumFacing opposite = EnumFacing.values()[facing.getIndex() ^ 1]; BlockPos offsetPos = pos.offset(opposite); - IBlockState state = worldIn.getBlockState(offsetPos); - if (state.getBlock().isSideSolid(state, worldIn, offsetPos, facing)) + IBlockState state = world.getBlockState(offsetPos); + if (state.getBlock().isSideSolid(state, world, offsetPos, facing)) { return this.getDefaultState().withProperty(FACING, opposite); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCargoLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCargoLoader.java index 2880ac5b16..75323ec8ad 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCargoLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCargoLoader.java @@ -24,6 +24,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; @@ -86,10 +87,10 @@ public BlockCargoLoader(String assetName) @SideOnly(Side.CLIENT) @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { - par3List.add(new ItemStack(par1, 1, BlockCargoLoader.METADATA_CARGO_LOADER)); - par3List.add(new ItemStack(par1, 1, BlockCargoLoader.METADATA_CARGO_UNLOADER)); + list.add(new ItemStack(itemIn, 1, BlockCargoLoader.METADATA_CARGO_LOADER)); + list.add(new ItemStack(itemIn, 1, BlockCargoLoader.METADATA_CARGO_UNLOADER)); } @Override @@ -158,7 +159,7 @@ public boolean onUseWrench(World world, BlockPos pos, EntityPlayer entityPlayer, @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - final int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + final int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int change = EnumFacing.getHorizontal(angle).getOpposite().getHorizontalIndex(); if (stack.getItemDamage() >= METADATA_CARGO_UNLOADER) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java index a4037fce39..7f3e7241b8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockCheese.java @@ -75,7 +75,7 @@ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, Bloc // } // // @Override -// public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) +// public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) // { // float f = 0.0625F; // float f1 = (float) (1 + ((Integer) state.getValue(BITES)).intValue() * 2) / 16.0F; @@ -103,7 +103,7 @@ public boolean isOpaqueCube(IBlockState state) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { this.eatCheeseSlice(worldIn, pos, worldIn.getBlockState(pos), playerIn); return true; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java index 4a6bba4f9e..8929e5ae8f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockDish.java @@ -67,7 +67,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti { int metadata = state.getBlock().getMetaFromState(state); - int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int change = 0; switch (angle) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java index eba4159e64..f58d58df0c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockEnclosed.java @@ -30,6 +30,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -147,11 +148,11 @@ public BlockEnclosed(String assetName) @SideOnly(Side.CLIENT) @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { - par3List.add(new ItemStack(par1, 1, EnumEnclosedBlockType.ALUMINUM_WIRE.getMeta())); - par3List.add(new ItemStack(par1, 1, EnumEnclosedBlockType.ALUMINUM_WIRE_HEAVY.getMeta())); - par3List.add(new ItemStack(par1, 1, EnumEnclosedBlockType.OXYGEN_PIPE.getMeta())); + list.add(new ItemStack(itemIn, 1, EnumEnclosedBlockType.ALUMINUM_WIRE.getMeta())); + list.add(new ItemStack(itemIn, 1, EnumEnclosedBlockType.ALUMINUM_WIRE_HEAVY.getMeta())); + list.add(new ItemStack(itemIn, 1, EnumEnclosedBlockType.OXYGEN_PIPE.getMeta())); if (CompatibilityManager.isTELoaded() || GCBlocks.registeringSorted) { @@ -160,26 +161,26 @@ public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { for (int i = 0; i < 2; i++) { - par3List.add(new ItemStack(par1, 1, i)); + list.add(new ItemStack(itemIn, 1, i)); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPadFull.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPadFull.java index 23364c0d44..6984a37c48 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPadFull.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockLandingPadFull.java @@ -103,7 +103,7 @@ public Item getItemDropped(IBlockState state, Random rand, int fortune) } @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { switch (getMetaFromState(blockState)) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine.java index 78c46064c4..4539ad63cf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine.java @@ -20,10 +20,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.IStringSerializable; +import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; @@ -137,7 +134,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti { int metadata = getMetaFromState(state); - final int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + final int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int change = EnumFacing.getHorizontal(angle).getOpposite().getHorizontalIndex(); worldIn.setBlockState(pos, getStateFromMeta((metadata & 12) + change), 3); @@ -211,10 +208,10 @@ public ItemStack getCoalGenerator() } @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { - par3List.add(this.getCoalGenerator()); - par3List.add(this.getCompressor()); + list.add(this.getCoalGenerator()); + list.add(this.getCompressor()); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine2.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine2.java index 8dd699b2d2..e1b7554651 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine2.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine2.java @@ -21,10 +21,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.IStringSerializable; +import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; @@ -145,7 +142,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti { int metadata = getMetaFromState(state); - final int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + final int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int change = EnumFacing.getHorizontal(angle).getOpposite().getHorizontalIndex(); if (metadata >= BlockMachine2.OXYGEN_STORAGE_MODULE_METADATA) @@ -230,11 +227,11 @@ public ItemStack getOxygenStorageModule() } @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { - par3List.add(this.getElectricCompressor()); - par3List.add(this.getCircuitFabricator()); - par3List.add(this.getOxygenStorageModule()); + list.add(this.getElectricCompressor()); + list.add(this.getCircuitFabricator()); + list.add(this.getOxygenStorageModule()); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine3.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine3.java index 3b2661f8bd..577dc4d2e2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine3.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachine3.java @@ -22,6 +22,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; @@ -109,7 +110,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti { int metadata = getMetaFromState(state); - final int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + final int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int change = EnumFacing.getHorizontal(angle).getOpposite().getHorizontalIndex(); worldIn.setBlockState(pos, getStateFromMeta((metadata & METADATA_MASK) + change), 3); @@ -164,9 +165,9 @@ public ItemStack getPainter() } @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { - par3List.add(this.getPainter()); + list.add(this.getPainter()); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachineTiered.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachineTiered.java index f101c72801..929c3ca892 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachineTiered.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMachineTiered.java @@ -23,6 +23,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; @@ -91,7 +92,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti { int metadata = getMetaFromState(state); - final int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + final int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int change = EnumFacing.getHorizontal(angle).getOpposite().getHorizontalIndex(); if (metadata >= BlockMachineTiered.ELECTRIC_FURNACE_METADATA + 8) @@ -180,14 +181,14 @@ public ItemStack getElectricArcFurnace() } @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { - par3List.add(this.getEnergyStorageModule()); - par3List.add(this.getElectricFurnace()); + list.add(this.getEnergyStorageModule()); + list.add(this.getElectricFurnace()); if (GalacticraftCore.isPlanetsLoaded) { - par3List.add(this.getEnergyStorageCluster()); - par3List.add(this.getElectricArcFurnace()); + list.add(this.getEnergyStorageCluster()); + list.add(this.getElectricArcFurnace()); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java index 96c51aaf7f..cf7e4eb85e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockMulti.java @@ -155,7 +155,7 @@ public boolean isOpaqueCube(IBlockState state) // } // // @Override -// public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) +// public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) // { // this.setBlockBoundsBasedOnState(worldIn, pos); // return super.getCollisionBoundingBox(worldIn, pos, state); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java index 02df105931..be1c82855a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockNasaWorkbench.java @@ -26,6 +26,7 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockNasaWorkbench extends BlockContainer implements ITileEntityProvider, IShiftDescription, IPartialSealableBlock, ISortableBlock @@ -58,7 +59,7 @@ public boolean isFullCube(IBlockState state) } @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { return new AxisAlignedBB((double) pos.getX() + -0.0F, (double) pos.getY() + 0.0F, (double) pos.getZ() + -0.0F, (double) pos.getX() + 1.0F, (double) pos.getY() + 1.4F, (double) pos.getZ() + 1.0F); } @@ -157,7 +158,7 @@ else if (y != 0 && y != 3) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { playerIn.openGui(GalacticraftCore.instance, SchematicRegistry.getMatchingRecipeForID(0).getGuiID(), worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCollector.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCollector.java index 61afe06d70..876767fc29 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCollector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCollector.java @@ -78,7 +78,7 @@ public TileEntity createTileEntity(World world, IBlockState state) @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - final int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + final int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int change = EnumFacing.getHorizontal(angle).getOpposite().getHorizontalIndex(); worldIn.setBlockState(pos, getStateFromMeta(change), 3); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCompressor.java index cef06b758e..66b48e3aaa 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenCompressor.java @@ -22,6 +22,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; @@ -126,7 +127,7 @@ else if (metadata >= BlockOxygenCompressor.OXYGEN_COMPRESSOR_METADATA) @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - final int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + final int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int change = EnumFacing.getHorizontal(angle).getOpposite().getHorizontalIndex(); if (stack.getItemDamage() >= BlockOxygenCompressor.OXYGEN_DECOMPRESSOR_METADATA) @@ -142,10 +143,10 @@ else if (stack.getItemDamage() >= BlockOxygenCompressor.OXYGEN_COMPRESSOR_METADA } @Override - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { - par3List.add(new ItemStack(this, 1, BlockOxygenCompressor.OXYGEN_COMPRESSOR_METADATA)); - par3List.add(new ItemStack(this, 1, BlockOxygenCompressor.OXYGEN_DECOMPRESSOR_METADATA)); + list.add(new ItemStack(this, 1, BlockOxygenCompressor.OXYGEN_COMPRESSOR_METADATA)); + list.add(new ItemStack(this, 1, BlockOxygenCompressor.OXYGEN_DECOMPRESSOR_METADATA)); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDistributor.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDistributor.java index 43b7b6acfa..5db7ff5815 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDistributor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenDistributor.java @@ -90,7 +90,7 @@ public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - final int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + final int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; worldIn.setBlockState(pos, getStateFromMeta(EnumFacing.getHorizontal(angle).getOpposite().getHorizontalIndex()), 3); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenSealer.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenSealer.java index c8d4ead376..81fb1e5565 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenSealer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockOxygenSealer.java @@ -67,7 +67,7 @@ public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - final int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + final int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; worldIn.setBlockState(pos, getStateFromMeta(EnumFacing.getHorizontal(angle).getOpposite().getHorizontalIndex()), 3); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java index a1d6787f72..c45ece86bf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockParaChest.java @@ -65,7 +65,7 @@ public EnumBlockRenderType getRenderType(IBlockState state) } @Override - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing()); } @@ -95,7 +95,7 @@ public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { @@ -148,16 +148,16 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) float f1 = this.random.nextFloat() * 0.8F + 0.1F; EntityItem entityitem; - for (float f2 = this.random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; worldIn.spawnEntityInWorld(entityitem)) + for (float f2 = this.random.nextFloat() * 0.8F + 0.1F; itemstack.getCount() > 0; worldIn.spawnEntity(entityitem)) { int k1 = this.random.nextInt(21) + 10; - if (k1 > itemstack.stackSize) + if (k1 > itemstack.getCount()) { - k1 = itemstack.stackSize; + k1 = itemstack.getCount(); } - itemstack.stackSize -= k1; + itemstack.shrink(k1); entityitem = new EntityItem(worldIn, pos.getX() + f, pos.getY() + f1, pos.getZ() + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage())); float f3 = 0.05F; entityitem.motionX = (float) this.random.nextGaussian() * f3; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockRefinery.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockRefinery.java index 915f548119..36ca07c516 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockRefinery.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockRefinery.java @@ -126,16 +126,16 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) final float var11 = this.refineryRand.nextFloat() * 0.8F + 0.1F; final float var12 = this.refineryRand.nextFloat() * 0.8F + 0.1F; - while (var9.stackSize > 0) + while (var9.getCount() > 0) { int var13 = this.refineryRand.nextInt(21) + 10; - if (var13 > var9.stackSize) + if (var13 > var9.getCount()) { - var13 = var9.stackSize; + var13 = var9.getCount(); } - var9.stackSize -= var13; + var9.shrink(var13); final EntityItem var14 = new EntityItem(worldIn, pos.getX() + var10, pos.getY() + var11, pos.getZ() + var12, new ItemStack(var9.getItem(), var13, var9.getItemDamage())); if (var9.hasTagCompound()) @@ -147,7 +147,7 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) var14.motionX = (float) this.refineryRand.nextGaussian() * var15; var14.motionY = (float) this.refineryRand.nextGaussian() * var15 + 0.2F; var14.motionZ = (float) this.refineryRand.nextGaussian() * var15; - worldIn.spawnEntityInWorld(var14); + worldIn.spawnEntity(var14); } } } @@ -159,7 +159,7 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - final int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + final int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; worldIn.setBlockState(pos, getStateFromMeta(EnumFacing.getHorizontal(angle).getOpposite().getHorizontalIndex()), 3); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java index 2ce76faab8..e49aa8bf9d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockScreen.java @@ -71,7 +71,7 @@ public boolean isFullCube(IBlockState state) @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - final int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + final int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int change = EnumFacing.getHorizontal(angle).getOpposite().getIndex(); worldIn.setBlockState(pos, getStateFromMeta(change), 3); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java index 4eac9a841f..78d1acf99a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSlabGC.java @@ -14,6 +14,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; @@ -41,7 +42,7 @@ public BlockSlabGC(Material material) @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { for (int i = 0; i < (GalacticraftCore.isPlanetsLoaded ? 6 : 4); ++i) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSolar.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSolar.java index b04ce7d773..7b17acf085 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSolar.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSolar.java @@ -23,6 +23,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; @@ -80,10 +81,10 @@ public BlockSolar(String assetName) @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { - par3List.add(new ItemStack(par1, 1, BlockSolar.BASIC_METADATA)); - par3List.add(new ItemStack(par1, 1, BlockSolar.ADVANCED_METADATA)); + list.add(new ItemStack(itemIn, 1, BlockSolar.BASIC_METADATA)); + list.add(new ItemStack(itemIn, 1, BlockSolar.ADVANCED_METADATA)); } @Override @@ -133,7 +134,7 @@ public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - final int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + final int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int change = EnumFacing.getHorizontal(angle).getOpposite().getHorizontalIndex(); if (stack.getItemDamage() >= ADVANCED_METADATA) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpaceGlass.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpaceGlass.java index 3770b9b414..e8195d3b02 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpaceGlass.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpaceGlass.java @@ -23,6 +23,7 @@ import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -68,18 +69,18 @@ protected BlockStateContainer createBlockState() } @Override - public void getSubBlocks(Item itemIn, CreativeTabs tab, List list) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { for (int i = 0; i < GlassFrame.values().length; i++) list.add(new ItemStack(itemIn, 1, i)); } @Override - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int damage, EntityLivingBase placer) + public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { //This allows the different item damage values to place different instances of the block - the instances of the block are constructed in GCBlocks - if (damage >= GlassFrame.values().length) damage = 0; - switch (GlassFrame.values()[damage]) + if (meta >= GlassFrame.values().length) meta = 0; + switch (GlassFrame.values()[meta]) { case TIN_DECO: { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java index a6720d03a1..8edb2edd40 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockSpinThruster.java @@ -92,7 +92,7 @@ public boolean canPlaceBlockAt(World worldIn, BlockPos pos) } @Override - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { return getStateFromMeta(facing.getHorizontalIndex()); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java index 3185687afe..c019e7729b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTelemetry.java @@ -39,7 +39,7 @@ public BlockTelemetry(String assetName) @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int change = 0; switch (angle) @@ -123,11 +123,11 @@ public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, { UUID uuid = new UUID(fmData.getLong("linkedUUIDMost"), fmData.getLong("linkedUUIDLeast")); ((TileEntityTelemetry) tile).addTrackedEntity(uuid); - entityPlayer.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.telemetry_succeed.message"))); + entityPlayer.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.telemetry_succeed.message"))); } else { - entityPlayer.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.telemetry_fail.message"))); + entityPlayer.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.telemetry_fail.message"))); if (fmData == null) { @@ -149,11 +149,11 @@ public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, { return false; } - entityPlayer.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.telemetry_fail_wearing_it.message"))); + entityPlayer.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.telemetry_fail_wearing_it.message"))); } else { - entityPlayer.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.telemetry_fail_no_frequency_module.message"))); + entityPlayer.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.telemetry_fail_no_frequency_module.message"))); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTier1TreasureChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTier1TreasureChest.java index ae1a3bc3f0..0c5e8dbe41 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTier1TreasureChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTier1TreasureChest.java @@ -122,7 +122,7 @@ public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) } @Override - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing()); } @@ -130,7 +130,7 @@ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - EnumFacing enumfacing = EnumFacing.getHorizontal(MathHelper.floor_double((double) (placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3).getOpposite(); + EnumFacing enumfacing = EnumFacing.getHorizontal(MathHelper.floor((double) (placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3).getOpposite(); state = state.withProperty(FACING, enumfacing); BlockPos blockpos1 = pos.north(); BlockPos blockpos2 = pos.south(); @@ -446,7 +446,7 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { @@ -482,7 +482,7 @@ public int isProvidingWeakPower(IBlockAccess worldIn, BlockPos pos, IBlockState i = ((TileEntityTreasureChest) tileentity).numPlayersUsing; } - return MathHelper.clamp_int(i, 0, 15); + return MathHelper.clamp(i, 0, 15); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java index e51735f864..8515dfb8da 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockTransmitter.java @@ -51,7 +51,7 @@ public void onNeighborChange(IBlockAccess worldIn, BlockPos pos, BlockPos neighb } // @Override -// public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) +// public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) // { // this.setBlockBoundsBasedOnState(worldIn, pos); // return super.getCollisionBoundingBox(blockState, worldIn, pos); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java index 1ce921444b..985611c71f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockUnlitTorch.java @@ -16,6 +16,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -73,7 +74,7 @@ public Block changeState() } @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { return null; } @@ -139,9 +140,9 @@ private boolean canPlaceOn(World worldIn, BlockPos pos) } @Override - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { - if (this.canPlaceAt(worldIn, pos, facing)) + if (this.canPlaceAt(world, pos, facing)) { return this.getDefaultState().withProperty(FACING, facing); } @@ -149,7 +150,7 @@ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, { for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) { - if (worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) + if (world.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true)) { return this.getDefaultState().withProperty(FACING, enumfacing); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java index 7c84eafaa4..99d7bc8537 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/blocks/BlockWallGC.java @@ -16,6 +16,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; @@ -112,7 +113,7 @@ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, Bloc } @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { blockState = this.getActualState(blockState, worldIn, pos); return CLIP_AABB_BY_INDEX[getAABBIndex(blockState)]; @@ -207,7 +208,7 @@ private boolean canConnectTo(IBlockAccess world, BlockPos pos) @Override @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) + public void getSubBlocks(Item itemIn, CreativeTabs tab, NonNullList list) { for (int i = 0; i < (GalacticraftCore.isPlanetsLoaded ? 6 : 4); ++i) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/EventHandlerClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/EventHandlerClient.java index 48c967cc80..981d0bf290 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/EventHandlerClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/EventHandlerClient.java @@ -65,7 +65,7 @@ public void onRenderPlanetPre(CelestialBodyRenderEvent.Pre event) { if (!ClientProxyCore.overworldTextureRequestSent) { - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(PacketSimple.EnumSimplePacket.S_REQUEST_OVERWORLD_IMAGE, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] {})); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(PacketSimple.EnumSimplePacket.S_REQUEST_OVERWORLD_IMAGE, GCCoreUtil.getDimensionID(mc.world), new Object[] {})); ClientProxyCore.overworldTextureRequestSent = true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/SkyProviderMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/SkyProviderMoon.java index 4aa4e7d5c5..a7e8728a2a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/SkyProviderMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/SkyProviderMoon.java @@ -87,7 +87,7 @@ public void render(float partialTicks, WorldClient world, Minecraft mc) { if (!ClientProxyCore.overworldTextureRequestSent) { - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(PacketSimple.EnumSimplePacket.S_REQUEST_OVERWORLD_IMAGE, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] {})); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(PacketSimple.EnumSimplePacket.S_REQUEST_OVERWORLD_IMAGE, GCCoreUtil.getDimensionID(mc.world), new Object[] {})); ClientProxyCore.overworldTextureRequestSent = true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/SkyProviderOverworld.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/SkyProviderOverworld.java index 8e0157548d..31bf90c311 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/SkyProviderOverworld.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/SkyProviderOverworld.java @@ -125,7 +125,7 @@ public void render(float partialTicks, WorldClient world, Minecraft mc) { if (!ClientProxyCore.overworldTextureRequestSent) { - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(PacketSimple.EnumSimplePacket.S_REQUEST_OVERWORLD_IMAGE, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] {})); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(PacketSimple.EnumSimplePacket.S_REQUEST_OVERWORLD_IMAGE, GCCoreUtil.getDimensionID(mc.world), new Object[] {})); ClientProxyCore.overworldTextureRequestSent = true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/EffectHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/EffectHandler.java index 8134797871..9997374edb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/EffectHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/EffectHandler.java @@ -25,42 +25,42 @@ public static void spawnParticle(String particleID, Vector3 position, Vector3 mo if (particleID.equals("whiteSmokeIdle")) { - particle = new ParticleLaunchSmoke(mc.theWorld, position, motion, 1.0F, false); + particle = new ParticleLaunchSmoke(mc.world, position, motion, 1.0F, false); } else if (particleID.equals("whiteSmokeLaunched")) { - particle = new ParticleLaunchSmoke(mc.theWorld, position, motion, 1.0F, true); + particle = new ParticleLaunchSmoke(mc.world, position, motion, 1.0F, true); } else if (particleID.equals("whiteSmokeLargeIdle")) { - particle = new ParticleLaunchSmoke(mc.theWorld, position, motion, 2.5F, false); + particle = new ParticleLaunchSmoke(mc.world, position, motion, 2.5F, false); } else if (particleID.equals("whiteSmokeLargeLaunched")) { - particle = new ParticleLaunchSmoke(mc.theWorld, position, motion, 2.5F, true); + particle = new ParticleLaunchSmoke(mc.world, position, motion, 2.5F, true); } else if (particleID.equals("launchFlameIdle")) { - particle = new ParticleLaunchFlame(mc.theWorld, position, motion, false, (EntityLivingBase) otherInfo[0]); + particle = new ParticleLaunchFlame(mc.world, position, motion, false, (EntityLivingBase) otherInfo[0]); } else if (particleID.equals("launchFlameLaunched")) { - particle = new ParticleLaunchFlame(mc.theWorld, position, motion, true, (EntityLivingBase) otherInfo[0]); + particle = new ParticleLaunchFlame(mc.world, position, motion, true, (EntityLivingBase) otherInfo[0]); } else if (particleID.equals("whiteSmokeTiny")) { - particle = new ParticleSmokeSmall(mc.theWorld, position, motion); + particle = new ParticleSmokeSmall(mc.world, position, motion); } else if (particleID.equals("oilDrip")) { - particle = new ParticleOilDrip(mc.theWorld, position.x, position.y, position.z); + particle = new ParticleOilDrip(mc.world, position.x, position.y, position.z); } if (dX * dX + dY * dY + dZ * dZ < viewDistance * viewDistance) { if (particleID.equals("oxygen")) { - particle = new ParticleOxygen(mc.theWorld, position, motion, (Vector3) otherInfo[0]); + particle = new ParticleOxygen(mc.world, position, motion, (Vector3) otherInfo[0]); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLanderFlame.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLanderFlame.java index 719d4c317e..229c55a016 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLanderFlame.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLanderFlame.java @@ -75,7 +75,7 @@ public void onUpdate() } this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); - this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.move(this.motionX, this.motionY, this.motionZ); this.particleGreen -= 0.09F; this.particleRed -= 0.09F; @@ -92,7 +92,7 @@ public void onUpdate() this.motionY *= 0.9599999785423279D; this.motionZ *= 0.9599999785423279D; - final List var3 = this.worldObj.getEntitiesWithinAABB(Entity.class, this.getEntityBoundingBox().expand(1.0D, 0.5D, 1.0D)); + final List var3 = this.world.getEntitiesWithinAABB(Entity.class, this.getBoundingBox().expand(1.0D, 0.5D, 1.0D)); if (var3 != null) { @@ -105,7 +105,7 @@ public void onUpdate() if (!var5.isDead && !var5.isBurning() && !var5.equals(this.ridingEntity)) { var5.setFire(3); - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_SET_ENTITY_FIRE, GCCoreUtil.getDimensionID(var5.worldObj), new Object[] { var5.getEntityId() })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_SET_ENTITY_FIRE, GCCoreUtil.getDimensionID(var5.world), new Object[] { var5.getEntityId() })); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchFlame.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchFlame.java index f0325222b7..d268c82f8a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchFlame.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchFlame.java @@ -84,7 +84,7 @@ public void onUpdate() this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); this.motionY += 0.001D; - this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.move(this.motionX, this.motionY, this.motionZ); this.particleGreen += 0.01F; @@ -98,7 +98,7 @@ public void onUpdate() this.motionY *= 0.9599999785423279D; this.motionZ *= 0.9599999785423279D; - final List var3 = this.worldObj.getEntitiesWithinAABB(Entity.class, this.getEntityBoundingBox().expand(1.0D, 0.5D, 1.0D)); + final List var3 = this.world.getEntitiesWithinAABB(Entity.class, this.getBoundingBox().expand(1.0D, 0.5D, 1.0D)); if (var3 != null) { @@ -111,7 +111,7 @@ public void onUpdate() if (!var5.isDead && !var5.isBurning() && !var5.equals(this.ridingEntity)) { var5.setFire(3); - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_SET_ENTITY_FIRE, GCCoreUtil.getDimensionID(var5.worldObj), new Object[] { var5.getEntityId() })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_SET_ENTITY_FIRE, GCCoreUtil.getDimensionID(var5.world), new Object[] { var5.getEntityId() })); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchSmoke.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchSmoke.java index 1202b8d0e8..92abee681f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchSmoke.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleLaunchSmoke.java @@ -84,7 +84,7 @@ public void onUpdate() } this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); - this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.move(this.motionX, this.motionY, this.motionZ); // if (this.posY == this.prevPosY) // { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleOilDrip.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleOilDrip.java index 1dbcfc18f1..3116d6edc7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleOilDrip.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleOilDrip.java @@ -51,7 +51,7 @@ public void onUpdate() this.setParticleTextureIndex(112); } - this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.move(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.9800000190734863D; this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; @@ -61,14 +61,14 @@ public void onUpdate() this.setExpired(); } - if (this.isCollided) + if (this.onGround) { this.motionX *= 0.699999988079071D; this.motionZ *= 0.699999988079071D; } BlockPos pos = new BlockPos(this.posX, this.posY, this.posZ); - IBlockState state = this.worldObj.getBlockState(pos); + IBlockState state = this.world.getBlockState(pos); Material material = state.getBlock().getMaterial(state); if (material.isLiquid() || material.isSolid()) @@ -80,7 +80,7 @@ public void onUpdate() d0 = BlockLiquid.getLiquidHeightPercent(((Integer) state.getValue(BlockLiquid.LEVEL)).intValue()); } - double d1 = MathHelper.floor_double(this.posY) + 1 - d0; + double d1 = MathHelper.floor(this.posY) + 1 - d0; if (this.posY < d1) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleSmokeSmall.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleSmokeSmall.java index e3d9ac3c41..4c06ed252b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleSmokeSmall.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleSmokeSmall.java @@ -71,7 +71,7 @@ public void onUpdate() } this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); - this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.move(this.motionX, this.motionY, this.motionZ); if (this.posY == this.prevPosY) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleSparks.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleSparks.java index f3082fd5c6..32108ac58a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleSparks.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/fx/ParticleSparks.java @@ -61,7 +61,7 @@ public void onUpdate() } this.setParticleTextureIndex(7 - this.particleAge * 8 / this.particleMaxAge); - this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.move(this.motionX, this.motionY, this.motionZ); if (this.posY == this.prevPosY) { @@ -71,7 +71,7 @@ public void onUpdate() this.setParticleTextureIndex(160 + 7 - this.particleAge * 8 / this.particleMaxAge); this.motionY -= 0.01D; - this.moveEntity(this.motionX, this.motionY, this.motionZ); + this.move(this.motionX, this.motionY, this.motionZ); this.motionX *= 0.9100000262260437D; this.motionY *= 0.9100000262260437D; this.motionZ *= 0.9100000262260437D; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java index f017526d3f..93506be2e7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/GuiHandler.java @@ -40,7 +40,7 @@ public Object getServerGuiElement(int ID, EntityPlayer player, World world, int if (playerBase == null) { - player.addChatMessage(new TextComponentString("Galacticraft player instance null server-side. This is a bug.")); + player.sendMessage(new TextComponentString("Galacticraft player instance null server-side. This is a bug.")); return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiAirLockController.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiAirLockController.java index 65e7805e9c..32a727374e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiAirLockController.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiAirLockController.java @@ -141,7 +141,7 @@ public void onSelectionChanged(GuiElementCheckbox checkbox, boolean newSelected) if (checkbox.equals(this.checkboxRedstoneSignal)) { this.controller.redstoneActivation = newSelected; - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 0, this.controller.getPos(), this.controller.redstoneActivation ? 1 : 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.world), new Object[] { 0, this.controller.getPos(), this.controller.redstoneActivation ? 1 : 0 })); // PacketDispatcher.sendPacketToServer(PacketUtil.createPacket(GalacticraftCore.CHANNEL, // EnumPacketServer.ON_ADVANCED_GUI_CLICKED_INT, new Object[] { 0, // this.controller.xCoord, this.controller.yCoord, @@ -151,7 +151,7 @@ public void onSelectionChanged(GuiElementCheckbox checkbox, boolean newSelected) else if (checkbox.equals(this.checkboxPlayerDistance)) { this.controller.playerDistanceActivation = newSelected; - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 1, this.controller.getPos(), this.controller.playerDistanceActivation ? 1 : 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.world), new Object[] { 1, this.controller.getPos(), this.controller.playerDistanceActivation ? 1 : 0 })); // PacketDispatcher.sendPacketToServer(PacketUtil.createPacket(GalacticraftCore.CHANNEL, // EnumPacketServer.ON_ADVANCED_GUI_CLICKED_INT, new Object[] { 1, // this.controller.xCoord, this.controller.yCoord, @@ -161,7 +161,7 @@ else if (checkbox.equals(this.checkboxPlayerDistance)) else if (checkbox.equals(this.checkboxOpenForPlayer)) { this.controller.playerNameMatches = newSelected; - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 3, this.controller.getPos(), this.controller.playerNameMatches ? 1 : 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.world), new Object[] { 3, this.controller.getPos(), this.controller.playerNameMatches ? 1 : 0 })); // PacketDispatcher.sendPacketToServer(PacketUtil.createPacket(GalacticraftCore.CHANNEL, // EnumPacketServer.ON_ADVANCED_GUI_CLICKED_INT, new Object[] { 3, // this.controller.xCoord, this.controller.yCoord, @@ -171,7 +171,7 @@ else if (checkbox.equals(this.checkboxOpenForPlayer)) else if (checkbox.equals(this.checkboxInvertSelection)) { this.controller.invertSelection = newSelected; - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 4, this.controller.getPos(), this.controller.invertSelection ? 1 : 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.world), new Object[] { 4, this.controller.getPos(), this.controller.invertSelection ? 1 : 0 })); // PacketDispatcher.sendPacketToServer(PacketUtil.createPacket(GalacticraftCore.CHANNEL, // EnumPacketServer.ON_ADVANCED_GUI_CLICKED_INT, new Object[] { 4, // this.controller.xCoord, this.controller.yCoord, @@ -182,7 +182,7 @@ else if (checkbox.equals(this.checkboxHorizontalMode)) { this.controller.lastHorizontalModeEnabled = this.controller.horizontalModeEnabled; this.controller.horizontalModeEnabled = newSelected; - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 5, this.controller.getPos(), this.controller.horizontalModeEnabled ? 1 : 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.world), new Object[] { 5, this.controller.getPos(), this.controller.horizontalModeEnabled ? 1 : 0 })); // PacketDispatcher.sendPacketToServer(PacketUtil.createPacket(GalacticraftCore.CHANNEL, // EnumPacketServer.ON_ADVANCED_GUI_CLICKED_INT, new Object[] { 5, // this.controller.xCoord, this.controller.yCoord, @@ -236,7 +236,7 @@ public void onSelectionChanged(GuiElementDropdown dropdown, int selection) if (dropdown.equals(this.dropdownPlayerDistance)) { this.controller.playerDistanceSelection = selection; - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 2, this.controller.getPos(), this.controller.playerDistanceSelection })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.world), new Object[] { 2, this.controller.getPos(), this.controller.playerDistanceSelection })); } } @@ -258,7 +258,7 @@ public void onTextChanged(GuiElementTextBox textBox, String newText) if (textBox.equals(this.textBoxPlayerToOpenFor)) { this.controller.playerToOpenFor = newText != null ? newText : ""; - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_STRING, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 0, this.controller.getPos(), this.controller.playerToOpenFor })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_STRING, GCCoreUtil.getDimensionID(mc.world), new Object[] { 0, this.controller.getPos(), this.controller.playerToOpenFor })); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiCargoUnloader.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiCargoUnloader.java index 882347dab0..6e164c6258 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiCargoUnloader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiCargoUnloader.java @@ -40,7 +40,7 @@ protected void actionPerformed(GuiButton par1GuiButton) switch (par1GuiButton.id) { case 0: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(this.mc.theWorld), new Object[] { this.cargoUnloader.getPos(), 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(this.mc.world), new Object[] { this.cargoUnloader.getPos(), 0 })); break; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenDistributor.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenDistributor.java index e034d0d437..6a11348fb5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenDistributor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenDistributor.java @@ -146,7 +146,7 @@ protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) public void onSelectionChanged(GuiElementCheckbox checkbox, boolean newSelected) { this.distributor.setBubbleVisible(newSelected); - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 6, this.distributor.getPos(), newSelected ? 1 : 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.world), new Object[] { 6, this.distributor.getPos(), newSelected ? 1 : 0 })); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenSealer.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenSealer.java index c604cbf3cd..bf12ec0607 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenSealer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiOxygenSealer.java @@ -48,7 +48,7 @@ protected void actionPerformed(GuiButton par1GuiButton) switch (par1GuiButton.id) { case 0: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(this.mc.theWorld), new Object[] { this.sealer.getPos(), 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(this.mc.world), new Object[] { this.sealer.getPos(), 0 })); break; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiRefinery.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiRefinery.java index f18dacd335..1992c5e62c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiRefinery.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiRefinery.java @@ -96,7 +96,7 @@ protected void actionPerformed(GuiButton par1GuiButton) switch (par1GuiButton.id) { case 0: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(this.mc.theWorld), new Object[] { this.tileEntity.getPos(), 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(this.mc.world), new Object[] { this.tileEntity.getPos(), 0 })); break; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicInput.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicInput.java index d97d71db2d..d8b8e2f22d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicInput.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSchematicInput.java @@ -61,7 +61,7 @@ protected void actionPerformed(GuiButton par1GuiButton) SchematicRegistry.flipToNextPage(this, this.pageIndex); break; case 2: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UNLOCK_NEW_SCHEMATIC, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] {})); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UNLOCK_NEW_SCHEMATIC, GCCoreUtil.getDimensionID(mc.world), new Object[] {})); break; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSolar.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSolar.java index 939f3f1919..5f1dc857b4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSolar.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/container/GuiSolar.java @@ -41,7 +41,7 @@ protected void actionPerformed(GuiButton par1GuiButton) switch (par1GuiButton.id) { case 0: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(this.mc.theWorld), new Object[] { this.solarPanel.getPos(), 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(this.mc.world), new Object[] { this.solarPanel.getPos(), 0 })); break; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiCelestialSelection.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiCelestialSelection.java index 0268b1ea9c..9d2cf032f1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiCelestialSelection.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiCelestialSelection.java @@ -609,7 +609,7 @@ protected boolean teleportToSelectedBody() { this.mc.gameSettings.thirdPersonView = 0; } - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(PacketSimple.EnumSimplePacket.S_TELEPORT_ENTITY, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { dimension })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(PacketSimple.EnumSimplePacket.S_TELEPORT_ENTITY, GCCoreUtil.getDimensionID(mc.world), new Object[] { dimension })); //TODO Some type of clientside "in Space" holding screen here while waiting for the server to do the teleport //(Otherwise the client will be returned to the destination he was in until now, which looks weird) mc.displayGuiScreen(null); @@ -684,7 +684,7 @@ protected void mouseClicked(int x, int y, int button) throws IOException { if (recipe.matches(this.mc.thePlayer, false) || this.mc.thePlayer.capabilities.isCreativeMode) { - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_BIND_SPACE_STATION_ID, GCCoreUtil.getDimensionID(this.mc.theWorld), new Object[] { this.selectedBody.getDimensionID() })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_BIND_SPACE_STATION_ID, GCCoreUtil.getDimensionID(this.mc.world), new Object[] { this.selectedBody.getDimensionID() })); //Zoom in on Overworld to show the new SpaceStation if not already zoomed if (this.selectionCount < 2) { @@ -751,7 +751,7 @@ protected void mouseClicked(int x, int y, int button) throws IOException { this.spaceStationMap.get(getSatelliteParentID(selectedSatellite)).get(strName).setStationName(this.renamingString); // this.spaceStationNames.put(strName, this.renamingString); - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_RENAME_SPACE_STATION, GCCoreUtil.getDimensionID(this.mc.theWorld), new Object[] { this.renamingString, spacestationID })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_RENAME_SPACE_STATION, GCCoreUtil.getDimensionID(this.mc.world), new Object[] { this.renamingString, spacestationID })); } this.renamingSpaceStation = false; } @@ -2111,7 +2111,7 @@ protected int getAmountInInventory(ItemStack stack) { if (SpaceStationRecipe.checkItemEquals(stack, slot)) { - amountInInv += slot.stackSize; + amountInInv += slot.getCount(); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiJoinSpaceRace.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiJoinSpaceRace.java index 468cd92184..d2e088a902 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiJoinSpaceRace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiJoinSpaceRace.java @@ -99,7 +99,7 @@ protected void actionPerformed(GuiButton buttonClicked) this.thePlayer.closeScreen(); break; case 1: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ADD_RACE_PLAYER, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { this.thePlayer.getGameProfile().getName(), this.spaceRaceData.getSpaceRaceID() })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ADD_RACE_PLAYER, GCCoreUtil.getDimensionID(mc.world), new Object[] { this.thePlayer.getGameProfile().getName(), this.spaceRaceData.getSpaceRaceID() })); this.thePlayer.closeScreen(); break; default: @@ -164,7 +164,7 @@ private void drawFlagButton(int mouseX, int mouseY) @Override public void drawWorldBackground(int i) { - if (this.mc.theWorld != null) + if (this.mc.world != null) { int scaleX = Math.min(this.ticksPassed * 14, this.width / 3); int scaleY = Math.min(this.ticksPassed * 14, this.height / 3); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiNewSpaceRace.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiNewSpaceRace.java index 14f63c6ea1..eec29091e8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiNewSpaceRace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/gui/screen/GuiNewSpaceRace.java @@ -333,7 +333,7 @@ else if (this.currentState == EnumSpaceRaceGui.ADD_PLAYER) SpaceRace race = SpaceRaceManager.getSpaceRaceFromPlayer(this.thePlayer.getGameProfile().getName()); if (race != null) { - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_INVITE_RACE_PLAYER, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { playerToInvite.value, race.getSpaceRaceID() })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_INVITE_RACE_PLAYER, GCCoreUtil.getDimensionID(mc.world), new Object[] { playerToInvite.value, race.getSpaceRaceID() })); this.recentlyInvited.put(playerToInvite.value, 20 * 60); } } @@ -346,7 +346,7 @@ else if (this.currentState == EnumSpaceRaceGui.REMOVE_PLAYER) SpaceRace race = SpaceRaceManager.getSpaceRaceFromPlayer(this.thePlayer.getGameProfile().getName()); if (race != null) { - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_REMOVE_RACE_PLAYER, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { playerToRemove.value, race.getSpaceRaceID() })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_REMOVE_RACE_PLAYER, GCCoreUtil.getDimensionID(mc.world), new Object[] { playerToRemove.value, race.getSpaceRaceID() })); } } } @@ -631,7 +631,7 @@ public void sendSpaceRaceData() objList.add(this.spaceRaceData.getFlagData()); objList.add(this.spaceRaceData.getTeamColor()); objList.add(this.spaceRaceData.getPlayerNames().toArray(new String[this.spaceRaceData.getPlayerNames().size()])); - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_START_NEW_SPACE_RACE, GCCoreUtil.getDimensionID(mc.theWorld), objList)); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_START_NEW_SPACE_RACE, GCCoreUtil.getDimensionID(mc.world), objList)); } } @@ -887,7 +887,7 @@ private void drawColorButton() @Override public void drawWorldBackground(int i) { - if (this.mc.theWorld != null) + if (this.mc.world != null) { int scaleX = Math.min(this.ticksPassed * 14, this.width / 3); int scaleY = Math.min(this.ticksPassed * 14, this.height / 3); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderTier1Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderTier1Rocket.java index 21506ac71e..2048e5665e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderTier1Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/client/render/entities/RenderTier1Rocket.java @@ -58,7 +58,7 @@ public void doRender(EntitySpaceshipBase entity, double par2, double par4, doubl if (var28 > 0.0F) { - final float i = entity.getLaunched() ? (5 - MathHelper.floor_double(entity.timeUntilLaunch / 85)) / 10F : 0.3F; + final float i = entity.getLaunched() ? (5 - MathHelper.floor(entity.timeUntilLaunch / 85)) / 10F : 0.3F; GL11.glRotatef(MathHelper.sin(var28) * var28 * i * par9, 1.0F, 0.0F, 0.0F); GL11.glRotatef(MathHelper.sin(var28) * var28 * i * par9, 1.0F, 0.0F, 1.0F); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java index 9246d6649c..73380faab3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCAstroMiner.java @@ -115,15 +115,15 @@ else if (args[0].length() > 3 && args[0].substring(0, 3).equalsIgnoreCase("set") switch (type) { case 1: - sender.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("command.gcastrominer.count", playerBase.getGameProfile().getName(), "" + stats.getAstroMinerCount()))); + sender.sendMessage(new TextComponentString(GCCoreUtil.translateWithFormat("command.gcastrominer.count", playerBase.getGameProfile().getName(), "" + stats.getAstroMinerCount()))); break; case 2: stats.setAstroMinerCount(0); - sender.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("command.gcastrominer.count", playerBase.getGameProfile().getName(), "" + 0))); + sender.sendMessage(new TextComponentString(GCCoreUtil.translateWithFormat("command.gcastrominer.count", playerBase.getGameProfile().getName(), "" + 0))); break; case 3: stats.setAstroMinerCount(newvalue); - sender.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("command.gcastrominer.count", playerBase.getGameProfile().getName(), "" + newvalue))); + sender.sendMessage(new TextComponentString(GCCoreUtil.translateWithFormat("command.gcastrominer.count", playerBase.getGameProfile().getName(), "" + newvalue))); break; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCHelp.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCHelp.java index c40669c240..7d3a055976 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCHelp.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandGCHelp.java @@ -45,6 +45,6 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args { return; } - playerBase.addChatMessage(ITextComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.help1") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki" + "\"}}]")); + playerBase.sendMessage(ITextComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.help1") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki" + "\"}}]")); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandKeepDim.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandKeepDim.java index aead3418a5..c06e36205e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandKeepDim.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandKeepDim.java @@ -67,17 +67,17 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args if (ConfigManagerCore.setLoaded(dimID)) { - playerBase.addChatMessage(new TextComponentString("[GCKeepLoaded] Successfully set dimension " + dimID + " to load staticly")); + playerBase.sendMessage(new TextComponentString("[GCKeepLoaded] Successfully set dimension " + dimID + " to load staticly")); } else { if (ConfigManagerCore.setUnloaded(dimID)) { - playerBase.addChatMessage(new TextComponentString("[GCKeepLoaded] Successfully set dimension " + dimID + " to not load staticly")); + playerBase.sendMessage(new TextComponentString("[GCKeepLoaded] Successfully set dimension " + dimID + " to not load staticly")); } else { - playerBase.addChatMessage(new TextComponentString("[GCKeepLoaded] Failed to set dimension as not static")); + playerBase.sendMessage(new TextComponentString("[GCKeepLoaded] Failed to set dimension as not static")); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java index 2d84a26815..17dae43576 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationAddOwner.java @@ -74,13 +74,13 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args if (var3.equalsIgnoreCase("+all")) { data.setAllowedAll(true); - playerBase.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.spacestation.allow_all_true"))); + playerBase.sendMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.spacestation.allow_all_true"))); return; } if (var3.equalsIgnoreCase("-all")) { data.setAllowedAll(false); - playerBase.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.spacestation.allow_all_false", var3))); + playerBase.sendMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.spacestation.allow_all_false", var3))); return; } @@ -96,7 +96,7 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args if (playerToAdd != null) { - playerToAdd.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.spacestation.added", playerBase.getGameProfile().getName()))); + playerToAdd.sendMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.spacestation.added", playerBase.getGameProfile().getName()))); } } } @@ -113,7 +113,7 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args if (playerBase != null) { - playerBase.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.spacestation.addsuccess", var3))); + playerBase.sendMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.spacestation.addsuccess", var3))); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationChangeOwner.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationChangeOwner.java index df8e682140..6ce3f7e55d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationChangeOwner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationChangeOwner.java @@ -107,7 +107,7 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args if (playerAdmin != null) { - playerAdmin.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.spacestation.changesuccess", oldOwner, newOwner))); + playerAdmin.sendMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.spacestation.changesuccess", oldOwner, newOwner))); } else //Console diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java index d8bb895afa..f10a117e61 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/command/CommandSpaceStationRemoveOwner.java @@ -107,7 +107,7 @@ public void execute(MinecraftServer server, ICommandSender sender, String[] args if (playerBase != null) { - playerBase.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.spacestation.removesuccess", var3))); + playerBase.sendMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.spacestation.removesuccess", var3))); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceRaceManager.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceRaceManager.java index 5f9d91dee7..dae9ce73e4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceRaceManager.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpaceRaceManager.java @@ -170,7 +170,7 @@ public static void onPlayerRemoval(String player, SpaceRace race) if (memberObj != null) { - memberObj.addChatMessage(new TextComponentString(EnumColor.DARK_AQUA + GCCoreUtil.translateWithFormat("gui.space_race.chat.remove_success", EnumColor.RED + player + EnumColor.DARK_AQUA)).setStyle(new Style().setColor(TextFormatting.DARK_AQUA))); + memberObj.sendMessage(new TextComponentString(EnumColor.DARK_AQUA + GCCoreUtil.translateWithFormat("gui.space_race.chat.remove_success", EnumColor.RED + player + EnumColor.DARK_AQUA)).setStyle(new Style().setColor(TextFormatting.DARK_AQUA))); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java index 5a8cd0c193..45258f755a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/SpinManager.java @@ -618,7 +618,7 @@ private void moveRotatedEntity(Entity e, double rotationCentreX, double rotation e.lastTickPosZ += offsetZ; //Rotated into an unloaded chunk (probably also drifted out to there): byebye - if (!e.worldObj.isBlockLoaded(new BlockPos(MathHelper.floor_double(e.posX), 64, MathHelper.floor_double(e.posZ)))) + if (!e.worldObj.isBlockLoaded(new BlockPos(MathHelper.floor(e.posX), 64, MathHelper.floor(e.posZ)))) { e.setDead(); return; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeMoon.java index 67b6856464..1a460aaf6a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeMoon.java @@ -94,7 +94,7 @@ public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boole if (!newWorld.isRemote) { - newWorld.spawnEntityInWorld(lander); + newWorld.spawnEntity(lander); } stats.setTeleportCooldown(10); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeSpaceStation.java b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeSpaceStation.java index 327df9587e..a7021b6e3a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeSpaceStation.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/dimension/TeleportTypeSpaceStation.java @@ -44,7 +44,7 @@ public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boole { if (ConfigManagerCore.spaceStationsRequirePermission && !newWorld.isRemote) { - player.addChatMessage(new TextComponentString(EnumColor.YELLOW + GCCoreUtil.translate("gui.spacestation.type_command") + " " + EnumColor.AQUA + "/ssinvite " + GCCoreUtil.translate("gui.spacestation.playername") + " " + EnumColor.YELLOW + GCCoreUtil.translate("gui.spacestation.to_allow_entry"))); + player.sendMessage(new TextComponentString(EnumColor.YELLOW + GCCoreUtil.translate("gui.spacestation.type_command") + " " + EnumColor.AQUA + "/ssinvite " + GCCoreUtil.translate("gui.spacestation.playername") + " " + EnumColor.YELLOW + GCCoreUtil.translate("gui.spacestation.to_allow_entry"))); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java index 1db7019f6b..c9aa5aaa88 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlock.java @@ -210,9 +210,9 @@ public EnumSet getElectricalInputDirections() return EnumSet.of(this.getElectricInputDirection()); } - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUsableByPlayer(EntityPlayer entityplayer) { - return this.worldObj.getTileEntity(this.getPos()) == this && entityplayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; + return this.getWorld().getTileEntity(this.getPos()) == this && entityplayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlockWithInventory.java b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlockWithInventory.java index 04b0ef29e3..f47709dfb0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlockWithInventory.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/energy/tile/TileBaseElectricBlockWithInventory.java @@ -2,124 +2,80 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ItemStackHelper; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; public abstract class TileBaseElectricBlockWithInventory extends TileBaseElectricBlock implements IInventory { - public ItemStack[] readStandardItemsFromNBT(NBTTagCompound nbt) + public NonNullList readStandardItemsFromNBT(NBTTagCompound nbt) { - final NBTTagList var2 = nbt.getTagList("Items", 10); - int length = this.getSizeInventory(); - ItemStack[] result = new ItemStack[length]; - - for (int var3 = 0; var3 < var2.tagCount(); ++var3) - { - final NBTTagCompound var4 = var2.getCompoundTagAt(var3); - final int var5 = var4.getByte("Slot") & 255; - - if (var5 < length) - { - result[var5] = ItemStack.loadItemStackFromNBT(var4); - } - } - return result; + NonNullList stacks = NonNullList.withSize(this.getSizeInventory(), ItemStack.EMPTY); + ItemStackHelper.loadAllItems(nbt, stacks); + return stacks; } - public void writeStandardItemsToNBT(NBTTagCompound nbt) + public void writeStandardItemsToNBT(NBTTagCompound nbt, NonNullList stacks) { - final NBTTagList list = new NBTTagList(); - int length = this.getSizeInventory(); - ItemStack containingItems[] = this.getContainingItems(); + ItemStackHelper.saveAllItems(nbt, stacks); + } - for (int var3 = 0; var3 < length; ++var3) + @Override + public boolean isEmpty() + { + for (ItemStack itemstack : this.getContainingItems()) { - if (containingItems[var3] != null) + if (!itemstack.isEmpty()) { - final NBTTagCompound var4 = new NBTTagCompound(); - var4.setByte("Slot", (byte) var3); - containingItems[var3].writeToNBT(var4); - list.appendTag(var4); + return false; } } - nbt.setTag("Items", list); + return true; } @Override public int getSizeInventory() { - return this.getContainingItems().length; + return this.getContainingItems().size(); } @Override - public ItemStack getStackInSlot(int par1) + public ItemStack getStackInSlot(int index) { - return this.getContainingItems()[par1]; + return this.getContainingItems().get(index); } @Override - public ItemStack decrStackSize(int par1, int par2) + public ItemStack decrStackSize(int index, int count) { - ItemStack containingItems[] = this.getContainingItems(); - if (containingItems[par1] != null) - { - ItemStack var3; - - if (containingItems[par1].stackSize <= par2) - { - var3 = containingItems[par1]; - containingItems[par1] = null; - this.markDirty(); - return var3; - } - else - { - var3 = containingItems[par1].splitStack(par2); - - if (containingItems[par1].stackSize == 0) - { - containingItems[par1] = null; - } + ItemStack itemstack = ItemStackHelper.getAndSplit(this.getContainingItems(), index, count); - this.markDirty(); - return var3; - } - } - else + if (!itemstack.isEmpty()) { - return null; + this.markDirty(); } + + return itemstack; } @Override - public ItemStack removeStackFromSlot(int par1) + public ItemStack removeStackFromSlot(int index) { - ItemStack containingItems[] = this.getContainingItems(); - if (containingItems[par1] != null) - { - final ItemStack var2 = containingItems[par1]; - containingItems[par1] = null; - this.markDirty(); - return var2; - } - else - { - return null; - } + return ItemStackHelper.getAndRemove(this.getContainingItems(), index); } @Override - public void setInventorySlotContents(int par1, ItemStack par2ItemStack) + public void setInventorySlotContents(int index, ItemStack stack) { - ItemStack containingItems[] = this.getContainingItems(); - containingItems[par1] = par2ItemStack; + this.getContainingItems().set(index, stack); - if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) + if (stack.getCount() > this.getInventoryStackLimit()) { - par2ItemStack.stackSize = this.getInventoryStackLimit(); + stack.setCount(this.getInventoryStackLimit()); } this.markDirty(); @@ -132,9 +88,9 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { - return this.worldObj.getTileEntity(this.getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; + return this.getWorld().getTileEntity(this.getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } @Override @@ -152,7 +108,7 @@ public ItemStack getBatteryInSlot() /* * Must be overridden by identical code, to get the actual containingItems */ - abstract protected ItemStack[] getContainingItems(); + abstract protected NonNullList getContainingItems(); @Override public void openInventory(EntityPlayer player) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAlienVillager.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAlienVillager.java index db76ff9856..d2ce3abc94 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAlienVillager.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityAlienVillager.java @@ -182,7 +182,7 @@ public boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable Ite IStatsCapability stats = playerMP.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); if (stats.getChatCooldown() == 0) { - player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.village.warning.no_freq_mod"))); + player.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.village.warning.no_freq_mod"))); stats.setChatCooldown(20); } } @@ -405,12 +405,12 @@ public void useRecipe(MerchantRecipe recipe) if (recipe.getItemToBuy().getItem() == Items.EMERALD) { - this.wealth += recipe.getItemToBuy().stackSize; + this.wealth += recipe.getItemToBuy().getCount(); } if (recipe.getRewardsExp()) { - this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY + 0.5D, this.posZ, i)); + this.worldObj.spawnEntity(new EntityXPOrb(this.worldObj, this.posX, this.posY + 0.5D, this.posZ, i)); } } @@ -546,7 +546,7 @@ public void onStruckByLightning(EntityLightningBolt lightningBolt) entitywitch.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag()); } - this.worldObj.spawnEntityInWorld(entitywitch); + this.worldObj.spawnEntity(entitywitch); this.setDead(); } } @@ -572,7 +572,7 @@ protected void updateEquipmentIfNeeded(EntityItem itemEntity) } else { - itemstack.stackSize = itemstack1.stackSize; + itemstack.stackSize = itemstack1.getCount(); } } } @@ -605,12 +605,12 @@ private boolean hasEnoughItems(int multiplier) if (itemstack != null) { - if (itemstack.getItem() == Items.BREAD && itemstack.stackSize >= 3 * multiplier || itemstack.getItem() == Items.POTATO && itemstack.stackSize >= 12 * multiplier || itemstack.getItem() == Items.CARROT && itemstack.stackSize >= 12 * multiplier) + if (itemstack.getItem() == Items.BREAD && itemstack.getCount() >= 3 * multiplier || itemstack.getItem() == Items.POTATO && itemstack.getCount() >= 12 * multiplier || itemstack.getItem() == Items.CARROT && itemstack.getCount() >= 12 * multiplier) { return true; } - if (itemstack.getItem() == Items.WHEAT && itemstack.stackSize >= 9 * multiplier) + if (itemstack.getItem() == Items.WHEAT && itemstack.getCount() >= 9 * multiplier) { return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java index a5d93b16b3..89ecfcfcff 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBossBase.java @@ -89,7 +89,7 @@ protected void onDeathUpdate() { j = EntityXPOrb.getXPSplit(i); i -= j; - this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); + this.worldObj.spawnEntity(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); } } } @@ -102,7 +102,7 @@ protected void onDeathUpdate() { j = EntityXPOrb.getXPSplit(i); i -= j; - this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); + this.worldObj.spawnEntity(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); } TileEntityTreasureChest chest = null; @@ -192,7 +192,7 @@ public void onLivingUpdate() for (EntityPlayer p : entitiesWithin2) { - p.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.skeleton_boss.message"))); + p.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.skeleton_boss.message"))); } this.setDead(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBuggy.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBuggy.java index 1f714c67e0..7516dabd23 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBuggy.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityBuggy.java @@ -430,7 +430,7 @@ public void onUpdate() { double d = this.motionX * this.motionX + this.motionZ * this.motionZ; - if (d != 0 && this.ticks % (MathHelper.floor_double(2 / d) + 1) == 0) + if (d != 0 && this.ticks % (MathHelper.floor(2 / d) + 1) == 0) { this.removeFuel(1); } @@ -541,7 +541,7 @@ public ItemStack decrStackSize(int var1, int var2) { ItemStack var3; - if (this.cargoItems[var1].stackSize <= var2) + if (this.cargoItems[var1].getCount() <= var2) { var3 = this.cargoItems[var1]; this.cargoItems[var1] = null; @@ -551,7 +551,7 @@ public ItemStack decrStackSize(int var1, int var2) { var3 = this.cargoItems[var1].splitStack(var2); - if (this.cargoItems[var1].stackSize == 0) + if (this.cargoItems[var1].getCount() == 0) { this.cargoItems[var1] = null; } @@ -585,7 +585,7 @@ public void setInventorySlotContents(int var1, ItemStack var2) { this.cargoItems[var1] = var2; - if (var2 != null && var2.stackSize > this.getInventoryStackLimit()) + if (var2 != null && var2.getCount() > this.getInventoryStackLimit()) { var2.stackSize = this.getInventoryStackLimit(); } @@ -604,7 +604,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer var1) + public boolean isUsableByPlayer(EntityPlayer var1) { return !this.isDead && var1.getDistanceSqToEntity(this) <= 64.0D; } @@ -631,10 +631,10 @@ public boolean processInitialInteract(EntityPlayer player, ItemStack stack, Enum { if (this.getPassengers().isEmpty()) { - player.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.leftKey.getKeyCode()) + " / " + GameSettings.getKeyDisplayString(KeyHandlerClient.rightKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.turn.name"))); - player.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.accelerateKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.accel.name"))); - player.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.decelerateKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.decel.name"))); - player.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.openFuelGui.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.inv.name"))); + player.sendMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.leftKey.getKeyCode()) + " / " + GameSettings.getKeyDisplayString(KeyHandlerClient.rightKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.turn.name"))); + player.sendMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.accelerateKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.accel.name"))); + player.sendMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.decelerateKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.decel.name"))); + player.sendMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.openFuelGui.getKeyCode()) + " - " + GCCoreUtil.translate("gui.buggy.inv.name"))); } return true; @@ -723,13 +723,13 @@ public EnumCargoLoadingState addCargo(ItemStack stack, boolean doAdd) { ItemStack stackAt = this.cargoItems[count]; - if (stackAt != null && stackAt.getItem() == stack.getItem() && stackAt.getItemDamage() == stack.getItemDamage() && stackAt.stackSize < stackAt.getMaxStackSize()) + if (stackAt != null && stackAt.getItem() == stack.getItem() && stackAt.getItemDamage() == stack.getItemDamage() && stackAt.getCount() < stackAt.getMaxStackSize()) { - if (stackAt.stackSize + stack.stackSize <= stackAt.getMaxStackSize()) + if (stackAt.getCount() + stack.getCount() <= stackAt.getMaxStackSize()) { if (doAdd) { - this.cargoItems[count].stackSize += stack.stackSize; + this.cargoItems[count].stackSize += stack.getCount(); this.markDirty(); } @@ -738,12 +738,12 @@ public EnumCargoLoadingState addCargo(ItemStack stack, boolean doAdd) else { //Part of the stack can fill this slot but there will be some left over - int origSize = stackAt.stackSize; - int surplus = origSize + stack.stackSize - stackAt.getMaxStackSize(); + int origSize = stackAt.getCount(); + int surplus = origSize + stack.getCount() - stackAt.getMaxStackSize(); if (doAdd) { - this.cargoItems[count].stackSize = stackAt.getMaxStackSize(); + this.cargoItems[count].getCount() = stackAt.getMaxStackSize(); this.markDirty(); } @@ -790,7 +790,7 @@ public RemovalResult removeCargo(boolean doRemove) ItemStack resultStack = stackAt.copy(); resultStack.stackSize = 1; - if (doRemove && --stackAt.stackSize <= 0) + if (doRemove && --stackAt.getCount() <= 0) { this.cargoItems[i] = null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSkeleton.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSkeleton.java index 477f9c8c27..40eedcc15b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSkeleton.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSkeleton.java @@ -98,7 +98,7 @@ else if (this.getSkeletonType() == SkeletonType.STRAY) } this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); - this.worldObj.spawnEntityInWorld(entitytippedarrow); + this.worldObj.spawnEntity(entitytippedarrow); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSpider.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSpider.java index ac1e60130c..84a31ce9bf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSpider.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityEvolvedSpider.java @@ -58,7 +58,7 @@ public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLi EntitySkeleton entityskeleton = new EntitySkeleton(this.worldObj); entityskeleton.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); entityskeleton.onInitialSpawn(difficulty, (IEntityLivingData)null); - this.worldObj.spawnEntityInWorld(entityskeleton); + this.worldObj.spawnEntity(entityskeleton); entityskeleton.startRiding(this); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java index 6ff4424a3b..93e193f2c3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityParachest.java @@ -114,9 +114,9 @@ public void onUpdate() { for (int i = 0; i < 100; i++) { - final int x = MathHelper.floor_double(this.posX); - final int y = MathHelper.floor_double(this.posY); - final int z = MathHelper.floor_double(this.posZ); + final int x = MathHelper.floor(this.posX); + final int y = MathHelper.floor(this.posY); + final int z = MathHelper.floor(this.posZ); BlockPos pos = new BlockPos(x, y + i, z); IBlockState state = this.worldObj.getBlockState(pos); @@ -134,7 +134,7 @@ else if (this.cargo != null) for (final ItemStack stack : this.cargo) { final EntityItem e = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, stack); - this.worldObj.spawnEntityInWorld(e); + this.worldObj.spawnEntity(e); } return; @@ -147,7 +147,7 @@ else if (this.cargo != null) for (final ItemStack stack : this.cargo) { final EntityItem e = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, stack); - this.worldObj.spawnEntityInWorld(e); + this.worldObj.spawnEntity(e); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntitySkeletonBoss.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntitySkeletonBoss.java index 312b7a801d..6f268a1493 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntitySkeletonBoss.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntitySkeletonBoss.java @@ -282,7 +282,7 @@ public EntityItem entityDropItem(ItemStack par1ItemStack, float par2) } else { - this.worldObj.spawnEntityInWorld(entityitem); + this.worldObj.spawnEntity(entityitem); } return entityitem; } @@ -329,7 +329,7 @@ public void attackEntityWithRangedAttack(EntityLivingBase target, float f) arrow.setThrowableHeading(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float)(14 - this.worldObj.getDifficulty().getDifficultyId() * 4)); this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); - this.worldObj.spawnEntityInWorld(arrow); + this.worldObj.spawnEntity(arrow); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityTier1Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityTier1Rocket.java index f6bbb1a6b2..fb677216b0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityTier1Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/EntityTier1Rocket.java @@ -115,7 +115,7 @@ public void onUpdate() } } - if (this.timeSinceLaunch % MathHelper.floor_double(3 * (1 / multiplier)) == 0) + if (this.timeSinceLaunch % MathHelper.floor(3 * (1 / multiplier)) == 0) { this.removeFuel(1); if (!this.hasValidFuel()) @@ -206,7 +206,7 @@ protected void spawnParticles(boolean launched) } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return !this.isDead && par1EntityPlayer.getDistanceSqToEntity(this) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/InventoryEntity.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/InventoryEntity.java index b016f94118..eeaae53d46 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/InventoryEntity.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/InventoryEntity.java @@ -66,7 +66,7 @@ public ItemStack decrStackSize(int slotIndex, int amount) { ItemStack var3; - if (this.containedItems[slotIndex].stackSize <= amount) + if (this.containedItems[slotIndex].getCount() <= amount) { var3 = this.containedItems[slotIndex]; this.containedItems[slotIndex] = null; @@ -76,7 +76,7 @@ public ItemStack decrStackSize(int slotIndex, int amount) { var3 = this.containedItems[slotIndex].splitStack(amount); - if (this.containedItems[slotIndex].stackSize == 0) + if (this.containedItems[slotIndex].getCount() == 0) { this.containedItems[slotIndex] = null; } @@ -110,7 +110,7 @@ public void setInventorySlotContents(int slotIndex, ItemStack stack) { this.containedItems[slotIndex] = stack; - if (stack != null && stack.stackSize > this.getInventoryStackLimit()) + if (stack != null && stack.getCount() > this.getInventoryStackLimit()) { stack.stackSize = this.getInventoryStackLimit(); } @@ -129,7 +129,7 @@ public void markDirty() } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUsableByPlayer(EntityPlayer entityplayer) { return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java index 678fc0dfc2..5366c6a122 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/FreefallHandler.java @@ -46,8 +46,8 @@ public boolean testFreefall(EntityPlayer player) { //Test whether feet are on a block, also stops the login glitch int playerFeetOnY = (int) (player.getEntityBoundingBox().minY - 0.01D); - int xx = MathHelper.floor_double(player.posX); - int zz = MathHelper.floor_double(player.posZ); + int xx = MathHelper.floor(player.posX); + int zz = MathHelper.floor(player.posZ); BlockPos pos = new BlockPos(xx, playerFeetOnY, zz); IBlockState state = player.worldObj.getBlockState(pos); Block b = state.getBlock(); @@ -153,12 +153,12 @@ private boolean testFreefall(EntityPlayerSP p, boolean flag) //Check if the player's bounding box is in the same block coordinates as any non-vacuum block (including torches etc) //If so, it's assumed the player has something close enough to grab onto, so is not in freefall //Note: breatheable air here means the player is definitely not in freefall - int xm = MathHelper.floor_double(playerReach.minX); - int xx = MathHelper.floor_double(playerReach.maxX); - int ym = MathHelper.floor_double(playerReach.minY); - int yy = MathHelper.floor_double(playerReach.maxY); - int zm = MathHelper.floor_double(playerReach.minZ); - int zz = MathHelper.floor_double(playerReach.maxZ); + int xm = MathHelper.floor(playerReach.minX); + int xx = MathHelper.floor(playerReach.maxX); + int ym = MathHelper.floor(playerReach.minY); + int yy = MathHelper.floor(playerReach.maxY); + int zm = MathHelper.floor(playerReach.minZ); + int zz = MathHelper.floor(playerReach.maxZ); for (int x = xm; x <= xx; x++) { for (int y = ym; y <= yy; y++) @@ -200,36 +200,36 @@ private boolean testFreefall(EntityPlayerSP p, boolean flag) } else quadrant = (zd<0) ? 3 : 1; - int ymin = MathHelper.floor_double(p.boundingBox.minY)-1; - int ymax = MathHelper.floor_double(p.boundingBox.maxY); + int ymin = MathHelper.floor(p.boundingBox.minY)-1; + int ymax = MathHelper.floor(p.boundingBox.maxY); int xmin, xmax, zmin, zmax; switch (quadrant) { case 0: - xmin = MathHelper.floor_double(p.boundingBox.maxX); + xmin = MathHelper.floor(p.boundingBox.maxX); xmax = this.ssBoundsMaxX - 1; - zmin = MathHelper.floor_double(p.boundingBox.minZ)-1; - zmax = MathHelper.floor_double(p.boundingBox.maxZ)+1; + zmin = MathHelper.floor(p.boundingBox.minZ)-1; + zmax = MathHelper.floor(p.boundingBox.maxZ)+1; break; case 1: - xmin = MathHelper.floor_double(p.boundingBox.minX)-1; - xmax = MathHelper.floor_double(p.boundingBox.maxX)+1; - zmin = MathHelper.floor_double(p.boundingBox.maxZ); + xmin = MathHelper.floor(p.boundingBox.minX)-1; + xmax = MathHelper.floor(p.boundingBox.maxX)+1; + zmin = MathHelper.floor(p.boundingBox.maxZ); zmax = this.ssBoundsMaxZ - 1; break; case 2: - zmin = MathHelper.floor_double(p.boundingBox.minZ)-1; - zmax = MathHelper.floor_double(p.boundingBox.maxZ)+1; + zmin = MathHelper.floor(p.boundingBox.minZ)-1; + zmax = MathHelper.floor(p.boundingBox.maxZ)+1; xmin = this.ssBoundsMinX; - xmax = MathHelper.floor_double(p.boundingBox.minX); + xmax = MathHelper.floor(p.boundingBox.minX); break; case 3: default: - xmin = MathHelper.floor_double(p.boundingBox.minX)-1; - xmax = MathHelper.floor_double(p.boundingBox.maxX)+1; + xmin = MathHelper.floor(p.boundingBox.minX)-1; + xmax = MathHelper.floor(p.boundingBox.maxX)+1; zmin = this.ssBoundsMinZ; - zmax = MathHelper.floor_double(p.boundingBox.minZ); + zmax = MathHelper.floor(p.boundingBox.minZ); break; } @@ -667,15 +667,15 @@ public static boolean testEntityFreefall(World worldObj, AxisAlignedBB entityBou //Check if the entity's bounding box is in the same block coordinates as any non-vacuum block (including torches etc) //If so, it's assumed the entity has something close enough to catch onto, so is not in freefall //Note: breatheable air here means the entity is definitely not in freefall - int xmx = MathHelper.floor_double(entityBoundingBox.maxX + 0.2D); - int ym = MathHelper.floor_double(entityBoundingBox.minY - 0.1D); - int yy = MathHelper.floor_double(entityBoundingBox.maxY + 0.1D); - int zm = MathHelper.floor_double(entityBoundingBox.minZ - 0.2D); - int zz = MathHelper.floor_double(entityBoundingBox.maxZ + 0.2D); + int xmx = MathHelper.floor(entityBoundingBox.maxX + 0.2D); + int ym = MathHelper.floor(entityBoundingBox.minY - 0.1D); + int yy = MathHelper.floor(entityBoundingBox.maxY + 0.1D); + int zm = MathHelper.floor(entityBoundingBox.minZ - 0.2D); + int zz = MathHelper.floor(entityBoundingBox.maxZ + 0.2D); if (ym < 0) ym = 0; if (yy > 255) yy = 255; - for (int x = MathHelper.floor_double(entityBoundingBox.minX - 0.2D); x <= xmx; x++) + for (int x = MathHelper.floor(entityBoundingBox.minX - 0.2D); x <= xmx; x++) { for (int z = zm; z <= zz; z++) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java index 906c178d2d..4eab152ea0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerHandler.java @@ -548,8 +548,8 @@ protected void checkThermalStatus(EntityPlayerMP player, IStatsCapability player if (absThermalLevelMod > 0D) { - int thermalLevelCooldownBase = Math.abs(MathHelper.floor_double(200 / thermalLevelMod)); - int normaliseCooldown = Math.abs(MathHelper.floor_double(150 / lowestThermalStrength)); + int thermalLevelCooldownBase = Math.abs(MathHelper.floor(200 / thermalLevelMod)); + int normaliseCooldown = Math.abs(MathHelper.floor(150 / lowestThermalStrength)); int thermalLevelTickCooldown = thermalLevelCooldownBase; if (thermalLevelTickCooldown < 1) { @@ -560,7 +560,7 @@ protected void checkThermalStatus(EntityPlayerMP player, IStatsCapability player { thermalLevelMod /= Math.max(1.0F, lowestThermalStrength / 2.0F); absThermalLevelMod = Math.abs(thermalLevelMod); - normaliseCooldown = MathHelper.floor_double(normaliseCooldown / absThermalLevelMod); + normaliseCooldown = MathHelper.floor(normaliseCooldown / absThermalLevelMod); if (normaliseCooldown < 1) { normaliseCooldown = 1; //Prevent divide by zero errors @@ -600,7 +600,7 @@ protected void checkThermalStatus(EntityPlayerMP player, IStatsCapability player // Instead of increasing/decreasing the thermal level by a large amount every ~200 ticks, increase/decrease // by a small amount each time (still the same average increase/decrease) - int thermalLevelTickCooldownSingle = MathHelper.floor_double(thermalLevelTickCooldown / absThermalLevelMod); + int thermalLevelTickCooldownSingle = MathHelper.floor(thermalLevelTickCooldown / absThermalLevelMod); if (thermalLevelTickCooldownSingle < 1) { thermalLevelTickCooldownSingle = 1; //Prevent divide by zero errors @@ -873,7 +873,7 @@ protected void throwMeteors(EntityPlayerMP player) if (!world.isRemote) { - world.spawnEntityInWorld(meteor); + world.spawnEntity(meteor); } } } @@ -896,7 +896,7 @@ protected void throwMeteors(EntityPlayerMP player) if (!world.isRemote) { - world.spawnEntityInWorld(meteor); + world.spawnEntity(meteor); } } } @@ -926,7 +926,7 @@ protected void checkCurrentItem(EntityPlayerMP player) } if (torchItem != null) { - player.inventory.mainInventory[player.inventory.currentItem] = new ItemStack(torchItem, theCurrentItem.stackSize, 0); + player.inventory.mainInventory[player.inventory.currentItem] = new ItemStack(torchItem, theCurrentItem.getCount(), 0); } } } @@ -939,7 +939,7 @@ protected void checkCurrentItem(EntityPlayerMP player) Item torchItem = torchItems.get(theCurrentItem.getItem()); if (torchItem != null) { - player.inventory.mainInventory[player.inventory.currentItem] = new ItemStack(torchItem, theCurrentItem.stackSize, 0); + player.inventory.mainInventory[player.inventory.currentItem] = new ItemStack(torchItem, theCurrentItem.getCount(), 0); } } } @@ -980,9 +980,9 @@ protected static void updateFeet(EntityPlayerMP player, double motionX, double m double motionSqrd = motionX * motionX + motionZ * motionZ; if (motionSqrd > 0.001D && !player.capabilities.isFlying) { - int iPosX = MathHelper.floor_double(player.posX); - int iPosY = MathHelper.floor_double(player.posY) - 1; - int iPosZ = MathHelper.floor_double(player.posZ); + int iPosX = MathHelper.floor(player.posX); + int iPosY = MathHelper.floor(player.posY) - 1; + int iPosZ = MathHelper.floor(player.posZ); // If the block below is the moon block IBlockState state = player.worldObj.getBlockState(new BlockPos(iPosX, iPosY, iPosZ)); @@ -997,7 +997,7 @@ protected static void updateFeet(EntityPlayerMP player, double motionX, double m { Vector3 pos = new Vector3(player); // Set the footprint position to the block below and add random number to stop z-fighting - pos.y = MathHelper.floor_double(player.posY - 1D) + player.worldObj.rand.nextFloat() / 100.0F; + pos.y = MathHelper.floor(player.posY - 1D) + player.worldObj.rand.nextFloat() / 100.0F; // Adjust footprint to left or right depending on step count switch (stats.getLastStep()) @@ -1189,7 +1189,7 @@ public void onPlayerUpdate(EntityPlayerMP player) { GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_RESET_THIRD_PERSON, GCCoreUtil.getDimensionID(player.worldObj), new Object[] {}), player); } - worldNew.spawnEntityInWorld(player); + worldNew.spawnEntity(player); player.setWorld(worldNew); } @@ -1319,9 +1319,9 @@ public void onPlayerUpdate(EntityPlayerMP player) if (player.getBedLocation(GCCoreUtil.getDimensionID(player.worldObj)) == null || stats.isNewAdventureSpawn()) { int i = 30000000; - int j = Math.min(i, Math.max(-i, MathHelper.floor_double(player.posX + 0.5D))); - int k = Math.min(256, Math.max(0, MathHelper.floor_double(player.posY + 1.5D))); - int l = Math.min(i, Math.max(-i, MathHelper.floor_double(player.posZ + 0.5D))); + int j = Math.min(i, Math.max(-i, MathHelper.floor(player.posX + 0.5D))); + int k = Math.min(256, Math.max(0, MathHelper.floor(player.posY + 1.5D))); + int l = Math.min(i, Math.max(-i, MathHelper.floor(player.posZ + 0.5D))); BlockPos coords = new BlockPos(j, k, l); player.setSpawnChunk(coords, true, GCCoreUtil.getDimensionID(player.worldObj)); stats.setNewAdventureSpawn(false); @@ -1371,7 +1371,7 @@ public void onPlayerUpdate(EntityPlayerMP player) if (!player.worldObj.isRemote) { - player.worldObj.spawnEntityInWorld(chest); + player.worldObj.spawnEntity(chest); } } } @@ -1405,7 +1405,7 @@ public void onPlayerUpdate(EntityPlayerMP player) { sb.append(" ").append(EnumColor.YELLOW).append(aString2); } - player.addChatMessage(new TextComponentString(EnumColor.YELLOW + GCCoreUtil.translate("gui.frequencymodule.warning0") + " " + EnumColor.AQUA + GCItems.basicItem.getItemStackDisplayName(new ItemStack(GCItems.basicItem, 1, 19)) + sb.toString())); + player.sendMessage(new TextComponentString(EnumColor.YELLOW + GCCoreUtil.translate("gui.frequencymodule.warning0") + " " + EnumColor.AQUA + GCItems.basicItem.getItemStackDisplayName(new ItemStack(GCItems.basicItem, 1, 19)) + sb.toString())); stats.setReceivedSoundWarning(true); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStats.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStats.java index cf4b318068..7236828078 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStats.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/GCPlayerStats.java @@ -342,7 +342,7 @@ // if (nbt.hasKey("LaunchpadStack")) // { // this.launchpadStack = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("LaunchpadStack")); -// if (this.launchpadStack != null && this.launchpadStack.stackSize == 0) +// if (this.launchpadStack != null && this.launchpadStack.getCount() == 0) // { // this.launchpadStack = null; // } @@ -405,7 +405,7 @@ // final GCPlayerStats GCPlayer = GCPlayerStats.get(player); // if (!GCPlayer.receivedBedWarning) // { -// player.addChatMessage(new ChatComponentText(GCCoreUtil.translate("gui.bed_fail.message"))); +// player.sendMessage(new ChatComponentText(GCCoreUtil.translate("gui.bed_fail.message"))); // GCPlayer.receivedBedWarning = true; // } // } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java index eda15125c2..6dde1e1770 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/PlayerClient.java @@ -303,7 +303,7 @@ private void updateFeet(EntityPlayerSP player, double motionX, double motionZ) { Vector3 pos = new Vector3(player); // Set the footprint position to the block below and add random number to stop z-fighting - pos.y = MathHelper.floor_double(player.posY) + player.getRNG().nextFloat() / 100.0F; + pos.y = MathHelper.floor(player.posY) + player.getRNG().nextFloat() / 100.0F; // Adjust footprint to left or right depending on step count switch (stats.getLastStep()) @@ -384,19 +384,19 @@ public void onBuild(int i, EntityPlayerSP player) case 1: case 2: case 3: - player.addChatMessage(ITextComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.help1") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/1" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/1" + "\"}}]")); - player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.help1a") + EnumColor.AQUA + " /gchelp")); + player.sendMessage(ITextComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.help1") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/1" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/1" + "\"}}]")); + player.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.message.help1a") + EnumColor.AQUA + " /gchelp")); break; case 4: case 5: case 6: - player.addChatMessage(ITextComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.help2") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/2" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/2" + "\"}}]")); + player.sendMessage(ITextComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.help2") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/2" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/2" + "\"}}]")); break; case 7: - player.addChatMessage(ITextComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.help3") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/oil" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/oil" + "\"}}]")); + player.sendMessage(ITextComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.help3") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/oil" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/oil" + "\"}}]")); break; case 8: - player.addChatMessage(ITextComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.prelaunch") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/pre" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/pre" + "\"}}]")); + player.sendMessage(ITextComponent.Serializer.jsonToComponent("[{\"text\":\"" + GCCoreUtil.translate("gui.message.prelaunch") + ": \",\"color\":\"white\"}," + "{\"text\":\" " + EnumColor.BRIGHT_GREEN + "wiki." + Constants.PREFIX + "com/wiki/pre" + "\"," + "\"color\":\"green\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":" + "{\"text\":\"" + GCCoreUtil.translate("gui.message.clicklink") + "\",\"color\":\"yellow\"}}," + "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + "http://wiki." + Constants.PREFIX + "com/wiki/pre" + "\"}}]")); break; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsCapability.java b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsCapability.java index 5a1178ef3d..587821b9b3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsCapability.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/entities/player/StatsCapability.java @@ -1171,7 +1171,7 @@ public void loadNBTData(NBTTagCompound nbt) if (nbt.hasKey("LaunchpadStack")) { this.launchpadStack = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("LaunchpadStack")); - if (this.launchpadStack != null && this.launchpadStack.stackSize == 0) + if (this.launchpadStack != null && this.launchpadStack.getCount() == 0) { this.launchpadStack = null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java index a4d114a10b..5d59efec82 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/event/EventHandlerGC.java @@ -251,7 +251,7 @@ public void onPlayerRightClickedBlock(PlayerInteractEvent.RightClickBlock event) IStatsCapability stats = event.getEntityPlayer().getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); if (!stats.hasReceivedBedWarning()) { - event.getEntityPlayer().addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.bed_fail.message"))); + event.getEntityPlayer().sendMessage(new TextComponentString(GCCoreUtil.translate("gui.bed_fail.message"))); stats.setReceivedBedWarning(true); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggy.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggy.java index a54f4da31d..4b95894e77 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggy.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggy.java @@ -79,7 +79,7 @@ else if (!this.mergeItemStack(var5, 0, b, false)) return null; } - if (var5.stackSize == 0) + if (var5.getCount() == 0) { var4.putStack((ItemStack) null); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggyBench.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggyBench.java index 5962bbae01..6fcff057de 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggyBench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerBuggyBench.java @@ -159,12 +159,12 @@ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) } } - if (var4.stackSize == 0) + if (var4.getCount() == 0) { slot.putStack((ItemStack) null); } - if (var4.stackSize == var2.stackSize) + if (var4.getCount() == var2.getCount()) { return null; } @@ -180,7 +180,7 @@ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par1) protected boolean mergeOneItem(ItemStack par1ItemStack, int par2, int par3, boolean par4) { boolean flag1 = false; - if (par1ItemStack.stackSize > 0) + if (par1ItemStack.getCount() > 0) { Slot slot; ItemStack slotStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCargoLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCargoLoader.java index a67da8ee96..9f0ffdad24 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCargoLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCargoLoader.java @@ -91,7 +91,7 @@ else if (!this.mergeItemStack(var5, 1, 15, false) && !this.mergeItemStack(var5, } } - if (var5.stackSize == 0) + if (var5.getCount() == 0) { slot.putStack((ItemStack) null); } @@ -100,7 +100,7 @@ else if (!this.mergeItemStack(var5, 1, 15, false) && !this.mergeItemStack(var5, slot.onSlotChanged(); } - if (var5.stackSize == var3.stackSize) + if (var5.getCount() == var3.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCircuitFabricator.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCircuitFabricator.java index dab3a1deb5..efda36d553 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCircuitFabricator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCircuitFabricator.java @@ -156,7 +156,7 @@ else if (!this.mergeItemStack(var4, b - 36, b - 9, false)) } } - if (var4.stackSize == 0) + if (var4.getCount() == 0) { slot.putStack((ItemStack) null); } @@ -165,7 +165,7 @@ else if (!this.mergeItemStack(var4, b - 36, b - 9, false)) slot.onSlotChanged(); } - if (var4.stackSize == var2.stackSize) + if (var4.getCount() == var2.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCoalGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCoalGenerator.java index 062a7e0390..34a6bb98db 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCoalGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerCoalGenerator.java @@ -88,7 +88,7 @@ else if (!this.mergeItemStack(var4, 1, 37, false)) return null; } - if (var4.stackSize == 0) + if (var4.getCount() == 0) { var3.putStack((ItemStack) null); } @@ -97,7 +97,7 @@ else if (!this.mergeItemStack(var4, 1, 37, false)) var3.onSlotChanged(); } - if (var4.stackSize == var2.stackSize) + if (var4.getCount() == var2.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerElectricFurnace.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerElectricFurnace.java index 20692976b8..6aa766705e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerElectricFurnace.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerElectricFurnace.java @@ -114,7 +114,7 @@ else if (!this.mergeItemStack(var4, 3, 39, false)) return null; } - if (var4.stackSize == 0) + if (var4.getCount() == 0) { var3.putStack((ItemStack) null); } @@ -123,7 +123,7 @@ else if (!this.mergeItemStack(var4, 3, 39, false)) var3.onSlotChanged(); } - if (var4.stackSize == var2.stackSize) + if (var4.getCount() == var2.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerElectricIngotCompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerElectricIngotCompressor.java index 22592f0202..04fde0d3ac 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerElectricIngotCompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerElectricIngotCompressor.java @@ -118,7 +118,7 @@ else if (!this.mergeItemStack(var4, 0, 9, false) && !this.mergeItemStack(var4, 1 } } - if (var4.stackSize == 0) + if (var4.getCount() == 0) { var3.putStack((ItemStack) null); } @@ -127,7 +127,7 @@ else if (!this.mergeItemStack(var4, 0, 9, false) && !this.mergeItemStack(var4, 1 var3.onSlotChanged(); } - if (var4.stackSize == var2.stackSize) + if (var4.getCount() == var2.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerEnergyStorageModule.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerEnergyStorageModule.java index 8bc1871266..b79b69ddd2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerEnergyStorageModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerEnergyStorageModule.java @@ -108,7 +108,7 @@ else if (!this.mergeItemStack(itemStack, 2, 38, false)) return null; } - if (itemStack.stackSize == 0) + if (itemStack.getCount() == 0) { slot.putStack((ItemStack) null); } @@ -117,7 +117,7 @@ else if (!this.mergeItemStack(itemStack, 2, 38, false)) slot.onSlotChanged(); } - if (itemStack.stackSize == returnStack.stackSize) + if (itemStack.getCount() == returnStack.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerExtendedInventory.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerExtendedInventory.java index 0b17e3b358..f529230262 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerExtendedInventory.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerExtendedInventory.java @@ -136,7 +136,7 @@ else if (!this.mergeItemStack(stack, 0, 27, false)) } } - if (stack.stackSize == 0) + if (stack.getCount() == 0) { slot.putStack((ItemStack) null); } @@ -145,7 +145,7 @@ else if (!this.mergeItemStack(stack, 0, 27, false)) slot.onSlotChanged(); } - if (stack.stackSize == var2.stackSize) + if (stack.getCount() == var2.getCount()) { return null; } @@ -159,7 +159,7 @@ else if (!this.mergeItemStack(stack, 0, 27, false)) protected boolean mergeOneItem(ItemStack par1ItemStack, int par2, int par3, boolean par4) { boolean flag1 = false; - if (par1ItemStack.stackSize > 0) + if (par1ItemStack.getCount() > 0) { Slot slot; ItemStack slotStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerFuelLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerFuelLoader.java index d27f6866ec..a298428679 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerFuelLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerFuelLoader.java @@ -95,7 +95,7 @@ else if (!this.mergeItemStack(var5, 2, 29, false)) } } - if (var5.stackSize == 0) + if (var5.getCount() == 0) { slot.putStack((ItemStack) null); } @@ -104,7 +104,7 @@ else if (!this.mergeItemStack(var5, 2, 29, false)) slot.onSlotChanged(); } - if (var5.stackSize == var3.stackSize) + if (var5.getCount() == var3.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerIngotCompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerIngotCompressor.java index 2532b07045..d8c2161870 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerIngotCompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerIngotCompressor.java @@ -119,7 +119,7 @@ else if (!this.mergeItemStack(var4, 0, 9, false) && !this.mergeItemStack(var4, 1 } } - if (var4.stackSize == 0) + if (var4.getCount() == 0) { slot.putStack((ItemStack) null); } @@ -128,7 +128,7 @@ else if (!this.mergeItemStack(var4, 0, 9, false) && !this.mergeItemStack(var4, 1 slot.onSlotChanged(); } - if (var4.stackSize == var2.stackSize) + if (var4.getCount() == var2.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenCollector.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenCollector.java index 145624bb54..267bfb5c0a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenCollector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenCollector.java @@ -87,7 +87,7 @@ else if (!this.mergeItemStack(stack, b - 36, b - 9, false)) } } - if (stack.stackSize == 0) + if (stack.getCount() == 0) { slot.putStack((ItemStack) null); } @@ -96,7 +96,7 @@ else if (!this.mergeItemStack(stack, b - 36, b - 9, false)) slot.onSlotChanged(); } - if (stack.stackSize == var2.stackSize) + if (stack.getCount() == var2.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenCompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenCompressor.java index f5d418b762..17335c2a51 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenCompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenCompressor.java @@ -104,7 +104,7 @@ else if (!this.mergeItemStack(stack, b - 36, b - 9, false)) } } - if (stack.stackSize == 0) + if (stack.getCount() == 0) { slot.putStack((ItemStack) null); } @@ -113,7 +113,7 @@ else if (!this.mergeItemStack(stack, b - 36, b - 9, false)) slot.onSlotChanged(); } - if (stack.stackSize == var2.stackSize) + if (stack.getCount() == var2.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenDecompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenDecompressor.java index a88d28adab..f4f006b0d0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenDecompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenDecompressor.java @@ -95,7 +95,7 @@ else if (!this.mergeItemStack(stack, b - 36, b - 9, false)) } } - if (stack.stackSize == 0) + if (stack.getCount() == 0) { slot.putStack((ItemStack) null); } @@ -104,7 +104,7 @@ else if (!this.mergeItemStack(stack, b - 36, b - 9, false)) slot.onSlotChanged(); } - if (stack.stackSize == var2.stackSize) + if (stack.getCount() == var2.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenDistributor.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenDistributor.java index cfc5c7a040..d4f7f80858 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenDistributor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenDistributor.java @@ -97,7 +97,7 @@ else if (!this.mergeItemStack(stack, b - 36, b - 9, false)) } } - if (stack.stackSize == 0) + if (stack.getCount() == 0) { slot.putStack((ItemStack) null); } @@ -106,7 +106,7 @@ else if (!this.mergeItemStack(stack, b - 36, b - 9, false)) slot.onSlotChanged(); } - if (stack.stackSize == var2.stackSize) + if (stack.getCount() == var2.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenSealer.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenSealer.java index fe0cbd80fe..01e7fa842e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenSealer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenSealer.java @@ -105,7 +105,7 @@ else if (!this.mergeItemStack(stack, b - 36, b - 9, false)) } } - if (stack.stackSize == 0) + if (stack.getCount() == 0) { slot.putStack((ItemStack) null); } @@ -114,7 +114,7 @@ else if (!this.mergeItemStack(stack, b - 36, b - 9, false)) slot.onSlotChanged(); } - if (stack.stackSize == var2.stackSize) + if (stack.getCount() == var2.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenStorageModule.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenStorageModule.java index 9b4639696a..675a6d0a7f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenStorageModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerOxygenStorageModule.java @@ -96,7 +96,7 @@ else if (!this.mergeItemStack(stack, b - 36, b - 9, false)) } } - if (stack.stackSize == 0) + if (stack.getCount() == 0) { slot.putStack((ItemStack) null); } @@ -105,7 +105,7 @@ else if (!this.mergeItemStack(stack, b - 36, b - 9, false)) slot.onSlotChanged(); } - if (stack.stackSize == var2.stackSize) + if (stack.getCount() == var2.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerParaChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerParaChest.java index ea5239725f..48f1118aed 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerParaChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerParaChest.java @@ -76,7 +76,7 @@ else if (!this.mergeItemStack(itemstack1, 0, this.parachestInventory.getSizeInve return null; } - if (itemstack1.stackSize == 0) + if (itemstack1.getCount() == 0) { slot.putStack((ItemStack) null); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerRefinery.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerRefinery.java index 675e5c4c9a..a9d0eb9fbf 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerRefinery.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerRefinery.java @@ -123,7 +123,7 @@ else if (!this.mergeItemStack(var4, 3, 30, false)) } } - if (var4.stackSize == 0) + if (var4.getCount() == 0) { slot.putStack((ItemStack) null); } @@ -132,7 +132,7 @@ else if (!this.mergeItemStack(var4, 3, 30, false)) slot.onSlotChanged(); } - if (var4.stackSize == var2.stackSize) + if (var4.getCount() == var2.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerRocketInventory.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerRocketInventory.java index b801643ae3..beacb44064 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerRocketInventory.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerRocketInventory.java @@ -115,7 +115,7 @@ else if (!this.mergeItemStack(var5, 0, b, false)) return null; } - if (var5.stackSize == 0) + if (var5.getCount() == 0) { var4.putStack((ItemStack) null); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematic.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematic.java index 5161380718..1255835296 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematic.java @@ -90,7 +90,7 @@ else if (!this.mergeItemStack(var5, 0, 1, false)) return null; } - if (var5.stackSize == 0) + if (var5.getCount() == 0) { var4.putStack((ItemStack) null); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java index f524b2ff36..93e0d13d62 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSchematicTier1Rocket.java @@ -186,7 +186,7 @@ else if (par1 >= 45 && par1 < 54) } } - if (var4.stackSize == 0) + if (var4.getCount() == 0) { if (par1 == 0) { @@ -196,7 +196,7 @@ else if (par1 >= 45 && par1 < 54) return var2; } - if (var4.stackSize == var2.stackSize) + if (var4.getCount() == var2.getCount()) { return null; } @@ -214,7 +214,7 @@ else if (par1 >= 45 && par1 < 54) protected boolean mergeOneItem(ItemStack par1ItemStack, int par2, int par3, boolean par4) { boolean flag1 = false; - if (par1ItemStack.stackSize > 0) + if (par1ItemStack.getCount() > 0) { Slot slot; ItemStack slotStack; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSolar.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSolar.java index 4ae5bf4c44..54e2f4e5e0 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSolar.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/ContainerSolar.java @@ -86,7 +86,7 @@ else if (!this.mergeItemStack(stack, b - 36, b - 9, false)) } } - if (stack.stackSize == 0) + if (stack.getCount() == 0) { slot.putStack((ItemStack) null); } @@ -95,7 +95,7 @@ else if (!this.mergeItemStack(stack, b - 36, b - 9, false)) slot.onSlotChanged(); } - if (stack.stackSize == var2.stackSize) + if (stack.getCount() == var2.getCount()) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryBuggyBench.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryBuggyBench.java index 47b9cbd086..8467534a87 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryBuggyBench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryBuggyBench.java @@ -73,7 +73,7 @@ public ItemStack decrStackSize(int par1, int par2) { ItemStack var3; - if (this.stackList[par1].stackSize <= par2) + if (this.stackList[par1].getCount() <= par2) { var3 = this.stackList[par1]; this.stackList[par1] = null; @@ -84,7 +84,7 @@ public ItemStack decrStackSize(int par1, int par2) { var3 = this.stackList[par1].splitStack(par2); - if (this.stackList[par1].stackSize == 0) + if (this.stackList[par1].getCount() == 0) { this.stackList[par1] = null; } @@ -118,7 +118,7 @@ public void markDirty() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryExtended.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryExtended.java index e857fc0b34..cde9577160 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryExtended.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryExtended.java @@ -30,7 +30,7 @@ public ItemStack decrStackSize(int i, int j) { ItemStack var3; - if (this.inventoryStacks[i].stackSize <= j) + if (this.inventoryStacks[i].getCount() <= j) { var3 = this.inventoryStacks[i]; this.inventoryStacks[i] = null; @@ -40,7 +40,7 @@ public ItemStack decrStackSize(int i, int j) { var3 = this.inventoryStacks[i].splitStack(j); - if (this.inventoryStacks[i].stackSize == 0) + if (this.inventoryStacks[i].getCount() == 0) { this.inventoryStacks[i] = null; } @@ -65,7 +65,7 @@ public void setInventorySlotContents(int i, ItemStack itemstack) { this.inventoryStacks[i] = itemstack; - if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) + if (itemstack != null && itemstack.getCount() > this.getInventoryStackLimit()) { itemstack.stackSize = this.getInventoryStackLimit(); } @@ -96,7 +96,7 @@ public void markDirty() } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUsableByPlayer(EntityPlayer entityplayer) { return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryRocketBench.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryRocketBench.java index cfbeedf10b..baf970445a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryRocketBench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryRocketBench.java @@ -77,7 +77,7 @@ public ItemStack decrStackSize(int par1, int par2) { ItemStack var3; - if (this.stackList[par1].stackSize <= par2) + if (this.stackList[par1].getCount() <= par2) { var3 = this.stackList[par1]; this.stackList[par1] = null; @@ -88,7 +88,7 @@ public ItemStack decrStackSize(int par1, int par2) { var3 = this.stackList[par1].splitStack(par2); - if (this.stackList[par1].stackSize == 0) + if (this.stackList[par1].getCount() == 0) { this.stackList[par1] = null; } @@ -122,7 +122,7 @@ public void markDirty() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventorySchematic.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventorySchematic.java index ddd6fd36d0..d26fe90f4e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventorySchematic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventorySchematic.java @@ -57,7 +57,7 @@ public ItemStack decrStackSize(int par1, int par2) { ItemStack var3; - if (this.stackList[par1].stackSize <= par2) + if (this.stackList[par1].getCount() <= par2) { var3 = this.stackList[par1]; this.stackList[par1] = null; @@ -68,7 +68,7 @@ public ItemStack decrStackSize(int par1, int par2) { var3 = this.stackList[par1].splitStack(par2); - if (this.stackList[par1].stackSize == 0) + if (this.stackList[par1].getCount() == 0) { this.stackList[par1] = null; } @@ -102,7 +102,7 @@ public void markDirty() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryTreasureChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryTreasureChest.java index 2ed70d6e17..7687c30eb9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryTreasureChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/InventoryTreasureChest.java @@ -95,7 +95,7 @@ public void markDirty() } @Override - public boolean isUseableByPlayer(EntityPlayer p_70300_1_) + public boolean isUsableByPlayer(EntityPlayer p_70300_1_) { return this.upperChest.isUseableByPlayer(p_70300_1_) && this.lowerChest.isUseableByPlayer(p_70300_1_); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/PersistantInventoryCrafting.java b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/PersistantInventoryCrafting.java index 4b7ec8eb1e..d71ba29777 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/inventory/PersistantInventoryCrafting.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/inventory/PersistantInventoryCrafting.java @@ -117,7 +117,7 @@ public ItemStack decrStackSize(int par1, int par2) { ItemStack itemstack; - if (this.stackList[par1].stackSize <= par2) + if (this.stackList[par1].getCount() <= par2) { itemstack = this.stackList[par1]; this.stackList[par1] = null; @@ -133,7 +133,7 @@ public ItemStack decrStackSize(int par1, int par2) { itemstack = this.stackList[par1].splitStack(par2); - if (this.stackList[par1].stackSize == 0) + if (this.stackList[par1].getCount() == 0) { this.stackList[par1] = null; } @@ -199,7 +199,7 @@ public void markDirty() * with Container */ @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBasic.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBasic.java index 10da129acd..47a66e30f1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBasic.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBasic.java @@ -248,7 +248,7 @@ public boolean onLeftClickEntity(ItemStack itemStack, EntityPlayer player, Entit itemStack.getTagCompound().setLong("linkedUUIDMost", entity.getUniqueID().getMostSignificantBits()); itemStack.getTagCompound().setLong("linkedUUIDLeast", entity.getUniqueID().getLeastSignificantBits()); - player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.tracking.message"))); + player.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.tracking.message"))); return true; } return false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java index c5e9f12231..e53cbbaf95 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBlockEnclosed.java @@ -67,7 +67,7 @@ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World pos = pos.offset(side); } - if (stack.stackSize == 0) + if (stack.getCount() == 0) { return EnumActionResult.FAIL; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBuggy.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBuggy.java index 8f41399057..7efe48ef63 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBuggy.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemBuggy.java @@ -137,12 +137,12 @@ public ActionResult onItemRightClick(ItemStack itemStackIn, World wor if (!worldIn.isRemote) { - worldIn.spawnEntityInWorld(var35); + worldIn.spawnEntity(var35); } if (!playerIn.capabilities.isCreativeMode) { - --itemStackIn.stackSize; + --itemStackIn.getCount(); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemCanisterGeneric.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemCanisterGeneric.java index 7fef98968c..993e537a43 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemCanisterGeneric.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemCanisterGeneric.java @@ -11,6 +11,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.fluids.*; +import net.minecraftforge.fluids.capability.ItemFluidContainer; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -194,7 +195,7 @@ protected void setNewDamage(ItemStack container, int newDamage) private void replaceEmptyCanisterItem(ItemStack container, Item newItem) { //This is a neat trick to change the item ID in an ItemStack - final int stackSize = container.stackSize; + final int getCount() = container.getCount(); NBTTagCompound tag = new NBTTagCompound(); tag.setShort("id", (short) Item.getIdFromItem(newItem)); tag.setByte("Count", (byte) stackSize); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java index 945ef74a63..dd3317be1f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemFlag.java @@ -83,7 +83,7 @@ public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBas if (worldIn.getEntitiesWithinAABB(EntityFlag.class, new AxisAlignedBB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 3, pos.getZ() + 1)).isEmpty()) { - worldIn.spawnEntityInWorld(flag); + worldIn.spawnEntity(flag); flag.setType(stack.getItemDamage()); flag.setOwner(player.getGameProfile().getName()); worldIn.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundType.METAL.getBreakSound(), SoundCategory.BLOCKS, SoundType.METAL.getVolume(), SoundType.METAL.getPitch() + 2.0F); @@ -91,7 +91,7 @@ public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBas } else { - entity.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.flag.already_placed"))); + entity.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.flag.already_placed"))); } } @@ -101,7 +101,7 @@ public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBas if (var2 >= 0 && !player.capabilities.isCreativeMode) { - if (--player.inventory.mainInventory[var2].stackSize <= 0) + if (--player.inventory.mainInventory[var2].getCount() <= 0) { player.inventory.mainInventory[var2] = null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemMeteorChunk.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemMeteorChunk.java index d8d8429b2a..dfd6bfc449 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemMeteorChunk.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemMeteorChunk.java @@ -155,7 +155,7 @@ public ActionResult onItemRightClick(ItemStack itemStack, World world meteor.isHot = true; } meteor.canBePickedUp = player.capabilities.isCreativeMode ? 2 : 1; - world.spawnEntityInWorld(meteor); + world.spawnEntity(meteor); } player.swingArm(hand); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java index dc73310a18..16cfa6c0fd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemTier1Rocket.java @@ -113,7 +113,7 @@ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World final EntityTier1Rocket spaceship = new EntityTier1Rocket(worldIn, centerX, centerY, centerZ, EnumRocketType.values()[stack.getItemDamage()]); spaceship.setPosition(spaceship.posX, spaceship.posY + spaceship.getOnPadYOffset(), spaceship.posZ); - worldIn.spawnEntityInWorld(spaceship); + worldIn.spawnEntity(spaceship); if (stack.hasTagCompound() && stack.getTagCompound().hasKey("RocketFuel")) { @@ -124,7 +124,7 @@ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World { stack.stackSize--; - if (stack.stackSize <= 0) + if (stack.getCount() <= 0) { stack = null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java index d359dbdb86..c995fefae6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/items/ItemUniversalWrench.java @@ -66,7 +66,7 @@ public void wrenchUsed(EntityPlayer entityPlayer, BlockPos pos) stack.stackSize--; } - if (stack.stackSize <= 0) + if (stack.getCount() <= 0) { entityPlayer.inventory.setInventorySlotContents(entityPlayer.inventory.currentItem, null); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/NetworkUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/NetworkUtil.java index 6bc2b86520..5c955138f6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/NetworkUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/NetworkUtil.java @@ -479,7 +479,7 @@ public static void writeItemStack(ItemStack itemStack, ByteBuf buffer) throws IO else { buffer.writeShort(Item.getIdFromItem(itemStack.getItem())); - buffer.writeByte(itemStack.stackSize); + buffer.writeByte(itemStack.getCount()); buffer.writeShort(itemStack.getItemDamage()); NBTTagCompound nbttagcompound = null; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java index 86c7f68d9e..0c0bf24fc8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/network/PacketSimple.java @@ -371,9 +371,9 @@ public void handleClientSide(EntityPlayer player) for (int i = 0; i < 4; i++) { - if (mc.getRenderViewEntity() != null && mc.effectRenderer != null && mc.theWorld != null) + if (mc.getRenderViewEntity() != null && mc.effectRenderer != null && mc.world != null) { - final ParticleSparks fx = new ParticleSparks(mc.theWorld, pos.getX() - 0.15 + 0.5, pos.getY() + 1.2, pos.getZ() + 0.15 + 0.5, mc.theWorld.rand.nextDouble() / 20 - mc.theWorld.rand.nextDouble() / 20, mc.theWorld.rand.nextDouble() / 20 - mc.theWorld.rand.nextDouble() / 20); + final ParticleSparks fx = new ParticleSparks(mc.world, pos.getX() - 0.15 + 0.5, pos.getY() + 1.2, pos.getZ() + 0.15 + 0.5, mc.world.rand.nextDouble() / 20 - mc.world.rand.nextDouble() / 20, mc.world.rand.nextDouble() / 20 - mc.world.rand.nextDouble() / 20); mc.effectRenderer.addEffect(fx); } @@ -657,10 +657,10 @@ public void handleClientSide(EntityPlayer player) stats.setThermalLevelNormalising((Boolean) this.data.get(1)); break; case C_DISPLAY_ROCKET_CONTROLS: - player.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.spaceKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.rocket.launch.name"))); - player.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.leftKey.getKeyCode()) + " / " + GameSettings.getKeyDisplayString(KeyHandlerClient.rightKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.rocket.turn.name"))); - player.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.accelerateKey.getKeyCode()) + " / " + GameSettings.getKeyDisplayString(KeyHandlerClient.decelerateKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.rocket.updown.name"))); - player.addChatMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.openFuelGui.getKeyCode()) + " - " + GCCoreUtil.translate("gui.rocket.inv.name"))); + player.sendMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.spaceKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.rocket.launch.name"))); + player.sendMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.leftKey.getKeyCode()) + " / " + GameSettings.getKeyDisplayString(KeyHandlerClient.rightKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.rocket.turn.name"))); + player.sendMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.accelerateKey.getKeyCode()) + " / " + GameSettings.getKeyDisplayString(KeyHandlerClient.decelerateKey.getKeyCode()) + " - " + GCCoreUtil.translate("gui.rocket.updown.name"))); + player.sendMessage(new TextComponentString(GameSettings.getKeyDisplayString(KeyHandlerClient.openFuelGui.getKeyCode()) + " - " + GCCoreUtil.translate("gui.rocket.inv.name"))); break; case C_GET_CELESTIAL_BODY_LIST: String str = ""; @@ -861,14 +861,14 @@ public void handleServerSide(EntityPlayer player) } else if (stats.getChatCooldown() == 0 && stats.getLaunchAttempts() == 0) { - player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.noparachute"))); + player.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.noparachute"))); stats.setChatCooldown(250); stats.setLaunchAttempts(1); } } else if (stats.getChatCooldown() == 0) { - player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.nofuel"))); + player.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.rocket.warning.nofuel"))); stats.setChatCooldown(250); } } @@ -950,7 +950,7 @@ else if (player.getRidingEntity() instanceof EntitySpaceshipBase) { SchematicRegistry.unlockNewPage(playerBase, stack); - if (--stack.stackSize <= 0) + if (--stack.getCount() <= 0) { stack = null; } @@ -976,7 +976,7 @@ else if (player.getRidingEntity() instanceof EntitySpaceshipBase) case S_ON_FAILED_CHEST_UNLOCK: if (stats.getChatCooldown() == 0) { - player.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.chest.warning.wrongkey", this.data.get(0)))); + player.sendMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.chest.warning.wrongkey", this.data.get(0)))); stats.setChatCooldown(100); } break; @@ -1130,7 +1130,7 @@ else if (player.getRidingEntity() instanceof EntitySpaceshipBase) { teamNameTotal = teamNameTotal.concat(dB + teamNamePart + " "); } - playerInvited.addChatMessage(new TextComponentString(dA + GCCoreUtil.translateWithFormat("gui.space_race.chat.invite_received", bG + player.getGameProfile().getName() + dA) + " " + GCCoreUtil.translateWithFormat("gui.space_race.chat.to_join", teamNameTotal, EnumColor.AQUA + "/joinrace" + dA)).setStyle(new Style().setColor(TextFormatting.DARK_AQUA))); + playerInvited.sendMessage(new TextComponentString(dA + GCCoreUtil.translateWithFormat("gui.space_race.chat.invite_received", bG + player.getGameProfile().getName() + dA) + " " + GCCoreUtil.translateWithFormat("gui.space_race.chat.to_join", teamNameTotal, EnumColor.AQUA + "/joinrace" + dA)).setStyle(new Style().setColor(TextFormatting.DARK_AQUA))); } } break; @@ -1144,7 +1144,7 @@ else if (player.getRidingEntity() instanceof EntitySpaceshipBase) if (!race.getPlayerNames().remove(playerToRemove)) { - player.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.space_race.chat.not_found", playerToRemove))); + player.sendMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.space_race.chat.not_found", playerToRemove))); } else { @@ -1177,13 +1177,13 @@ else if (player.getRidingEntity() instanceof EntitySpaceshipBase) if (memberObj != null) { - memberObj.addChatMessage(new TextComponentString(EnumColor.DARK_AQUA + GCCoreUtil.translateWithFormat("gui.space_race.chat.add_success", EnumColor.BRIGHT_GREEN + playerToAdd + EnumColor.DARK_AQUA)).setStyle(new Style().setColor(TextFormatting.DARK_AQUA))); + memberObj.sendMessage(new TextComponentString(EnumColor.DARK_AQUA + GCCoreUtil.translateWithFormat("gui.space_race.chat.add_success", EnumColor.BRIGHT_GREEN + playerToAdd + EnumColor.DARK_AQUA)).setStyle(new Style().setColor(TextFormatting.DARK_AQUA))); } } } else { - player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.space_race.chat.already_part")).setStyle(new Style().setColor(TextFormatting.DARK_RED))); + player.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.space_race.chat.already_part")).setStyle(new Style().setColor(TextFormatting.DARK_RED))); } } break; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java b/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java index 623d19f77c..4054ac75ad 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/proxy/ClientProxyCore.java @@ -275,7 +275,7 @@ protected ModelResourceLocation getModelResourceLocation(IBlockState state) @Override public World getClientWorld() { - return ClientProxyCore.mc.theWorld; + return ClientProxyCore.mc.world; } @Override @@ -287,7 +287,7 @@ public void spawnParticle(String particleID, Vector3 position, Vector3 motion, O @Override public World getWorldForID(int dimensionID) { - World world = ClientProxyCore.mc.theWorld; + World world = ClientProxyCore.mc.world; if (world != null && GCCoreUtil.getDimensionID(world) == dimensionID) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tick/KeyHandlerClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/tick/KeyHandlerClient.java index 3612e5f94d..6113e459cb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tick/KeyHandlerClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tick/KeyHandlerClient.java @@ -83,14 +83,14 @@ public void keyDown(Type types, KeyBinding kb, boolean tickEnd, boolean isRepeat { if (KeyHandlerClient.mc.currentScreen == null) { - KeyHandlerClient.mc.thePlayer.openGui(GalacticraftCore.instance, GuiIdsCore.GALAXY_MAP, KeyHandlerClient.mc.theWorld, (int) KeyHandlerClient.mc.thePlayer.posX, (int) KeyHandlerClient.mc.thePlayer.posY, (int) KeyHandlerClient.mc.thePlayer.posZ); + KeyHandlerClient.mc.thePlayer.openGui(GalacticraftCore.instance, GuiIdsCore.GALAXY_MAP, KeyHandlerClient.mc.world, (int) KeyHandlerClient.mc.thePlayer.posX, (int) KeyHandlerClient.mc.thePlayer.posY, (int) KeyHandlerClient.mc.thePlayer.posZ); } } else if (kb.getKeyCode() == KeyHandlerClient.openFuelGui.getKeyCode()) { if (playerBase.getRidingEntity() instanceof EntitySpaceshipBase || playerBase.getRidingEntity() instanceof EntityBuggy) { - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_OPEN_FUEL_GUI, mc.theWorld.provider.getDimension(), new Object[] { playerBase.getGameProfile().getName() })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_OPEN_FUEL_GUI, mc.world.provider.getDimension(), new Object[] { playerBase.getGameProfile().getName() })); } } else if (kb.getKeyCode() == KeyHandlerClient.toggleAdvGoggles.getKeyCode()) @@ -152,13 +152,13 @@ else if (entityTest != null && entityTest instanceof EntityAutoRocket) if (kb == KeyHandlerClient.leftShiftKey) { autoRocket.motionY -= 0.02D; - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_SHIP_MOTION_Y, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { autoRocket.getEntityId(), false })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_SHIP_MOTION_Y, GCCoreUtil.getDimensionID(mc.world), new Object[] { autoRocket.getEntityId(), false })); } if (kb == KeyHandlerClient.spaceKey) { autoRocket.motionY += 0.02D; - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_SHIP_MOTION_Y, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { autoRocket.getEntityId(), true })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_SHIP_MOTION_Y, GCCoreUtil.getDimensionID(mc.world), new Object[] { autoRocket.getEntityId(), true })); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java index ddd394eea7..4496cc03f5 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tick/TickHandlerClient.java @@ -371,13 +371,13 @@ public void onClientTick(ClientTickEvent event) for (int i = -4; i < 5; i++) { - int x = MathHelper.floor_double(player.posX + i); + int x = MathHelper.floor(player.posX + i); for (int j = -4; j < 5; j++) { - int y = MathHelper.floor_double(player.posY + j); + int y = MathHelper.floor(player.posY + j); for (int k = -4; k < 5; k++) { - int z = MathHelper.floor_double(player.posZ + k); + int z = MathHelper.floor(player.posZ + k); BlockPos pos = new BlockPos(x, y, z); IBlockState state = player.worldObj.getBlockState(pos); @@ -405,7 +405,7 @@ public void onClientTick(ClientTickEvent event) } } } - TileEntityOxygenSealer nearestSealer = TileEntityOxygenSealer.getNearestSealer(world, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ)); + TileEntityOxygenSealer nearestSealer = TileEntityOxygenSealer.getNearestSealer(world, MathHelper.floor(player.posX), MathHelper.floor(player.posY), MathHelper.floor(player.posZ)); //TODO: revert. Correct code is temporarily commented out for testing render if (nearestSealer != null)// && nearestSealer.threadSeal != null) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoLoader.java index 637f80a927..71a04d86a1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCargoLoader.java @@ -10,11 +10,13 @@ import micdoodle8.mods.galacticraft.core.energy.tile.TileBaseElectricBlockWithInventory; import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; import micdoodle8.mods.miccore.Annotations.NetworkedField; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; @@ -24,7 +26,7 @@ public class TileEntityCargoLoader extends TileBaseElectricBlockWithInventory implements ISidedInventory, ILandingPadAttachable { - private ItemStack[] containingItems = new ItemStack[15]; + private NonNullList stacks = NonNullList.withSize(15, ItemStack.EMPTY); public boolean outOfItems; @NetworkedField(targetSide = Side.CLIENT) public boolean targetFull; @@ -45,7 +47,7 @@ public void update() { super.update(); - if (!this.worldObj.isRemote) + if (!this.getWorld().isRemote) { if (this.ticks % 100 == 0) { @@ -90,7 +92,7 @@ public void checkForCargoEntity() for (final EnumFacing dir : EnumFacing.VALUES) { - final TileEntity pad = new BlockVec3(this).getTileEntityOnSide(this.worldObj, dir); + final TileEntity pad = new BlockVec3(this).getTileEntityOnSide(this.getWorld(), dir); if (pad != null && pad instanceof TileEntityMulti) { @@ -121,21 +123,21 @@ else if (pad != null && pad instanceof ICargoEntity) public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - this.containingItems = this.readStandardItemsFromNBT(nbt); + this.stacks = this.readStandardItemsFromNBT(nbt); } @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - this.writeStandardItemsToNBT(nbt); + this.writeStandardItemsToNBT(nbt, stacks); return nbt; } @Override - protected ItemStack[] getContainingItems() + protected NonNullList getContainingItems() { - return this.containingItems; + return this.stacks; } @Override @@ -213,17 +215,17 @@ public EnumCargoLoadingState addCargo(ItemStack stack, boolean doAdd) { int count = 1; - for (count = 1; count < this.containingItems.length; count++) + for (count = 1; count < this.stacks.size(); count++) { - ItemStack stackAt = this.containingItems[count]; + ItemStack stackAt = this.stacks.get(count); - if (stackAt != null && stackAt.getItem() == stack.getItem() && stackAt.getItemDamage() == stack.getItemDamage() && stackAt.stackSize < stackAt.getMaxStackSize()) + if (!stackAt.isEmpty() && stackAt.getItem() == stack.getItem() && stackAt.getItemDamage() == stack.getItemDamage() && stackAt.getCount() < stackAt.getMaxStackSize()) { - if (stackAt.stackSize + stack.stackSize <= stackAt.getMaxStackSize()) + if (stackAt.getCount() + stack.getCount() <= stackAt.getMaxStackSize()) { if (doAdd) { - this.containingItems[count].stackSize += stack.stackSize; + stackAt.grow(stack.getCount()); this.markDirty(); } @@ -232,36 +234,36 @@ public EnumCargoLoadingState addCargo(ItemStack stack, boolean doAdd) else { //Part of the stack can fill this slot but there will be some left over - int origSize = stackAt.stackSize; - int surplus = origSize + stack.stackSize - stackAt.getMaxStackSize(); + int origSize = stackAt.getCount(); + int surplus = origSize + stack.getCount() - stackAt.getMaxStackSize(); if (doAdd) { - this.containingItems[count].stackSize = stackAt.getMaxStackSize(); + stackAt.setCount(stackAt.getMaxStackSize()); this.markDirty(); } - stack.stackSize = surplus; + stack.setCount(surplus); if (this.addCargo(stack, doAdd) == EnumCargoLoadingState.SUCCESS) { return EnumCargoLoadingState.SUCCESS; } - this.containingItems[count].stackSize = origSize; + stackAt.setCount(origSize); return EnumCargoLoadingState.FULL; } } } - for (count = 1; count < this.containingItems.length; count++) + for (count = 1; count < this.stacks.size(); count++) { - ItemStack stackAt = this.containingItems[count]; + ItemStack stackAt = this.stacks.get(count); if (stackAt == null) { if (doAdd) { - this.containingItems[count] = stack; + this.stacks.set(count, stack); this.markDirty(); } @@ -274,18 +276,22 @@ public EnumCargoLoadingState addCargo(ItemStack stack, boolean doAdd) public RemovalResult removeCargo(boolean doRemove) { - for (int i = 1; i < this.containingItems.length; i++) + for (int i = 1; i < this.stacks.size(); i++) { - ItemStack stackAt = this.containingItems[i]; + ItemStack stackAt = this.stacks.get(i); if (stackAt != null) { ItemStack resultStack = stackAt.copy(); - resultStack.stackSize = 1; + resultStack.setCount(1); - if (doRemove && --stackAt.stackSize <= 0) + if (doRemove) { - this.containingItems[i] = null; + stackAt.shrink(1); + if (stackAt.isEmpty()) + { + this.stacks.set(i, null); + } } if (doRemove) @@ -309,7 +315,7 @@ public boolean canAttachToLandingPad(IBlockAccess world, BlockPos pos) @Override public EnumFacing getFront() { - return this.worldObj.getBlockState(getPos()).getValue(BlockCargoLoader.FACING); + return this.getWorld().getBlockState(getPos()).getValue(BlockCargoLoader.FACING); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCircuitFabricator.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCircuitFabricator.java index 95046d3d39..12130118dd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCircuitFabricator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCircuitFabricator.java @@ -149,7 +149,7 @@ else if (this.containingItems[6].isItemEqual(resultItemStack)) entityitem.setPickupDelay(10); - this.worldObj.spawnEntityInWorld(entityitem); + this.worldObj.spawnEntity(entityitem); } this.containingItems[6].stackSize = 64; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCoalGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCoalGenerator.java index fcec3ff10b..70a22b4102 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCoalGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityCoalGenerator.java @@ -244,7 +244,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java index 1a67ebbc37..9e4429e195 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDish.java @@ -331,7 +331,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java index 25782e3a44..a2a31bf46b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityDungeonSpawner.java @@ -126,7 +126,7 @@ else if (playersWithin.size() == 0) { EntityLiving bossLiving = (EntityLiving) this.boss; bossLiving.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(bossLiving)), null); - this.worldObj.spawnEntityInWorld(bossLiving); + this.worldObj.spawnEntity(bossLiving); this.playSpawnSound(bossLiving); this.spawned = true; this.boss.onBossSpawned(this); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricIngotCompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricIngotCompressor.java index 049a71a109..3cb4acfc1a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricIngotCompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityElectricIngotCompressor.java @@ -183,7 +183,7 @@ else if (this.containingItems[slot].isItemEqual(resultItemStack)) entityitem.setPickupDelay(10); - this.worldObj.spawnEntityInWorld(entityitem); + this.worldObj.spawnEntity(entityitem); } this.containingItems[slot].stackSize = 64; } @@ -379,7 +379,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) + public boolean isUsableByPlayer(EntityPlayer entityplayer) { return this.worldObj.getTileEntity(this.getPos()) == this && entityplayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityEnergyStorageModule.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityEnergyStorageModule.java index 112d7372b4..9fbfcd519d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityEnergyStorageModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityEnergyStorageModule.java @@ -265,7 +265,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java index 6c57984a2d..cea2bc90b7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFluidTank.java @@ -13,6 +13,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fluids.*; +import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.NetworkRegistry; diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java index 989ae721c1..942c624a71 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityFuelLoader.java @@ -22,6 +22,7 @@ import net.minecraft.util.text.ITextComponent; import net.minecraft.world.IBlockAccess; import net.minecraftforge.fluids.*; +import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fml.relauncher.Side; public class TileEntityFuelLoader extends TileBaseElectricBlockWithInventory implements ISidedInventory, IFluidHandler, ILandingPadAttachable diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityIngotCompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityIngotCompressor.java index f09dc071e6..734ea63ce6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityIngotCompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityIngotCompressor.java @@ -249,7 +249,7 @@ else if (this.containingItems[1].isItemEqual(resultItemStack)) entityitem.setPickupDelay(10); - this.worldObj.spawnEntityInWorld(entityitem); + this.worldObj.spawnEntity(entityitem); } this.containingItems[1].stackSize = 64; } @@ -444,7 +444,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java index b3fc03a1ca..c539014e05 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCollector.java @@ -318,7 +318,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCompressor.java index 6ac47fdfc8..92e3c4410f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenCompressor.java @@ -194,7 +194,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDecompressor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDecompressor.java index 9e4fcc3793..49a1e46766 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDecompressor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDecompressor.java @@ -175,7 +175,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java index 224871ff4f..944aecd06a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenDistributor.java @@ -231,7 +231,7 @@ public void update() // { // this.oxygenBubble = new EntityBubble(this.worldObj, new Vector3(this), this); // this.hasValidBubble = true; -// this.worldObj.spawnEntityInWorld(this.oxygenBubble); +// this.worldObj.spawnEntity(this.oxygenBubble); // } // } @@ -242,7 +242,7 @@ public void update() if (this.ticks % (this.active ? 20 : 4) == 0) { double size = bubbleSize; - int bubbleR = MathHelper.floor_double(size) + 4; + int bubbleR = MathHelper.floor(size) + 4; int bubbleR2 = (int) (size * size); for (int x = this.getPos().getX() - bubbleR; x <= this.getPos().getX() + bubbleR; x++) { @@ -413,7 +413,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java index 107ceda3e3..2fce26721c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenSealer.java @@ -339,7 +339,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenStorageModule.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenStorageModule.java index c48a032217..9c9cb35cc9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenStorageModule.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityOxygenStorageModule.java @@ -307,7 +307,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java index c81e1cdf17..27f3eee014 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityParaChest.java @@ -234,7 +234,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java index db39c7f689..a087d93181 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntitySolar.java @@ -533,7 +533,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTreasureChest.java b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTreasureChest.java index a8bc76d064..3a58ce6af9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTreasureChest.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/tile/TileEntityTreasureChest.java @@ -236,7 +236,7 @@ public int getInventoryStackLimit() * Do not make give this method the name canInteractWith because it clashes with Container */ @Override - public boolean isUseableByPlayer(EntityPlayer player) + public boolean isUsableByPlayer(EntityPlayer player) { return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double) this.pos.getX() + 0.5D, (double) this.pos.getY() + 0.5D, (double) this.pos.getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java index 2c7c3646c2..93fb34117d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/FluidUtil.java @@ -413,9 +413,9 @@ public static ItemStack getUsedContainer(ItemStack container) public static boolean isInsideOfFluid(Entity entity, Fluid fluid) { double d0 = entity.posY + entity.getEyeHeight(); - int i = MathHelper.floor_double(entity.posX); - int j = MathHelper.floor_float(MathHelper.floor_double(d0)); - int k = MathHelper.floor_double(entity.posZ); + int i = MathHelper.floor(entity.posX); + int j = MathHelper.floor_float(MathHelper.floor(d0)); + int k = MathHelper.floor(entity.posZ); BlockPos pos = new BlockPos(i, j, k); Block block = entity.worldObj.getBlockState(pos).getBlock(); diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java index 7760fa35e1..190aac9421 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/OxygenUtil.java @@ -117,12 +117,12 @@ public static boolean isAABBInBreathableAirBlock(World world, AxisAlignedBB bb, public static boolean isInOxygenBlock(World world, AxisAlignedBB bb) { - int i = MathHelper.floor_double(bb.minX); - int j = MathHelper.floor_double(bb.maxX); - int k = MathHelper.floor_double(bb.minY); - int l = MathHelper.floor_double(bb.maxY); - int i1 = MathHelper.floor_double(bb.minZ); - int j1 = MathHelper.floor_double(bb.maxZ); + int i = MathHelper.floor(bb.minX); + int j = MathHelper.floor(bb.maxX); + int k = MathHelper.floor(bb.minY); + int l = MathHelper.floor(bb.maxY); + int i1 = MathHelper.floor(bb.minZ); + int j1 = MathHelper.floor(bb.maxZ); OxygenUtil.checked = new HashSet(); if (world.isAreaLoaded(new BlockPos(i, k, i1), new BlockPos(j, l, j1))) @@ -149,12 +149,12 @@ public static boolean isInOxygenBlock(World world, AxisAlignedBB bb) public static boolean isInOxygenAndThermalBlock(World world, AxisAlignedBB bb) { - int i = MathHelper.floor_double(bb.minX); - int j = MathHelper.floor_double(bb.maxX); - int k = MathHelper.floor_double(bb.minY); - int l = MathHelper.floor_double(bb.maxY); - int i1 = MathHelper.floor_double(bb.minZ); - int j1 = MathHelper.floor_double(bb.maxZ); + int i = MathHelper.floor(bb.minX); + int j = MathHelper.floor(bb.maxX); + int k = MathHelper.floor(bb.minY); + int l = MathHelper.floor(bb.maxY); + int i1 = MathHelper.floor(bb.minZ); + int j1 = MathHelper.floor(bb.maxZ); OxygenUtil.checked = new HashSet(); if (world.isAreaLoaded(new BlockPos(i, k, i1), new BlockPos(j, l, j1))) diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/ThreadVersionCheck.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/ThreadVersionCheck.java index 9d0a248fe9..967d1a9d29 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/ThreadVersionCheck.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/ThreadVersionCheck.java @@ -77,7 +77,7 @@ public void run() if (sideToCheck.equals(Side.CLIENT)) { - FMLClientHandler.instance().getClient().thePlayer.addChatMessage(new TextComponentString(EnumColor.GREY + "New " + EnumColor.DARK_AQUA + Constants.MOD_NAME_SIMPLE + EnumColor.GREY + " version available! v" + String.valueOf(remoteMajVer) + "." + String.valueOf(remoteMinVer) + "." + String.valueOf(remoteBuildVer) + EnumColor.DARK_BLUE + " http://micdoodle8.com/")); + FMLClientHandler.instance().getClient().thePlayer.sendMessage(new TextComponentString(EnumColor.GREY + "New " + EnumColor.DARK_AQUA + Constants.MOD_NAME_SIMPLE + EnumColor.GREY + " version available! v" + String.valueOf(remoteMajVer) + "." + String.valueOf(remoteMinVer) + "." + String.valueOf(remoteBuildVer) + EnumColor.DARK_BLUE + " http://micdoodle8.com/")); } else if (sideToCheck.equals(Side.SERVER)) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java b/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java index a314467328..388c3879d6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/util/WorldUtil.java @@ -322,7 +322,7 @@ public static WorldProvider getProviderForDimensionServer(int id) @SideOnly(Side.CLIENT) public static WorldProvider getProviderForDimensionClient(int id) { - World ws = ClientProxyCore.mc.theWorld; + World ws = ClientProxyCore.mc.world; if (ws != null && GCCoreUtil.getDimensionID(ws) == id) { return ws.provider; @@ -802,7 +802,7 @@ else if (entity.getRidingEntity() instanceof EntityCelestialFake) { GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_RESET_THIRD_PERSON, GCCoreUtil.getDimensionID(player.worldObj), new Object[] {}), player); } - worldNew.spawnEntityInWorld(entity); + worldNew.spawnEntity(entity); entity.setWorld(worldNew); ChunkPos pair = worldNew.getChunkFromChunkCoords(spawnPos.intX(), spawnPos.intZ()).getChunkCoordIntPair(); @@ -858,7 +858,7 @@ else if (entity.getRidingEntity() instanceof EntityCelestialFake) ((IWorldTransferCallback) entity).onWorldTransferred(worldNew); } - worldNew.spawnEntityInWorld(entity); + worldNew.spawnEntity(entity); entity.setWorld(worldNew); worldNew.updateEntityWithOptionalForce(entity, false); @@ -953,7 +953,7 @@ else if (stack == stats.getRocketStacks().length - 2) entity.setPositionAndRotation(ridingRocket.posX, ridingRocket.posY, ridingRocket.posZ, 0, 0); worldNew.updateEntityWithOptionalForce(entity, true); - worldNew.spawnEntityInWorld(ridingRocket); + worldNew.spawnEntity(ridingRocket); ridingRocket.setWorld(worldNew); worldNew.updateEntityWithOptionalForce(ridingRocket, true); @@ -968,7 +968,7 @@ else if (otherRiddenEntity != null) otherRiddenEntity.writeToNBTOptional(nbt); removeEntityFromWorld(worldOld, otherRiddenEntity, true); otherRiddenEntity = EntityList.createEntityFromNBT(nbt, worldNew); - worldNew.spawnEntityInWorld(otherRiddenEntity); + worldNew.spawnEntity(otherRiddenEntity); otherRiddenEntity.setWorld(worldNew); } if (spawnPos != null) @@ -1267,7 +1267,7 @@ public static void toCelestialSelection(EntityPlayerMP player, IStatsCapability stats.setUsingPlanetSelectionGui(true); stats.setSavedPlanetList(dimensionList); Entity fakeEntity = new EntityCelestialFake(player.worldObj, player.posX, player.posY, player.posZ); - player.worldObj.spawnEntityInWorld(fakeEntity); + player.worldObj.spawnEntity(fakeEntity); player.startRiding(fakeEntity); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java index 70535f230e..ef79f729f4 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/MapGenCavesMoon.java @@ -90,12 +90,12 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime if (par6 >= d4 - 16.0D - d6 * 2.0D && par10 >= d5 - 16.0D - d6 * 2.0D && par6 <= d4 + 16.0D + d6 * 2.0D && par10 <= d5 + 16.0D + d6 * 2.0D) { - int l1 = MathHelper.floor_double(par6 - d6) - par3 * 16 - 1; - int i2 = MathHelper.floor_double(par6 + d6) - par3 * 16 + 1; - int j2 = MathHelper.floor_double(par8 - d7) - 1; - int k2 = MathHelper.floor_double(par8 + d7) + 1; - int l2 = MathHelper.floor_double(par10 - d6) - par4 * 16 - 1; - int i3 = MathHelper.floor_double(par10 + d6) - par4 * 16 + 1; + int l1 = MathHelper.floor(par6 - d6) - par3 * 16 - 1; + int i2 = MathHelper.floor(par6 + d6) - par3 * 16 + 1; + int j2 = MathHelper.floor(par8 - d7) - 1; + int k2 = MathHelper.floor(par8 + d7) + 1; + int l2 = MathHelper.floor(par10 - d6) - par4 * 16 - 1; + int i3 = MathHelper.floor(par10 + d6) - par4 * 16 + 1; if (l1 < 0) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java index f1d1b44e18..0553687d5f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/OverworldGenerator.java @@ -66,12 +66,12 @@ private boolean generateOre(World par1World, Random par2Random, int par3, int pa double var26 = par2Random.nextDouble() * this.amountPerVein / 16.0D; double var28 = (MathHelper.sin(var19 * (float) Math.PI / this.amountPerVein) + 1.0F) * var26 + 1.0D; double var30 = (MathHelper.sin(var19 * (float) Math.PI / this.amountPerVein) + 1.0F) * var26 + 1.0D; - int var32 = MathHelper.floor_double(var20 - var28 / 2.0D); - int var33 = MathHelper.floor_double(var22 - var30 / 2.0D); - int var34 = MathHelper.floor_double(var24 - var28 / 2.0D); - int var35 = MathHelper.floor_double(var20 + var28 / 2.0D); - int var36 = MathHelper.floor_double(var22 + var30 / 2.0D); - int var37 = MathHelper.floor_double(var24 + var28 / 2.0D); + int var32 = MathHelper.floor(var20 - var28 / 2.0D); + int var33 = MathHelper.floor(var22 - var30 / 2.0D); + int var34 = MathHelper.floor(var24 - var28 / 2.0D); + int var35 = MathHelper.floor(var20 + var28 / 2.0D); + int var36 = MathHelper.floor(var22 + var30 / 2.0D); + int var37 = MathHelper.floor(var24 + var28 / 2.0D); for (int var38 = var32; var38 <= var35; ++var38) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java index d2b86bc11a..723d2aa880 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/StructureComponentVillage.java @@ -142,7 +142,7 @@ protected void spawnVillagers(World par1World, StructureBoundingBox par2Structur ++this.villagersSpawned; final EntityAlienVillager var11 = new EntityAlienVillager(par1World); var11.setLocationAndAngles(var8 + 0.5D, var9, var10 + 0.5D, 0.0F, 0.0F); - par1World.spawnEntityInWorld(var11); + par1World.spawnEntity(var11); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java index 998b7a82ee..cdd16f769a 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java +++ b/src/main/java/micdoodle8/mods/galacticraft/core/world/gen/WorldGenMinableMeta.java @@ -55,12 +55,12 @@ public boolean generate(World worldIn, Random rand, BlockPos position) double d9 = rand.nextDouble() * (double) this.numberOfBlocks / 16.0D; double d10 = (double) (MathHelper.sin((float) Math.PI * f1) + 1.0F) * d9 + 1.0D; double d11 = (double) (MathHelper.sin((float) Math.PI * f1) + 1.0F) * d9 + 1.0D; - int j = MathHelper.floor_double(d6 - d10 / 2.0D); - int k = MathHelper.floor_double(d7 - d11 / 2.0D); - int l = MathHelper.floor_double(d8 - d10 / 2.0D); - int i1 = MathHelper.floor_double(d6 + d10 / 2.0D); - int j1 = MathHelper.floor_double(d7 + d11 / 2.0D); - int k1 = MathHelper.floor_double(d8 + d10 / 2.0D); + int j = MathHelper.floor(d6 - d10 / 2.0D); + int k = MathHelper.floor(d7 - d11 / 2.0D); + int l = MathHelper.floor(d8 - d10 / 2.0D); + int i1 = MathHelper.floor(d6 + d10 / 2.0D); + int j1 = MathHelper.floor(d7 + d11 / 2.0D); + int k1 = MathHelper.floor(d8 + d10 / 2.0D); for (int l1 = j; l1 <= i1; ++l1) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java index 3b314a8c0c..27da58fdf2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/AsteroidsModuleClient.java @@ -268,11 +268,11 @@ public void spawnParticle(String particleID, Vector3 position, Vector3 motion, O { if (particleID.equals("portalBlue")) { - particle = new EntityFXTeleport(mc.theWorld, position, motion, (TileEntityShortRangeTelepad) extraData[0], (Boolean) extraData[1]); + particle = new EntityFXTeleport(mc.world, position, motion, (TileEntityShortRangeTelepad) extraData[0], (Boolean) extraData[1]); } else if (particleID.equals("cryoFreeze")) { - particle = new EntityCryoFX(mc.theWorld, position, motion); + particle = new EntityCryoFX(mc.world, position, motion); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java index 61d5b279e2..ba18bfcdda 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockBeamReceiver.java @@ -213,7 +213,7 @@ private int getMetadataFromAngle(World world, BlockPos pos, EnumFacing side) } @Override - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { return getStateFromMeta(this.getMetadataFromAngle(worldIn, pos, facing)); } @@ -237,7 +237,7 @@ public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) @SideOnly(Side.CLIENT) private void sendIncorrectSideMessage() { - FMLClientHandler.instance().getClient().thePlayer.addChatMessage(new TextComponentString(EnumColor.RED + GCCoreUtil.translate("gui.receiver.cannot_attach"))); + FMLClientHandler.instance().getClient().thePlayer.sendMessage(new TextComponentString(EnumColor.RED + GCCoreUtil.translate("gui.receiver.cannot_attach"))); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java index eeaf755478..9a9f1af0c1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBase.java @@ -71,7 +71,7 @@ public TileEntity createTileEntity(World world, IBlockState metadata) } @Override - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { return getStateFromMeta(0); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java index f30c0cc654..21c2e44aac 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockMinerBaseFull.java @@ -66,7 +66,7 @@ public TileEntity createTileEntity(World world, IBlockState state) } @Override - public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) + public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { return this.getStateFromMeta(0); //TODO diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java index e4af89d3d0..191c4d16bd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockShortRangeTelepad.java @@ -133,7 +133,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti { if (!worldIn.isRemote) { - ((EntityPlayer) placer).addChatMessage(new TextComponentString(EnumColor.RED + GCCoreUtil.translate("gui.warning.noroom"))); + ((EntityPlayer) placer).sendMessage(new TextComponentString(EnumColor.RED + GCCoreUtil.translate("gui.warning.noroom"))); } ((EntityPlayer) placer).inventory.addItemStackToInventory(new ItemStack(Item.getItemFromBlock(this), 1, 0)); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java index e5069b457d..e6a4ff5f72 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/blocks/BlockTelepadFake.java @@ -92,7 +92,7 @@ public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, Bloc // } // // @Override -// public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) +// public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) // { // this.setBlockBoundsBasedOnState(worldIn, pos); // return super.getCollisionBoundingBox(worldIn, pos, state); @@ -150,7 +150,7 @@ public void breakBlock(World worldIn, BlockPos pos, IBlockState state) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { TileEntityTelepadFake tileEntity = (TileEntityTelepadFake) worldIn.getTileEntity(pos); return tileEntity.onActivated(playerIn); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiAstroMinerDock.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiAstroMinerDock.java index 3e9fe512dd..ed1be46d7f 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiAstroMinerDock.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiAstroMinerDock.java @@ -104,7 +104,7 @@ protected void actionPerformed(GuiButton par1GuiButton) switch (par1GuiButton.id) { case 0: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, mc.theWorld.provider.getDimension(), new Object[] { this.tile.getPos(), 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, mc.world.provider.getDimension(), new Object[] { this.tile.getPos(), 0 })); break; default: break; @@ -124,15 +124,15 @@ protected void drawGuiContainerForegroundLayer(int par1, int par2) this.fontRendererObj.drawString(this.getStatus(), 177, 141, 4210752); if (this.extraLines) { - this.fontRendererObj.drawString("\u0394x: " + getDeltaString((MathHelper.floor_double(this.tile.linkedMiner.posX) - this.tile.getPos().getX() - 1)), 186, 152, 2536735); + this.fontRendererObj.drawString("\u0394x: " + getDeltaString((MathHelper.floor(this.tile.linkedMiner.posX) - this.tile.getPos().getX() - 1)), 186, 152, 2536735); } if (this.extraLines) { - this.fontRendererObj.drawString("\u0394y: " + getDeltaString((MathHelper.floor_double(this.tile.linkedMiner.posY) - this.tile.getPos().getY())), 186, 162, 2536735); + this.fontRendererObj.drawString("\u0394y: " + getDeltaString((MathHelper.floor(this.tile.linkedMiner.posY) - this.tile.getPos().getY())), 186, 162, 2536735); } if (this.extraLines) { - this.fontRendererObj.drawString("\u0394z: " + getDeltaString((MathHelper.floor_double(this.tile.linkedMiner.posZ) - this.tile.getPos().getZ() - 1)), 186, 172, 2536735); + this.fontRendererObj.drawString("\u0394z: " + getDeltaString((MathHelper.floor(this.tile.linkedMiner.posZ) - this.tile.getPos().getZ() - 1)), 186, 172, 2536735); } if (this.extraLines) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiShortRangeTelepad.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiShortRangeTelepad.java index 0cfb0a8db2..2195d2ad49 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiShortRangeTelepad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/gui/GuiShortRangeTelepad.java @@ -130,7 +130,7 @@ protected void actionPerformed(GuiButton par1GuiButton) switch (par1GuiButton.id) { case 0: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { this.telepad.getPos(), 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(mc.world), new Object[] { this.telepad.getPos(), 0 })); break; default: break; @@ -192,12 +192,12 @@ public void onTextChanged(GuiElementTextBox textBox, String newText) if (textBox.equals(this.address)) { this.telepad.address = textBox.getIntegerValue(); - GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleAsteroids(PacketSimpleAsteroids.EnumSimplePacketAsteroids.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(this.mc.theWorld), new Object[] { 0, this.telepad.getPos(), this.telepad.address })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleAsteroids(PacketSimpleAsteroids.EnumSimplePacketAsteroids.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(this.mc.world), new Object[] { 0, this.telepad.getPos(), this.telepad.address })); } else if (textBox.equals(this.targetAddress)) { this.telepad.targetAddress = textBox.getIntegerValue(); - GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleAsteroids(PacketSimpleAsteroids.EnumSimplePacketAsteroids.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(this.mc.theWorld), new Object[] { 1, this.telepad.getPos(), this.telepad.targetAddress })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleAsteroids(PacketSimpleAsteroids.EnumSimplePacketAsteroids.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(this.mc.world), new Object[] { 1, this.telepad.getPos(), this.telepad.targetAddress })); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderTier3Rocket.java index 2aea6ec4f9..c4628ed547 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/client/render/entity/RenderTier3Rocket.java @@ -78,7 +78,7 @@ public void doRender(EntityTier3Rocket entity, double par2, double par4, double if (var28 > 0.0F) { - final float i = entity.getLaunched() ? (5 - MathHelper.floor_double(entity.timeUntilLaunch / 85)) / 10F : 0.3F; + final float i = entity.getLaunched() ? (5 - MathHelper.floor(entity.timeUntilLaunch / 85)) / 10F : 0.3F; GL11.glRotatef(MathHelper.sin(var28) * var28 * i * par9, 1.0F, 0.0F, 0.0F); GL11.glRotatef(MathHelper.sin(var28) * var28 * i * par9, 1.0F, 0.0F, 1.0F); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java index a6402ba9de..d7591fc14c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/dimension/TeleportTypeAsteroids.java @@ -45,8 +45,8 @@ public Vector3 getPlayerSpawnLocation(WorldServer world, EntityPlayerMP player) if (player != null) { IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); - int x = MathHelper.floor_double(stats.getCoordsTeleportedFromX()); - int z = MathHelper.floor_double(stats.getCoordsTeleportedFromZ()); + int x = MathHelper.floor(stats.getCoordsTeleportedFromX()); + int z = MathHelper.floor(stats.getCoordsTeleportedFromZ()); int limit = ConfigManagerCore.otherPlanetWorldBorders - 2; if (limit > 20) { @@ -326,7 +326,7 @@ public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boole { EntityEntryPod entryPod = new EntityEntryPod(player); - newWorld.spawnEntityInWorld(entryPod); + newWorld.spawnEntity(entryPod); } stats.setTeleportCooldown(10); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java index 758bc1321f..035dbf03be 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityAstroMiner.java @@ -324,7 +324,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer var1) + public boolean isUsableByPlayer(EntityPlayer var1) { return !this.isDead && var1.getDistanceSqToEntity(this) <= 64.0D; } @@ -499,7 +499,7 @@ else if (((TileEntityMinerBase) tileEntity).linkedMiner != this) { if (this.playerMP != null && (this.givenFailMessage & (1 << FAIL_BASEDESTROYED)) == 0) { - this.playerMP.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner" + FAIL_BASEDESTROYED + ".fail"))); + this.playerMP.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner" + FAIL_BASEDESTROYED + ".fail"))); this.givenFailMessage += (1 << FAIL_BASEDESTROYED); //Continue mining even though base was destroyed - maybe it will be replaced } @@ -661,7 +661,7 @@ private void freeze(int i) this.motionZ = 0; if (this.playerMP != null && (this.givenFailMessage & (1 << i)) == 0) { - this.playerMP.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner" + i + ".fail"))); + this.playerMP.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner" + i + ".fail"))); this.givenFailMessage += (1 << i); } } @@ -782,7 +782,7 @@ private void atBase() { if (this.playerMP != null && (this.givenFailMessage & 64) == 0) { - this.playerMP.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner6.fail"))); + this.playerMP.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner6.fail"))); this.givenFailMessage += 64; } } @@ -890,7 +890,7 @@ private void setMinePoints() return; } - BlockVec3 inFront = new BlockVec3(MathHelper.floor_double(this.posX + 0.5D), MathHelper.floor_double(this.posY + 1.5D), MathHelper.floor_double(this.posZ + 0.5D)); + BlockVec3 inFront = new BlockVec3(MathHelper.floor(this.posX + 0.5D), MathHelper.floor(this.posY + 1.5D), MathHelper.floor(this.posZ + 0.5D)); int otherEnd = (this.worldObj.provider instanceof WorldProviderAsteroids) ? this.MINE_LENGTH_AST : this.MINE_LENGTH; if (this.baseFacing == EnumFacing.NORTH || this.baseFacing == EnumFacing.WEST) { @@ -1003,7 +1003,7 @@ private boolean prepareMove(int limit, int dist) this.mineCountDown--; return false; } - BlockVec3 inFront = new BlockVec3(MathHelper.floor_double(this.posX + 0.5D), MathHelper.floor_double(this.posY + 1.5D), MathHelper.floor_double(this.posZ + 0.5D)); + BlockVec3 inFront = new BlockVec3(MathHelper.floor(this.posX + 0.5D), MathHelper.floor(this.posY + 1.5D), MathHelper.floor(this.posZ + 0.5D)); if (dist == 2) { inFront.translate(headings2[this.facingAI.getIndex()]); @@ -1204,7 +1204,7 @@ private boolean prepareMove(int limit, int dist) { if (this.playerMP != null) { - this.playerMP.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner1_a.fail") + " " + GCCoreUtil.translate(EntityAstroMiner.blockingBlock.toString()))); + this.playerMP.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner1_a.fail") + " " + GCCoreUtil.translate(EntityAstroMiner.blockingBlock.toString()))); } this.motionX = 0; this.motionY = 0; @@ -1241,7 +1241,7 @@ else if (this.AIstate == AISTATE_RETURNING) private boolean prepareMoveClient(int limit, int dist) { - BlockVec3 inFront = new BlockVec3(MathHelper.floor_double(this.posX + 0.5D), MathHelper.floor_double(this.posY + 1.5D), MathHelper.floor_double(this.posZ + 0.5D)); + BlockVec3 inFront = new BlockVec3(MathHelper.floor(this.posX + 0.5D), MathHelper.floor(this.posY + 1.5D), MathHelper.floor(this.posZ + 0.5D)); if (dist == 2) { inFront.translate(headings2[this.facing.getIndex()]); @@ -1529,7 +1529,7 @@ private void dropStack(BlockPos pos, ItemStack drops) double d2 = this.worldObj.rand.nextFloat() * f + (1.0F - f) * 0.5D; EntityItem entityitem = new EntityItem(this.worldObj, pos.getX() + d0, pos.getY() + d1, pos.getZ() + d2, drops); entityitem.setDefaultPickupDelay(); - this.worldObj.spawnEntityInWorld(entityitem); + this.worldObj.spawnEntity(entityitem); this.inventoryDrops++; } @@ -2027,7 +2027,7 @@ public static boolean spawnMinerAtBase(World world, int x, int y, int z, EnumFac return false; } - world.spawnEntityInWorld(miner); + world.spawnEntity(miner); miner.flagLink = true; return true; } @@ -2083,7 +2083,7 @@ public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { if (this.playerMP == null && !this.spawnedInCreative) { - ((EntityPlayer) e).addChatMessage(new TextComponentString("WARNING: that Astro Miner belonged to an offline player, cannot reset player's Astro Miner count.")); + ((EntityPlayer) e).sendMessage(new TextComponentString("WARNING: that Astro Miner belonged to an offline player, cannot reset player's Astro Miner count.")); } this.kill(); return true; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityTier3Rocket.java index 04d8f97c0f..f6e7c976ff 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/EntityTier3Rocket.java @@ -132,7 +132,7 @@ public void onUpdate() } } - if (this.timeSinceLaunch % MathHelper.floor_double(2 * (1 / multiplier)) == 0) + if (this.timeSinceLaunch % MathHelper.floor(2 * (1 / multiplier)) == 0) { this.removeFuel(1); if (!this.hasValidFuel()) @@ -243,7 +243,7 @@ private void makeFlame(double x2, double y2, double z2, Vector3 motionVec, boole } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return !this.isDead && par1EntityPlayer.getDistanceSqToEntity(this) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/player/AsteroidsPlayerHandler.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/player/AsteroidsPlayerHandler.java index 34486f7ab6..43bc028c03 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/player/AsteroidsPlayerHandler.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/entities/player/AsteroidsPlayerHandler.java @@ -91,7 +91,7 @@ public void onPlayerUpdate(EntityPlayerMP player) smallAsteroid.spinYaw = player.worldObj.rand.nextFloat() * 4; smallAsteroid.spinPitch = player.worldObj.rand.nextFloat() * 2; - player.worldObj.spawnEntityInWorld(smallAsteroid); + player.worldObj.spawnEntity(smallAsteroid); } } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicAstroMiner.java index 98f2b8b182..17383e1421 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicAstroMiner.java @@ -121,7 +121,7 @@ public void markDirty() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicTier3Rocket.java index 84b8448b26..1c6e4b4a6c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/inventory/InventorySchematicTier3Rocket.java @@ -121,7 +121,7 @@ public void markDirty() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java index 2ef5db3ceb..38dc52c301 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemAstroMiner.java @@ -93,13 +93,13 @@ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World { if (worldIn.provider instanceof WorldProviderSpaceStation) { - playerIn.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner7.fail"))); + playerIn.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner7.fail"))); return EnumActionResult.FAIL; } if (((TileEntityMinerBase) tile).getLinkedMiner() != null) { - playerIn.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner.fail"))); + playerIn.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner.fail"))); return EnumActionResult.FAIL; } @@ -115,13 +115,13 @@ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World int astroCount = stats.getAstroMinerCount(); if (astroCount >= ConfigManagerAsteroids.astroMinerMax && (!playerIn.capabilities.isCreativeMode)) { - playerIn.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner2.fail"))); + playerIn.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner2.fail"))); return EnumActionResult.FAIL; } if (!((TileEntityMinerBase) tile).spawnMiner(playerMP)) { - playerIn.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner1.fail") + " " + GCCoreUtil.translate(EntityAstroMiner.blockingBlock.toString()))); + playerIn.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.message.astro_miner1.fail") + " " + GCCoreUtil.translate(EntityAstroMiner.blockingBlock.toString()))); return EnumActionResult.FAIL; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemGrappleHook.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemGrappleHook.java index 5bba2161f7..fb3e021af7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemGrappleHook.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemGrappleHook.java @@ -82,7 +82,7 @@ public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBas if (!worldIn.isRemote) { - worldIn.spawnEntityInWorld(grapple); + worldIn.spawnEntity(grapple); } stack.damageItem(1, player); @@ -100,7 +100,7 @@ public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityLivingBas } else if (worldIn.isRemote) { - player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.message.grapple.fail"))); + player.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.message.grapple.fail"))); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java index 5bdce518f8..0f820c293b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/items/ItemTier3Rocket.java @@ -121,7 +121,7 @@ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World rocket.rotationYaw += 45; rocket.setPosition(rocket.posX, rocket.posY + rocket.getOnPadYOffset(), rocket.posZ); - worldIn.spawnEntityInWorld(rocket); + worldIn.spawnEntity(rocket); if (stack.hasTagCompound() && stack.getTagCompound().hasKey("RocketFuel")) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java index 3332838a86..c00cf1f5cc 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityMinerBase.java @@ -302,7 +302,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java index 77114219cf..8e903b210e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/asteroids/tile/TileEntityShortRangeTelepad.java @@ -406,7 +406,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(getPos()) == this && par1EntityPlayer.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java index d617991476..4d7c798bf9 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/EventHandlerMars.java @@ -166,9 +166,9 @@ public void orientCamera(OrientCameraEvent event) if (entity != null) { - int x = MathHelper.floor_double(entity.posX); - int y = MathHelper.floor_double(entity.posY); - int z = MathHelper.floor_double(entity.posZ); + int x = MathHelper.floor(entity.posX); + int y = MathHelper.floor(entity.posY); + int z = MathHelper.floor(entity.posZ); TileEntity tile = Minecraft.getMinecraft().theWorld.getTileEntity(new BlockPos(x, y - 1, z)); if (tile instanceof TileEntityMulti) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java index 72665c12ec..0297392126 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/MarsModuleClient.java @@ -271,11 +271,11 @@ public void spawnParticle(String particleID, Vector3 position, Vector3 motion, O { if (particleID.equals("sludgeDrip")) { -// particle = new EntityDropParticleFX(mc.theWorld, position.x, position.y, position.z, Material.WATER); TODO +// particle = new EntityDropParticleFX(mc.world, position.x, position.y, position.z, Material.WATER); TODO } else if (particleID.equals("bacterialDrip")) { - particle = new ParticleDrip(mc.theWorld, position.x, position.y, position.z); + particle = new ParticleDrip(mc.world, position.x, position.y, position.z); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java index 85a60584d8..4c6c51fa79 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCavernousVine.java @@ -158,7 +158,7 @@ public boolean isFullCube(IBlockState state) } @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java index c2f146f756..0557349610 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockCreeperEgg.java @@ -59,7 +59,7 @@ public boolean isFullCube(IBlockState state) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { return false; } @@ -85,7 +85,7 @@ public void onBlockExploded(World world, BlockPos pos, Explosion explosion) EntityEvolvedCreeper creeper = new EntityEvolvedCreeper(world); creeper.setPosition(pos.getX() + 0.5, pos.getY() + 3, pos.getZ() + 0.5); creeper.setChild(true); - world.spawnEntityInWorld(creeper); + world.spawnEntity(creeper); } world.setBlockToAir(pos); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java index a18245d717..c3e8b2c99e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMars.java @@ -119,7 +119,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti { int metadata = getMetaFromState(state); - final int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + final int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int change = EnumFacing.getHorizontal(angle).getOpposite().getHorizontalIndex(); worldIn.setBlockState(pos, getStateFromMeta((metadata & 12) + change), 3); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java index 9aafc8a305..acf1378cbb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockMachineMarsT2.java @@ -197,7 +197,7 @@ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, Enti { int metadata = state.getBlock().getMetaFromState(state); - int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int change = EnumFacing.getHorizontal(angle).getOpposite().getHorizontalIndex(); worldIn.setBlockState(pos, getStateFromMeta((metadata & 12) + change), 3); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java index 42a77a46ab..bd85c7d6cd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSlimelingEgg.java @@ -153,7 +153,7 @@ else if (player.capabilities.isCreativeMode) } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { return beginHatch(worldIn, pos, playerIn); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSludge.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSludge.java index 638e1a638f..161ece4cb2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSludge.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/blocks/BlockSludge.java @@ -45,7 +45,7 @@ public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState s { EntitySludgeling sludgeling = new EntitySludgeling(worldIn); sludgeling.setPosition(pos.getX() + worldIn.rand.nextInt(5) - 2, pos.getY(), pos.getZ() + worldIn.rand.nextInt(5) - 2); - worldIn.spawnEntityInWorld(sludgeling); + worldIn.spawnEntity(sludgeling); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/ParticleDrip.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/ParticleDrip.java index 262769f64c..26f9512628 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/ParticleDrip.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/fx/ParticleDrip.java @@ -78,7 +78,7 @@ public void onUpdate() d0 = BlockLiquid.getLiquidHeightPercent(((Integer) state.getValue(BlockLiquid.LEVEL)).intValue()); } - double d1 = MathHelper.floor_double(this.posY) + 1 - d0; + double d1 = MathHelper.floor(this.posY) + 1 - d0; if (this.posY < d1) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiCargoRocket.java index a631373c90..474726cec6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiCargoRocket.java @@ -62,7 +62,7 @@ protected void actionPerformed(GuiButton button) switch (button.id) { case 0: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_CARGO_ROCKET_STATUS, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { this.rocket.getEntityId(), 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_CARGO_ROCKET_STATUS, GCCoreUtil.getDimensionID(mc.world), new Object[] { this.rocket.getEntityId(), 0 })); break; default: break; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiLaunchController.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiLaunchController.java index 1e2dc16ed5..551f386f96 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiLaunchController.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiLaunchController.java @@ -254,10 +254,10 @@ protected void actionPerformed(GuiButton par1GuiButton) switch (par1GuiButton.id) { case 0: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, mc.theWorld.provider.getDimension(), new Object[] { this.launchController.getPos(), 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, mc.world.provider.getDimension(), new Object[] { this.launchController.getPos(), 0 })); break; case 6: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, mc.theWorld.provider.getDimension(), new Object[] { this.launchController.getPos(), 2 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, mc.world.provider.getDimension(), new Object[] { this.launchController.getPos(), 2 })); break; default: break; @@ -352,7 +352,7 @@ public void onSelectionChanged(GuiElementDropdown dropdown, int selection) if (dropdown.equals(this.dropdownTest)) { this.launchController.launchDropdownSelection = selection; - GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 1, this.launchController.getPos(), this.launchController.launchDropdownSelection })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(mc.world), new Object[] { 1, this.launchController.getPos(), this.launchController.launchDropdownSelection })); } } @@ -381,12 +381,12 @@ public void onTextChanged(GuiElementTextBox textBox, String newText) if (textBox.equals(this.frequency)) { this.launchController.frequency = textBox.getIntegerValue(); - GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 0, this.launchController.getPos(), this.launchController.frequency })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(mc.world), new Object[] { 0, this.launchController.getPos(), this.launchController.frequency })); } else if (textBox.equals(this.destinationFrequency)) { this.launchController.destFrequency = textBox.getIntegerValue(); - GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 2, this.launchController.getPos(), this.launchController.destFrequency })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(mc.world), new Object[] { 2, this.launchController.getPos(), this.launchController.destFrequency })); } } } @@ -443,12 +443,12 @@ public void onSelectionChanged(GuiElementCheckbox checkbox, boolean newSelected) if (checkbox.equals(this.enablePadRemovalButton)) { this.launchController.launchPadRemovalDisabled = !newSelected; - GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 3, this.launchController.getPos(), this.launchController.launchPadRemovalDisabled ? 1 : 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(mc.world), new Object[] { 3, this.launchController.getPos(), this.launchController.launchPadRemovalDisabled ? 1 : 0 })); } else if (checkbox.equals(this.launchWhenCheckbox)) { this.launchController.launchSchedulingEnabled = newSelected; - GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 4, this.launchController.getPos(), this.launchController.launchSchedulingEnabled ? 1 : 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_ADVANCED_GUI, GCCoreUtil.getDimensionID(mc.world), new Object[] { 4, this.launchController.getPos(), this.launchController.launchSchedulingEnabled ? 1 : 0 })); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSlimelingFeed.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSlimelingFeed.java index 6bb059b9a5..aea210e725 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSlimelingFeed.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiSlimelingFeed.java @@ -80,7 +80,7 @@ protected void actionPerformed(GuiButton par1GuiButton) switch (par1GuiButton.id) { case 0: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_SLIMELING_DATA, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { this.slimeling.getEntityId(), 2, "" })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_SLIMELING_DATA, GCCoreUtil.getDimensionID(mc.world), new Object[] { this.slimeling.getEntityId(), 2, "" })); break; case 1: if (!this.slimeling.isInLove() && this.slimeling.isOwner(this.mc.thePlayer) && this.slimeling.worldObj.isRemote) @@ -88,13 +88,13 @@ protected void actionPerformed(GuiButton par1GuiButton) this.slimeling.setInLove(this.mc.thePlayer); } - GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_SLIMELING_DATA, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { this.slimeling.getEntityId(), 3, "" })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_SLIMELING_DATA, GCCoreUtil.getDimensionID(mc.world), new Object[] { this.slimeling.getEntityId(), 3, "" })); break; case 2: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_SLIMELING_DATA, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { this.slimeling.getEntityId(), 4, "" })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_SLIMELING_DATA, GCCoreUtil.getDimensionID(mc.world), new Object[] { this.slimeling.getEntityId(), 4, "" })); break; case 3: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_SLIMELING_DATA, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { this.slimeling.getEntityId(), 5, "" })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimpleMars(EnumSimplePacketMars.S_UPDATE_SLIMELING_DATA, GCCoreUtil.getDimensionID(mc.world), new Object[] { this.slimeling.getEntityId(), 5, "" })); break; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiTerraformer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiTerraformer.java index 84a0c2d8a2..a44018f2c7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiTerraformer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/gui/GuiTerraformer.java @@ -104,10 +104,10 @@ protected void actionPerformed(GuiButton par1GuiButton) switch (par1GuiButton.id) { case 0: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { this.terraformer.getPos(), 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(mc.world), new Object[] { this.terraformer.getPos(), 0 })); break; case 1: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { this.terraformer.getPos(), 1 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(mc.world), new Object[] { this.terraformer.getPos(), 1 })); break; case 2: break; @@ -216,7 +216,7 @@ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) public void onSelectionChanged(GuiElementCheckbox checkbox, boolean newSelected) { this.terraformer.shouldRenderBubble = newSelected; - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.theWorld), new Object[] { 6, this.terraformer.getPos(), newSelected ? 1 : 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT, GCCoreUtil.getDimensionID(mc.world), new Object[] { 6, this.terraformer.getPos(), newSelected ? 1 : 0 })); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderTier2Rocket.java index bcf6dd3b54..d3fee02860 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/client/render/entity/RenderTier2Rocket.java @@ -64,7 +64,7 @@ public void doRender(EntityTier2Rocket entity, double par2, double par4, double if (var28 > 0.0F) { - final float i = entity.getLaunched() ? (5 - MathHelper.floor_double(entity.timeUntilLaunch / 85)) / 10F : 0.3F; + final float i = entity.getLaunched() ? (5 - MathHelper.floor(entity.timeUntilLaunch / 85)) / 10F : 0.3F; GL11.glRotatef(MathHelper.sin(var28) * var28 * i * par9, 1.0F, 0.0F, 0.0F); GL11.glRotatef(MathHelper.sin(var28) * var28 * i * par9, 1.0F, 0.0F, 1.0F); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/TeleportTypeMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/TeleportTypeMars.java index 3ef82244a9..4c57734631 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/TeleportTypeMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/dimension/TeleportTypeMars.java @@ -89,7 +89,7 @@ public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boole if (!newWorld.isRemote) { - newWorld.spawnEntityInWorld(lander); + newWorld.spawnEntity(lander); } stats.setTeleportCooldown(10); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCargoRocket.java index 887623e362..4e43b0c7c1 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCargoRocket.java @@ -108,7 +108,7 @@ public void onUpdate() } } - if (this.timeSinceLaunch % MathHelper.floor_double(3 * (1 / multiplier)) == 0) + if (this.timeSinceLaunch % MathHelper.floor(3 * (1 / multiplier)) == 0) { this.removeFuel(1); if (!this.hasValidFuel()) diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java index 7a64f92173..1cda5d92fd 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityCreeperBoss.java @@ -220,7 +220,7 @@ public EntityItem entityDropItem(ItemStack par1ItemStack, float par2) } else { - this.worldObj.spawnEntityInWorld(entityitem); + this.worldObj.spawnEntity(entityitem); } return entityitem; } @@ -303,7 +303,7 @@ public void attackEntityWithRangedAttack(EntityLivingBase entitylivingbase, floa projectileTNT.posY = d4; projectileTNT.posX = d3; projectileTNT.posZ = d5; - this.worldObj.spawnEntityInWorld(projectileTNT); + this.worldObj.spawnEntity(projectileTNT); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySlimeling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySlimeling.java index 2c47f42061..ea3f297b05 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySlimeling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntitySlimeling.java @@ -441,7 +441,7 @@ public boolean processInteract(EntityPlayer player, EnumHand hand, ItemStack sta IStatsCapability stats = player.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); if (stats.getChatCooldown() == 0) { - player.addChatMessage(new TextComponentString(GCCoreUtil.translate("gui.slimeling.chat.wrong_player"))); + player.sendMessage(new TextComponentString(GCCoreUtil.translate("gui.slimeling.chat.wrong_player"))); stats.setChatCooldown(100); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityTier2Rocket.java index 4c46acdfe3..47c5ccdfc3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/entities/EntityTier2Rocket.java @@ -135,7 +135,7 @@ public void onUpdate() } } - if (this.timeSinceLaunch % MathHelper.floor_double(2 * (1 / multiplier)) == 0) + if (this.timeSinceLaunch % MathHelper.floor(2 * (1 / multiplier)) == 0) { this.removeFuel(1); if (!this.hasValidFuel()) @@ -236,7 +236,7 @@ protected void spawnParticles(boolean launched) } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return !this.isDead && par1EntityPlayer.getDistanceSqToEntity(this) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicCargoRocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicCargoRocket.java index 54f261a5ea..8ccafc7c8b 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicCargoRocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicCargoRocket.java @@ -121,7 +121,7 @@ public void markDirty() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicTier2Rocket.java index 83db417463..1176c5cbc7 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySchematicTier2Rocket.java @@ -121,7 +121,7 @@ public void markDirty() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return true; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySlimeling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySlimeling.java index 9d4b2df2ca..04f83d1257 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySlimeling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/inventory/InventorySlimeling.java @@ -180,7 +180,7 @@ public void markDirty() } @Override - public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) + public boolean isUsableByPlayer(EntityPlayer par1EntityPlayer) { return !this.slimeling.isDead && par1EntityPlayer.getDistanceSqToEntity(this.slimeling) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java index 642f06e4bf..c71024f72c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/items/ItemTier2Rocket.java @@ -131,7 +131,7 @@ public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, Wor } rocket.setPosition(rocket.posX, rocket.posY + rocket.getOnPadYOffset(), rocket.posZ); - world.spawnEntityInWorld(rocket); + world.spawnEntity(rocket); if (stack.hasTagCompound() && stack.getTagCompound().hasKey("RocketFuel")) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java index 86794cf4a8..2e7731c7ff 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityCryogenicChamber.java @@ -58,7 +58,7 @@ public boolean onActivated(EntityPlayer entityPlayer) return true; case NOT_POSSIBLE_NOW: IStatsCapability stats = entityPlayer.getCapability(CapabilityStatsHandler.GC_STATS_CAPABILITY, null); - entityPlayer.addChatMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.cryogenic.chat.cant_use", stats.getCryogenicChamberCooldown() / 20))); + entityPlayer.sendMessage(new TextComponentString(GCCoreUtil.translateWithFormat("gui.cryogenic.chat.cant_use", stats.getCryogenicChamberCooldown() / 20))); return false; default: return false; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntitySlimelingEgg.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntitySlimelingEgg.java index bdec382ddb..651e686558 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntitySlimelingEgg.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntitySlimelingEgg.java @@ -56,7 +56,7 @@ else if (this.timeToHatch == 0 && lastTouchedPlayerUUID != null && lastTouchedPl if (!this.worldObj.isRemote) { - this.worldObj.spawnEntityInWorld(slimeling); + this.worldObj.spawnEntity(slimeling); } slimeling.setTamed(true); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java index 1919ac58e3..530feac4fb 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/tile/TileEntityTerraformer.java @@ -94,7 +94,7 @@ public void update() // if (!this.worldObj.isRemote) // { // this.terraformBubble = new EntityTerraformBubble(this.worldObj, new Vector3(this), this); -// this.worldObj.spawnEntityInWorld(this.terraformBubble); +// this.worldObj.spawnEntity(this.terraformBubble); // } // } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java index e050b73d63..e631bc5006 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCaveMars.java @@ -91,12 +91,12 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime if (par6 >= d4 - 16.0D - d6 * 2.0D && par10 >= d5 - 16.0D - d6 * 2.0D && par6 <= d4 + 16.0D + d6 * 2.0D && par10 <= d5 + 16.0D + d6 * 2.0D) { - int l1 = MathHelper.floor_double(par6 - d6) - par3 * 16 - 1; - int i2 = MathHelper.floor_double(par6 + d6) - par3 * 16 + 1; - int j2 = MathHelper.floor_double(par8 - d7) - 1; - int k2 = MathHelper.floor_double(par8 + d7) + 1; - int l2 = MathHelper.floor_double(par10 - d6) - par4 * 16 - 1; - int i3 = MathHelper.floor_double(par10 + d6) - par4 * 16 + 1; + int l1 = MathHelper.floor(par6 - d6) - par3 * 16 - 1; + int i2 = MathHelper.floor(par6 + d6) - par3 * 16 + 1; + int j2 = MathHelper.floor(par8 - d7) - 1; + int k2 = MathHelper.floor(par8 + d7) + 1; + int l2 = MathHelper.floor(par10 - d6) - par4 * 16 - 1; + int i3 = MathHelper.floor(par10 + d6) - par4 * 16 + 1; if (l1 < 0) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java index 4935ea1dd8..909d850be3 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/mars/world/gen/MapGenCavernMars.java @@ -114,12 +114,12 @@ protected void generateCaveNode(long par1, int origXChunkCoord, int origZChunkCo if (xPos >= var19 - 16.0D - caveWidth * 2.0D && zPos >= var21 - 16.0D - caveWidth * 2.0D && xPos <= var19 + 16.0D + caveWidth * 2.0D && zPos <= var21 + 16.0D + caveWidth * 2.0D) // CHECKED { - int caveMinX = MathHelper.floor_double(xPos - caveWidth) - origXChunkCoord * 16 - 1; - int caveMaxX = MathHelper.floor_double(xPos + caveWidth) - origXChunkCoord * 16 + 1; - int caveMinY = MathHelper.floor_double(yPos - caveHeight) - 1; - int caveMaxY = MathHelper.floor_double(yPos + caveHeight) + 1; - int caveMinZ = MathHelper.floor_double(zPos - caveWidth) - origZChunkCoord * 16 - 1; - int caveMaxZ = MathHelper.floor_double(zPos + caveWidth) - origZChunkCoord * 16 + 1; + int caveMinX = MathHelper.floor(xPos - caveWidth) - origXChunkCoord * 16 - 1; + int caveMaxX = MathHelper.floor(xPos + caveWidth) - origXChunkCoord * 16 + 1; + int caveMinY = MathHelper.floor(yPos - caveHeight) - 1; + int caveMaxY = MathHelper.floor(yPos + caveHeight) + 1; + int caveMinZ = MathHelper.floor(zPos - caveWidth) - origZChunkCoord * 16 - 1; + int caveMaxZ = MathHelper.floor(zPos + caveWidth) - origZChunkCoord * 16 + 1; if (caveMinX < 0) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java index 96e7f04720..cbee6ef18d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/VenusModuleClient.java @@ -212,14 +212,14 @@ public void spawnParticle(String particleID, Vector3 position, Vector3 motion, O if (particleID.equals("acidVapor")) { - particle = new ParticleAcidVapor(mc.theWorld, position.x, position.y, position.z, motion.x, motion.y, motion.z, 2.5F); + particle = new ParticleAcidVapor(mc.world, position.x, position.y, position.z, motion.x, motion.y, motion.z, 2.5F); } if (dX * dX + dY * dY + dZ * dZ < viewDistance * viewDistance) { if (particleID.equals("acidExhaust")) { - particle = new ParticleAcidExhaust(mc.theWorld, position.x, position.y, position.z, motion.x, motion.y, motion.z, 0.5F); + particle = new ParticleAcidExhaust(mc.world, position.x, position.y, position.z, motion.x, motion.y, motion.z, 0.5F); } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java index 0ad5221d98..3b989aa96e 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockCrashedProbe.java @@ -76,7 +76,7 @@ public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) + public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { playerIn.openGui(GalacticraftPlanets.instance, GuiIdsPlanets.MACHINE_VENUS, worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java index 5ad38cc3f4..1c516dd312 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockGeothermalGenerator.java @@ -65,7 +65,7 @@ public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; + int angle = MathHelper.floor(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int change = EnumFacing.getHorizontal(angle).getOpposite().getHorizontalIndex(); worldIn.setBlockState(pos, getStateFromMeta(change), 3); } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java index 6ad780f07d..90f68994f8 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/blocks/BlockTorchWeb.java @@ -177,7 +177,7 @@ public boolean isFullCube(IBlockState state) } @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { return null; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/gui/GuiGeothermal.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/gui/GuiGeothermal.java index 3e27f55573..3b74a59453 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/gui/GuiGeothermal.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/client/gui/GuiGeothermal.java @@ -42,7 +42,7 @@ protected void actionPerformed(GuiButton par1GuiButton) switch (par1GuiButton.id) { case 0: - GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(this.mc.theWorld), new Object[] { this.geothermalGenerator.getPos(), 0 })); + GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_DISABLEABLE_BUTTON, GCCoreUtil.getDimensionID(this.mc.world), new Object[] { this.geothermalGenerator.getPos(), 0 })); break; } } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/TeleportTypeVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/TeleportTypeVenus.java index 7419c5fe7c..f18eafaaf6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/TeleportTypeVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/dimension/TeleportTypeVenus.java @@ -89,7 +89,7 @@ public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boole { EntityEntryPodVenus entryPod = new EntityEntryPodVenus(player); - newWorld.spawnEntityInWorld(entryPod); + newWorld.spawnEntity(entryPod); } stats.setTeleportCooldown(10); diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java index ea893f475d..97cc59e8c2 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/EntitySpiderQueen.java @@ -194,7 +194,7 @@ else if (this.rangedAttackTime < 0) double dist = 3.0F; juicer.setPosition(this.posX + dist * Math.sin(angle), this.posY + 0.2F, this.posZ + dist * Math.cos(angle)); juicer.setHanging(true); - this.worldObj.spawnEntityInWorld(juicer); + this.worldObj.spawnEntity(juicer); this.juicersSpawned.add(juicer); } } @@ -369,7 +369,7 @@ public void attackEntityWithRangedAttack(EntityLivingBase target, float damage) { EntityWebShot entityarrow = new EntityWebShot(this.worldObj, this, target, 0.8F, (float)(14 - this.worldObj.getDifficulty().getDifficultyId() * 4)); this.playSound(SoundEvents.ENTITY_ARROW_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F)); - this.worldObj.spawnEntityInWorld(entityarrow); + this.worldObj.spawnEntity(entityarrow); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/EntityMoveHelperCeiling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/EntityMoveHelperCeiling.java index e09c1f22c2..6c0b12cf25 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/EntityMoveHelperCeiling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/EntityMoveHelperCeiling.java @@ -20,7 +20,7 @@ public void onUpdateMoveHelper() if (this.isUpdating()) { this.action = EntityMoveHelper.Action.WAIT; - int i = MathHelper.floor_double(this.entity.getEntityBoundingBox().minY + 0.5D); + int i = MathHelper.floor(this.entity.getEntityBoundingBox().minY + 0.5D); double d0 = this.posX - this.entity.posX; double d1 = this.posZ - this.entity.posZ; double d2 = this.posY - (double)i; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java index 3c45ba5b58..e17c398b96 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/PathNavigateCeiling.java @@ -49,8 +49,8 @@ private int getPathablePosY() @Override protected boolean isDirectPathBetweenPoints(Vec3d current, Vec3d target, int sizeX, int sizeY, int sizeZ) { - int i = MathHelper.floor_double(current.xCoord); - int j = MathHelper.floor_double(current.zCoord); + int i = MathHelper.floor(current.xCoord); + int j = MathHelper.floor(current.zCoord); double d0 = target.xCoord - current.xCoord; double d1 = target.zCoord - current.zCoord; double d2 = d0 * d0 + d1 * d1; @@ -94,8 +94,8 @@ protected boolean isDirectPathBetweenPoints(Vec3d current, Vec3d target, int siz d7 = d7 / d1; int k = d0 < 0.0D ? -1 : 1; int l = d1 < 0.0D ? -1 : 1; - int i1 = MathHelper.floor_double(target.xCoord); - int j1 = MathHelper.floor_double(target.zCoord); + int i1 = MathHelper.floor(target.xCoord); + int j1 = MathHelper.floor(target.zCoord); int k1 = i1 - i; int l1 = j1 - j; diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java index ab75956255..f2fd880db6 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/entities/ai/WalkNodeProcessorCeiling.java @@ -45,17 +45,17 @@ public PathPoint getStart() if (this.getCanSwim() && this.entity.isInWater()) { i = (int)this.entity.getEntityBoundingBox().minY; - BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor_double(this.entity.posX), i, MathHelper.floor_double(this.entity.posZ)); + BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor(this.entity.posX), i, MathHelper.floor(this.entity.posZ)); for (Block block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock(); block == Blocks.FLOWING_WATER || block == Blocks.WATER; block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock()) { ++i; - blockpos$mutableblockpos.setPos(MathHelper.floor_double(this.entity.posX), i, MathHelper.floor_double(this.entity.posZ)); + blockpos$mutableblockpos.setPos(MathHelper.floor(this.entity.posX), i, MathHelper.floor(this.entity.posZ)); } } else if (this.entity.onGround) { - i = MathHelper.floor_double(this.entity.getEntityBoundingBox().minY + 0.5D); + i = MathHelper.floor(this.entity.getEntityBoundingBox().minY + 0.5D); } else { @@ -97,7 +97,7 @@ else if (this.entity.onGround) @Override public PathPoint getPathPointToCoords(double x, double y, double z) { - return this.openPoint(MathHelper.floor_double(x - (double)(this.entity.width / 2.0F)), MathHelper.floor_double(y), MathHelper.floor_double(z - (double)(this.entity.width / 2.0F))); + return this.openPoint(MathHelper.floor(x - (double)(this.entity.width / 2.0F)), MathHelper.floor(y), MathHelper.floor(z - (double)(this.entity.width / 2.0F))); } @Override diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityCrashedProbe.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityCrashedProbe.java index e5dd223131..d3baa73c8d 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityCrashedProbe.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityCrashedProbe.java @@ -143,7 +143,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer player) + public boolean isUsableByPlayer(EntityPlayer player) { return this.worldObj.getTileEntity(this.getPos()) == this && player.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java index 6204450f3a..6a0a36033c 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/tile/TileEntityGeothermalGenerator.java @@ -332,7 +332,7 @@ public int getInventoryStackLimit() } @Override - public boolean isUseableByPlayer(EntityPlayer player) + public boolean isUsableByPlayer(EntityPlayer player) { return this.worldObj.getTileEntity(this.getPos()) == this && player.getDistanceSq(this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; } diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java index 0c8567dc8c..5d67bdd137 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenCaveVenus.java @@ -91,12 +91,12 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime if (par6 >= d4 - 16.0D - d6 * 2.0D && par10 >= d5 - 16.0D - d6 * 2.0D && par6 <= d4 + 16.0D + d6 * 2.0D && par10 <= d5 + 16.0D + d6 * 2.0D) { - int l1 = MathHelper.floor_double(par6 - d6) - par3 * 16 - 1; - int i2 = MathHelper.floor_double(par6 + d6) - par3 * 16 + 1; - int j2 = MathHelper.floor_double(par8 - d7) - 1; - int k2 = MathHelper.floor_double(par8 + d7) + 1; - int l2 = MathHelper.floor_double(par10 - d6) - par4 * 16 - 1; - int i3 = MathHelper.floor_double(par10 + d6) - par4 * 16 + 1; + int l1 = MathHelper.floor(par6 - d6) - par3 * 16 - 1; + int i2 = MathHelper.floor(par6 + d6) - par3 * 16 + 1; + int j2 = MathHelper.floor(par8 - d7) - 1; + int k2 = MathHelper.floor(par8 + d7) + 1; + int l2 = MathHelper.floor(par10 - d6) - par4 * 16 - 1; + int i3 = MathHelper.floor(par10 + d6) - par4 * 16 + 1; if (l1 < 0) { diff --git a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java index e023ec5ef1..ad0b5ef190 100644 --- a/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java +++ b/src/main/java/micdoodle8/mods/galacticraft/planets/venus/world/gen/MapGenLavaVenus.java @@ -84,12 +84,12 @@ protected void generateCaveNode(long par1, int par3, int par4, ChunkPrimer prime if (par6 >= d4 - 16.0D - d6 * 2.0D && par10 >= d5 - 16.0D - d6 * 2.0D && par6 <= d4 + 16.0D + d6 * 2.0D && par10 <= d5 + 16.0D + d6 * 2.0D) { - int l1 = MathHelper.floor_double(par6 - d6) - par3 * 16 - 1; - int i2 = MathHelper.floor_double(par6 + d6) - par3 * 16 + 1; - int j2 = MathHelper.floor_double(par8 - d7) - 1; - int k2 = MathHelper.floor_double(par8 + d7) + 1; - int l2 = MathHelper.floor_double(par10 - d6) - par4 * 16 - 1; - int i3 = MathHelper.floor_double(par10 + d6) - par4 * 16 + 1; + int l1 = MathHelper.floor(par6 - d6) - par3 * 16 - 1; + int i2 = MathHelper.floor(par6 + d6) - par3 * 16 + 1; + int j2 = MathHelper.floor(par8 - d7) - 1; + int k2 = MathHelper.floor(par8 + d7) + 1; + int l2 = MathHelper.floor(par10 - d6) - par4 * 16 - 1; + int i3 = MathHelper.floor(par10 + d6) - par4 * 16 + 1; if (l1 < 0) { From c0a8627d15b290754cbe17854c944faa7fbad242 Mon Sep 17 00:00:00 2001 From: Mitch Date: Sun, 26 Mar 2017 23:16:37 -0400 Subject: [PATCH 021/535] 1.11.2 error fixing --- .../api/player/client/ClientPlayerAPI.java | 2 +- .../client/ClientPlayerClassVisitor.java | 12 +- .../api/player/server/ServerPlayerAPI.java | 2 +- .../server/ServerPlayerClassVisitor.java | 12 +- .../codechicken/core/CCUpdateChecker.java | 109 --- .../core/ModDescriptionEnhancer.java | 55 -- .../core/commands/CoreCommand.java | 102 -- .../core/commands/PlayerCommand.java | 33 - .../core/commands/ServerCommand.java | 22 - .../core/fluid/ExtendedFluidTank.java | 105 -- .../codechicken/core/fluid/FluidUtils.java | 98 -- .../codechicken/core/fluid/TankAccess.java | 28 - .../codechicken/core/gui/ClickCounter.java | 55 -- .../codechicken/core/gui/GuiCCButton.java | 77 -- .../codechicken/core/gui/GuiCCTextField.java | 175 ---- .../codechicken/core/gui/GuiScreenWidget.java | 139 --- .../codechicken/core/gui/GuiScrollPane.java | 221 ----- .../codechicken/core/gui/GuiScrollSlot.java | 169 ---- .../java/codechicken/core/gui/GuiWidget.java | 74 -- .../core/gui/IGuiActionListener.java | 5 - .../core/internal/CCCEventHandler.java | 16 - .../core/inventory/ContainerExtended.java | 247 ----- .../core/inventory/ContainerSynchronised.java | 60 -- .../core/inventory/GuiContainerWidget.java | 123 --- .../core/inventory/IContainerSyncVar.java | 13 - .../core/inventory/IntegerSync.java | 29 - .../core/inventory/MappedInventoryAccess.java | 145 --- .../codechicken/core/inventory/SlotDummy.java | 69 -- .../core/inventory/SlotDummyOutput.java | 17 - .../core/inventory/SlotHandleClicks.java | 15 - .../core/launch/CodeChickenCorePlugin.java | 60 -- .../codechicken/core/launch/DepLoader.java | 853 ----------------- .../core/launch/FingerprintChecker.java | 86 -- .../java/codechicken/lib/CodeChickenLib.java | 50 - .../java/codechicken/lib/asm/ASMBlock.java | 191 ---- .../java/codechicken/lib/asm/ASMHelper.java | 213 ----- .../java/codechicken/lib/asm/ASMReader.java | 311 ------ .../codechicken/lib/asm/CCLCorePlugin.java | 103 -- .../lib/asm/CCL_ASMTransformer.java | 31 - .../codechicken/lib/asm/CC_ClassWriter.java | 33 - .../lib/asm/ClassHeirachyManager.java | 181 ---- .../lib/asm/ImportantInsnVisitor.java | 36 - .../codechicken/lib/asm/InsnComparator.java | 200 ---- .../codechicken/lib/asm/InsnListSection.java | 260 ----- .../lib/asm/LocalVariablesSorterVisitor.java | 36 - .../codechicken/lib/asm/MethodASMifier.java | 73 -- .../lib/asm/ModularASMTransformer.java | 345 ------- .../java/codechicken/lib/asm/ObfMapping.java | 446 --------- .../lib/asm/discovery/ClassDiscoverer.java | 138 --- .../lib/asm/discovery/IStringMatcher.java | 7 - .../codechicken/lib/block/BlockMultiTile.java | 55 -- .../lib/block/IParticleProvider.java | 10 - .../java/codechicken/lib/block/IType.java | 15 - .../lib/block/ItemBlockMultiType.java | 55 -- .../codechicken/lib/block/StateReference.java | 14 - .../block/property/PropertyEnumFacingAll.java | 21 - .../block/property/PropertyEnumFacingHoz.java | 22 - .../lib/block/property/PropertyInteger.java | 48 - .../lib/block/property/PropertyString.java | 52 - .../block/property/TileEntityProperty.java | 39 - .../unlisted/UnlistedBooleanProperty.java | 21 - .../unlisted/UnlistedByteArrayProperty.java | 31 - .../unlisted/UnlistedByteProperty.java | 21 - .../unlisted/UnlistedEnumFacingProperty.java | 23 - .../unlisted/UnlistedFluidStackProperty.java | 24 - .../unlisted/UnlistedIntArrayProperty.java | 31 - .../unlisted/UnlistedIntegerProperty.java | 21 - .../unlisted/UnlistedMapProperty.java | 41 - .../unlisted/UnlistedPropertyBase.java | 25 - .../UnlistedResourceLocationProperty.java | 23 - .../unlisted/UnlistedSpriteProperty.java | 27 - .../unlisted/UnlistedStringProperty.java | 21 - .../unlisted/UnlistedTileEntityProperty.java | 23 - .../java/codechicken/lib/colour/Colour.java | 208 ---- .../codechicken/lib/colour/ColourARGB.java | 37 - .../codechicken/lib/colour/ColourRGBA.java | 67 -- .../lib/colour/CustomGradient.java | 35 - .../codechicken/lib/colour/EnumColour.java | 193 ---- .../codechicken/lib/config/ConfigFile.java | 117 --- .../codechicken/lib/config/ConfigTag.java | 252 ----- .../lib/config/ConfigTagParent.java | 215 ----- .../lib/config/DefaultingConfigFile.java | 20 - .../lib/config/SimpleProperties.java | 128 --- .../codechicken/lib/data/MCDataHandler.java | 8 - .../java/codechicken/lib/data/MCDataIO.java | 134 --- .../codechicken/lib/data/MCDataInput.java | 47 - .../lib/data/MCDataInputStream.java | 17 - .../codechicken/lib/data/MCDataOutput.java | 44 - .../lib/data/MCDataOutputStream.java | 17 - .../lib/data/MCDataOutputWrapper.java | 150 --- .../java/codechicken/lib/data/NBTHelper.java | 33 - .../lib/fingerprint/FingerprintChecker.java | 85 -- .../FingerprintViolatedCrashCallable.java | 37 - .../java/codechicken/lib/gui/GuiDraw.java | 406 -------- .../codechicken/lib/gui/IGuiPacketSender.java | 8 - .../lib/gui/SimpleCreativeTab.java | 81 -- .../lib/internal/command/DevEnvCommand.java | 90 -- .../client/DumpModelLocationsCommand.java | 76 -- .../client/NukeCCModelCacheCommand.java | 60 -- .../lib/internal/proxy/ClientProxy.java | 37 - .../lib/internal/proxy/CommonProxy.java | 24 - .../lib/inventory/InventoryCopy.java | 135 --- .../lib/inventory/InventoryNBT.java | 124 --- .../lib/inventory/InventoryRange.java | 75 -- .../lib/inventory/InventorySimple.java | 159 ---- .../lib/inventory/InventoryUtils.java | 372 -------- .../codechicken/lib/inventory/ItemKey.java | 65 -- .../codechicken/lib/item/ItemMultiType.java | 147 --- .../lib/item/ItemStackRegistry.java | 52 - .../lib/item/filtering/IItemFilter.java | 20 - .../item/filtering/IItemFilterProvider.java | 13 - .../java/codechicken/lib/lighting/LC.java | 91 -- .../codechicken/lib/lighting/LightMatrix.java | 173 ---- .../codechicken/lib/lighting/LightModel.java | 111 --- .../lib/lighting/PlanarLightMatrix.java | 55 -- .../lib/lighting/PlanarLightModel.java | 40 - .../lib/lighting/SimpleBrightnessModel.java | 57 -- .../java/codechicken/lib/math/MathHelper.java | 312 ------ .../lib/model/BakedModelProperties.java | 60 -- .../codechicken/lib/model/CCMultiModel.java | 91 -- .../lib/model/CCOverrideBakedBlockModel.java | 83 -- .../lib/model/CCOverrideBakedModel.java | 13 - .../lib/model/CCOverrideListHandler.java | 32 - .../lib/model/DummyBakedModel.java | 56 -- .../lib/model/ModelRegistryHelper.java | 107 --- .../PerspectiveAwareModelProperties.java | 34 - .../lib/model/SimpleBakedBlockModel.java | 66 -- .../lib/model/SimpleBakedItemModel.java | 100 -- .../lib/model/SimpleOverrideBakedModel.java | 61 -- .../SimplePerspectiveAwareBakedModel.java | 91 -- .../lib/model/StateOverrideIModel.java | 77 -- .../AbstractBakedPropertiesModel.java | 43 - .../PerspectiveAwareBakedModel.java | 94 -- .../PerspectiveAwareLayeredModel.java | 100 -- .../PerspectiveAwareLayeredModelWrapper.java | 87 -- .../PerspectiveAwareMultiModel.java | 84 -- .../PerspectiveAwareOverrideModel.java | 59 -- .../lib/model/bakery/BlockModelBakery.java | 628 ------------ .../lib/model/bakery/CCModelBakery.java | 96 -- .../codechicken/lib/model/bakery/CCQuad.java | 309 ------ .../lib/model/bakery/CCQuadBakery.java | 202 ---- .../lib/model/bakery/ItemModelBakery.java | 42 - .../lib/model/bakery/PlanarFaceBakery.java | 227 ----- ...implePerspectiveAwareLayerModelBakery.java | 40 - .../model/bakery/UnpackingVertexConsumer.java | 66 -- .../lib/model/blockbakery/BlockBakery.java | 343 ------- .../blockbakery/BlockBakeryProperties.java | 38 - .../lib/model/blockbakery/CCBakeryModel.java | 71 -- .../lib/model/blockbakery/IBakeryBlock.java | 18 - .../lib/model/blockbakery/IBakeryItem.java | 18 - .../blockbakery/IBlockStateKeyGenerator.java | 13 - .../model/blockbakery/ICustomBlockBakery.java | 27 - .../lib/model/blockbakery/IItemBakery.java | 29 - .../blockbakery/IItemStackKeyGenerator.java | 13 - .../blockbakery/ILayeredBlockBakery.java | 21 - .../model/blockbakery/ISimpleBlockBakery.java | 19 - .../blockbakery/SimpleBlockRenderer.java | 90 -- .../model/blockbakery/loader/BakeryModel.java | 44 - .../loader/CCBakeryModelLoader.java | 30 - .../model/blockbakery/sub/SubBlockBakery.java | 121 --- .../sub/SubBlockStateKeyGenerator.java | 31 - .../sub/SubItemStackKeyGenerator.java | 31 - .../model/blockstate/CCBlockStateLoader.java | 279 ------ .../model/blockstate/CCFinalMultiVariant.java | 72 -- .../lib/model/blockstate/CCFinalVariant.java | 72 -- .../lib/model/blockstate/CCVariant.java | 210 ---- .../lib/model/cube/CCCubeLoader.java | 29 - .../lib/model/cube/CCModelCube.java | 158 --- .../lib/model/loader/CCBakedModelLoader.java | 215 ----- .../lib/model/loader/IBakedModelLoader.java | 77 -- .../lib/model/modelbase/CCModelBase.java | 74 -- .../lib/model/modelbase/CCModelBox.java | 130 --- .../lib/model/modelbase/CCModelRenderer.java | 279 ------ .../lib/packet/ICustomPacketTile.java | 12 - .../codechicken/lib/packet/PacketCustom.java | 583 ------------ .../lib/raytracer/CuboidRayTraceResult.java | 54 -- .../lib/raytracer/DistanceRayTraceResult.java | 60 -- .../lib/raytracer/ICuboidProvider.java | 19 - .../lib/raytracer/IndexedCuboid6.java | 94 -- .../codechicken/lib/raytracer/RayTracer.java | 256 ----- .../codechicken/lib/render/BlockRenderer.java | 207 ---- .../lib/render/CCIconRegister.java | 52 - .../java/codechicken/lib/render/CCModel.java | 901 ------------------ .../lib/render/CCModelLibrary.java | 83 -- .../codechicken/lib/render/CCModelState.java | 79 -- .../codechicken/lib/render/CCOBJParser.java | 289 ------ .../codechicken/lib/render/CCRSConsumer.java | 86 -- .../lib/render/CCRenderEventHandler.java | 56 -- .../codechicken/lib/render/CCRenderState.java | 297 ------ .../lib/render/DigIconParticle.java | 92 -- .../codechicken/lib/render/QBImporter.java | 808 ---------------- .../codechicken/lib/render/RenderUtils.java | 444 --------- .../render/block/BlockRenderingRegistry.java | 110 --- .../block/CCBlockRendererDispatcher.java | 91 -- .../CCExtendedBlockRendererDispatcher.java | 94 -- .../lib/render/block/ICCBlockRenderer.java | 23 - .../lib/render/block/IExtendedModel.java | 26 - .../lib/render/buffer/BakingVertexBuffer.java | 176 ---- .../lib/render/item/CCRenderItem.java | 306 ------ .../lib/render/item/EntityRendererHooks.java | 129 --- .../lib/render/item/IGLTransform.java | 13 - .../lib/render/item/IItemRenderer.java | 20 - .../lib/render/item/IMatrixTransform.java | 14 - .../item/IStackPerspectiveAwareModel.java | 17 - .../lib/render/item/map/IMapRenderer.java | 34 - .../render/item/map/MapRenderRegistry.java | 50 - .../particle/CustomParticleHandler.java | 85 -- .../lib/render/pipeline/CCRenderPipeline.java | 168 ---- .../lib/render/pipeline/ColourMultiplier.java | 41 - .../lib/render/pipeline/IVertexOperation.java | 26 - .../lib/render/pipeline/IVertexSource.java | 32 - .../lib/render/pipeline/VertexAttribute.java | 39 - .../pipeline/attribute/AttributeKey.java | 40 - .../pipeline/attribute/ColourAttribute.java | 45 - .../attribute/LightCoordAttribute.java | 56 -- .../pipeline/attribute/LightingAttribute.java | 49 - .../pipeline/attribute/NormalAttribute.java | 54 -- .../pipeline/attribute/SideAttribute.java | 50 - .../lib/render/shader/ShaderProgram.java | 173 ---- .../shader/pipeline/CCShaderPipeline.java | 135 --- .../pipeline/attribute/IShaderOperation.java | 15 - .../attribute/ShaderRenderTimeOperation.java | 37 - .../render/state/GlStateManagerHelper.java | 356 ------- .../lib/texture/CustomIResource.java | 69 -- .../texture/IItemBlockTextureProvider.java | 15 - .../texture/IWorldBlockTextureProvider.java | 27 - .../lib/texture/ManagedTextureFX.java | 27 - .../lib/texture/PlaceholderTexture.java | 22 - .../lib/texture/SpriteSheetManager.java | 121 --- .../lib/texture/TextureDataHolder.java | 34 - .../codechicken/lib/texture/TextureFX.java | 60 -- .../lib/texture/TextureSpecial.java | 170 ---- .../codechicken/lib/texture/TextureUtils.java | 311 ------ .../codechicken/lib/thread/ProfileTimer.java | 40 - .../lib/thread/ReentrantCheck.java | 31 - .../lib/thread/RestartableTask.java | 103 -- .../codechicken/lib/thread/TaskProfiler.java | 78 -- .../lib/thread/ThreadOperationTimer.java | 78 -- .../codechicken/lib/tile/IActiveTile.java | 12 - .../lib/tile/IDisplayTickTile.java | 19 - .../java/codechicken/lib/tile/IGuiTile.java | 13 - .../codechicken/lib/tile/IHarvestTile.java | 13 - .../lib/tile/IPlacingTypeTile.java | 13 - .../lib/tile/IRedstoneActiveTile.java | 12 - .../codechicken/lib/tile/IRotatableTile.java | 13 - .../codechicken/lib/tool/LibDownloader.java | 111 --- .../lib/tool/MCStripTransformer.java | 49 - .../main/java/codechicken/lib/tool/Main.java | 14 - .../lib/tool/StripClassLoader.java | 53 -- .../java/codechicken/lib/tool/ToolMain.java | 48 - .../lib/tool/module/JOptModule.java | 42 - .../lib/tool/module/ModuleQBConverter.java | 82 -- .../java/codechicken/lib/util/ArrayUtils.java | 234 ----- .../codechicken/lib/util/BlockStateUtils.java | 41 - .../java/codechicken/lib/util/BlockUtils.java | 81 -- .../codechicken/lib/util/CCDirection.java | 103 -- .../codechicken/lib/util/ClientUtils.java | 58 -- .../codechicken/lib/util/CommonUtils.java | 59 -- .../codechicken/lib/util/ContainerUtils.java | 37 - .../java/codechicken/lib/util/Copyable.java | 6 - .../codechicken/lib/util/EntityUtils.java | 32 - .../java/codechicken/lib/util/FontUtils.java | 67 -- .../java/codechicken/lib/util/FuelUtils.java | 37 - .../codechicken/lib/util/ItemNBTUtils.java | 389 -------- .../java/codechicken/lib/util/ItemUtils.java | 188 ---- .../java/codechicken/lib/util/LangProxy.java | 20 - .../lib/util/ReflectionManager.java | 336 ------- .../codechicken/lib/util/RotationUtils.java | 177 ---- .../codechicken/lib/util/ServerUtils.java | 90 -- .../java/codechicken/lib/util/SoundUtils.java | 42 - .../codechicken/lib/util/TileEntityUtils.java | 62 -- .../codechicken/lib/util/TransformUtils.java | 229 ----- .../java/codechicken/lib/util/TripleABC.java | 30 - .../codechicken/lib/util/VectorUtils.java | 78 -- .../codechicken/lib/util/VertexDataUtils.java | 145 --- .../java/codechicken/lib/vec/AxisCycle.java | 36 - .../java/codechicken/lib/vec/BlockCoord.java | 261 ----- .../java/codechicken/lib/vec/Cuboid6.java | 258 ----- .../java/codechicken/lib/vec/CuboidCoord.java | 242 ----- .../codechicken/lib/vec/ITransformation.java | 50 - .../IrreversibleTransformationException.java | 16 - .../main/java/codechicken/lib/vec/Line3.java | 40 - .../java/codechicken/lib/vec/Matrix4.java | 368 ------- .../main/java/codechicken/lib/vec/Quat.java | 139 --- .../java/codechicken/lib/vec/Rectangle4i.java | 97 -- .../lib/vec/RedundantTransformation.java | 49 - .../java/codechicken/lib/vec/Rotation.java | 280 ------ .../main/java/codechicken/lib/vec/Scale.java | 71 -- .../main/java/codechicken/lib/vec/SwapYZ.java | 20 - .../codechicken/lib/vec/Transformation.java | 58 -- .../lib/vec/TransformationList.java | 175 ---- .../java/codechicken/lib/vec/Translation.java | 73 -- .../lib/vec/VariableTransformation.java | 29 - .../java/codechicken/lib/vec/Vector3.java | 541 ----------- .../java/codechicken/lib/vec/Vertex5.java | 77 -- .../lib/vec/uv/IconTransformation.java | 31 - .../vec/uv/IconVertexRangeUVTransform.java | 112 --- .../lib/vec/uv/MultiIconTransformation.java | 33 - .../lib/vec/uv/ScaledIconTransformation.java | 29 - .../main/java/codechicken/lib/vec/uv/UV.java | 81 -- .../codechicken/lib/vec/uv/UVRotation.java | 53 -- .../java/codechicken/lib/vec/uv/UVScale.java | 37 - .../lib/vec/uv/UVTransformation.java | 39 - .../lib/vec/uv/UVTransformationList.java | 113 --- .../codechicken/lib/vec/uv/UVTranslation.java | 55 -- .../codechicken/lib/world/ChunkExtension.java | 71 -- .../codechicken/lib/world/IChunkLoadTile.java | 12 - .../lib/world/TileChunkLoadHook.java | 33 - .../codechicken/lib/world/WorldExtension.java | 103 -- .../lib/world/WorldExtensionInstantiator.java | 17 - .../lib/world/WorldExtensionManager.java | 208 ---- .../placement/BlockPlacementBatcher.java | 184 ---- .../BlockPlacementLightingManager.java | 93 -- .../placement/lighting/LightingCalcEntry.java | 34 - .../lighting/LightingCalcEntryBuilder.java | 65 -- .../java/codechicken/nei/ButtonCycled.java | 13 - .../java/codechicken/nei/ClientHandler.java | 233 ----- .../nei/ContainerEnchantmentModifier.java | 340 ------- .../nei/ContainerPotionCreator.java | 171 ---- .../nei/DefaultHighlightHandler.java | 49 - .../codechicken/nei/FastTransferManager.java | 376 -------- .../codechicken/nei/FingerprintChecker.java | 86 -- .../nei/GuiEnchantmentModifier.java | 106 --- .../nei/GuiExtendedCreativeInv.java | 56 -- .../java/codechicken/nei/GuiNEIButton.java | 40 - .../codechicken/nei/GuiPotionCreator.java | 339 ------- .../java/codechicken/nei/HUDRenderer.java | 97 -- .../main/java/codechicken/nei/Image.java | 15 - .../nei/InfiniteStackSizeHandler.java | 50 - .../codechicken/nei/InfiniteToolHandler.java | 37 - .../main/java/codechicken/nei/ItemList.java | 266 ------ .../java/codechicken/nei/ItemMobSpawner.java | 155 --- .../codechicken/nei/ItemQuantityField.java | 48 - .../main/java/codechicken/nei/ItemSorter.java | 203 ---- .../java/codechicken/nei/ItemStackMap.java | 308 ------ .../java/codechicken/nei/ItemStackSet.java | 58 -- .../main/java/codechicken/nei/KeyManager.java | 20 - .../java/codechicken/nei/LayoutManager.java | 877 ----------------- .../main/java/codechicken/nei/NEIActions.java | 86 -- .../codechicken/nei/NEIChestGuiHandler.java | 29 - .../java/codechicken/nei/NEIClientConfig.java | 578 ----------- .../codechicken/nei/NEICompatibility.java | 4 - .../java/codechicken/nei/NEIController.java | 305 ------ .../nei/NEICreativeGuiHandler.java | 22 - .../codechicken/nei/NEIDummySlotHandler.java | 23 - .../java/codechicken/nei/NEIModContainer.java | 120 --- .../java/codechicken/nei/NEIServerConfig.java | 300 ------ .../codechicken/nei/OffsetPositioner.java | 25 - .../main/java/codechicken/nei/PlayerSave.java | 129 --- .../codechicken/nei/PopupInputHandler.java | 58 -- .../java/codechicken/nei/SaveLoadButton.java | 105 -- .../java/codechicken/nei/SearchField.java | 152 --- .../java/codechicken/nei/ServerHandler.java | 164 ---- .../main/java/codechicken/nei/SlotOP.java | 9 - .../java/codechicken/nei/SpawnerRenderer.java | 121 --- .../java/codechicken/nei/SubsetWidget.java | 798 ---------------- .../main/java/codechicken/nei/TextField.java | 159 ---- .../java/codechicken/nei/VisibilityData.java | 44 - .../java/codechicken/nei/WidgetZOrder.java | 17 - .../codechicken/nei/WorldOverlayRenderer.java | 233 ----- .../main/java/codechicken/nei/api/API.java | 295 ------ .../nei/api/DefaultOverlayRenderer.java | 41 - .../java/codechicken/nei/api/GuiInfo.java | 35 - .../codechicken/nei/api/IConfigureNEI.java | 13 - .../nei/api/IGuiContainerOverlay.java | 7 - .../nei/api/IHighlightHandler.java | 15 - .../nei/api/IInfiniteItemHandler.java | 18 - .../codechicken/nei/api/INEIGuiAdapter.java | 38 - .../codechicken/nei/api/INEIGuiHandler.java | 50 - .../codechicken/nei/api/INEIModeHandler.java | 5 - .../codechicken/nei/api/IOverlayHandler.java | 8 - .../nei/api/IRecipeOverlayRenderer.java | 8 - .../codechicken/nei/api/IStackPositioner.java | 12 - .../java/codechicken/nei/api/ItemInfo.java | 544 ----------- .../java/codechicken/nei/api/NEIInfo.java | 30 - .../nei/api/TaggedInventoryArea.java | 45 - .../nei/api/layout/LayoutStyle.java | 23 - .../nei/api/stack/PositionedStack.java | 119 --- .../codechicken/nei/asm/NEICorePlugin.java | 66 -- .../codechicken/nei/asm/NEITransformer.java | 226 ----- .../codechicken/nei/config/ArrayDumper.java | 32 - .../codechicken/nei/config/ConfigSet.java | 44 - .../codechicken/nei/config/DataDumper.java | 153 --- .../nei/config/GuiHighlightTips.java | 152 --- .../nei/config/GuiItemIconDumper.java | 202 ---- .../codechicken/nei/config/GuiItemSorter.java | 184 ---- .../nei/config/GuiNEIOptionList.java | 54 -- .../codechicken/nei/config/GuiOptionList.java | 284 ------ .../codechicken/nei/config/GuiOptionPane.java | 108 --- .../nei/config/ItemPanelDumper.java | 152 --- .../codechicken/nei/config/KeyBindings.java | 79 -- .../java/codechicken/nei/config/Option.java | 232 ----- .../codechicken/nei/config/OptionButton.java | 132 --- .../codechicken/nei/config/OptionCycled.java | 52 - .../nei/config/OptionGamemodes.java | 25 - .../nei/config/OptionIntegerField.java | 40 - .../codechicken/nei/config/OptionList.java | 166 ---- .../codechicken/nei/config/OptionOpenGui.java | 24 - .../nei/config/OptionScrollPane.java | 92 -- .../nei/config/OptionStringSet.java | 149 --- .../nei/config/OptionTextField.java | 111 --- .../nei/config/OptionToggleButton.java | 33 - .../nei/config/OptionUtilities.java | 56 -- .../codechicken/nei/config/PatreonButton.java | 22 - .../nei/config/RegistryDumper.java | 33 - .../nei/config/dumps/FluidRegistryDumper.java | 43 - .../nei/config/dumps/ForgeRegistryDumper.java | 42 - .../nei/container/ContainerCreativeInv.java | 118 --- .../nei/container/ExtendedCreativeInv.java | 136 --- .../nei/container/InventoryCraftingDummy.java | 16 - .../VanillaCreativeTabSearchHooks.java | 141 --- .../nei/guihook/DefaultSlotClickHandler.java | 28 - .../nei/guihook/GuiContainerManager.java | 578 ----------- .../nei/guihook/IContainerDrawHandler.java | 47 - .../nei/guihook/IContainerInputHandler.java | 95 -- .../nei/guihook/IContainerObjectHandler.java | 54 -- .../guihook/IContainerSlotClickHandler.java | 13 - .../nei/guihook/IContainerTooltipHandler.java | 42 - .../nei/guihook/IGuiClientSide.java | 7 - .../nei/guihook/IGuiHandleMouseWheel.java | 8 - .../codechicken/nei/guihook/IGuiSlotDraw.java | 8 - .../nei/layout/LayoutStyleDefault.java | 168 ---- .../nei/layout/LayoutStyleMinecraft.java | 100 -- .../nei/layout/LayoutStyleTMIOld.java | 130 --- .../nei/network/NEIClientPacketHandler.java | 264 ----- .../nei/network/NEIServerPacketHandler.java | 273 ------ .../nei/recipe/BrewingOverlayHandler.java | 20 - .../nei/recipe/BrewingRecipeHandler.java | 250 ----- .../nei/recipe/ContainerRecipe.java | 169 ---- .../nei/recipe/DefaultOverlayHandler.java | 307 ------ .../nei/recipe/FireworkRecipeHandler.java | 179 ---- .../nei/recipe/FuelRecipeHandler.java | 104 -- .../nei/recipe/FurnaceRecipeHandler.java | 171 ---- .../nei/recipe/GuiCraftingRecipe.java | 54 -- .../codechicken/nei/recipe/GuiRecipe.java | 323 ------- .../nei/recipe/GuiUsageRecipe.java | 54 -- .../nei/recipe/ICraftingHandler.java | 14 - .../nei/recipe/IRecipeHandler.java | 123 --- .../codechicken/nei/recipe/IUsageHandler.java | 14 - .../nei/recipe/ProfilerRecipeHandler.java | 153 --- .../codechicken/nei/recipe/RecipeInfo.java | 105 -- .../nei/recipe/RecipeItemInputHandler.java | 83 -- .../nei/recipe/ShapedRecipeHandler.java | 225 ----- .../nei/recipe/ShapelessRecipeHandler.java | 161 ---- .../nei/recipe/TemplateRecipeHandler.java | 613 ------------ .../nei/recipe/potion/IPotionRecipe.java | 14 - .../nei/recipe/potion/PotionRecipeHelper.java | 89 -- .../nei/recipe/potion/PotionTypeRecipe.java | 37 - .../recipe/potion/PotionUpgradeRecipe.java | 41 - .../colossalchests/ColossalChestsConfig.java | 34 - .../java/codechicken/nei/util/LogHelper.java | 240 ----- .../codechicken/nei/util/NEIClientUtils.java | 380 -------- .../codechicken/nei/util/NEIServerUtils.java | 455 --------- .../java/codechicken/nei/widget/Button.java | 76 -- .../codechicken/nei/widget/ItemPanel.java | 392 -------- .../java/codechicken/nei/widget/Label.java | 29 - .../java/codechicken/nei/widget/Widget.java | 76 -- .../obfuscator/ConstantObfuscator.java | 92 -- .../obfuscator/DummyOutputStream.java | 11 - .../obfuscator/IHeirachyEvaluator.java | 19 - .../codechicken/obfuscator/ILogStreams.java | 9 - .../codechicken/obfuscator/ObfDirection.java | 29 - .../codechicken/obfuscator/ObfRemapper.java | 93 -- .../obfuscator/ObfuscationMap.java | 302 ------ .../obfuscator/ObfuscationRun.java | 235 ----- .../obfuscator/SystemLogStreams.java | 17 - .../api/client/tabs/TabRegistry.java | 6 +- .../oxygen/GCCoreOxygenSuffocationEvent.java | 2 +- .../api/event/wgen/GCCoreEventPopulate.java | 2 +- .../api/prefab/entity/EntityAutoRocket.java | 210 ++-- .../prefab/entity/EntitySpaceshipBase.java | 34 +- .../api/prefab/entity/EntityTieredRocket.java | 30 +- .../prefab/world/gen/ChunkProviderSpace.java | 18 +- .../api/prefab/world/gen/MapGenBaseMeta.java | 2 +- .../prefab/world/gen/WorldProviderSpace.java | 18 +- .../api/recipe/CircuitFabricatorRecipes.java | 11 +- .../galacticraft/api/vector/BlockVec3Dim.java | 2 +- .../mods/galacticraft/core/GCFluids.java | 4 +- .../galacticraft/core/TransformerHooks.java | 40 +- .../core/client/EventHandlerClient.java | 2 +- .../core/client/FootprintRenderer.java | 4 +- .../core/client/SkyProviderMoon.java | 6 +- .../core/client/SkyProviderOrbit.java | 26 +- .../core/client/SkyProviderOverworld.java | 24 +- .../core/client/gui/container/GuiBuggy.java | 10 +- .../client/gui/container/GuiContainerGC.java | 4 +- .../gui/container/GuiExtendedInventory.java | 32 +- .../gui/container/GuiOxygenCompressor.java | 2 +- .../gui/container/GuiOxygenDecompressor.java | 2 +- .../client/gui/container/GuiParaChest.java | 2 +- .../client/gui/container/GuiRefinery.java | 2 +- .../gui/container/GuiRocketInventory.java | 14 +- .../gui/container/GuiSchematicBuggy.java | 2 +- .../gui/element/GuiElementCheckbox.java | 2 +- .../element/GuiElementCheckboxPreLaunch.java | 2 +- .../gui/element/GuiElementDropdown.java | 4 +- .../client/gui/element/GuiElementTextBox.java | 10 +- .../gui/overlay/OverlayDockingRocket.java | 4 +- .../client/gui/overlay/OverlayLander.java | 8 +- .../gui/overlay/OverlayLaunchCountdown.java | 2 +- .../client/gui/overlay/OverlayRocket.java | 12 +- .../gui/overlay/OverlaySensorGlasses.java | 2 +- .../client/gui/screen/GameScreenBasic.java | 2 +- .../client/gui/screen/GameScreenText.java | 5 +- .../gui/screen/GuiCelestialSelection.java | 16 +- .../client/gui/screen/GuiJoinSpaceRace.java | 2 +- .../client/gui/screen/GuiNewSpaceRace.java | 10 +- .../gui/screen/GuiPreLaunchChecklist.java | 4 +- .../gui/screen/InventoryTabGalacticraft.java | 2 +- .../core/client/model/ModelBipedGC.java | 6 +- .../client/model/ModelEvolvedSkeleton.java | 2 +- .../model/ModelEvolvedSkeletonBoss.java | 2 +- .../core/client/model/ModelEvolvedZombie.java | 2 +- .../core/client/model/ModelFlag.java | 4 +- .../core/client/model/ModelPlayerGC.java | 2 +- .../render/entities/RenderEvolvedCreeper.java | 2 +- .../entities/RenderEvolvedSkeleton.java | 8 +- .../render/entities/RenderEvolvedZombie.java | 4 +- .../render/entities/RenderPlayerGC.java | 8 +- .../entities/layer/LayerThermalPadding.java | 5 +- .../client/render/item/ItemModelFlag.java | 6 +- .../render/tile/TileEntityDishRenderer.java | 2 +- .../tile/TileEntityTreasureChestRenderer.java | 2 +- .../core/command/CommandGCAstroMiner.java | 22 +- .../core/command/CommandGCEnergyUnits.java | 12 +- .../core/command/CommandGCHelp.java | 6 +- .../core/command/CommandGCInv.java | 22 +- .../core/command/CommandJoinSpaceRace.java | 10 +- .../core/command/CommandKeepDim.java | 10 +- .../core/command/CommandPlanetTeleport.java | 13 +- .../command/CommandSpaceStationAddOwner.java | 14 +- .../CommandSpaceStationChangeOwner.java | 18 +- .../CommandSpaceStationRemoveOwner.java | 16 +- .../core/command/GCInvSaveData.java | 2 +- .../core/dimension/OrbitSpinSaveData.java | 6 +- .../core/dimension/SpaceRaceManager.java | 10 +- .../core/dimension/SpaceStationWorldData.java | 10 +- .../core/dimension/SpinManager.java | 42 +- .../core/dimension/WorldDataSpaceRaces.java | 4 +- .../core/dimension/WorldProviderMoon.java | 18 +- .../WorldProviderOverworldOrbit.java | 4 +- .../core/energy/EnergyDisplayHelper.java | 4 +- .../core/energy/item/ItemElectricBase.java | 8 +- .../core/energy/tile/TileBaseConductor.java | 10 +- .../energy/tile/TileBaseElectricBlock.java | 10 +- .../tile/TileBaseUniversalConductor.java | 18 +- .../tile/TileBaseUniversalElectrical.java | 14 +- .../TileBaseUniversalElectricalSource.java | 8 +- .../core/entities/EntityAIArrowAttack.java | 8 +- .../core/entities/EntityAIThrowPlayer.java | 2 +- .../core/entities/EntityAdvanced.java | 16 +- .../core/entities/EntityAdvancedMotion.java | 35 +- .../core/entities/EntityAlienVillager.java | 51 +- .../core/entities/EntityBossBase.java | 20 +- .../core/entities/EntityBuggy.java | 191 ++-- .../core/entities/EntityCelestialFake.java | 16 +- .../core/entities/EntityEvolvedCreeper.java | 2 +- .../core/entities/EntityEvolvedSkeleton.java | 65 +- .../core/entities/EntityEvolvedSpider.java | 10 +- .../core/entities/EntityEvolvedZombie.java | 8 +- .../core/entities/EntityFlag.java | 19 +- .../core/entities/EntityLander.java | 12 +- .../core/entities/EntityLanderBase.java | 89 +- .../core/entities/EntityMeteor.java | 17 +- .../core/entities/EntityMeteorChunk.java | 48 +- .../core/entities/EntityParachest.java | 72 +- .../core/entities/EntitySkeletonBoss.java | 32 +- .../core/entities/EntityTier1Rocket.java | 17 +- .../core/entities/InventoryEntity.java | 101 +- .../core/entities/NetworkedEntity.java | 6 +- .../core/entities/player/FreefallHandler.java | 19 +- .../player/GCEntityClientPlayerMP.java | 39 +- .../entities/player/GCEntityPlayerMP.java | 13 +- .../core/entities/player/GCPlayerBaseMP.java | 136 +-- .../core/entities/player/GCPlayerBaseSP.java | 262 ++--- .../core/entities/player/GCPlayerHandler.java | 88 +- .../core/entities/player/GCPlayerStats.java | 6 +- .../core/entities/player/IPlayerClient.java | 3 +- .../core/entities/player/IPlayerServer.java | 3 +- .../entities/player/IStatsCapability.java | 5 +- .../core/entities/player/PlayerClient.java | 27 +- .../core/entities/player/PlayerServer.java | 17 +- .../core/entities/player/StatsCapability.java | 64 +- .../core/event/EventHandlerGC.java | 64 +- .../galacticraft/core/fluid/FluidNetwork.java | 42 +- .../core/inventory/ContainerBuggy.java | 2 +- .../core/inventory/ContainerBuggyBench.java | 12 +- .../core/inventory/ContainerCargoLoader.java | 4 +- .../inventory/ContainerCircuitFabricator.java | 4 +- .../inventory/ContainerCoalGenerator.java | 4 +- .../inventory/ContainerElectricFurnace.java | 4 +- .../ContainerElectricIngotCompressor.java | 4 +- .../ContainerEnergyStorageModule.java | 4 +- .../inventory/ContainerExtendedInventory.java | 6 +- .../core/inventory/ContainerFuelLoader.java | 4 +- .../inventory/ContainerIngotCompressor.java | 4 +- .../inventory/ContainerOxygenCollector.java | 4 +- .../inventory/ContainerOxygenCompressor.java | 4 +- .../ContainerOxygenDecompressor.java | 4 +- .../inventory/ContainerOxygenDistributor.java | 4 +- .../core/inventory/ContainerOxygenSealer.java | 4 +- .../ContainerOxygenStorageModule.java | 2 +- .../core/inventory/ContainerParaChest.java | 2 +- .../core/inventory/ContainerRefinery.java | 4 +- .../inventory/ContainerRocketInventory.java | 2 +- .../core/inventory/ContainerSchematic.java | 6 +- .../ContainerSchematicTier1Rocket.java | 14 +- .../core/inventory/ContainerSolar.java | 4 +- .../core/inventory/InventoryBuggyBench.java | 58 +- .../core/inventory/InventoryExtended.java | 104 +- .../core/inventory/InventoryRocketBench.java | 97 +- .../core/inventory/InventorySchematic.java | 81 +- .../inventory/InventoryTreasureChest.java | 8 +- .../PersistantInventoryCrafting.java | 179 +--- .../core/inventory/SlotBuggyBench.java | 8 +- .../core/inventory/SlotRocketBench.java | 8 +- .../core/inventory/SlotRocketBenchResult.java | 10 +- .../galacticraft/core/items/ItemBasic.java | 19 +- .../core/items/ItemBatteryInfinite.java | 5 +- .../core/items/ItemBlockDesc.java | 2 +- .../core/items/ItemBlockEnclosed.java | 24 +- .../core/items/ItemBlockNasaWorkbench.java | 4 +- .../galacticraft/core/items/ItemBuggy.java | 25 +- .../core/items/ItemBuggyMaterial.java | 8 +- .../galacticraft/core/items/ItemCanister.java | 8 +- .../core/items/ItemCanisterGeneric.java | 126 +-- .../items/ItemCanisterOxygenInfinite.java | 9 +- .../galacticraft/core/items/ItemFlag.java | 16 +- .../mods/galacticraft/core/items/ItemKey.java | 7 +- .../core/items/ItemMeteorChunk.java | 18 +- .../galacticraft/core/items/ItemMoon.java | 8 +- .../core/items/ItemOilCanister.java | 8 +- .../core/items/ItemOxygenGear.java | 6 +- .../core/items/ItemOxygenMask.java | 6 +- .../core/items/ItemOxygenTank.java | 16 +- .../core/items/ItemParaChute.java | 13 +- .../core/items/ItemPreLaunchChecklist.java | 6 +- .../core/items/ItemRocketEngineGC.java | 8 +- .../core/items/ItemSchematic.java | 8 +- .../core/items/ItemTier1Rocket.java | 18 +- .../core/items/ItemUniversalWrench.java | 8 +- .../core/nei/BuggyRecipeHandler.java | 312 +++--- .../nei/CircuitFabricatorRecipeHandler.java | 364 +++---- .../ElectricIngotCompressorRecipeHandler.java | 434 ++++----- .../core/nei/GCNEIHighlightHandler.java | 202 ++-- .../nei/IngotCompressorRecipeHandler.java | 520 +++++----- .../core/nei/NEIGalacticraftConfig.java | 644 ++++++------- .../core/nei/RefineryRecipeHandler.java | 370 +++---- .../core/nei/RocketT1RecipeHandler.java | 312 +++--- .../core/network/ConnectionEvents.java | 6 +- .../core/network/ConnectionPacket.java | 2 +- .../core/network/PacketDynamic.java | 8 +- .../core/network/PacketDynamicInventory.java | 12 +- .../core/network/PacketEntityUpdate.java | 6 +- .../network/PacketFluidNetworkUpdate.java | 4 +- .../core/network/PacketRotateRocket.java | 4 +- .../core/network/PacketSimple.java | 81 +- .../core/proxy/ClientProxyCore.java | 7 +- .../core/tick/KeyHandlerClient.java | 10 +- .../core/tick/TickHandlerClient.java | 22 +- .../core/tick/TickHandlerServer.java | 16 +- .../core/tile/AirLockProtocol.java | 22 +- .../core/tile/TileEntityAdvanced.java | 18 +- .../tile/TileEntityAirLockController.java | 42 +- .../tile/TileEntityAluminumWireSwitch.java | 12 +- .../core/tile/TileEntityArclamp.java | 30 +- .../core/tile/TileEntityBuggyFueler.java | 20 +- .../tile/TileEntityBuggyFuelerSingle.java | 10 +- .../core/tile/TileEntityCargoUnloader.java | 57 +- .../tile/TileEntityCircuitFabricator.java | 56 +- .../core/tile/TileEntityCoalGenerator.java | 124 +-- .../core/tile/TileEntityDish.java | 127 +-- .../core/tile/TileEntityDungeonSpawner.java | 16 +- .../core/tile/TileEntityElectricFurnace.java | 54 +- .../TileEntityElectricIngotCompressor.java | 144 +-- .../tile/TileEntityEnergyStorageModule.java | 20 +- .../core/tile/TileEntityFallenMeteor.java | 6 +- .../core/tile/TileEntityFluidPipe.java | 30 +- .../core/tile/TileEntityFluidTank.java | 10 +- .../core/tile/TileEntityFluidTransmitter.java | 14 +- .../core/tile/TileEntityFuelLoader.java | 10 +- .../core/tile/TileEntityIngotCompressor.java | 24 +- .../core/tile/TileEntityLandingPad.java | 18 +- .../core/tile/TileEntityLandingPadSingle.java | 8 +- .../core/tile/TileEntityMulti.java | 12 +- .../core/tile/TileEntityNasaWorkbench.java | 16 +- .../core/tile/TileEntityOxygen.java | 6 +- .../core/tile/TileEntityOxygenCollector.java | 24 +- .../core/tile/TileEntityOxygenCompressor.java | 10 +- .../tile/TileEntityOxygenDecompressor.java | 8 +- .../core/tile/TileEntityOxygenDetector.java | 4 +- .../tile/TileEntityOxygenDistributor.java | 40 +- .../core/tile/TileEntityOxygenSealer.java | 20 +- .../tile/TileEntityOxygenStorageModule.java | 16 +- .../core/tile/TileEntityPainter.java | 12 +- .../core/tile/TileEntityParaChest.java | 152 ++- .../core/tile/TileEntityRefinery.java | 6 +- .../core/tile/TileEntityScreen.java | 78 +- .../core/tile/TileEntitySolar.java | 52 +- .../core/tile/TileEntitySpaceStationBase.java | 2 +- .../core/tile/TileEntityTelemetry.java | 16 +- .../core/tile/TileEntityTreasureChest.java | 36 +- .../galacticraft/core/util/ClientUtil.java | 8 +- .../core/util/CompatibilityManager.java | 4 +- .../galacticraft/core/util/CreativeTabGC.java | 34 +- .../galacticraft/core/util/FluidUtil.java | 13 +- .../galacticraft/core/util/GCCoreUtil.java | 4 +- .../mods/galacticraft/core/util/MapGen.java | 4 +- .../mods/galacticraft/core/util/MapUtil.java | 16 +- .../galacticraft/core/util/OxygenUtil.java | 2 +- .../galacticraft/core/util/PlayerUtil.java | 2 +- .../core/util/ThreadVersionCheck.java | 2 +- .../galacticraft/core/util/WorldUtil.java | 58 +- .../core/world/ChunkLoadingCallback.java | 2 +- .../core/world/gen/BiomeDecoratorMoon.java | 12 +- .../core/world/gen/ChunkProviderMoon.java | 30 +- .../core/world/gen/ChunkProviderOrbit.java | 16 +- .../core/world/gen/MapGenVillageMoon.java | 4 +- .../core/world/gen/OreGenOtherMods.java | 4 +- .../core/world/gen/dungeon/MapGenDungeon.java | 4 +- .../asteroids/blocks/BlockBeamReceiver.java | 2 +- .../client/SkyProviderAsteroids.java | 4 +- .../client/gui/GuiShortRangeTelepad.java | 2 +- .../client/render/NetworkRenderer.java | 2 +- .../render/entity/RenderTier3Rocket.java | 4 +- .../dimension/WorldProviderAsteroids.java | 10 +- .../asteroids/entities/EntityAstroMiner.java | 52 +- .../asteroids/entities/EntityEntryPod.java | 4 +- .../asteroids/entities/EntityGrapple.java | 44 +- .../entities/EntitySmallAsteroid.java | 2 +- .../asteroids/entities/EntityTier3Rocket.java | 21 +- .../player/AsteroidsPlayerHandler.java | 26 +- .../event/AsteroidsEventHandlerClient.java | 4 +- .../inventory/ContainerAstroMinerDock.java | 4 +- .../ContainerSchematicAstroMiner.java | 6 +- .../ContainerSchematicTier3Rocket.java | 6 +- .../inventory/ContainerShortRangeTelepad.java | 4 +- .../inventory/SlotSchematicAstroMiner.java | 8 +- .../inventory/SlotSchematicTier3Rocket.java | 8 +- .../asteroids/items/ItemBasicAsteroids.java | 2 +- .../asteroids/items/ItemThermalPadding.java | 2 +- .../asteroids/items/ItemTier3Rocket.java | 2 +- .../nei/AstroMinerRecipeHandler.java | 282 +++--- .../nei/NEIGalacticraftAsteroidsConfig.java | 290 +++--- .../asteroids/nei/RocketT3RecipeHandler.java | 282 +++--- .../network/PacketSimpleAsteroids.java | 10 +- .../asteroids/tile/TileEntityBeamOutput.java | 10 +- .../tile/TileEntityBeamReceiver.java | 6 +- .../asteroids/tile/TileEntityMinerBase.java | 40 +- .../tile/TileEntityMinerBaseSingle.java | 6 +- .../tile/TileEntityShortRangeTelepad.java | 26 +- .../asteroids/tile/TileEntityTelepadFake.java | 14 +- .../world/gen/ChunkProviderAsteroids.java | 18 +- .../planets/mars/EventHandlerMars.java | 24 +- .../galacticraft/planets/mars/MarsModule.java | 2 +- .../planets/mars/MarsModuleClient.java | 2 +- .../planets/mars/client/SkyProviderMars.java | 4 +- .../planets/mars/client/fx/EntityCryoFX.java | 2 +- .../planets/mars/client/fx/ParticleDrip.java | 2 +- .../mars/client/gui/GuiCargoRocket.java | 2 +- .../mars/client/gui/GuiGasLiquefier.java | 2 +- .../mars/client/gui/GuiLaunchController.java | 12 +- .../client/gui/GuiMethaneSynthesizer.java | 2 +- .../planets/mars/client/gui/GuiSlimeling.java | 20 +- .../mars/client/gui/GuiSlimelingFeed.java | 4 +- .../client/gui/GuiSlimelingInventory.java | 2 +- .../mars/client/gui/GuiTerraformer.java | 2 +- .../mars/client/gui/GuiWaterElectrolyzer.java | 2 +- .../tile/TileEntityTreasureChestRenderer.java | 2 +- .../mars/dimension/WorldProviderMars.java | 6 +- .../mars/entities/EntityCargoRocket.java | 16 +- .../mars/entities/EntityCreeperBoss.java | 18 +- .../mars/entities/EntityLandingBalloons.java | 6 +- .../mars/entities/EntityProjectileTNT.java | 4 +- .../mars/entities/EntitySlimeling.java | 22 +- .../mars/entities/EntitySludgeling.java | 6 +- .../mars/entities/EntityTier2Rocket.java | 8 +- .../mars/inventory/ContainerElectrolyzer.java | 4 +- .../mars/inventory/ContainerGasLiquefier.java | 4 +- .../inventory/ContainerLaunchController.java | 4 +- .../ContainerMethaneSynthesizer.java | 4 +- .../ContainerSchematicCargoRocket.java | 6 +- .../ContainerSchematicTier2Rocket.java | 6 +- .../mars/inventory/ContainerSlimeling.java | 4 +- .../mars/inventory/ContainerTerraformer.java | 4 +- .../mars/inventory/InventorySlimeling.java | 4 +- .../inventory/SlotSchematicCargoRocket.java | 8 +- .../inventory/SlotSchematicTier2Rocket.java | 8 +- .../planets/mars/items/ItemBasicMars.java | 2 +- .../planets/mars/items/ItemBlockMachine.java | 2 +- .../planets/mars/items/ItemKeyMars.java | 2 +- .../planets/mars/items/ItemPickaxeMars.java | 2 +- .../mars/items/ItemPickaxeStickyMars.java | 2 +- .../mars/items/ItemSchematicTier2.java | 4 +- .../planets/mars/items/ItemTier2Rocket.java | 2 +- .../mars/nei/CargoRocketRecipeHandler.java | 282 +++--- .../mars/nei/GCMarsNEIHighlightHandler.java | 170 ++-- .../mars/nei/GasLiquefierRecipeHandler.java | 548 +++++------ .../nei/MethaneSynthesizerRecipeHandler.java | 570 +++++------ .../mars/nei/NEIGalacticraftMarsConfig.java | 420 ++++---- .../mars/nei/RocketT2RecipeHandler.java | 282 +++--- .../mars/network/PacketSimpleMars.java | 26 +- .../mars/tile/TileEntityCryogenicChamber.java | 22 +- .../tile/TileEntityDungeonSpawnerMars.java | 2 +- .../mars/tile/TileEntityElectrolyzer.java | 10 +- .../mars/tile/TileEntityGasLiquefier.java | 10 +- .../mars/tile/TileEntityLaunchController.java | 30 +- .../tile/TileEntityMethaneSynthesizer.java | 12 +- .../mars/tile/TileEntitySlimelingEgg.java | 14 +- .../mars/tile/TileEntityTerraformer.java | 60 +- .../planets/mars/util/MarsUtil.java | 6 +- .../mars/world/gen/ChunkProviderMars.java | 6 +- .../mars/world/gen/MapGenCavernMars.java | 2 +- .../planets/venus/VenusModule.java | 2 +- .../venus/client/SkyProviderVenus.java | 4 +- .../venus/client/TickHandlerClientVenus.java | 12 +- .../tile/TileEntityTreasureChestRenderer.java | 2 +- .../venus/dimension/WorldProviderVenus.java | 4 +- .../venus/entities/EntityEntryPodVenus.java | 6 +- .../planets/venus/entities/EntityJuicer.java | 14 +- .../venus/entities/EntitySpiderQueen.java | 22 +- .../planets/venus/entities/EntityWebShot.java | 22 +- .../entities/ai/PathNavigateCeiling.java | 6 +- .../entities/ai/WalkNodeProcessorCeiling.java | 6 +- .../inventory/ContainerCrashedProbe.java | 4 +- .../venus/inventory/ContainerGeothermal.java | 4 +- .../venus/tile/TileEntityCrashedProbe.java | 4 +- .../tile/TileEntityDungeonSpawnerVenus.java | 2 +- .../tile/TileEntityGeothermalGenerator.java | 26 +- .../planets/venus/tile/TileEntitySpout.java | 6 +- .../venus/world/gen/BiomeDecoratorVenus.java | 12 +- .../venus/world/gen/ChunkProviderVenus.java | 44 +- .../world/gen/dungeon/MapGenDungeonVenus.java | 4 +- 833 files changed, 6132 insertions(+), 58442 deletions(-) delete mode 100644 dependencies/main/java/codechicken/core/CCUpdateChecker.java delete mode 100644 dependencies/main/java/codechicken/core/ModDescriptionEnhancer.java delete mode 100644 dependencies/main/java/codechicken/core/commands/CoreCommand.java delete mode 100644 dependencies/main/java/codechicken/core/commands/PlayerCommand.java delete mode 100644 dependencies/main/java/codechicken/core/commands/ServerCommand.java delete mode 100644 dependencies/main/java/codechicken/core/fluid/ExtendedFluidTank.java delete mode 100644 dependencies/main/java/codechicken/core/fluid/FluidUtils.java delete mode 100644 dependencies/main/java/codechicken/core/fluid/TankAccess.java delete mode 100644 dependencies/main/java/codechicken/core/gui/ClickCounter.java delete mode 100644 dependencies/main/java/codechicken/core/gui/GuiCCButton.java delete mode 100644 dependencies/main/java/codechicken/core/gui/GuiCCTextField.java delete mode 100644 dependencies/main/java/codechicken/core/gui/GuiScreenWidget.java delete mode 100644 dependencies/main/java/codechicken/core/gui/GuiScrollPane.java delete mode 100644 dependencies/main/java/codechicken/core/gui/GuiScrollSlot.java delete mode 100644 dependencies/main/java/codechicken/core/gui/GuiWidget.java delete mode 100644 dependencies/main/java/codechicken/core/gui/IGuiActionListener.java delete mode 100644 dependencies/main/java/codechicken/core/internal/CCCEventHandler.java delete mode 100644 dependencies/main/java/codechicken/core/inventory/ContainerExtended.java delete mode 100644 dependencies/main/java/codechicken/core/inventory/ContainerSynchronised.java delete mode 100644 dependencies/main/java/codechicken/core/inventory/GuiContainerWidget.java delete mode 100644 dependencies/main/java/codechicken/core/inventory/IContainerSyncVar.java delete mode 100644 dependencies/main/java/codechicken/core/inventory/IntegerSync.java delete mode 100644 dependencies/main/java/codechicken/core/inventory/MappedInventoryAccess.java delete mode 100644 dependencies/main/java/codechicken/core/inventory/SlotDummy.java delete mode 100644 dependencies/main/java/codechicken/core/inventory/SlotDummyOutput.java delete mode 100644 dependencies/main/java/codechicken/core/inventory/SlotHandleClicks.java delete mode 100644 dependencies/main/java/codechicken/core/launch/CodeChickenCorePlugin.java delete mode 100644 dependencies/main/java/codechicken/core/launch/DepLoader.java delete mode 100644 dependencies/main/java/codechicken/core/launch/FingerprintChecker.java delete mode 100644 dependencies/main/java/codechicken/lib/CodeChickenLib.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/ASMBlock.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/ASMHelper.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/ASMReader.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/CCLCorePlugin.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/CCL_ASMTransformer.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/CC_ClassWriter.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/ClassHeirachyManager.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/ImportantInsnVisitor.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/InsnComparator.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/InsnListSection.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/LocalVariablesSorterVisitor.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/MethodASMifier.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/ModularASMTransformer.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/ObfMapping.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/discovery/ClassDiscoverer.java delete mode 100644 dependencies/main/java/codechicken/lib/asm/discovery/IStringMatcher.java delete mode 100644 dependencies/main/java/codechicken/lib/block/BlockMultiTile.java delete mode 100644 dependencies/main/java/codechicken/lib/block/IParticleProvider.java delete mode 100644 dependencies/main/java/codechicken/lib/block/IType.java delete mode 100644 dependencies/main/java/codechicken/lib/block/ItemBlockMultiType.java delete mode 100644 dependencies/main/java/codechicken/lib/block/StateReference.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingAll.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingHoz.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/PropertyInteger.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/PropertyString.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/TileEntityProperty.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedBooleanProperty.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteArrayProperty.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteProperty.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedEnumFacingProperty.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedFluidStackProperty.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntArrayProperty.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntegerProperty.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedMapProperty.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedPropertyBase.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedResourceLocationProperty.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedSpriteProperty.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedStringProperty.java delete mode 100644 dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedTileEntityProperty.java delete mode 100644 dependencies/main/java/codechicken/lib/colour/Colour.java delete mode 100644 dependencies/main/java/codechicken/lib/colour/ColourARGB.java delete mode 100644 dependencies/main/java/codechicken/lib/colour/ColourRGBA.java delete mode 100644 dependencies/main/java/codechicken/lib/colour/CustomGradient.java delete mode 100644 dependencies/main/java/codechicken/lib/colour/EnumColour.java delete mode 100644 dependencies/main/java/codechicken/lib/config/ConfigFile.java delete mode 100644 dependencies/main/java/codechicken/lib/config/ConfigTag.java delete mode 100644 dependencies/main/java/codechicken/lib/config/ConfigTagParent.java delete mode 100644 dependencies/main/java/codechicken/lib/config/DefaultingConfigFile.java delete mode 100644 dependencies/main/java/codechicken/lib/config/SimpleProperties.java delete mode 100644 dependencies/main/java/codechicken/lib/data/MCDataHandler.java delete mode 100644 dependencies/main/java/codechicken/lib/data/MCDataIO.java delete mode 100644 dependencies/main/java/codechicken/lib/data/MCDataInput.java delete mode 100644 dependencies/main/java/codechicken/lib/data/MCDataInputStream.java delete mode 100644 dependencies/main/java/codechicken/lib/data/MCDataOutput.java delete mode 100644 dependencies/main/java/codechicken/lib/data/MCDataOutputStream.java delete mode 100644 dependencies/main/java/codechicken/lib/data/MCDataOutputWrapper.java delete mode 100644 dependencies/main/java/codechicken/lib/data/NBTHelper.java delete mode 100644 dependencies/main/java/codechicken/lib/fingerprint/FingerprintChecker.java delete mode 100644 dependencies/main/java/codechicken/lib/fingerprint/FingerprintViolatedCrashCallable.java delete mode 100644 dependencies/main/java/codechicken/lib/gui/GuiDraw.java delete mode 100644 dependencies/main/java/codechicken/lib/gui/IGuiPacketSender.java delete mode 100644 dependencies/main/java/codechicken/lib/gui/SimpleCreativeTab.java delete mode 100644 dependencies/main/java/codechicken/lib/internal/command/DevEnvCommand.java delete mode 100644 dependencies/main/java/codechicken/lib/internal/command/client/DumpModelLocationsCommand.java delete mode 100644 dependencies/main/java/codechicken/lib/internal/command/client/NukeCCModelCacheCommand.java delete mode 100644 dependencies/main/java/codechicken/lib/internal/proxy/ClientProxy.java delete mode 100644 dependencies/main/java/codechicken/lib/internal/proxy/CommonProxy.java delete mode 100644 dependencies/main/java/codechicken/lib/inventory/InventoryCopy.java delete mode 100644 dependencies/main/java/codechicken/lib/inventory/InventoryNBT.java delete mode 100644 dependencies/main/java/codechicken/lib/inventory/InventoryRange.java delete mode 100644 dependencies/main/java/codechicken/lib/inventory/InventorySimple.java delete mode 100644 dependencies/main/java/codechicken/lib/inventory/InventoryUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/inventory/ItemKey.java delete mode 100644 dependencies/main/java/codechicken/lib/item/ItemMultiType.java delete mode 100644 dependencies/main/java/codechicken/lib/item/ItemStackRegistry.java delete mode 100644 dependencies/main/java/codechicken/lib/item/filtering/IItemFilter.java delete mode 100644 dependencies/main/java/codechicken/lib/item/filtering/IItemFilterProvider.java delete mode 100644 dependencies/main/java/codechicken/lib/lighting/LC.java delete mode 100644 dependencies/main/java/codechicken/lib/lighting/LightMatrix.java delete mode 100644 dependencies/main/java/codechicken/lib/lighting/LightModel.java delete mode 100644 dependencies/main/java/codechicken/lib/lighting/PlanarLightMatrix.java delete mode 100644 dependencies/main/java/codechicken/lib/lighting/PlanarLightModel.java delete mode 100644 dependencies/main/java/codechicken/lib/lighting/SimpleBrightnessModel.java delete mode 100644 dependencies/main/java/codechicken/lib/math/MathHelper.java delete mode 100644 dependencies/main/java/codechicken/lib/model/BakedModelProperties.java delete mode 100644 dependencies/main/java/codechicken/lib/model/CCMultiModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/CCOverrideBakedBlockModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/CCOverrideBakedModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/CCOverrideListHandler.java delete mode 100644 dependencies/main/java/codechicken/lib/model/DummyBakedModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/ModelRegistryHelper.java delete mode 100644 dependencies/main/java/codechicken/lib/model/PerspectiveAwareModelProperties.java delete mode 100644 dependencies/main/java/codechicken/lib/model/SimpleBakedBlockModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/SimpleBakedItemModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/SimpleOverrideBakedModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/SimplePerspectiveAwareBakedModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/StateOverrideIModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/bakedmodels/AbstractBakedPropertiesModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareBakedModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModelWrapper.java delete mode 100644 dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareMultiModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareOverrideModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/bakery/BlockModelBakery.java delete mode 100644 dependencies/main/java/codechicken/lib/model/bakery/CCModelBakery.java delete mode 100644 dependencies/main/java/codechicken/lib/model/bakery/CCQuad.java delete mode 100644 dependencies/main/java/codechicken/lib/model/bakery/CCQuadBakery.java delete mode 100644 dependencies/main/java/codechicken/lib/model/bakery/ItemModelBakery.java delete mode 100644 dependencies/main/java/codechicken/lib/model/bakery/PlanarFaceBakery.java delete mode 100644 dependencies/main/java/codechicken/lib/model/bakery/SimplePerspectiveAwareLayerModelBakery.java delete mode 100644 dependencies/main/java/codechicken/lib/model/bakery/UnpackingVertexConsumer.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakery.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakeryProperties.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/CCBakeryModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryBlock.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryItem.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/IBlockStateKeyGenerator.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/ICustomBlockBakery.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/IItemBakery.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/IItemStackKeyGenerator.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/ILayeredBlockBakery.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/ISimpleBlockBakery.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/SimpleBlockRenderer.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/loader/BakeryModel.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/loader/CCBakeryModelLoader.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockBakery.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockStateKeyGenerator.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubItemStackKeyGenerator.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockstate/CCBlockStateLoader.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockstate/CCFinalMultiVariant.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockstate/CCFinalVariant.java delete mode 100644 dependencies/main/java/codechicken/lib/model/blockstate/CCVariant.java delete mode 100644 dependencies/main/java/codechicken/lib/model/cube/CCCubeLoader.java delete mode 100644 dependencies/main/java/codechicken/lib/model/cube/CCModelCube.java delete mode 100644 dependencies/main/java/codechicken/lib/model/loader/CCBakedModelLoader.java delete mode 100644 dependencies/main/java/codechicken/lib/model/loader/IBakedModelLoader.java delete mode 100644 dependencies/main/java/codechicken/lib/model/modelbase/CCModelBase.java delete mode 100644 dependencies/main/java/codechicken/lib/model/modelbase/CCModelBox.java delete mode 100644 dependencies/main/java/codechicken/lib/model/modelbase/CCModelRenderer.java delete mode 100644 dependencies/main/java/codechicken/lib/packet/ICustomPacketTile.java delete mode 100644 dependencies/main/java/codechicken/lib/packet/PacketCustom.java delete mode 100644 dependencies/main/java/codechicken/lib/raytracer/CuboidRayTraceResult.java delete mode 100644 dependencies/main/java/codechicken/lib/raytracer/DistanceRayTraceResult.java delete mode 100644 dependencies/main/java/codechicken/lib/raytracer/ICuboidProvider.java delete mode 100644 dependencies/main/java/codechicken/lib/raytracer/IndexedCuboid6.java delete mode 100644 dependencies/main/java/codechicken/lib/raytracer/RayTracer.java delete mode 100644 dependencies/main/java/codechicken/lib/render/BlockRenderer.java delete mode 100644 dependencies/main/java/codechicken/lib/render/CCIconRegister.java delete mode 100644 dependencies/main/java/codechicken/lib/render/CCModel.java delete mode 100644 dependencies/main/java/codechicken/lib/render/CCModelLibrary.java delete mode 100644 dependencies/main/java/codechicken/lib/render/CCModelState.java delete mode 100644 dependencies/main/java/codechicken/lib/render/CCOBJParser.java delete mode 100644 dependencies/main/java/codechicken/lib/render/CCRSConsumer.java delete mode 100644 dependencies/main/java/codechicken/lib/render/CCRenderEventHandler.java delete mode 100644 dependencies/main/java/codechicken/lib/render/CCRenderState.java delete mode 100644 dependencies/main/java/codechicken/lib/render/DigIconParticle.java delete mode 100644 dependencies/main/java/codechicken/lib/render/QBImporter.java delete mode 100644 dependencies/main/java/codechicken/lib/render/RenderUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/render/block/BlockRenderingRegistry.java delete mode 100644 dependencies/main/java/codechicken/lib/render/block/CCBlockRendererDispatcher.java delete mode 100644 dependencies/main/java/codechicken/lib/render/block/CCExtendedBlockRendererDispatcher.java delete mode 100644 dependencies/main/java/codechicken/lib/render/block/ICCBlockRenderer.java delete mode 100644 dependencies/main/java/codechicken/lib/render/block/IExtendedModel.java delete mode 100644 dependencies/main/java/codechicken/lib/render/buffer/BakingVertexBuffer.java delete mode 100644 dependencies/main/java/codechicken/lib/render/item/CCRenderItem.java delete mode 100644 dependencies/main/java/codechicken/lib/render/item/EntityRendererHooks.java delete mode 100644 dependencies/main/java/codechicken/lib/render/item/IGLTransform.java delete mode 100644 dependencies/main/java/codechicken/lib/render/item/IItemRenderer.java delete mode 100644 dependencies/main/java/codechicken/lib/render/item/IMatrixTransform.java delete mode 100644 dependencies/main/java/codechicken/lib/render/item/IStackPerspectiveAwareModel.java delete mode 100644 dependencies/main/java/codechicken/lib/render/item/map/IMapRenderer.java delete mode 100644 dependencies/main/java/codechicken/lib/render/item/map/MapRenderRegistry.java delete mode 100644 dependencies/main/java/codechicken/lib/render/particle/CustomParticleHandler.java delete mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/CCRenderPipeline.java delete mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/ColourMultiplier.java delete mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/IVertexOperation.java delete mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/IVertexSource.java delete mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/VertexAttribute.java delete mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/attribute/AttributeKey.java delete mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/attribute/ColourAttribute.java delete mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightCoordAttribute.java delete mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightingAttribute.java delete mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/attribute/NormalAttribute.java delete mode 100644 dependencies/main/java/codechicken/lib/render/pipeline/attribute/SideAttribute.java delete mode 100644 dependencies/main/java/codechicken/lib/render/shader/ShaderProgram.java delete mode 100644 dependencies/main/java/codechicken/lib/render/shader/pipeline/CCShaderPipeline.java delete mode 100644 dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/IShaderOperation.java delete mode 100644 dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/ShaderRenderTimeOperation.java delete mode 100644 dependencies/main/java/codechicken/lib/render/state/GlStateManagerHelper.java delete mode 100644 dependencies/main/java/codechicken/lib/texture/CustomIResource.java delete mode 100644 dependencies/main/java/codechicken/lib/texture/IItemBlockTextureProvider.java delete mode 100644 dependencies/main/java/codechicken/lib/texture/IWorldBlockTextureProvider.java delete mode 100644 dependencies/main/java/codechicken/lib/texture/ManagedTextureFX.java delete mode 100644 dependencies/main/java/codechicken/lib/texture/PlaceholderTexture.java delete mode 100644 dependencies/main/java/codechicken/lib/texture/SpriteSheetManager.java delete mode 100644 dependencies/main/java/codechicken/lib/texture/TextureDataHolder.java delete mode 100644 dependencies/main/java/codechicken/lib/texture/TextureFX.java delete mode 100644 dependencies/main/java/codechicken/lib/texture/TextureSpecial.java delete mode 100644 dependencies/main/java/codechicken/lib/texture/TextureUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/thread/ProfileTimer.java delete mode 100644 dependencies/main/java/codechicken/lib/thread/ReentrantCheck.java delete mode 100644 dependencies/main/java/codechicken/lib/thread/RestartableTask.java delete mode 100644 dependencies/main/java/codechicken/lib/thread/TaskProfiler.java delete mode 100644 dependencies/main/java/codechicken/lib/thread/ThreadOperationTimer.java delete mode 100644 dependencies/main/java/codechicken/lib/tile/IActiveTile.java delete mode 100644 dependencies/main/java/codechicken/lib/tile/IDisplayTickTile.java delete mode 100644 dependencies/main/java/codechicken/lib/tile/IGuiTile.java delete mode 100644 dependencies/main/java/codechicken/lib/tile/IHarvestTile.java delete mode 100644 dependencies/main/java/codechicken/lib/tile/IPlacingTypeTile.java delete mode 100644 dependencies/main/java/codechicken/lib/tile/IRedstoneActiveTile.java delete mode 100644 dependencies/main/java/codechicken/lib/tile/IRotatableTile.java delete mode 100644 dependencies/main/java/codechicken/lib/tool/LibDownloader.java delete mode 100644 dependencies/main/java/codechicken/lib/tool/MCStripTransformer.java delete mode 100644 dependencies/main/java/codechicken/lib/tool/Main.java delete mode 100644 dependencies/main/java/codechicken/lib/tool/StripClassLoader.java delete mode 100644 dependencies/main/java/codechicken/lib/tool/ToolMain.java delete mode 100644 dependencies/main/java/codechicken/lib/tool/module/JOptModule.java delete mode 100644 dependencies/main/java/codechicken/lib/tool/module/ModuleQBConverter.java delete mode 100644 dependencies/main/java/codechicken/lib/util/ArrayUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/BlockStateUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/BlockUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/CCDirection.java delete mode 100644 dependencies/main/java/codechicken/lib/util/ClientUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/CommonUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/ContainerUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/Copyable.java delete mode 100644 dependencies/main/java/codechicken/lib/util/EntityUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/FontUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/FuelUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/ItemNBTUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/ItemUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/LangProxy.java delete mode 100644 dependencies/main/java/codechicken/lib/util/ReflectionManager.java delete mode 100644 dependencies/main/java/codechicken/lib/util/RotationUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/ServerUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/SoundUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/TileEntityUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/TransformUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/TripleABC.java delete mode 100644 dependencies/main/java/codechicken/lib/util/VectorUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/util/VertexDataUtils.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/AxisCycle.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/BlockCoord.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/Cuboid6.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/CuboidCoord.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/ITransformation.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/IrreversibleTransformationException.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/Line3.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/Matrix4.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/Quat.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/Rectangle4i.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/RedundantTransformation.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/Rotation.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/Scale.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/SwapYZ.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/Transformation.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/TransformationList.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/Translation.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/VariableTransformation.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/Vector3.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/Vertex5.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/uv/IconTransformation.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/uv/IconVertexRangeUVTransform.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/uv/MultiIconTransformation.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/uv/ScaledIconTransformation.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/uv/UV.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/uv/UVRotation.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/uv/UVScale.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/uv/UVTransformation.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/uv/UVTransformationList.java delete mode 100644 dependencies/main/java/codechicken/lib/vec/uv/UVTranslation.java delete mode 100644 dependencies/main/java/codechicken/lib/world/ChunkExtension.java delete mode 100644 dependencies/main/java/codechicken/lib/world/IChunkLoadTile.java delete mode 100644 dependencies/main/java/codechicken/lib/world/TileChunkLoadHook.java delete mode 100644 dependencies/main/java/codechicken/lib/world/WorldExtension.java delete mode 100644 dependencies/main/java/codechicken/lib/world/WorldExtensionInstantiator.java delete mode 100644 dependencies/main/java/codechicken/lib/world/WorldExtensionManager.java delete mode 100644 dependencies/main/java/codechicken/lib/world/placement/BlockPlacementBatcher.java delete mode 100644 dependencies/main/java/codechicken/lib/world/placement/BlockPlacementLightingManager.java delete mode 100644 dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntry.java delete mode 100644 dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntryBuilder.java delete mode 100644 dependencies/main/java/codechicken/nei/ButtonCycled.java delete mode 100644 dependencies/main/java/codechicken/nei/ClientHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/ContainerEnchantmentModifier.java delete mode 100644 dependencies/main/java/codechicken/nei/ContainerPotionCreator.java delete mode 100644 dependencies/main/java/codechicken/nei/DefaultHighlightHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/FastTransferManager.java delete mode 100644 dependencies/main/java/codechicken/nei/FingerprintChecker.java delete mode 100644 dependencies/main/java/codechicken/nei/GuiEnchantmentModifier.java delete mode 100644 dependencies/main/java/codechicken/nei/GuiExtendedCreativeInv.java delete mode 100644 dependencies/main/java/codechicken/nei/GuiNEIButton.java delete mode 100644 dependencies/main/java/codechicken/nei/GuiPotionCreator.java delete mode 100644 dependencies/main/java/codechicken/nei/HUDRenderer.java delete mode 100644 dependencies/main/java/codechicken/nei/Image.java delete mode 100644 dependencies/main/java/codechicken/nei/InfiniteStackSizeHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/InfiniteToolHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/ItemList.java delete mode 100644 dependencies/main/java/codechicken/nei/ItemMobSpawner.java delete mode 100644 dependencies/main/java/codechicken/nei/ItemQuantityField.java delete mode 100644 dependencies/main/java/codechicken/nei/ItemSorter.java delete mode 100644 dependencies/main/java/codechicken/nei/ItemStackMap.java delete mode 100644 dependencies/main/java/codechicken/nei/ItemStackSet.java delete mode 100644 dependencies/main/java/codechicken/nei/KeyManager.java delete mode 100644 dependencies/main/java/codechicken/nei/LayoutManager.java delete mode 100644 dependencies/main/java/codechicken/nei/NEIActions.java delete mode 100644 dependencies/main/java/codechicken/nei/NEIChestGuiHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/NEIClientConfig.java delete mode 100644 dependencies/main/java/codechicken/nei/NEICompatibility.java delete mode 100644 dependencies/main/java/codechicken/nei/NEIController.java delete mode 100644 dependencies/main/java/codechicken/nei/NEICreativeGuiHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/NEIDummySlotHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/NEIModContainer.java delete mode 100644 dependencies/main/java/codechicken/nei/NEIServerConfig.java delete mode 100644 dependencies/main/java/codechicken/nei/OffsetPositioner.java delete mode 100644 dependencies/main/java/codechicken/nei/PlayerSave.java delete mode 100644 dependencies/main/java/codechicken/nei/PopupInputHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/SaveLoadButton.java delete mode 100644 dependencies/main/java/codechicken/nei/SearchField.java delete mode 100644 dependencies/main/java/codechicken/nei/ServerHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/SlotOP.java delete mode 100644 dependencies/main/java/codechicken/nei/SpawnerRenderer.java delete mode 100644 dependencies/main/java/codechicken/nei/SubsetWidget.java delete mode 100644 dependencies/main/java/codechicken/nei/TextField.java delete mode 100644 dependencies/main/java/codechicken/nei/VisibilityData.java delete mode 100644 dependencies/main/java/codechicken/nei/WidgetZOrder.java delete mode 100644 dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java delete mode 100644 dependencies/main/java/codechicken/nei/api/API.java delete mode 100644 dependencies/main/java/codechicken/nei/api/DefaultOverlayRenderer.java delete mode 100644 dependencies/main/java/codechicken/nei/api/GuiInfo.java delete mode 100644 dependencies/main/java/codechicken/nei/api/IConfigureNEI.java delete mode 100644 dependencies/main/java/codechicken/nei/api/IGuiContainerOverlay.java delete mode 100644 dependencies/main/java/codechicken/nei/api/IHighlightHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/api/IInfiniteItemHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/api/INEIGuiAdapter.java delete mode 100644 dependencies/main/java/codechicken/nei/api/INEIGuiHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/api/INEIModeHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/api/IOverlayHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/api/IRecipeOverlayRenderer.java delete mode 100644 dependencies/main/java/codechicken/nei/api/IStackPositioner.java delete mode 100644 dependencies/main/java/codechicken/nei/api/ItemInfo.java delete mode 100644 dependencies/main/java/codechicken/nei/api/NEIInfo.java delete mode 100644 dependencies/main/java/codechicken/nei/api/TaggedInventoryArea.java delete mode 100644 dependencies/main/java/codechicken/nei/api/layout/LayoutStyle.java delete mode 100644 dependencies/main/java/codechicken/nei/api/stack/PositionedStack.java delete mode 100644 dependencies/main/java/codechicken/nei/asm/NEICorePlugin.java delete mode 100644 dependencies/main/java/codechicken/nei/asm/NEITransformer.java delete mode 100644 dependencies/main/java/codechicken/nei/config/ArrayDumper.java delete mode 100644 dependencies/main/java/codechicken/nei/config/ConfigSet.java delete mode 100644 dependencies/main/java/codechicken/nei/config/DataDumper.java delete mode 100644 dependencies/main/java/codechicken/nei/config/GuiHighlightTips.java delete mode 100644 dependencies/main/java/codechicken/nei/config/GuiItemIconDumper.java delete mode 100644 dependencies/main/java/codechicken/nei/config/GuiItemSorter.java delete mode 100644 dependencies/main/java/codechicken/nei/config/GuiNEIOptionList.java delete mode 100644 dependencies/main/java/codechicken/nei/config/GuiOptionList.java delete mode 100644 dependencies/main/java/codechicken/nei/config/GuiOptionPane.java delete mode 100644 dependencies/main/java/codechicken/nei/config/ItemPanelDumper.java delete mode 100644 dependencies/main/java/codechicken/nei/config/KeyBindings.java delete mode 100644 dependencies/main/java/codechicken/nei/config/Option.java delete mode 100644 dependencies/main/java/codechicken/nei/config/OptionButton.java delete mode 100644 dependencies/main/java/codechicken/nei/config/OptionCycled.java delete mode 100644 dependencies/main/java/codechicken/nei/config/OptionGamemodes.java delete mode 100644 dependencies/main/java/codechicken/nei/config/OptionIntegerField.java delete mode 100644 dependencies/main/java/codechicken/nei/config/OptionList.java delete mode 100644 dependencies/main/java/codechicken/nei/config/OptionOpenGui.java delete mode 100644 dependencies/main/java/codechicken/nei/config/OptionScrollPane.java delete mode 100644 dependencies/main/java/codechicken/nei/config/OptionStringSet.java delete mode 100644 dependencies/main/java/codechicken/nei/config/OptionTextField.java delete mode 100644 dependencies/main/java/codechicken/nei/config/OptionToggleButton.java delete mode 100644 dependencies/main/java/codechicken/nei/config/OptionUtilities.java delete mode 100644 dependencies/main/java/codechicken/nei/config/PatreonButton.java delete mode 100644 dependencies/main/java/codechicken/nei/config/RegistryDumper.java delete mode 100644 dependencies/main/java/codechicken/nei/config/dumps/FluidRegistryDumper.java delete mode 100644 dependencies/main/java/codechicken/nei/config/dumps/ForgeRegistryDumper.java delete mode 100644 dependencies/main/java/codechicken/nei/container/ContainerCreativeInv.java delete mode 100644 dependencies/main/java/codechicken/nei/container/ExtendedCreativeInv.java delete mode 100644 dependencies/main/java/codechicken/nei/container/InventoryCraftingDummy.java delete mode 100644 dependencies/main/java/codechicken/nei/featurehack/VanillaCreativeTabSearchHooks.java delete mode 100644 dependencies/main/java/codechicken/nei/guihook/DefaultSlotClickHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/guihook/GuiContainerManager.java delete mode 100644 dependencies/main/java/codechicken/nei/guihook/IContainerDrawHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/guihook/IContainerInputHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/guihook/IContainerObjectHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/guihook/IContainerSlotClickHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/guihook/IContainerTooltipHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/guihook/IGuiClientSide.java delete mode 100644 dependencies/main/java/codechicken/nei/guihook/IGuiHandleMouseWheel.java delete mode 100644 dependencies/main/java/codechicken/nei/guihook/IGuiSlotDraw.java delete mode 100644 dependencies/main/java/codechicken/nei/layout/LayoutStyleDefault.java delete mode 100644 dependencies/main/java/codechicken/nei/layout/LayoutStyleMinecraft.java delete mode 100644 dependencies/main/java/codechicken/nei/layout/LayoutStyleTMIOld.java delete mode 100644 dependencies/main/java/codechicken/nei/network/NEIClientPacketHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/network/NEIServerPacketHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/BrewingOverlayHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/BrewingRecipeHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/ContainerRecipe.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/DefaultOverlayHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/FireworkRecipeHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/FuelRecipeHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/FurnaceRecipeHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/GuiCraftingRecipe.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/GuiRecipe.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/GuiUsageRecipe.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/ICraftingHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/IRecipeHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/IUsageHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/ProfilerRecipeHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/RecipeInfo.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/RecipeItemInputHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/ShapedRecipeHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/ShapelessRecipeHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/TemplateRecipeHandler.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/potion/IPotionRecipe.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/potion/PotionRecipeHelper.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/potion/PotionTypeRecipe.java delete mode 100644 dependencies/main/java/codechicken/nei/recipe/potion/PotionUpgradeRecipe.java delete mode 100644 dependencies/main/java/codechicken/nei/thirdparty/colossalchests/ColossalChestsConfig.java delete mode 100644 dependencies/main/java/codechicken/nei/util/LogHelper.java delete mode 100644 dependencies/main/java/codechicken/nei/util/NEIClientUtils.java delete mode 100644 dependencies/main/java/codechicken/nei/util/NEIServerUtils.java delete mode 100644 dependencies/main/java/codechicken/nei/widget/Button.java delete mode 100644 dependencies/main/java/codechicken/nei/widget/ItemPanel.java delete mode 100644 dependencies/main/java/codechicken/nei/widget/Label.java delete mode 100644 dependencies/main/java/codechicken/nei/widget/Widget.java delete mode 100644 dependencies/main/java/codechicken/obfuscator/ConstantObfuscator.java delete mode 100644 dependencies/main/java/codechicken/obfuscator/DummyOutputStream.java delete mode 100644 dependencies/main/java/codechicken/obfuscator/IHeirachyEvaluator.java delete mode 100644 dependencies/main/java/codechicken/obfuscator/ILogStreams.java delete mode 100644 dependencies/main/java/codechicken/obfuscator/ObfDirection.java delete mode 100644 dependencies/main/java/codechicken/obfuscator/ObfRemapper.java delete mode 100644 dependencies/main/java/codechicken/obfuscator/ObfuscationMap.java delete mode 100644 dependencies/main/java/codechicken/obfuscator/ObfuscationRun.java delete mode 100644 dependencies/main/java/codechicken/obfuscator/SystemLogStreams.java diff --git a/dependencies/main/java/api/player/client/ClientPlayerAPI.java b/dependencies/main/java/api/player/client/ClientPlayerAPI.java index e47d28f1cb..098b59606a 100644 --- a/dependencies/main/java/api/player/client/ClientPlayerAPI.java +++ b/dependencies/main/java/api/player/client/ClientPlayerAPI.java @@ -759,7 +759,7 @@ private static void register(Class baseClass, String id, ClientPlayerBaseSort addMethod(id, baseClass, afterKnockBackHookTypes, "afterKnockBack", net.minecraft.entity.Entity.class, float.class, double.class, double.class); addMethod(id, baseClass, beforeMoveEntityHookTypes, "beforeMoveEntity", double.class, double.class, double.class); - addMethod(id, baseClass, overrideMoveEntityHookTypes, "moveEntity", double.class, double.class, double.class); + addMethod(id, baseClass, overrideMoveEntityHookTypes, "move", double.class, double.class, double.class); addMethod(id, baseClass, afterMoveEntityHookTypes, "afterMoveEntity", double.class, double.class, double.class); addMethod(id, baseClass, beforeMoveEntityWithHeadingHookTypes, "beforeMoveEntityWithHeading", float.class, float.class); diff --git a/dependencies/main/java/api/player/client/ClientPlayerClassVisitor.java b/dependencies/main/java/api/player/client/ClientPlayerClassVisitor.java index 329a3a19bc..181ce5e707 100644 --- a/dependencies/main/java/api/player/client/ClientPlayerClassVisitor.java +++ b/dependencies/main/java/api/player/client/ClientPlayerClassVisitor.java @@ -369,7 +369,7 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si return super.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL, "localKnockBack", desc, signature, exceptions); } - if(name.equals(isObfuscated ? "d" : "moveEntity") && desc.equals("(DDD)V")) + if(name.equals(isObfuscated ? "d" : "move") && desc.equals("(DDD)V")) { hadLocalMoveEntity = true; return super.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL, "localMoveEntity", desc, signature, exceptions); @@ -1886,12 +1886,12 @@ public void visitEnd() mv.visitEnd(); } - mv = cv.visitMethod(Opcodes.ACC_PUBLIC, isObfuscated ? "d" : "moveEntity", "(DDD)V", null, null); + mv = cv.visitMethod(Opcodes.ACC_PUBLIC, isObfuscated ? "d" : "move", "(DDD)V", null, null); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitVarInsn(Opcodes.DLOAD, 1); mv.visitVarInsn(Opcodes.DLOAD, 3); mv.visitVarInsn(Opcodes.DLOAD, 5); - mv.visitMethodInsn(Opcodes.INVOKESTATIC, "api/player/client/ClientPlayerAPI", "moveEntity", "(Lapi/player/client/IClientPlayerAPI;DDD)V", false); + mv.visitMethodInsn(Opcodes.INVOKESTATIC, "api/player/client/ClientPlayerAPI", "move", "(Lapi/player/client/IClientPlayerAPI;DDD)V", false); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); @@ -1901,7 +1901,7 @@ public void visitEnd() mv.visitVarInsn(Opcodes.DLOAD, 1); mv.visitVarInsn(Opcodes.DLOAD, 3); mv.visitVarInsn(Opcodes.DLOAD, 5); - mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, isObfuscated ? "bnn" : "net/minecraft/client/entity/EntityPlayerSP", isObfuscated ? "d" : "moveEntity", "(DDD)V", false); + mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, isObfuscated ? "bnn" : "net/minecraft/client/entity/EntityPlayerSP", isObfuscated ? "d" : "move", "(DDD)V", false); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); @@ -1911,7 +1911,7 @@ public void visitEnd() mv.visitVarInsn(Opcodes.DLOAD, 1); mv.visitVarInsn(Opcodes.DLOAD, 3); mv.visitVarInsn(Opcodes.DLOAD, 5); - mv.visitMethodInsn(Opcodes.INVOKESPECIAL, isObfuscated ? "bnk" : "net/minecraft/client/entity/AbstractClientPlayer", isObfuscated ? "d" : "moveEntity", "(DDD)V", false); + mv.visitMethodInsn(Opcodes.INVOKESPECIAL, isObfuscated ? "bnk" : "net/minecraft/client/entity/AbstractClientPlayer", isObfuscated ? "d" : "move", "(DDD)V", false); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); @@ -1923,7 +1923,7 @@ public void visitEnd() mv.visitVarInsn(Opcodes.DLOAD, 1); mv.visitVarInsn(Opcodes.DLOAD, 3); mv.visitVarInsn(Opcodes.DLOAD, 5); - mv.visitMethodInsn(Opcodes.INVOKESPECIAL, isObfuscated ? "bnk" : "net/minecraft/client/entity/AbstractClientPlayer", isObfuscated ? "d" : "moveEntity", "(DDD)V", false); + mv.visitMethodInsn(Opcodes.INVOKESPECIAL, isObfuscated ? "bnk" : "net/minecraft/client/entity/AbstractClientPlayer", isObfuscated ? "d" : "move", "(DDD)V", false); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); diff --git a/dependencies/main/java/api/player/server/ServerPlayerAPI.java b/dependencies/main/java/api/player/server/ServerPlayerAPI.java index 61751080ac..0a8771aade 100644 --- a/dependencies/main/java/api/player/server/ServerPlayerAPI.java +++ b/dependencies/main/java/api/player/server/ServerPlayerAPI.java @@ -661,7 +661,7 @@ private static void register(Class baseClass, String id, ServerPlayerBaseSort addMethod(id, baseClass, afterMountEntityHookTypes, "afterMountEntity", net.minecraft.entity.Entity.class, boolean.class); addMethod(id, baseClass, beforeMoveEntityHookTypes, "beforeMoveEntity", double.class, double.class, double.class); - addMethod(id, baseClass, overrideMoveEntityHookTypes, "moveEntity", double.class, double.class, double.class); + addMethod(id, baseClass, overrideMoveEntityHookTypes, "move", double.class, double.class, double.class); addMethod(id, baseClass, afterMoveEntityHookTypes, "afterMoveEntity", double.class, double.class, double.class); addMethod(id, baseClass, beforeMoveEntityWithHeadingHookTypes, "beforeMoveEntityWithHeading", float.class, float.class); diff --git a/dependencies/main/java/api/player/server/ServerPlayerClassVisitor.java b/dependencies/main/java/api/player/server/ServerPlayerClassVisitor.java index 30dde5e11a..f45ba2eae4 100644 --- a/dependencies/main/java/api/player/server/ServerPlayerClassVisitor.java +++ b/dependencies/main/java/api/player/server/ServerPlayerClassVisitor.java @@ -317,7 +317,7 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si return super.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL, "localMountEntity", desc, signature, exceptions); } - if(name.equals(isObfuscated ? "d" : "moveEntity") && desc.equals("(DDD)V")) + if(name.equals(isObfuscated ? "d" : "move") && desc.equals("(DDD)V")) { hadLocalMoveEntity = true; return super.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL, "localMoveEntity", desc, signature, exceptions); @@ -1595,12 +1595,12 @@ public void visitEnd() mv.visitEnd(); } - mv = cv.visitMethod(Opcodes.ACC_PUBLIC, isObfuscated ? "d" : "moveEntity", "(DDD)V", null, null); + mv = cv.visitMethod(Opcodes.ACC_PUBLIC, isObfuscated ? "d" : "move", "(DDD)V", null, null); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitVarInsn(Opcodes.DLOAD, 1); mv.visitVarInsn(Opcodes.DLOAD, 3); mv.visitVarInsn(Opcodes.DLOAD, 5); - mv.visitMethodInsn(Opcodes.INVOKESTATIC, "api/player/server/ServerPlayerAPI", "moveEntity", "(Lapi/player/server/IServerPlayerAPI;DDD)V", false); + mv.visitMethodInsn(Opcodes.INVOKESTATIC, "api/player/server/ServerPlayerAPI", "move", "(Lapi/player/server/IServerPlayerAPI;DDD)V", false); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); @@ -1610,7 +1610,7 @@ public void visitEnd() mv.visitVarInsn(Opcodes.DLOAD, 1); mv.visitVarInsn(Opcodes.DLOAD, 3); mv.visitVarInsn(Opcodes.DLOAD, 5); - mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, isObfuscated ? "lu" : "net/minecraft/entity/player/EntityPlayerMP", isObfuscated ? "d" : "moveEntity", "(DDD)V", false); + mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, isObfuscated ? "lu" : "net/minecraft/entity/player/EntityPlayerMP", isObfuscated ? "d" : "move", "(DDD)V", false); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); @@ -1620,7 +1620,7 @@ public void visitEnd() mv.visitVarInsn(Opcodes.DLOAD, 1); mv.visitVarInsn(Opcodes.DLOAD, 3); mv.visitVarInsn(Opcodes.DLOAD, 5); - mv.visitMethodInsn(Opcodes.INVOKESPECIAL, isObfuscated ? "zs" : "net/minecraft/entity/player/EntityPlayer", isObfuscated ? "d" : "moveEntity", "(DDD)V", false); + mv.visitMethodInsn(Opcodes.INVOKESPECIAL, isObfuscated ? "zs" : "net/minecraft/entity/player/EntityPlayer", isObfuscated ? "d" : "move", "(DDD)V", false); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); @@ -1632,7 +1632,7 @@ public void visitEnd() mv.visitVarInsn(Opcodes.DLOAD, 1); mv.visitVarInsn(Opcodes.DLOAD, 3); mv.visitVarInsn(Opcodes.DLOAD, 5); - mv.visitMethodInsn(Opcodes.INVOKESPECIAL, isObfuscated ? "zs" : "net/minecraft/entity/player/EntityPlayer", isObfuscated ? "d" : "moveEntity", "(DDD)V", false); + mv.visitMethodInsn(Opcodes.INVOKESPECIAL, isObfuscated ? "zs" : "net/minecraft/entity/player/EntityPlayer", isObfuscated ? "d" : "move", "(DDD)V", false); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); diff --git a/dependencies/main/java/codechicken/core/CCUpdateChecker.java b/dependencies/main/java/codechicken/core/CCUpdateChecker.java deleted file mode 100644 index c26fce5222..0000000000 --- a/dependencies/main/java/codechicken/core/CCUpdateChecker.java +++ /dev/null @@ -1,109 +0,0 @@ -package codechicken.core; - -import codechicken.core.launch.CodeChickenCorePlugin; -import com.google.common.base.Function; -import net.minecraft.client.Minecraft; -import net.minecraft.util.text.TextComponentString; -import net.minecraftforge.common.ForgeVersion; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.versioning.ComparableVersion; -import net.minecraftforge.fml.relauncher.FMLInjectionData; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.*; -import java.util.ArrayList; - -public class CCUpdateChecker { - private static final ArrayList updates = new ArrayList(); - - private static class ThreadUpdateCheck extends Thread { - private final URL url; - private final Function handler; - - public ThreadUpdateCheck(URL url, Function handler) { - this.url = url; - this.handler = handler; - - setName("CodeChicken Update Checker"); - } - - @Override - public void run() { - try { - HttpURLConnection conn = (HttpURLConnection) url.openConnection(); - conn.setRequestMethod("GET"); - conn.setConnectTimeout(5000); - conn.setReadTimeout(5000); - BufferedReader read = new BufferedReader(new InputStreamReader(conn.getInputStream())); - String ret = read.readLine(); - read.close(); - if (ret == null) { - ret = ""; - } - handler.apply(ret); - } catch (SocketTimeoutException ignored) { - } catch (UnknownHostException ignored) { - } catch (IOException iox) { - iox.printStackTrace(); - } - } - } - - public static void tick() { - Minecraft mc = Minecraft.getMinecraft(); - if (!mc.inGameHasFocus) { - return; - } - - synchronized (updates) { - for (String updateMessage : updates) { - mc.thePlayer.addChatMessage(new TextComponentString(updateMessage)); - } - updates.clear(); - } - } - - public static void addUpdateMessage(String s) { - synchronized (updates) { - updates.add(s); - } - } - - public static String mcVersion() { - return (String) FMLInjectionData.data()[4]; - } - - public static void updateCheck(final String mod, final String version) { - updateCheck("http://www.chickenbones.net/Files/notification/version.php?" + - "version=" + mcVersion() + "&" + - "file=" + mod, new Function() { - @Override - public Void apply(String ret) { - if (!ret.startsWith("Ret: ")) { - CodeChickenCorePlugin.logger.error("Failed to check update for " + mod + " returned: " + ret); - return null; - } - ComparableVersion newVersion = new ComparableVersion(ret.substring(5)); - if (newVersion.compareTo(new ComparableVersion(version)) > 0) { - ModDescriptionEnhancer.setUpdateStatus(mod, ForgeVersion.Status.OUTDATED, newVersion); - addUpdateMessage("Version " + newVersion + " of " + mod + " is available"); - } - return null; - } - }); - } - - public static void updateCheck(String mod) { - updateCheck(mod, Loader.instance().getIndexedModList().get(mod).getVersion()); - } - - public static void updateCheck(String url, Function handler) { - try { - new ThreadUpdateCheck(new URL(url), handler).start(); - } catch (MalformedURLException e) { - CodeChickenCorePlugin.logger.error("Malformed URL: " + url, e); - } - } -} diff --git a/dependencies/main/java/codechicken/core/ModDescriptionEnhancer.java b/dependencies/main/java/codechicken/core/ModDescriptionEnhancer.java deleted file mode 100644 index 884b1ce171..0000000000 --- a/dependencies/main/java/codechicken/core/ModDescriptionEnhancer.java +++ /dev/null @@ -1,55 +0,0 @@ -package codechicken.core; - -import codechicken.lib.util.ReflectionManager; -import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.common.ForgeVersion; -import net.minecraftforge.common.ForgeVersion.CheckResult; -import net.minecraftforge.common.ForgeVersion.Status; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.common.versioning.ComparableVersion; - -import java.util.HashMap; -import java.util.Map; - -@SuppressWarnings("unchecked") -public class ModDescriptionEnhancer { - public static void enhanceMod(Object mod) { - ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod); - mc.getMetadata().description = enhanceDesc(mc.getMetadata().description); - } - - public static String enhanceDesc(String desc) { - int supportersIdx = desc.indexOf("Supporters:"); - if (supportersIdx < 0) { - return desc; - } - - String supportersList = desc.substring(supportersIdx); - supportersList = supportersList.replaceAll("\\b(\\w+)\\b", TextFormatting.AQUA + "$1"); - return desc.substring(0, supportersIdx) + supportersList; - } - - public static void setUpdateStatus(String modId, Status status, ComparableVersion version) { - try { - ModContainer modContainer = FMLCommonHandler.instance().findContainerFor(modId); - Map changes = new HashMap(); - CheckResult result = ReflectionManager.newInstance(CheckResult.class, status, version, changes, ""); - setUpdateStatus(modContainer, result); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void setUpdateStatus(ModContainer container, CheckResult result) { - try { - Map resultMap = ReflectionManager.getField(ForgeVersion.class, Map.class, null, "results"); - synchronized (resultMap) { - resultMap.put(container, result); - } - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/dependencies/main/java/codechicken/core/commands/CoreCommand.java b/dependencies/main/java/codechicken/core/commands/CoreCommand.java deleted file mode 100644 index b872312607..0000000000 --- a/dependencies/main/java/codechicken/core/commands/CoreCommand.java +++ /dev/null @@ -1,102 +0,0 @@ -package codechicken.core.commands; - -import codechicken.lib.util.ServerUtils; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentTranslation; -import net.minecraft.world.WorldServer; -import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.fml.common.FMLCommonHandler; - -import java.util.ArrayList; -import java.util.List; - -public abstract class CoreCommand implements ICommand { - public static void chatT(ICommandSender sender, String s, Object... params) { - sender.addChatMessage(new TextComponentTranslation(s, params)); - } - - public static void chatOpsT(String s, Object... params) { - for (EntityPlayerMP player : ServerUtils.getPlayers()) { - if (FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().canSendCommands(player.getGameProfile())) { - player.addChatMessage(new TextComponentTranslation(s, params)); - } - } - } - - public abstract boolean isOpOnly(); - - @Override - public String getCommandUsage(ICommandSender commandSender) { - return "/" + getCommandName() + " help"; - } - - @Override - public void execute(MinecraftServer server, ICommandSender sender, String[] args) { - if (args.length < minimumParameters() || args.length == 1 && args[0].equals("help")) { - printHelp(sender); - return; - } - - String command = getCommandName(); - for (String arg : args) { - command += " " + arg; - } - - handleCommand(command, sender.getName(), args, sender); - } - - public abstract void handleCommand(String command, String playername, String[] args, ICommandSender listener); - - public abstract void printHelp(ICommandSender sender); - - public final EntityPlayerMP getPlayer(String name) { - return ServerUtils.getPlayer(name); - } - - public WorldServer getWorld(int dimension) { - return DimensionManager.getWorld(dimension); - } - - public WorldServer getWorld(EntityPlayer player) { - return (WorldServer) player.worldObj; - } - - @Override - public int compareTo(ICommand o) { - return getCommandName().compareTo(o.getCommandName()); - } - - @Override - public List getCommandAliases() { - return new ArrayList(); - } - - @Override - public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) { - return null; - } - - @Override - public boolean isUsernameIndex(String[] args, int index) { - return false; - } - - @Override - public boolean checkPermission(MinecraftServer server, ICommandSender commandSender) { - if (isOpOnly()) { - if (commandSender instanceof EntityPlayer) { - return FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().canSendCommands(((EntityPlayer) commandSender).getGameProfile()); - } - - return commandSender instanceof MinecraftServer; - } - return true; - } - - public abstract int minimumParameters(); -} diff --git a/dependencies/main/java/codechicken/core/commands/PlayerCommand.java b/dependencies/main/java/codechicken/core/commands/PlayerCommand.java deleted file mode 100644 index 728ce340bf..0000000000 --- a/dependencies/main/java/codechicken/core/commands/PlayerCommand.java +++ /dev/null @@ -1,33 +0,0 @@ -package codechicken.core.commands; - -import codechicken.lib.raytracer.RayTracer; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldServer; - -public abstract class PlayerCommand extends CoreCommand { - @Override - public boolean checkPermission(MinecraftServer server, ICommandSender player) { - return super.checkPermission(server, player) && player instanceof EntityPlayer; - } - - @Override - public void handleCommand(String command, String playername, String[] args, ICommandSender listener) { - EntityPlayerMP player = (EntityPlayerMP) listener; - handleCommand(getWorld(player), player, args); - } - - public abstract void handleCommand(WorldServer world, EntityPlayerMP player, String[] args); - - public static BlockPos traceBlock(EntityPlayerMP player, float reach) { - return RayTracer.retrace(player, reach).getBlockPos(); - } - - public static Entity traceEntity(EntityPlayerMP player, float reach) { - return RayTracer.retrace(player, reach).entityHit; - } -} diff --git a/dependencies/main/java/codechicken/core/commands/ServerCommand.java b/dependencies/main/java/codechicken/core/commands/ServerCommand.java deleted file mode 100644 index b1303e806a..0000000000 --- a/dependencies/main/java/codechicken/core/commands/ServerCommand.java +++ /dev/null @@ -1,22 +0,0 @@ -package codechicken.core.commands; - -import net.minecraft.command.ICommandSender; -import net.minecraft.server.MinecraftServer; - -public abstract class ServerCommand extends CoreCommand { - @Override - public void execute(MinecraftServer server, ICommandSender sender, String[] args) { - handleCommand(args, (MinecraftServer) sender); - } - - @Override - public boolean checkPermission(MinecraftServer server, ICommandSender sender) { - return super.checkPermission(server, sender) && sender instanceof MinecraftServer; - } - - public abstract void handleCommand(String[] args, MinecraftServer listener); - - public final boolean isOpOnly() { - return false; - } -} diff --git a/dependencies/main/java/codechicken/core/fluid/ExtendedFluidTank.java b/dependencies/main/java/codechicken/core/fluid/ExtendedFluidTank.java deleted file mode 100644 index 0b05927421..0000000000 --- a/dependencies/main/java/codechicken/core/fluid/ExtendedFluidTank.java +++ /dev/null @@ -1,105 +0,0 @@ -package codechicken.core.fluid; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; -import net.minecraftforge.fluids.IFluidTank; - -public class ExtendedFluidTank implements IFluidTank { - private FluidStack fluid; - private boolean changeType; - private int capacity; - - public ExtendedFluidTank(FluidStack type, int capacity) { - if (type == null) { - type = FluidUtils.emptyFluid(); - changeType = true; - } - fluid = FluidUtils.copy(type, 0); - this.capacity = capacity; - } - - public ExtendedFluidTank(int capacity) { - this(null, capacity); - } - - @Override - public FluidStack getFluid() { - return fluid.copy(); - } - - @Override - public int getCapacity() { - return capacity; - } - - public boolean canAccept(FluidStack type) { - return type == null || (fluid.amount == 0 && changeType) || fluid.isFluidEqual(type); - } - - @Override - public int fill(FluidStack resource, boolean doFill) { - if (resource == null) { - return 0; - } - - if (!canAccept(resource)) { - return 0; - } - - int tofill = Math.min(getCapacity() - fluid.amount, resource.amount); - if (doFill && tofill > 0) { - if (!fluid.isFluidEqual(resource)) { - fluid = FluidUtils.copy(resource, fluid.amount + tofill); - } else { - fluid.amount += tofill; - } - onLiquidChanged(); - } - - return tofill; - } - - @Override - public FluidStack drain(int maxDrain, boolean doDrain) { - if (fluid.amount == 0 || maxDrain <= 0) { - return null; - } - - int todrain = Math.min(maxDrain, fluid.amount); - if (doDrain && todrain > 0) { - fluid.amount -= todrain; - onLiquidChanged(); - } - return FluidUtils.copy(fluid, todrain); - } - - public FluidStack drain(FluidStack resource, boolean doDrain) { - if (resource == null || !resource.isFluidEqual(fluid)) { - return null; - } - - return drain(resource.amount, doDrain); - } - - public void onLiquidChanged() { - } - - public void fromTag(NBTTagCompound tag) { - fluid = FluidUtils.read(tag); - } - - public NBTTagCompound toTag() { - return FluidUtils.write(fluid, new NBTTagCompound()); - } - - @Override - public int getFluidAmount() { - return fluid.amount; - } - - @Override - public FluidTankInfo getInfo() { - return new FluidTankInfo(this); - } -} diff --git a/dependencies/main/java/codechicken/core/fluid/FluidUtils.java b/dependencies/main/java/codechicken/core/fluid/FluidUtils.java deleted file mode 100644 index 065d841744..0000000000 --- a/dependencies/main/java/codechicken/core/fluid/FluidUtils.java +++ /dev/null @@ -1,98 +0,0 @@ -package codechicken.core.fluid; - -import codechicken.lib.inventory.InventoryUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumHand; -import net.minecraftforge.fluids.*; -import net.minecraftforge.fluids.capability.IFluidHandler; - -public class FluidUtils { - public static int B = FluidContainerRegistry.BUCKET_VOLUME; - public static FluidStack water = new FluidStack(FluidRegistry.WATER, 1000); - public static FluidStack lava = new FluidStack(FluidRegistry.LAVA, 1000); - - public static boolean fillTankWithContainer(IFluidHandler tank, EntityPlayer player) { - ItemStack stack = player.getHeldItem(EnumHand.MAIN_HAND); - FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(stack); - - if (liquid == null) { - return false; - } - - if (tank.fill(liquid, false) != liquid.amount && !player.capabilities.isCreativeMode) { - return false; - } - - tank.fill(liquid, true); - - if (!player.capabilities.isCreativeMode) { - InventoryUtils.consumeItem(player.inventory, player.inventory.currentItem); - } - - player.inventoryContainer.detectAndSendChanges(); - return true; - } - - public static boolean emptyTankIntoContainer(IFluidHandler tank, EntityPlayer player, FluidStack tankLiquid) { - ItemStack stack = player.getHeldItem(EnumHand.MAIN_HAND); - - if (!FluidContainerRegistry.isEmptyContainer(stack)) { - return false; - } - - ItemStack filled = FluidContainerRegistry.fillFluidContainer(tankLiquid, stack); - FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(filled); - - if (liquid == null || filled == null) { - return false; - } - - tank.drain(liquid.amount, true); - - if (!player.capabilities.isCreativeMode) { - if (stack.stackSize == 1) { - player.inventory.setInventorySlotContents(player.inventory.currentItem, filled); - } else if (player.inventory.addItemStackToInventory(filled)) { - stack.stackSize--; - } else { - return false; - } - } - - player.inventoryContainer.detectAndSendChanges(); - return true; - } - - public static FluidStack copy(FluidStack liquid, int quantity) { - liquid = liquid.copy(); - liquid.amount = quantity; - return liquid; - } - - public static FluidStack read(NBTTagCompound tag) { - FluidStack stack = FluidStack.loadFluidStackFromNBT(tag); - return stack != null ? stack : new FluidStack(new Fluid("none", null, null), 0); - } - - public static NBTTagCompound write(FluidStack fluid, NBTTagCompound tag) { - return fluid == null || fluid.getFluid() == null ? new NBTTagCompound() : fluid.writeToNBT(new NBTTagCompound()); - } - - public static int getLuminosity(FluidStack stack, double density) { - Fluid fluid = stack.getFluid(); - if (fluid == null) { - return 0; - } - int light = fluid.getLuminosity(stack); - if (fluid.isGaseous()) { - light = (int) (light * density); - } - return light; - } - - public static FluidStack emptyFluid() { - return new FluidStack(water, 0); - } -} diff --git a/dependencies/main/java/codechicken/core/fluid/TankAccess.java b/dependencies/main/java/codechicken/core/fluid/TankAccess.java deleted file mode 100644 index 57460c8add..0000000000 --- a/dependencies/main/java/codechicken/core/fluid/TankAccess.java +++ /dev/null @@ -1,28 +0,0 @@ -package codechicken.core.fluid; - -import net.minecraft.util.EnumFacing; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidHandler; - -@Deprecated -public class TankAccess { - public IFluidHandler tank; - public EnumFacing face; - - public TankAccess(IFluidHandler tank, EnumFacing face) { - this.tank = tank; - this.face = face; - } - - public TankAccess(IFluidHandler tank, int side) { - this(tank, EnumFacing.values()[side]); - } - - public int fill(FluidStack resource, boolean doFill) { - return tank.fill(face, resource, doFill); - } - - public FluidStack drain(int maxDrain, boolean doDrain) { - return tank.drain(face, maxDrain, doDrain); - } -} diff --git a/dependencies/main/java/codechicken/core/gui/ClickCounter.java b/dependencies/main/java/codechicken/core/gui/ClickCounter.java deleted file mode 100644 index 76a423c4ef..0000000000 --- a/dependencies/main/java/codechicken/core/gui/ClickCounter.java +++ /dev/null @@ -1,55 +0,0 @@ -package codechicken.core.gui; - -import com.google.common.base.Objects; - -import java.util.Map; -import java.util.TreeMap; - -public class ClickCounter { - public class ClickCount { - public T clicked; - public long time; - public int count; - - public boolean update(T clicked) { - if (!Objects.equal(this.clicked, clicked)) { - this.clicked = clicked; - count = 0; - time = Long.MIN_VALUE; - return false; - } - return true; - } - } - - public Map buttons = new TreeMap(); - - public ClickCount getCount(int button) { - ClickCount c = buttons.get(button); - if (c == null) { - buttons.put(button, c = new ClickCount()); - } - return c; - } - - public void mouseDown(T clicked, int button) { - ClickCount c = getCount(button); - c.update(clicked); - } - - public int mouseUp(T clicked, int button) { - ClickCount c = getCount(button); - if (!c.update(clicked)) { - return 0; - } - - long time = System.currentTimeMillis(); - if (time - c.time < 500) { - c.count++; - } else { - c.count = 1; - } - c.time = time; - return c.count; - } -} diff --git a/dependencies/main/java/codechicken/core/gui/GuiCCButton.java b/dependencies/main/java/codechicken/core/gui/GuiCCButton.java deleted file mode 100644 index e8fa8076e5..0000000000 --- a/dependencies/main/java/codechicken/core/gui/GuiCCButton.java +++ /dev/null @@ -1,77 +0,0 @@ -package codechicken.core.gui; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.init.SoundEvents; - -public class GuiCCButton extends GuiWidget { - public String text; - public String actionCommand; - private boolean isEnabled = true; - public boolean visible = true; - - public GuiCCButton(int x, int y, int width, int height, String text) { - super(x, y, width, height); - this.text = text; - } - - public void setText(String s) { - text = s; - } - - public boolean isEnabled() { - return isEnabled; - } - - public void setEnabled(boolean b) { - isEnabled = b; - } - - @Override - public void mouseClicked(int x, int y, int button) { - if (isEnabled && pointInside(x, y) && actionCommand != null) { - sendAction(actionCommand, button); - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); - } - } - - @Override - public void draw(int mousex, int mousey, float frame) { - if (!visible) { - return; - } - - drawButtonTex(mousex, mousey); - if (text != null) { - drawText(mousex, mousey); - } - } - - public void drawButtonTex(int mousex, int mousey) { - GlStateManager.color(1, 1, 1, 1); - renderEngine.bindTexture(guiTex); - int state = getButtonTex(mousex, mousey); - drawTexturedModalRect(x, y, 0, 46 + state * 20, width / 2, height / 2);//top left - drawTexturedModalRect(x + width / 2, y, 200 - width / 2, 46 + state * 20, width / 2, height / 2);//top right - drawTexturedModalRect(x, y + height / 2, 0, 46 + state * 20 + 20 - height / 2, width / 2, height / 2);//bottom left - drawTexturedModalRect(x + width / 2, y + height / 2, 200 - width / 2, 46 + state * 20 + 20 - height / 2, width / 2, height / 2);//bottom right - } - - public int getButtonTex(int mousex, int mousey) { - return !isEnabled ? 0 : pointInside(mousex, mousey) ? 2 : 1; - } - - public void drawText(int mousex, int mousey) { - drawCenteredString(fontRenderer, text, x + width / 2, y + (height - 8) / 2, getTextColour(mousex, mousey)); - } - - public int getTextColour(int mousex, int mousey) { - return !isEnabled ? 0xFFA0A0A0 : pointInside(mousex, mousey) ? 0xFFFFFFA0 : 0xFFE0E0E0; - } - - public GuiCCButton setActionCommand(String string) { - actionCommand = string; - return this; - } -} diff --git a/dependencies/main/java/codechicken/core/gui/GuiCCTextField.java b/dependencies/main/java/codechicken/core/gui/GuiCCTextField.java deleted file mode 100644 index b1097db368..0000000000 --- a/dependencies/main/java/codechicken/core/gui/GuiCCTextField.java +++ /dev/null @@ -1,175 +0,0 @@ -package codechicken.core.gui; - -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.util.ChatAllowedCharacters; -import org.lwjgl.input.Keyboard; - -public class GuiCCTextField extends GuiWidget { - private String text; - private boolean isFocused; - private boolean isEnabled; - - public int maxStringLength; - public int cursorCounter; - public String actionCommand; - - private String allowedCharacters; - - public GuiCCTextField(int x, int y, int width, int height, String text) { - super(x, y, width, height); - isFocused = false; - isEnabled = true; - this.text = text; - } - - public GuiCCTextField setActionCommand(String s) { - actionCommand = s; - return this; - } - - public void setText(String s) { - if (s.equals(text)) { - return; - } - - String oldText = text; - text = s; - onTextChanged(oldText); - } - - public void onTextChanged(String oldText) { - } - - public final String getText() { - return text; - } - - public final boolean isEnabled() { - return isEnabled; - } - - public void setEnabled(boolean b) { - isEnabled = b; - if (!isEnabled && isFocused) { - setFocused(false); - } - } - - public final boolean isFocused() { - return isFocused; - } - - @Override - public void update() { - cursorCounter++; - } - - @Override - public void keyTyped(char c, int keycode) { - if (!isEnabled || !isFocused) { - return; - } - - /*if(c == '\t')//tab - { - parentGuiScreen.selectNextField(); - }*/ - if (c == '\026')//paste - { - String s = GuiScreen.getClipboardString(); - if (s == null || s.equals("")) { - return; - } - - for (int i = 0; i < s.length(); i++) { - if (text.length() == maxStringLength) { - return; - } - - char tc = s.charAt(i); - if (canAddChar(tc)) { - setText(text + tc); - } - } - } - if (keycode == Keyboard.KEY_RETURN) { - setFocused(false); - sendAction(actionCommand, getText()); - } - - if (keycode == Keyboard.KEY_BACK && text.length() > 0) { - setText(text.substring(0, text.length() - 1)); - } - - if ((text.length() < maxStringLength || maxStringLength == 0) && canAddChar(c)) { - setText(text + c); - } - } - - public boolean canAddChar(char c) { - return allowedCharacters == null ? ChatAllowedCharacters.isAllowedCharacter(c) : allowedCharacters.indexOf(c) >= 0; - } - - @Override - public void mouseClicked(int x, int y, int button) { - if (isEnabled && pointInside(x, y)) { - setFocused(true); - if (button == 1) { - setText(""); - } - } else { - setFocused(false); - } - } - - public void setFocused(boolean focus) { - if (focus == isFocused) { - return; - } - isFocused = focus; - onFocusChanged(); - } - - public void onFocusChanged() { - if (isFocused) { - cursorCounter = 0; - } - } - - @Override - public void draw(int i, int j, float f) { - drawBackground(); - drawText(); - } - - public void drawBackground() { - drawRect(x - 1, y - 1, x + width + 1, y + height + 1, 0xffa0a0a0); - drawRect(x, y, x + width, y + height, 0xff000000); - } - - public String getDrawText() { - String s = getText(); - if (isEnabled && isFocused && (cursorCounter / 6) % 2 == 0) { - s += "_"; - } - return s; - } - - public void drawText() { - drawString(fontRenderer, getDrawText(), x + 4, y + height / 2 - 4, getTextColour()); - } - - public int getTextColour() { - return isEnabled ? 0xe0e0e0 : 0x707070; - } - - public GuiCCTextField setMaxStringLength(int i) { - maxStringLength = i; - return this; - } - - public GuiCCTextField setAllowedCharacters(String s) { - allowedCharacters = s; - return this; - } -} diff --git a/dependencies/main/java/codechicken/core/gui/GuiScreenWidget.java b/dependencies/main/java/codechicken/core/gui/GuiScreenWidget.java deleted file mode 100644 index ab1c33d860..0000000000 --- a/dependencies/main/java/codechicken/core/gui/GuiScreenWidget.java +++ /dev/null @@ -1,139 +0,0 @@ -package codechicken.core.gui; - -import codechicken.lib.gui.GuiDraw; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.input.Mouse; - -import java.awt.*; -import java.io.IOException; -import java.util.ArrayList; - -public class GuiScreenWidget extends GuiScreen implements IGuiActionListener { - public ArrayList widgets = new ArrayList(); - public int xSize, ySize, guiTop, guiLeft; - - public GuiScreenWidget() { - this(176, 166); - } - - public GuiScreenWidget(int xSize, int ySize) { - super(); - this.xSize = xSize; - this.ySize = ySize; - } - - @Override - public void initGui() { - guiTop = (height - ySize) / 2; - guiLeft = (width - xSize) / 2; - if (!widgets.isEmpty()) { - resize(); - } - } - - public void reset() { - widgets.clear(); - initGui(); - addWidgets(); - resize(); - } - - @Override - public void setWorldAndResolution(Minecraft mc, int i, int j) { - boolean init = this.mc == null; - super.setWorldAndResolution(mc, i, j); - if (init) { - addWidgets(); - resize(); - } - } - - public void add(GuiWidget widget) { - widgets.add(widget); - widget.onAdded(this); - } - - @Override - public void drawScreen(int mousex, int mousey, float f) { - GlStateManager.translate(guiLeft, guiTop, 0); - drawBackground(); - for (GuiWidget widget : widgets) { - widget.draw(mousex - guiLeft, mousey - guiTop, f); - } - drawForeground(); - GlStateManager.translate(-guiLeft, -guiTop, 0); - } - - public void drawBackground() { - } - - public void drawForeground() { - } - - @Override - protected void mouseClicked(int x, int y, int button) throws IOException { - super.mouseClicked(x, y, button); - for (GuiWidget widget : widgets) { - widget.mouseClicked(x - guiLeft, y - guiTop, button); - } - } - - @Override - protected void mouseReleased(int x, int y, int button) { - super.mouseReleased(x, y, button); - for (GuiWidget widget : widgets) { - widget.mouseReleased(x - guiLeft, y - guiTop, button); - } - } - - @Override - protected void mouseClickMove(int x, int y, int button, long time) { - super.mouseClickMove(x, y, button, time); - for (GuiWidget widget : widgets) { - widget.mouseDragged(x - guiLeft, y - guiTop, button, time); - } - } - - @Override - public void updateScreen() { - super.updateScreen(); - if (mc.currentScreen == this) { - for (GuiWidget widget : widgets) { - widget.update(); - } - } - } - - @Override - public void keyTyped(char c, int keycode) throws IOException { - super.keyTyped(c, keycode); - for (GuiWidget widget : widgets) { - widget.keyTyped(c, keycode); - } - } - - @Override - public void handleMouseInput() throws IOException { - super.handleMouseInput(); - int i = Mouse.getEventDWheel(); - if (i != 0) { - Point p = GuiDraw.getMousePosition(); - int scroll = i > 0 ? 1 : -1; - for (GuiWidget widget : widgets) { - widget.mouseScrolled(p.x, p.y, scroll); - } - } - } - - @Override - public void actionPerformed(String ident, Object... params) { - } - - public void resize() { - } - - public void addWidgets() { - } -} diff --git a/dependencies/main/java/codechicken/core/gui/GuiScrollPane.java b/dependencies/main/java/codechicken/core/gui/GuiScrollPane.java deleted file mode 100644 index 764c7fd79d..0000000000 --- a/dependencies/main/java/codechicken/core/gui/GuiScrollPane.java +++ /dev/null @@ -1,221 +0,0 @@ -package codechicken.core.gui; - -import codechicken.lib.math.MathHelper; -import codechicken.lib.vec.Rectangle4i; - -import java.awt.*; - -public abstract class GuiScrollPane extends GuiWidget { - protected int scrollclicky = -1; - protected float scrollpercent; - protected int scrollmousey; - protected float percentscrolled; - - public int marginleft; - public int margintop; - public int marginright; - public int marginbottom; - - public GuiScrollPane(int x, int y, int width, int height) { - super(x, y, width, height); - } - - public void setMargins(int left, int top, int right, int bottom) { - marginleft = left; - margintop = top; - marginright = right; - marginbottom = bottom; - } - - public Rectangle windowBounds() { - return new Rectangle(x + marginleft, y + margintop, width - marginleft - marginright, height - margintop - marginbottom); - } - - public abstract int contentHeight(); - - public Dimension scrollbarDim() { - int h = (int) ((windowBounds().getHeight() / contentHeight()) * height); - return new Dimension(5, h > height ? height : h < height / 15 ? height / 15 : h); - } - - public Rectangle scrollbarBounds() { - Dimension dim = scrollbarDim(); - return new Rectangle(x + width - dim.width, y + (int) ((height - dim.height) * percentscrolled + 0.4999), dim.width, dim.height); - } - - public void scrollUp() { - scroll(-5); - } - - public void scrollDown() { - scroll(5); - } - - public void scroll(int i) { - percentscrolled += i * height / (float) (2 * contentHeight()); - calculatePercentScrolled(); - } - - public void calculatePercentScrolled() { - int barempty = height - scrollbarDim().height; - if (isScrolling()) { - int scrolldiff = scrollmousey - scrollclicky; - percentscrolled = scrolldiff / (float) barempty + scrollpercent; - } - percentscrolled = (float) MathHelper.clip(percentscrolled, 0, 1); - } - - public boolean isScrolling() { - return scrollclicky >= 0; - } - - public boolean hasScrollbar() { - return contentHeight() > height; - } - - /** - * @return -1 for left, 0 for none, 1 for right - */ - public int scrollbarGuideAlignment() { - return -1; - } - - public void showSlot(int sloty, int slotHeight) { - Rectangle w = windowBounds(); - if (sloty + slotHeight > w.y + w.height) { - int diff = sloty - (w.y + w.height - slotHeight); - percentscrolled += diff / (double) (contentHeight() - w.height); - calculatePercentScrolled(); - } else if (sloty < w.y) { - int diff = w.y - sloty; - percentscrolled -= diff / (double) (contentHeight() - w.height); - calculatePercentScrolled(); - } - } - - @Override - public void mouseClicked(int mx, int my, int button) { - Rectangle sbar = scrollbarBounds(); - Rectangle w = windowBounds(); - int barempty = height - sbar.height; - - if (button == 0 && - sbar.height < height && //the scroll bar can move (not full length) - mx >= sbar.x && mx <= sbar.x + sbar.width && - my >= y && my <= y + height)//in the scroll pane - { - if (my < sbar.y) { - percentscrolled = (my - y) / (float) barempty; - calculatePercentScrolled(); - } else if (my > sbar.y + sbar.height) { - percentscrolled = (my - y - sbar.height + 1) / (float) barempty; - calculatePercentScrolled(); - } else { - scrollclicky = my; - scrollpercent = percentscrolled; - scrollmousey = my; - } - } else if (w.contains(mx, my)) { - slotDown(mx - w.x, my - w.y + scrolledPixels(), button); - } - } - - /** - * Mouse down on slot area - * Coordinates relative to slot content area - */ - public void slotDown(int mx, int my, int button) { - } - - /** - * Mouse up on slot area - * Coordinates relative to slot content area - */ - public void slotUp(int mx, int my, int button) { - } - - @Override - public void mouseReleased(int mx, int my, int button) { - Rectangle w = windowBounds(); - if (isScrolling() && button == 0)//we were scrolling and we released mouse - { - scrollclicky = -1; - } else if (w.contains(mx, my)) { - slotUp(mx - w.x, my - w.y + scrolledPixels(), button); - } - } - - @Override - public void mouseDragged(int mousex, int mousey, int button, long time) { - if (isScrolling()) { - int scrolldiff = mousey - scrollclicky; - int sbarh = scrollbarDim().height; - int barupallowed = (int) ((height - sbarh) * scrollpercent + 0.5); - int bardownallowed = (height - sbarh) - barupallowed; - - if (-scrolldiff > barupallowed) { - scrollmousey = scrollclicky - barupallowed; - } else if (scrolldiff > bardownallowed) { - scrollmousey = scrollclicky + bardownallowed; - } else { - scrollmousey = mousey; - } - - calculatePercentScrolled(); - } - } - - public int scrolledPixels() { - int scrolled = (int) ((contentHeight() - windowBounds().height) * percentscrolled + 0.5); - if (scrolled < 0) { - scrolled = 0; - } - return scrolled; - } - - public Rectangle4i bounds() { - return new Rectangle4i(x, y, width, height); - } - - public boolean contains(int mx, int my) { - return bounds().contains(mx, my); - } - - @Override - public void draw(int mx, int my, float frame) { - Rectangle w = windowBounds(); - drawBackground(frame); - drawContent(mx - w.x, my + scrolledPixels() - w.y, frame); - drawOverlay(frame); - drawScrollbar(frame); - } - - public void drawBackground(float frame) { - drawRect(x, y, x + width, y + height, 0xff000000); - } - - public abstract void drawContent(int mx, int my, float frame); - - public void drawOverlay(float frame) { - //outlines - drawRect(x, y - 1, x + width, y, 0xffa0a0a0);//top - drawRect(x, y + height, x + width, y + height + 1, 0xffa0a0a0);//bottom - drawRect(x - 1, y - 1, x, y + height + 1, 0xffa0a0a0);//left - drawRect(x + width, y - 1, x + width + 1, y + height + 1, 0xffa0a0a0);//right - } - - public void drawScrollbar(float frame) { - Rectangle r = scrollbarBounds(); - - drawRect(r.x, r.y, r.x + r.width, r.y + r.height, 0xFF8B8B8B);//corners - drawRect(r.x, r.y, r.x + r.width - 1, r.y + r.height - 1, 0xFFF0F0F0);//topleft up - drawRect(r.x + 1, r.y + 1, r.x + r.width, r.y + r.height, 0xFF555555);//bottom right down - drawRect(r.x + 1, r.y + 1, r.x + r.width - 1, r.y + r.height - 1, 0xFFC6C6C6);//scrollbar - - int algn = scrollbarGuideAlignment(); - if (algn != 0) { - drawRect(algn > 0 ? r.x + r.width : r.x - 1, y, r.x, y + height, 0xFF808080);//lineguide - } - } - -} diff --git a/dependencies/main/java/codechicken/core/gui/GuiScrollSlot.java b/dependencies/main/java/codechicken/core/gui/GuiScrollSlot.java deleted file mode 100644 index f33f315dfb..0000000000 --- a/dependencies/main/java/codechicken/core/gui/GuiScrollSlot.java +++ /dev/null @@ -1,169 +0,0 @@ -package codechicken.core.gui; - -import org.lwjgl.input.Keyboard; - -import java.awt.*; - -public abstract class GuiScrollSlot extends GuiScrollPane { - protected String actionCommand; - public boolean focused; - protected ClickCounter click = new ClickCounter(); - public boolean smoothScroll = true; - - public GuiScrollSlot(int x, int y, int width, int height) { - super(x, y, width, height); - setMargins(3, 2, 3, 2); - } - - public GuiScrollSlot setActionCommand(String s) { - actionCommand = s; - return this; - } - - public void setSmoothScroll(boolean b) { - smoothScroll = b; - } - - public abstract int getSlotHeight(int slot); - - protected abstract int getNumSlots(); - - public void selectNext() { - } - - public void selectPrev() { - } - - /** - * Coordinates are relative to slot area - */ - protected abstract void slotClicked(int slot, int button, int mx, int my, int count); - - protected abstract void drawSlot(int slot, int x, int y, int mx, int my, float frame); - - protected void unfocus() { - } - - public void setFocused(boolean focus) { - focused = focus; - if (!focused) { - unfocus(); - } - } - - @Override - public int contentHeight() { - return getSlotY(getNumSlots()); - } - - public int getSlotY(int slot) { - int h = 0; - for (int i = 0; i < slot; i++) { - h += getSlotHeight(i); - } - return h; - } - - public int getSlot(int my) { - if (my < 0) { - return -1; - } - - int y = 0; - for (int i = 0; i < getNumSlots(); i++) { - int h = getSlotHeight(i); - if (my >= y && my < y + h) { - return i; - } - y += h; - } - return -1; - } - - public int getClickedSlot(int my) { - return getSlot(my - windowBounds().y + scrolledPixels()); - } - - @Override - public int scrolledPixels() { - int scrolled = super.scrolledPixels(); - if (!smoothScroll) { - int slot = getSlot(scrolled); - int sloty = getSlotY(slot); - int sloth = getSlotHeight(slot); - scrolled = sloty + (int) ((scrolled - sloty) / (double) sloth + 0.5) * sloth; - } - return scrolled; - } - - /** - * @return -1 for left, 1 for right - */ - public int scrollbarAlignment() { - return 1; - } - - @Override - public int scrollbarGuideAlignment() { - return scrollbarAlignment(); - } - - @Override - public Rectangle scrollbarBounds() { - Rectangle r = super.scrollbarBounds(); - if (scrollbarAlignment() == -1) { - r.x = x; - } - return r; - } - - public void showSlot(int slot) { - showSlot(getSlotY(slot), getSlotHeight(slot)); - } - - @Override - public void slotDown(int mx, int my, int button) { - int slot = getSlot(my); - click.mouseDown(slot >= 0 ? slot : null, button); - } - - @Override - public void slotUp(int mx, int my, int button) { - int slot = getSlot(my); - int c = click.mouseUp(slot >= 0 ? slot : null, button); - if (c > 0 && slot >= 0) { - slotClicked(slot, button, mx, my - getSlotY(slot), c); - } - } - - @Override - public void keyTyped(char c, int keycode) { - if (!focused) { - return; - } - - if (keycode == Keyboard.KEY_UP) { - selectPrev(); - } - if (keycode == Keyboard.KEY_DOWN) { - selectNext(); - } - if (keycode == Keyboard.KEY_RETURN && actionCommand != null) { - sendAction(actionCommand); - } - } - - @Override - public void drawContent(int mx, int my, float frame) { - int scrolled = scrolledPixels(); - Rectangle w = windowBounds(); - int y = 0; - for (int slot = 0; slot < getNumSlots(); slot++) { - int h = getSlotHeight(slot); - if (y + h > scrolled && y < scrolled + w.height) { - drawSlot(slot, w.x, w.y + y - scrolledPixels(), mx, my - y, frame); - } - y += h; - } - } -} diff --git a/dependencies/main/java/codechicken/core/gui/GuiWidget.java b/dependencies/main/java/codechicken/core/gui/GuiWidget.java deleted file mode 100644 index ed4905fe95..0000000000 --- a/dependencies/main/java/codechicken/core/gui/GuiWidget.java +++ /dev/null @@ -1,74 +0,0 @@ -package codechicken.core.gui; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.util.ResourceLocation; - -public class GuiWidget extends Gui { - protected static final ResourceLocation guiTex = new ResourceLocation("textures/gui/widgets.png"); - - public GuiScreen parentScreen; - public TextureManager renderEngine; - public FontRenderer fontRenderer; - - public int x; - public int y; - public int width; - public int height; - - public GuiWidget(int x, int y, int width, int height) { - setSize(x, y, width, height); - } - - public void setSize(int x, int y, int width, int height) { - this.x = x; - this.y = y; - this.width = width; - this.height = height; - } - - public boolean pointInside(int px, int py) { - return px >= x && px < x + width && py >= y && py < y + height; - } - - public void sendAction(String actionCommand, Object... params) { - sendAction(parentScreen, actionCommand, params); - } - - public static void sendAction(GuiScreen screen, String actionCommand, Object... params) { - if (actionCommand != null && screen instanceof IGuiActionListener) { - ((IGuiActionListener) screen).actionPerformed(actionCommand, params); - } - } - - public void mouseClicked(int x, int y, int button) { - } - - public void mouseReleased(int x, int y, int button) { - } - - public void mouseDragged(int x, int y, int button, long time) { - } - - public void update() { - } - - public void draw(int mousex, int mousey, float frame) { - } - - public void keyTyped(char c, int keycode) { - } - - public void mouseScrolled(int x, int y, int scroll) { - } - - public void onAdded(GuiScreen s) { - Minecraft mc = Minecraft.getMinecraft(); - parentScreen = s; - renderEngine = mc.renderEngine; - fontRenderer = mc.fontRendererObj; - } -} diff --git a/dependencies/main/java/codechicken/core/gui/IGuiActionListener.java b/dependencies/main/java/codechicken/core/gui/IGuiActionListener.java deleted file mode 100644 index 04a187cda6..0000000000 --- a/dependencies/main/java/codechicken/core/gui/IGuiActionListener.java +++ /dev/null @@ -1,5 +0,0 @@ -package codechicken.core.gui; - -public interface IGuiActionListener { - void actionPerformed(String actionCommand, Object... params); -} \ No newline at end of file diff --git a/dependencies/main/java/codechicken/core/internal/CCCEventHandler.java b/dependencies/main/java/codechicken/core/internal/CCCEventHandler.java deleted file mode 100644 index 31ddc556f9..0000000000 --- a/dependencies/main/java/codechicken/core/internal/CCCEventHandler.java +++ /dev/null @@ -1,16 +0,0 @@ -package codechicken.core.internal; - -import codechicken.core.CCUpdateChecker; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; - -public class CCCEventHandler { - - @SubscribeEvent - public void clientTick(TickEvent.ClientTickEvent event) { - if (event.phase == Phase.END) { - CCUpdateChecker.tick(); - } - } -} diff --git a/dependencies/main/java/codechicken/core/inventory/ContainerExtended.java b/dependencies/main/java/codechicken/core/inventory/ContainerExtended.java deleted file mode 100644 index fddda563c5..0000000000 --- a/dependencies/main/java/codechicken/core/inventory/ContainerExtended.java +++ /dev/null @@ -1,247 +0,0 @@ -package codechicken.core.inventory; - -import codechicken.lib.packet.PacketCustom; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.*; -import net.minecraft.item.ItemStack; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -public abstract class ContainerExtended extends Container implements IContainerListener { - public LinkedList playerCrafters = new LinkedList(); - - public ContainerExtended() { - listeners.add(this); - } - - @Override - public void addListener(IContainerListener icrafting) { - if (icrafting instanceof EntityPlayerMP) { - playerCrafters.add((EntityPlayerMP) icrafting); - sendContainerAndContentsToPlayer(this, getInventory(), Arrays.asList((EntityPlayerMP) icrafting)); - detectAndSendChanges(); - } else { - super.addListener(icrafting); - } - } - - @Override - public void removeListener(IContainerListener icrafting) { - if (icrafting instanceof EntityPlayerMP) { - playerCrafters.remove(icrafting); - } else { - super.removeListener(icrafting); - } - } - - @Override - public void updateCraftingInventory(Container container, List list) { - sendContainerAndContentsToPlayer(container, list, playerCrafters); - } - - @Override - public void sendAllWindowProperties(Container p_175173_1_, IInventory p_175173_2_) { - } - - public void sendContainerAndContentsToPlayer(Container container, List list, List playerCrafters) { - LinkedList largeStacks = new LinkedList(); - for (int i = 0; i < list.size(); i++) { - ItemStack stack = list.get(i); - if (stack != null && stack.stackSize > Byte.MAX_VALUE) { - list.set(i, null); - largeStacks.add(stack); - } else { - largeStacks.add(null); - } - } - - for (EntityPlayerMP player : playerCrafters) { - player.updateCraftingInventory(container, list); - } - - for (int i = 0; i < largeStacks.size(); i++) { - ItemStack stack = largeStacks.get(i); - if (stack != null) { - sendLargeStack(stack, i, playerCrafters); - } - } - } - - public void sendLargeStack(ItemStack stack, int slot, List players) { - } - - @Override - public void sendProgressBarUpdate(Container container, int i, int j) { - for (EntityPlayerMP player : playerCrafters) { - player.sendProgressBarUpdate(container, i, j); - } - } - - @Override - public void sendSlotContents(Container container, int slot, ItemStack stack) { - if (stack != null && stack.stackSize > Byte.MAX_VALUE) { - sendLargeStack(stack, slot, playerCrafters); - } else { - for (EntityPlayerMP player : playerCrafters) { - player.sendSlotContents(container, slot, stack); - } - } - } - - @Override - public ItemStack slotClick(int slot, int dragType, ClickType clickType, EntityPlayer player) { - if (slot >= 0 && slot < inventorySlots.size()) { - Slot actualSlot = getSlot(slot); - if (actualSlot instanceof SlotHandleClicks) { - return ((SlotHandleClicks) actualSlot).slotClick(this, player, dragType, clickType); - } - } - return super.slotClick(slot, dragType, clickType, player); - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slotIndex) { - ItemStack transferredStack = null; - Slot slot = inventorySlots.get(slotIndex); - - if (slot != null && slot.getHasStack()) { - ItemStack stack = slot.getStack(); - transferredStack = stack.copy(); - - if (!doMergeStackAreas(slotIndex, stack)) { - return null; - } - - if (stack.stackSize == 0) { - slot.putStack(null); - } else { - slot.onSlotChanged(); - } - } - - return transferredStack; - } - - @Override - public boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverse) { - boolean merged = false; - int slotIndex = reverse ? endIndex - 1 : startIndex; - - if (stack == null) { - return false; - } - - if (stack.isStackable())//search for stacks to increase - { - while (stack.stackSize > 0 && (reverse ? slotIndex >= startIndex : slotIndex < endIndex)) { - Slot slot = inventorySlots.get(slotIndex); - ItemStack slotStack = slot.getStack(); - - if (slotStack != null && slotStack.getItem() == stack.getItem() && - (!stack.getHasSubtypes() || stack.getItemDamage() == slotStack.getItemDamage()) && - ItemStack.areItemStackTagsEqual(stack, slotStack)) { - int totalStackSize = slotStack.stackSize + stack.stackSize; - int maxStackSize = Math.min(stack.getMaxStackSize(), slot.getSlotStackLimit()); - if (totalStackSize <= maxStackSize) { - stack.stackSize = 0; - slotStack.stackSize = totalStackSize; - slot.onSlotChanged(); - merged = true; - } else if (slotStack.stackSize < maxStackSize) { - stack.stackSize -= maxStackSize - slotStack.stackSize; - slotStack.stackSize = maxStackSize; - slot.onSlotChanged(); - merged = true; - } - } - - slotIndex += reverse ? -1 : 1; - } - } - - if (stack.stackSize > 0)//normal transfer :) - { - slotIndex = reverse ? endIndex - 1 : startIndex; - - while (stack.stackSize > 0 && (reverse ? slotIndex >= startIndex : slotIndex < endIndex)) { - Slot slot = this.inventorySlots.get(slotIndex); - - if (!slot.getHasStack() && slot.isItemValid(stack)) { - int maxStackSize = Math.min(stack.getMaxStackSize(), slot.getSlotStackLimit()); - if (stack.stackSize <= maxStackSize) { - slot.putStack(stack.copy()); - slot.onSlotChanged(); - stack.stackSize = 0; - merged = true; - } else { - slot.putStack(stack.splitStack(maxStackSize)); - slot.onSlotChanged(); - merged = true; - } - } - - slotIndex += reverse ? -1 : 1; - } - } - - return merged; - } - - public boolean doMergeStackAreas(int slotIndex, ItemStack stack) { - return false; - } - - protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) { - bindPlayerInventory(inventoryPlayer, 8, 84); - } - - protected void bindPlayerInventory(InventoryPlayer inventoryPlayer, int x, int y) { - for (int row = 0; row < 3; row++) { - for (int col = 0; col < 9; col++) { - addSlotToContainer(new Slot(inventoryPlayer, col + row * 9 + 9, x + col * 18, y + row * 18)); - } - } - for (int slot = 0; slot < 9; slot++) { - addSlotToContainer(new Slot(inventoryPlayer, slot, x + slot * 18, y + 58)); - } - } - - @Override - public boolean canInteractWith(EntityPlayer var1) { - return true; - } - - public void sendContainerPacket(PacketCustom packet) { - for (EntityPlayerMP player : playerCrafters) { - packet.sendToPlayer(player); - } - } - - /** - * May be called from a client packet handler to handle additional info - */ - public void handleOutputPacket(PacketCustom packet) { - } - - /** - * May be called from a server packet handler to handle additional info - */ - public void handleInputPacket(PacketCustom packet) { - } - - /** - * May be called from a server packet handler to handle client input - */ - public void handleGuiChange(int ID, int value) { - } - - public void sendProgressBarUpdate(int barID, int value) { - for (IContainerListener crafting : listeners) { - crafting.sendProgressBarUpdate(this, barID, value); - } - } -} diff --git a/dependencies/main/java/codechicken/core/inventory/ContainerSynchronised.java b/dependencies/main/java/codechicken/core/inventory/ContainerSynchronised.java deleted file mode 100644 index 4a0bf5b7c1..0000000000 --- a/dependencies/main/java/codechicken/core/inventory/ContainerSynchronised.java +++ /dev/null @@ -1,60 +0,0 @@ -package codechicken.core.inventory; - -import codechicken.lib.packet.PacketCustom; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public abstract class ContainerSynchronised extends ContainerExtended { - private ArrayList syncVars = new ArrayList(); - - public abstract PacketCustom createSyncPacket(); - - @Override - public final void detectAndSendChanges() { - super.detectAndSendChanges(); - - for (int i = 0; i < syncVars.size(); i++) { - IContainerSyncVar var = syncVars.get(i); - if (var.changed()) { - PacketCustom packet = createSyncPacket(); - packet.writeByte(i); - var.writeChange(packet); - sendContainerPacket(packet); - var.reset(); - } - } - } - - @Override - public void sendContainerAndContentsToPlayer(Container container, List list, List playerCrafters) { - super.sendContainerAndContentsToPlayer(container, list, playerCrafters); - for (int i = 0; i < syncVars.size(); i++) { - IContainerSyncVar var = syncVars.get(i); - PacketCustom packet = createSyncPacket(); - packet.writeByte(i); - var.writeChange(packet); - var.reset(); - for (EntityPlayerMP player : playerCrafters) { - packet.sendToPlayer(player); - } - } - } - - public void addSyncVar(IContainerSyncVar var) { - syncVars.add(var); - } - - @Override - public final void handleOutputPacket(PacketCustom packet) { - syncVars.get(packet.readUByte()).readChange(packet); - } - - public List getSyncedVars() { - return Collections.unmodifiableList(syncVars); - } -} diff --git a/dependencies/main/java/codechicken/core/inventory/GuiContainerWidget.java b/dependencies/main/java/codechicken/core/inventory/GuiContainerWidget.java deleted file mode 100644 index 53be82e5a9..0000000000 --- a/dependencies/main/java/codechicken/core/inventory/GuiContainerWidget.java +++ /dev/null @@ -1,123 +0,0 @@ -package codechicken.core.inventory; - -import codechicken.core.gui.GuiWidget; -import codechicken.core.gui.IGuiActionListener; -import codechicken.lib.gui.GuiDraw; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.inventory.Container; -import org.lwjgl.input.Mouse; - -import java.awt.*; -import java.io.IOException; -import java.util.ArrayList; - -public class GuiContainerWidget extends GuiContainer implements IGuiActionListener { - public ArrayList widgets = new ArrayList(); - - public GuiContainerWidget(Container inventorySlots) { - this(inventorySlots, 176, 166); - } - - public GuiContainerWidget(Container inventorySlots, int xSize, int ySize) { - super(inventorySlots); - this.xSize = xSize; - this.ySize = ySize; - } - - @Override - public void setWorldAndResolution(Minecraft mc, int i, int j) { - super.setWorldAndResolution(mc, i, j); - if (widgets.isEmpty()) { - addWidgets(); - } - } - - public void add(GuiWidget widget) { - widgets.add(widget); - widget.onAdded(this); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float f, int mousex, int mousey) { - GlStateManager.translate(guiLeft, guiTop, 0); - drawBackground(); - for (GuiWidget widget : widgets) { - widget.draw(mousex - guiLeft, mousey - guiTop, f); - } - - GlStateManager.translate(-guiLeft, -guiTop, 0); - } - - public void drawBackground() { - } - - @Override - protected void mouseClicked(int x, int y, int button) throws IOException { - super.mouseClicked(x, y, button); - for (GuiWidget widget : widgets) { - widget.mouseClicked(x - guiLeft, y - guiTop, button); - } - } - - @Override - protected void mouseReleased(int x, int y, int button) { - super.mouseReleased(x, y, button); - for (GuiWidget widget : widgets) { - widget.mouseReleased(x - guiLeft, y - guiTop, button); - } - } - - @Override - protected void mouseClickMove(int x, int y, int button, long time) { - super.mouseClickMove(x, y, button, time); - for (GuiWidget widget : widgets) { - widget.mouseDragged(x - guiLeft, y - guiTop, button, time); - } - } - - @Override - public void updateScreen() { - super.updateScreen(); - if (mc.currentScreen == this) { - for (GuiWidget widget : widgets) { - widget.update(); - } - } - } - - @Override - public void keyTyped(char c, int keycode) throws IOException { - super.keyTyped(c, keycode); - for (GuiWidget widget : widgets) { - widget.keyTyped(c, keycode); - } - } - - @Override - public void handleMouseInput() throws IOException { - super.handleMouseInput(); - int i = Mouse.getEventDWheel(); - if (i != 0) { - Point p = GuiDraw.getMousePosition(); - int scroll = i > 0 ? 1 : -1; - for (GuiWidget widget : widgets) { - widget.mouseScrolled(p.x, p.y, scroll); - } - } - } - - @Override - public void actionPerformed(String ident, Object... params) { - } - - public void addWidgets() { - } - - @Override - public void onGuiClosed() { - super.onGuiClosed(); - widgets.clear(); - } -} diff --git a/dependencies/main/java/codechicken/core/inventory/IContainerSyncVar.java b/dependencies/main/java/codechicken/core/inventory/IContainerSyncVar.java deleted file mode 100644 index c1e3b708a0..0000000000 --- a/dependencies/main/java/codechicken/core/inventory/IContainerSyncVar.java +++ /dev/null @@ -1,13 +0,0 @@ -package codechicken.core.inventory; - -import codechicken.lib.packet.PacketCustom; - -public interface IContainerSyncVar { - boolean changed(); - - void reset(); - - void writeChange(PacketCustom packet); - - void readChange(PacketCustom packet); -} diff --git a/dependencies/main/java/codechicken/core/inventory/IntegerSync.java b/dependencies/main/java/codechicken/core/inventory/IntegerSync.java deleted file mode 100644 index a9280663dd..0000000000 --- a/dependencies/main/java/codechicken/core/inventory/IntegerSync.java +++ /dev/null @@ -1,29 +0,0 @@ -package codechicken.core.inventory; - -import codechicken.lib.packet.PacketCustom; - -public abstract class IntegerSync implements IContainerSyncVar { - public int c_value; - - @Override - public boolean changed() { - return getValue() != c_value; - } - - @Override - public void reset() { - c_value = getValue(); - } - - @Override - public void writeChange(PacketCustom packet) { - packet.writeInt(getValue()); - } - - @Override - public void readChange(PacketCustom packet) { - c_value = packet.readInt(); - } - - public abstract int getValue(); -} diff --git a/dependencies/main/java/codechicken/core/inventory/MappedInventoryAccess.java b/dependencies/main/java/codechicken/core/inventory/MappedInventoryAccess.java deleted file mode 100644 index e4922a57a9..0000000000 --- a/dependencies/main/java/codechicken/core/inventory/MappedInventoryAccess.java +++ /dev/null @@ -1,145 +0,0 @@ -package codechicken.core.inventory; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.ITextComponent; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class MappedInventoryAccess implements IInventory { - public interface InventoryAccessor { - boolean canAccessSlot(int slot); - } - - public static final InventoryAccessor fullAccess = new InventoryAccessor() { - public boolean canAccessSlot(int slot) { - return true; - } - }; - - private ArrayList slotMap = new ArrayList(); - private IInventory inv; - private ArrayList accessors = new ArrayList(); - - public MappedInventoryAccess(IInventory inv, InventoryAccessor... accessors) { - this.inv = inv; - Collections.addAll(this.accessors, accessors); - reset(); - } - - public void reset() { - slotMap.clear(); - nextslot: - for (int i = 0; i < inv.getSizeInventory(); i++) { - for (InventoryAccessor a : accessors) { - if (!a.canAccessSlot(i)) { - continue nextslot; - } - } - - slotMap.add(i); - } - } - - @Override - public int getSizeInventory() { - return slotMap.size(); - } - - @Override - public ItemStack getStackInSlot(int slot) { - return inv.getStackInSlot(slotMap.get(slot)); - } - - @Override - public ItemStack decrStackSize(int slot, int amount) { - return inv.decrStackSize(slotMap.get(slot), amount); - } - - @Override - public ItemStack removeStackFromSlot(int slot) { - return inv.removeStackFromSlot(slotMap.get(slot)); - } - - @Override - public void setInventorySlotContents(int slot, ItemStack stack) { - inv.setInventorySlotContents(slotMap.get(slot), stack); - } - - @Override - public int getInventoryStackLimit() { - return inv.getInventoryStackLimit(); - } - - @Override - public void markDirty() { - inv.markDirty(); - } - - @Override - public boolean isUseableByPlayer(EntityPlayer player) { - return inv.isUseableByPlayer(player); - } - - public void addAccessor(InventoryAccessor accessor) { - accessors.add(accessor); - reset(); - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack stack) { - return inv.isItemValidForSlot(slotMap.get(slot), stack); - } - - @Override - public void openInventory(EntityPlayer player) { - inv.openInventory(player); - } - - @Override - public void closeInventory(EntityPlayer player) { - inv.closeInventory(player); - } - - @Override - public int getField(int id) { - return inv.getField(id); - } - - @Override - public void setField(int id, int value) { - inv.setField(id, value); - } - - @Override - public int getFieldCount() { - return inv.getFieldCount(); - } - - @Override - public void clear() { - inv.clear(); - } - - @Override - public String getName() { - return inv.getName(); - } - - @Override - public boolean hasCustomName() { - return inv.hasCustomName(); - } - - @Override - public ITextComponent getDisplayName() { - return inv.getDisplayName(); - } - - public List accessors() { - return accessors; - } -} diff --git a/dependencies/main/java/codechicken/core/inventory/SlotDummy.java b/dependencies/main/java/codechicken/core/inventory/SlotDummy.java deleted file mode 100644 index 6e2f364cd5..0000000000 --- a/dependencies/main/java/codechicken/core/inventory/SlotDummy.java +++ /dev/null @@ -1,69 +0,0 @@ -package codechicken.core.inventory; - -import codechicken.lib.inventory.InventoryUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ClickType; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -public class SlotDummy extends SlotHandleClicks { - public final int stackLimit; - - public SlotDummy(IInventory inv, int slot, int x, int y) { - this(inv, slot, x, y, 64); - } - - public SlotDummy(IInventory inv, int slot, int x, int y, int limit) { - super(inv, slot, x, y); - stackLimit = limit; - } - - @Override - public ItemStack slotClick(ContainerExtended container, EntityPlayer player, int button, ClickType clickType) { - ItemStack held = player.inventory.getItemStack(); - boolean shift = clickType == ClickType.QUICK_MOVE; - slotClick(held, button, shift); - return null; - } - - public void slotClick(ItemStack held, int button, boolean shift) { - ItemStack tstack = getStack(); - if (held != null && (tstack == null || !InventoryUtils.canStack(held, tstack))) { - int quantity = Math.min(held.stackSize, stackLimit); - if (shift) { - quantity = Math.min(stackLimit, held.getMaxStackSize() * 16); - } - if (button == 1) { - quantity = 1; - } - putStack(InventoryUtils.copyStack(held, quantity)); - } else if (tstack != null) { - int inc; - if (held != null) { - inc = button == 1 ? -held.stackSize : held.stackSize; - if (shift) { - inc *= 16; - } - } else { - inc = button == 1 ? -1 : 1; - if (shift) { - inc *= 16; - } - } - int quantity = tstack.stackSize + inc; - if (quantity <= 0) { - putStack(null); - } else { - putStack(InventoryUtils.copyStack(tstack, quantity)); - } - } - } - - @Override - public void putStack(ItemStack stack) { - if (stack != null && stack.stackSize > stackLimit) { - stack = InventoryUtils.copyStack(stack, stackLimit); - } - super.putStack(stack); - } -} diff --git a/dependencies/main/java/codechicken/core/inventory/SlotDummyOutput.java b/dependencies/main/java/codechicken/core/inventory/SlotDummyOutput.java deleted file mode 100644 index 30b5d3756f..0000000000 --- a/dependencies/main/java/codechicken/core/inventory/SlotDummyOutput.java +++ /dev/null @@ -1,17 +0,0 @@ -package codechicken.core.inventory; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ClickType; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -public class SlotDummyOutput extends SlotHandleClicks { - public SlotDummyOutput(IInventory inv, int slot, int x, int y) { - super(inv, slot, x, y); - } - - @Override - public ItemStack slotClick(ContainerExtended container, EntityPlayer player, int button, ClickType clickType) { - return null; - } -} diff --git a/dependencies/main/java/codechicken/core/inventory/SlotHandleClicks.java b/dependencies/main/java/codechicken/core/inventory/SlotHandleClicks.java deleted file mode 100644 index ead7471e14..0000000000 --- a/dependencies/main/java/codechicken/core/inventory/SlotHandleClicks.java +++ /dev/null @@ -1,15 +0,0 @@ -package codechicken.core.inventory; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ClickType; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public abstract class SlotHandleClicks extends Slot { - public SlotHandleClicks(IInventory inv, int slot, int x, int y) { - super(inv, slot, x, y); - } - - public abstract ItemStack slotClick(ContainerExtended container, EntityPlayer player, int button, ClickType clickType); -} diff --git a/dependencies/main/java/codechicken/core/launch/CodeChickenCorePlugin.java b/dependencies/main/java/codechicken/core/launch/CodeChickenCorePlugin.java deleted file mode 100644 index f48bf9ee1e..0000000000 --- a/dependencies/main/java/codechicken/core/launch/CodeChickenCorePlugin.java +++ /dev/null @@ -1,60 +0,0 @@ -package codechicken.core.launch; - -import codechicken.core.CCUpdateChecker; -import codechicken.core.internal.CCCEventHandler; -import codechicken.lib.CodeChickenLib; -import codechicken.lib.config.ConfigFile; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventHandler; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.relauncher.FMLInjectionData; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.io.File; - -@Mod(modid = "CodeChickenCore", name = "CodeChicken Core", dependencies = "required-after:CodeChickenLib@[" + CodeChickenLib.version + ",)", acceptedMinecraftVersions = CodeChickenLib.mcVersion, certificateFingerprint = "f1850c39b2516232a2108a7bd84d1cb5df93b261") -public class CodeChickenCorePlugin { - public static final String version = "${mod_version}"; - - public static File minecraftDir; - public static String currentMcVersion; - public static Logger logger = LogManager.getLogger("CodeChickenCore"); - - public static ConfigFile config; - - public static void loadConfig() { - if (config == null) { - config = new ConfigFile(new File(minecraftDir, "config/CodeChickenCore.cfg")).setComment("CodeChickenCore configuration file."); - } - } - - public CodeChickenCorePlugin() { - if (minecraftDir != null) { - return;//get called twice, once for IFMLCallHook - } - - minecraftDir = (File) FMLInjectionData.data()[6]; - currentMcVersion = (String) FMLInjectionData.data()[4]; - - loadConfig(); - } - - @EventHandler - public void preInit(FMLPreInitializationEvent event) { - FingerprintChecker.runFingerprintChecks(); - } - - @EventHandler - public void init(FMLInitializationEvent event) { - if (event.getSide().isClient()) { - if (config.getTag("checkUpdates").getBooleanValue(true)) { - CCUpdateChecker.updateCheck("CodeChickenCore"); - } - - MinecraftForge.EVENT_BUS.register(new CCCEventHandler()); - } - } -} diff --git a/dependencies/main/java/codechicken/core/launch/DepLoader.java b/dependencies/main/java/codechicken/core/launch/DepLoader.java deleted file mode 100644 index e48106f64e..0000000000 --- a/dependencies/main/java/codechicken/core/launch/DepLoader.java +++ /dev/null @@ -1,853 +0,0 @@ -package codechicken.core.launch; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import net.minecraft.launchwrapper.LaunchClassLoader; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.asm.transformers.ModAccessTransformer; -import net.minecraftforge.fml.common.versioning.ComparableVersion; -import net.minecraftforge.fml.relauncher.*; -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import sun.misc.URLClassPath; -import sun.net.util.URLUtil; - -import javax.swing.*; -import javax.swing.event.HyperlinkEvent; -import javax.swing.event.HyperlinkListener; -import java.awt.*; -import java.awt.Dialog.ModalityType; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.io.*; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.net.URLConnection; -import java.nio.ByteBuffer; -import java.util.*; -import java.util.List; -import java.util.Map.Entry; -import java.util.jar.Attributes; -import java.util.jar.JarFile; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -/** - * For autodownloading stuff. - * This is really unoriginal, mostly ripped off FML, credits to cpw. - */ -@Deprecated -public class DepLoader implements IFMLLoadingPlugin, IFMLCallHook { - private static ByteBuffer downloadBuffer = ByteBuffer.allocateDirect(1 << 23); - private static final String owner = "DepLoader"; - private static DepLoadInst inst; - private static final Logger logger = LogManager.getLogger(owner); - - public interface IYellAtPeople { - void addYellingData(String data); - - void displayYellingData(); - } - - public static class YellGui extends JOptionPane implements IYellAtPeople { - private ArrayList yellingData = new ArrayList(); - - @Override - public void addYellingData(String data) { - yellingData.add(data); - } - - @Override - public void displayYellingData() { - StringBuilder builder = new StringBuilder(); - builder.append(""); - for (String data : yellingData) { - builder.append("
"); - builder.append(data); - } - builder.append(""); - JEditorPane ep = new JEditorPane("text/html", builder.toString()); - ep.setAutoscrolls(true); - ep.setEditable(false); - ep.setOpaque(false); - ep.addHyperlinkListener(new HyperlinkListener() { - @Override - public void hyperlinkUpdate(HyperlinkEvent event) { - try { - if (event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) { - Desktop.getDesktop().browse(event.getURL().toURI()); - } - } catch (Exception ignored) { - } - } - }); - JOptionPane.showMessageDialog(null, ep, "DepLoader is Deprecated!", -1); - } - } - - public static class YellServer implements IYellAtPeople { - private ArrayList yellingData = new ArrayList(); - - @Override - public void addYellingData(String data) { - yellingData.add(data); - } - - @Override - public void displayYellingData() { - for (String string : yellingData) { - FMLLog.severe(string); - } - try { - Thread.sleep(10000); - } catch (InterruptedException ignored) { - } - } - } - - public interface IDownloadDisplay { - void resetProgress(int sizeGuess); - - void setPokeThread(Thread currentThread); - - void updateProgress(int fullLength); - - boolean shouldStopIt(); - - void updateProgressString(String string, Object... data); - - Object makeDialog(); - - void showErrorDialog(String name, String url); - } - - @SuppressWarnings("serial") - public static class Downloader extends JOptionPane implements IDownloadDisplay { - private JDialog container; - private JLabel currentActivity; - private JProgressBar progress; - boolean stopIt; - Thread pokeThread; - - private Box makeProgressPanel() { - Box box = Box.createVerticalBox(); - box.add(Box.createRigidArea(new Dimension(0, 10))); - JLabel welcomeLabel = new JLabel("" + owner + " is setting up your minecraft environment"); - box.add(welcomeLabel); - welcomeLabel.setAlignmentY(LEFT_ALIGNMENT); - welcomeLabel = new JLabel("Please wait, " + owner + " has some tasks to do before you can play"); - welcomeLabel.setAlignmentY(LEFT_ALIGNMENT); - box.add(welcomeLabel); - box.add(Box.createRigidArea(new Dimension(0, 10))); - currentActivity = new JLabel("Currently doing ..."); - box.add(currentActivity); - box.add(Box.createRigidArea(new Dimension(0, 10))); - progress = new JProgressBar(0, 100); - progress.setStringPainted(true); - box.add(progress); - box.add(Box.createRigidArea(new Dimension(0, 30))); - return box; - } - - @Override - public JDialog makeDialog() { - if (container != null) { - return container; - } - - setMessageType(JOptionPane.INFORMATION_MESSAGE); - setMessage(makeProgressPanel()); - setOptions(new Object[] { "Stop" }); - addPropertyChangeListener(new PropertyChangeListener() { - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getSource() == Downloader.this && evt.getPropertyName() == VALUE_PROPERTY) { - requestClose("This will stop minecraft from launching\nAre you sure you want to do this?"); - } - } - }); - container = new JDialog(null, "Hello", ModalityType.MODELESS); - container.setResizable(false); - container.setLocationRelativeTo(null); - container.add(this); - this.updateUI(); - container.pack(); - container.setMinimumSize(container.getPreferredSize()); - container.setVisible(true); - container.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - container.addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - requestClose("Closing this window will stop minecraft from launching\nAre you sure you wish to do this?"); - } - }); - return container; - } - - protected void requestClose(String message) { - int shouldClose = JOptionPane.showConfirmDialog(container, message, "Are you sure you want to stop?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); - if (shouldClose == JOptionPane.YES_OPTION) { - container.dispose(); - } - - stopIt = true; - if (pokeThread != null) { - pokeThread.interrupt(); - } - } - - @Override - public void updateProgressString(String progressUpdate, Object... data) { - //FMLLog.finest(progressUpdate, data); - if (currentActivity != null) { - currentActivity.setText(String.format(progressUpdate, data)); - } - } - - @Override - public void resetProgress(int sizeGuess) { - if (progress != null) { - progress.getModel().setRangeProperties(0, 0, 0, sizeGuess, false); - } - } - - @Override - public void updateProgress(int fullLength) { - if (progress != null) { - progress.getModel().setValue(fullLength); - } - } - - @Override - public void setPokeThread(Thread currentThread) { - this.pokeThread = currentThread; - } - - @Override - public boolean shouldStopIt() { - return stopIt; - } - - @Override - public void showErrorDialog(String name, String url) { - JEditorPane ep = new JEditorPane("text/html", "" + owner + " was unable to download required library " + name + "
Check your internet connection and try restarting or download it manually from" + "
" + url + " and put it in your mods folder" + ""); - - ep.setEditable(false); - ep.setOpaque(false); - ep.addHyperlinkListener(new HyperlinkListener() { - @Override - public void hyperlinkUpdate(HyperlinkEvent event) { - try { - if (event.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) { - Desktop.getDesktop().browse(event.getURL().toURI()); - } - } catch (Exception e) { - } - } - }); - - JOptionPane.showMessageDialog(null, ep, "A download error has occured", JOptionPane.ERROR_MESSAGE); - } - } - - public static class DummyDownloader implements IDownloadDisplay { - @Override - public void resetProgress(int sizeGuess) { - } - - @Override - public void setPokeThread(Thread currentThread) { - } - - @Override - public void updateProgress(int fullLength) { - } - - @Override - public boolean shouldStopIt() { - return false; - } - - @Override - public void updateProgressString(String string, Object... data) { - } - - @Override - public Object makeDialog() { - return null; - } - - @Override - public void showErrorDialog(String name, String url) { - } - } - - public static class VersionedFile { - public final Pattern pattern; - public final String filename; - public final ComparableVersion version; - public final String name; - - public VersionedFile(String filename, Pattern pattern) { - this.pattern = pattern; - this.filename = filename; - Matcher m = pattern.matcher(filename); - if (m.matches()) { - name = m.group(1); - version = new ComparableVersion(m.group(2)); - } else { - name = null; - version = null; - } - } - - public boolean matches() { - return name != null; - } - } - - public static class Dependency { - /** - * Zip file to extract packed dependencies from - */ - public File source; - public String repo; - public String packed; - public VersionedFile file; - public String testClass; - public boolean coreLib; - - public String existing; - - /** - * Flag set to add this dep to the classpath immediately because it is required for a coremod. - */ - - public Dependency(File source, String repo, String packed, VersionedFile file, String testClass, boolean coreLib) { - this.source = source; - this.repo = repo; - this.packed = packed; - this.file = file; - this.coreLib = coreLib; - this.testClass = testClass; - } - - public void set(Dependency dep) { - this.source = dep.source; - this.repo = dep.repo; - this.packed = dep.packed; - this.file = dep.file; - } - } - - public static class DepLoadInst { - private File modsDir; - private File v_modsDir; - private IDownloadDisplay downloadMonitor; - private JDialog popupWindow; - - private Map depMap = new HashMap(); - private HashSet depSet = new HashSet(); - - private File scanning; - private LaunchClassLoader loader = (LaunchClassLoader) DepLoader.class.getClassLoader(); - - public DepLoadInst() { - String mcVer = (String) FMLInjectionData.data()[4]; - File mcDir = (File) FMLInjectionData.data()[6]; - - modsDir = new File(mcDir, "mods"); - v_modsDir = new File(mcDir, "mods/" + mcVer); - if (!v_modsDir.exists()) { - v_modsDir.mkdirs(); - } - } - - private void addClasspath(File file) { - try { - loader.addURL(file.toURI().toURL()); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - private void deleteMod(File mod) { - if (mod.delete()) { - return; - } - - try { - URL url = mod.toURI().toURL(); - Field f_ucp = URLClassLoader.class.getDeclaredField("ucp"); - Field f_loaders = URLClassPath.class.getDeclaredField("loaders"); - Field f_lmap = URLClassPath.class.getDeclaredField("lmap"); - f_ucp.setAccessible(true); - f_loaders.setAccessible(true); - f_lmap.setAccessible(true); - - URLClassPath ucp = (URLClassPath) f_ucp.get(loader); - Closeable loader = ((Map) f_lmap.get(ucp)).remove(URLUtil.urlNoFragString(url)); - if (loader != null) { - loader.close(); - ((List) f_loaders.get(ucp)).remove(loader); - } - } catch (Exception e) { - e.printStackTrace(); - } - - if (!mod.delete()) { - mod.deleteOnExit(); - String msg = owner + " was unable to delete file " + mod.getPath() + " the game will now try to delete it on exit. If this dialog appears again, delete it manually."; - logger.error(msg); - if (!GraphicsEnvironment.isHeadless()) { - JOptionPane.showMessageDialog(null, msg, "An update error has occured", JOptionPane.ERROR_MESSAGE); - } - - System.exit(1); - } - } - - private void install(Dependency dep) { - popupWindow = (JDialog) downloadMonitor.makeDialog(); - - if (!extract(dep)) { - download(dep); - } - - dep.existing = dep.file.filename; - scanDepInfo(new File(v_modsDir, dep.existing)); - } - - private boolean extract(Dependency dep) { - if (dep.packed == null) { - return false; - } - - ZipFile zip = null; - try { - zip = new ZipFile(dep.source); - ZipEntry libEntry = zip.getEntry(dep.packed + dep.file.filename); - if (libEntry == null) { - return false; - } - - downloadMonitor.updateProgressString("Extracting file %s\n", dep.source.getPath() + '!' + libEntry.toString()); - logger.info("Extracting file " + dep.source.getPath() + '!' + libEntry.toString()); - - download(zip.getInputStream(libEntry), (int) libEntry.getSize(), dep); - - downloadMonitor.updateProgressString("Extraction complete"); - logger.info("Extraction complete"); - } catch (Exception e) { - installError(e, dep, "extraction"); - } finally { - try { - if (zip != null) { - zip.close(); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - return true; - } - - private void download(Dependency dep) { - try { - URL libDownload = new URL(dep.repo + dep.file.filename); - downloadMonitor.updateProgressString("Downloading file %s", libDownload.toString()); - logger.info("Downloading file " + libDownload.toString()); - URLConnection connection = libDownload.openConnection(); - connection.setConnectTimeout(5000); - connection.setReadTimeout(5000); - connection.setRequestProperty("User-Agent", "" + owner + " Downloader"); - download(connection.getInputStream(), connection.getContentLength(), dep); - downloadMonitor.updateProgressString("Download complete"); - logger.info("Download complete"); - } catch (Exception e) { - installError(e, dep, "download"); - } - } - - private void installError(Exception e, Dependency dep, String s) { - if (downloadMonitor.shouldStopIt()) { - logger.error("You have stopped the " + s + " before it could complete"); - System.exit(1); - } - downloadMonitor.showErrorDialog(dep.file.filename, dep.repo + '/' + dep.file.filename); - throw new RuntimeException(s + " error", e); - } - - private void download(InputStream is, int sizeGuess, Dependency dep) throws Exception { - File target = new File(v_modsDir, dep.file.filename); - if (sizeGuess > downloadBuffer.capacity()) { - throw new Exception(String.format("The file %s is too large to be downloaded by " + owner + " - the download is invalid", target.getName())); - } - - downloadBuffer.clear(); - - int read, fullLength = 0; - - downloadMonitor.resetProgress(sizeGuess); - try { - downloadMonitor.setPokeThread(Thread.currentThread()); - byte[] buffer = new byte[1024]; - while ((read = is.read(buffer)) >= 0) { - downloadBuffer.put(buffer, 0, read); - fullLength += read; - if (downloadMonitor.shouldStopIt()) { - break; - } - - downloadMonitor.updateProgress(fullLength); - } - is.close(); - downloadMonitor.setPokeThread(null); - downloadBuffer.limit(fullLength); - downloadBuffer.position(0); - } catch (InterruptedIOException e) { - // We were interrupted by the stop button. We're stopping now.. clear interruption flag. - Thread.interrupted(); - throw new Exception("Stop"); - } - - if (!target.exists()) { - target.createNewFile(); - } - - downloadBuffer.position(0); - FileOutputStream fos = new FileOutputStream(target); - fos.getChannel().write(downloadBuffer); - fos.close(); - } - - private String checkExisting(Dependency dep) { - for (File f : modsDir.listFiles()) { - VersionedFile vfile = new VersionedFile(f.getName(), dep.file.pattern); - if (!vfile.matches() || !vfile.name.equals(dep.file.name)) { - continue; - } - - if (f.renameTo(new File(v_modsDir, f.getName()))) { - continue; - } - - deleteMod(f); - } - - for (File f : v_modsDir.listFiles()) { - VersionedFile vfile = new VersionedFile(f.getName(), dep.file.pattern); - if (!vfile.matches() || !vfile.name.equals(dep.file.name)) { - continue; - } - - int cmp = vfile.version.compareTo(dep.file.version); - if (cmp < 0) { - logger.info("Deleted old version " + f.getName()); - deleteMod(f); - return null; - } - if (cmp > 0) { - logger.info("Warning: version of " + dep.file.name + ", " + vfile.version + " is newer than request " + dep.file.version); - return f.getName(); - } - return f.getName();//found dependency - } - return null; - } - - public void load() { - scanDepInfos(); - if (depMap.isEmpty()) { - return; - } - boolean dontYell = Boolean.parseBoolean(System.getProperty("deploader.dontYellAtPeople", "false")); - if (!dontYell) { - yellAtPeople(); - } - forceRemoveCCL(); - - loadDeps(); - activateDeps(); - } - - private void activateDeps() { - for (Dependency dep : depMap.values()) { - File file = new File(v_modsDir, dep.existing); - if (!searchCoreMod(file) && dep.coreLib) { - addClasspath(file); - } - } - } - - /** - * Looks for FMLCorePlugin attributes and adds to CoreModManager - */ - private boolean searchCoreMod(File coreMod) { - JarFile jar = null; - Attributes mfAttributes; - try { - jar = new JarFile(coreMod); - if (jar.getManifest() == null) { - return false; - } - - ModAccessTransformer.addJar(jar); - mfAttributes = jar.getManifest().getMainAttributes(); - } catch (IOException ioe) { - FMLRelaunchLog.log(Level.ERROR, ioe, "Unable to read the jar file %s - ignoring", coreMod.getName()); - return false; - } finally { - try { - if (jar != null) { - jar.close(); - } - } catch (IOException ignored) { - } - } - - String fmlCorePlugin = mfAttributes.getValue("FMLCorePlugin"); - if (fmlCorePlugin == null) { - return false; - } - - addClasspath(coreMod); - - try { - if (!mfAttributes.containsKey(new Attributes.Name("FMLCorePluginContainsFMLMod"))) { - FMLRelaunchLog.finer("Adding %s to the list of known coremods, it will not be examined again", coreMod.getName()); - CoreModManager.getIgnoredMods().add(coreMod.getName()); - } else { - FMLRelaunchLog.finer("Found FMLCorePluginContainsFMLMod marker in %s, it will be examined later for regular @Mod instances", coreMod.getName()); - CoreModManager.getReparseableCoremods().add(coreMod.getName()); - } - Method m_loadCoreMod = CoreModManager.class.getDeclaredMethod("loadCoreMod", LaunchClassLoader.class, String.class, File.class); - m_loadCoreMod.setAccessible(true); - m_loadCoreMod.invoke(null, loader, fmlCorePlugin, coreMod); - } catch (Exception e) { - throw new RuntimeException(e); - } - - return true; - } - - private void loadDeps() { - downloadMonitor = FMLLaunchHandler.side().isClient() ? new Downloader() : new DummyDownloader(); - try { - while (!depSet.isEmpty()) { - Iterator it = depSet.iterator(); - Dependency dep = depMap.get(it.next()); - it.remove(); - load(dep); - } - } finally { - if (popupWindow != null) { - popupWindow.setVisible(false); - popupWindow.dispose(); - } - } - } - - private void load(Dependency dep) { - dep.existing = checkExisting(dep); - if (dep.existing == null && DepLoader.class.getResource("/" + dep.testClass.replace('.', '/') + ".class") == null) { - install(dep); - } - } - - private List modFiles() { - List list = new LinkedList(); - list.addAll(Arrays.asList(modsDir.listFiles())); - list.addAll(Arrays.asList(v_modsDir.listFiles())); - return list; - } - - private void scanDepInfos() { - for (File file : modFiles()) { - if (!file.getName().endsWith(".jar") && !file.getName().endsWith(".zip")) { - continue; - } - - scanDepInfo(file); - } - } - - private void scanDepInfo(File file) { - try { - scanning = file; - ZipFile zip = new ZipFile(file); - ZipEntry e = zip.getEntry("dependencies.info"); - if (e != null) { - loadJSon(zip.getInputStream(e)); - } - - zip.close(); - } catch (Exception e) { - logger.error("Failed to load dependencies.info from " + file.getName() + " as JSON", e); - } - } - - private void loadJSon(InputStream input) throws IOException { - InputStreamReader reader = new InputStreamReader(input); - JsonElement root = new JsonParser().parse(reader); - if (root.isJsonArray()) { - loadJSonArr(root); - } else { - loadJson(root.getAsJsonObject()); - } - reader.close(); - } - - private void loadJSonArr(JsonElement root) throws IOException { - for (JsonElement node : root.getAsJsonArray()) { - loadJson(node.getAsJsonObject()); - } - } - - private void loadJson(JsonObject node) throws IOException { - boolean obfuscated = ((LaunchClassLoader) DepLoader.class.getClassLoader()).getClassBytes("net.minecraft.world.World") == null; - - String repo = node.has("repo") ? node.get("repo").getAsString() : null; - String packed = node.has("packed") ? node.get("packed").getAsString() : null; - String testClass = node.get("class").getAsString(); - - String filename = node.get("file").getAsString(); - if (!obfuscated && node.has("dev")) { - filename = node.get("dev").getAsString(); - } - - boolean coreLib = node.has("coreLib") && node.get("coreLib").getAsBoolean(); - - Pattern pattern = null; - try { - if (node.has("pattern")) { - pattern = Pattern.compile(node.get("pattern").getAsString()); - } - } catch (PatternSyntaxException e) { - logger.error("Invalid filename pattern: " + node.get("pattern"), e); - } - if (pattern == null) { - pattern = Pattern.compile("(\\w+).*?([\\d\\.]+)[-\\w]*\\.[^\\d]+"); - } - - VersionedFile file = new VersionedFile(filename, pattern); - if (!file.matches()) { - throw new RuntimeException("Invalid filename format for dependency: " + filename); - } - - addDep(new Dependency(scanning, repo, packed, file, testClass, coreLib)); - } - - private void addDep(Dependency newDep) { - Dependency oldDep = depMap.get(newDep.file.name); - if (oldDep == null) { - depMap.put(newDep.file.name, newDep); - depSet.add(newDep.file.name); - return; - } - - //combine newer info from newDep into oldDep - oldDep.coreLib |= newDep.coreLib; - int cmp = newDep.file.version.compareTo(oldDep.file.version); - if (cmp == 1) { - oldDep.set(newDep); - } else if (cmp == 0) { - if (oldDep.repo == null) { - oldDep.repo = newDep.repo; - } - if (oldDep.packed == null) { - oldDep.source = newDep.source; - oldDep.packed = newDep.packed; - } - } - } - - public void yellAtPeople() { - IYellAtPeople yellAtPeople = FMLLaunchHandler.side().isClient() ? new YellGui() : new YellServer(); - yellAtPeople.addYellingData("The CodeChicken Dependency Downloader is being phased out and has detected mods using it."); - yellAtPeople.addYellingData("The downloader will function as normal but this message serves as a log of what mods are using it."); - yellAtPeople.addYellingData("If you are a mod dev, Please phase out all use of the dependency downloader."); - yellAtPeople.addYellingData("If you are a normal user, you can follow the instructions at the bottom of the window if you would like."); - yellAtPeople.addYellingData("The following mods are being requested to download..."); - yellAtPeople.addYellingData(""); - for (Entry entry : depMap.entrySet()) { - yellAtPeople.addYellingData("\"" + entry.getValue().source.getName() + "\"" + " Wants: " + entry.getKey() + "-" + entry.getValue().file.version); - } - yellAtPeople.addYellingData(""); - yellAtPeople.addYellingData(""); - yellAtPeople.addYellingData("Don't be alarmed by this window, it is simply so i can log what mods are using the Dependency Downloader."); - yellAtPeople.addYellingData("If you would like to report this please follow instructions listed here."); - yellAtPeople.addYellingData("Click the OK button to continue."); - - yellAtPeople.displayYellingData(); - } - - private void forceRemoveCCL() { - if (depSet.contains("CodeChickenLib")) { - depSet.remove("CodeChickenLib"); - depMap.remove("CodeChickenLib"); - } - try { - File[] files = v_modsDir.listFiles(); - if (files != null) { - for (File file : files) { - if (file.getName().contains("CodeChickenLib") && file.getName().endsWith(".jar")) { - FMLLog.info("Found old CCL [%s] attempting delete..", file.getName()); - deleteMod(file); - } - } - } - } catch (Exception e) { - throw new RuntimeException(e); - } - } - } - - public static void load() { - if (inst == null) { - inst = new DepLoadInst(); - inst.load(); - } - } - - @Override - public String[] getASMTransformerClass() { - return null; - } - - @Override - public String getModContainerClass() { - return null; - } - - @Override - public String getSetupClass() { - return getClass().getName(); - } - - @Override - public void injectData(Map data) { - } - - @Override - public Void call() { - load(); - - return null; - } - - @Override - public String getAccessTransformerClass() { - return null; - } -} diff --git a/dependencies/main/java/codechicken/core/launch/FingerprintChecker.java b/dependencies/main/java/codechicken/core/launch/FingerprintChecker.java deleted file mode 100644 index 9a3a8305a5..0000000000 --- a/dependencies/main/java/codechicken/core/launch/FingerprintChecker.java +++ /dev/null @@ -1,86 +0,0 @@ -package codechicken.core.launch; - -import codechicken.lib.fingerprint.FingerprintViolatedCrashCallable; -import com.google.common.collect.ImmutableList; -import net.minecraftforge.fml.common.*; -import org.apache.logging.log4j.Level; - -import java.security.cert.Certificate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -/** - * Created by covers1624 on 13/12/2016. - * To be packaged in each mod runtime, used to cross verify jar fingerprints. - * Idea behind this: - * A malicious user would have to override the fingerprint data in all mod jars this is packaged with in order to avoid detection. - * This is not to be used as DRM. It is used simply to provide cross verification of jars. - */ -public class FingerprintChecker { - - private static final Map modCertMap = new HashMap(); - private static final List invalidMods = new ArrayList(); - - static { - //@formatter:off - modCertMap.put("CodeChickenLib" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("CodeChickenCore" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("ChickenChunks" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("EnderStorage" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("Translocator" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("NotEnoughItems" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("forgemultipartcbe" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - //@formatter:on - } - - public static void runFingerprintChecks() { - try { - ModContainer activeContainer = Loader.instance().activeModContainer(); - for (Entry modEntry : Loader.instance().getIndexedModList().entrySet()) { - for (Entry certEntry : modCertMap.entrySet()) { - if (modEntry.getKey().equals(certEntry.getKey())) { - Object modInstance = modEntry.getValue().getMod(); - if (modInstance == null) { - FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "Unable to do Fingerprint Verification for mod %s! ModContainer returned a null mod instance!", modEntry.getKey()); - break; - } - if (modInstance.getClass().getName().contains("net.minecraftforge.")) { - FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "Unable to do Fingerprint Verification for mod %s! ModContainer returned is a suspected FML class! [%s]", modEntry.getKey(), modInstance.getClass().getName()); - } - - Certificate[] certificates = modInstance.getClass().getProtectionDomain().getCodeSource().getCertificates(); - ImmutableList.Builder certBuilder = ImmutableList.builder(); - if (certificates != null) { - for (Certificate cert : certificates) { - certBuilder.add(CertificateHelper.getFingerprint(cert)); - } - } - - ImmutableList certList = certBuilder.build(); - - String expectedFingerprint = certEntry.getValue(); - - if (expectedFingerprint != null && !expectedFingerprint.isEmpty()) { - if (!certList.contains(expectedFingerprint)) { - FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "The fingerprint for mod %s is invalid! Expected: %s", modEntry.getKey(), expectedFingerprint); - invalidMods.add(modEntry.getKey()); - break; - } else { - FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.DEBUG, "Valid fingerprint found for mod %s.", modEntry.getKey()); - } - } - - break; - } - } - } - FMLCommonHandler.instance().registerCrashCallable(new FingerprintViolatedCrashCallable(activeContainer.getModId(), invalidMods)); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/dependencies/main/java/codechicken/lib/CodeChickenLib.java b/dependencies/main/java/codechicken/lib/CodeChickenLib.java deleted file mode 100644 index cdf0daa298..0000000000 --- a/dependencies/main/java/codechicken/lib/CodeChickenLib.java +++ /dev/null @@ -1,50 +0,0 @@ -package codechicken.lib; - -import codechicken.lib.fingerprint.FingerprintChecker; -import codechicken.lib.internal.proxy.CommonProxy; -import codechicken.lib.util.FuelUtils; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventHandler; -import net.minecraftforge.fml.common.SidedProxy; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.event.FMLServerStartingEvent; -import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.relauncher.FMLInjectionData; - -import java.io.File; - -/** - * Created by covers1624 on 12/10/2016. - */ -@Mod (modid = CodeChickenLib.MOD_ID, name = CodeChickenLib.MOD_NAME, acceptedMinecraftVersions = CodeChickenLib.mcVersion, certificateFingerprint = "f1850c39b2516232a2108a7bd84d1cb5df93b261") -public class CodeChickenLib { - - public static final String MOD_ID = "CodeChickenLib"; - public static final String MOD_NAME = "CodeChicken Lib"; - public static final String version = "${mod_version}"; - public static final String mcVersion = "[1.10.2]"; - - public static final File minecraftDir = (File) FMLInjectionData.data()[6]; - - @SidedProxy (clientSide = "codechicken.lib.internal.proxy.ClientProxy", serverSide = "codechicken.lib.internal.proxy.CommonProxy") - public static CommonProxy proxy; - - @EventHandler - public void preInit(FMLPreInitializationEvent event) { - FingerprintChecker.runFingerprintChecks(); - GameRegistry.registerFuelHandler(new FuelUtils()); - proxy.preInit(); - } - - @EventHandler - public void init(FMLInitializationEvent event) { - proxy.init(); - } - - @EventHandler - public void onServerStartingEvent(FMLServerStartingEvent event) { - proxy.serverStarting(event); - } - -} diff --git a/dependencies/main/java/codechicken/lib/asm/ASMBlock.java b/dependencies/main/java/codechicken/lib/asm/ASMBlock.java deleted file mode 100644 index 981336a054..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/ASMBlock.java +++ /dev/null @@ -1,191 +0,0 @@ -package codechicken.lib.asm; - -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.ImmutableMap; -import org.objectweb.asm.tree.AbstractInsnNode; -import org.objectweb.asm.tree.InsnList; -import org.objectweb.asm.tree.JumpInsnNode; -import org.objectweb.asm.tree.LabelNode; - -import java.util.*; -import java.util.Map.Entry; - -import static org.objectweb.asm.tree.AbstractInsnNode.*; - -public class ASMBlock { - - public InsnListSection list; - private BiMap labels; - - public ASMBlock(InsnListSection list, BiMap labels) { - this.list = list; - this.labels = labels; - } - - public ASMBlock(InsnListSection list) { - this(list, HashBiMap.create()); - } - - public ASMBlock(InsnList list) { - this(new InsnListSection(list)); - } - - public ASMBlock() { - this(new InsnListSection()); - } - - public LabelNode getOrAdd(String s) { - LabelNode l = get(s); - if (l == null) { - labels.put(s, l = new LabelNode()); - } - return l; - } - - public LabelNode get(String s) { - return labels.get(s); - } - - public void replaceLabels(Map labelMap, Set usedLabels) { - for (AbstractInsnNode insn : list) { - switch (insn.getType()) { - case LABEL: - AbstractInsnNode insn2 = insn.clone(labelMap); - if (insn2 == insn)//identity mapping - { - continue; - } - if (usedLabels.contains(insn2)) { - throw new IllegalStateException("LabelNode cannot be a part of two InsnLists"); - } - list.replace(insn, insn2); - break; - case JUMP_INSN: - case FRAME: - case LOOKUPSWITCH_INSN: - case TABLESWITCH_INSN: - list.replace(insn, insn.clone(labelMap)); - } - } - - for (Entry entry : labelMap.entrySet()) { - String key = labels.inverse().get(entry.getKey()); - if (key != null) { - labels.put(key, entry.getValue()); - } - } - } - - public void replaceLabels(Map labelMap) { - replaceLabels(labelMap, Collections.EMPTY_SET); - } - - public void replaceLabel(String s, LabelNode l) { - LabelNode old = get(s); - if (old != null) { - replaceLabels(ImmutableMap.of(old, l)); - } - } - - /** - * Pulls all common labels from other into this - * - * @return this - */ - public ASMBlock mergeLabels(ASMBlock other) { - if (labels.isEmpty() || other.labels.isEmpty()) { - return this; - } - - //common labels, give them our nodes - HashMap labelMap = list.identityLabelMap(); - for (Entry entry : other.labels.entrySet()) { - LabelNode old = labels.get(entry.getKey()); - if (old != null) { - labelMap.put(old, entry.getValue()); - } - } - HashSet usedLabels = new HashSet(); - for (AbstractInsnNode insn = other.list.list.getFirst(); insn != null; insn = insn.getNext()) { - if (insn.getType() == LABEL) { - usedLabels.add((LabelNode) insn); - } - } - - replaceLabels(labelMap, usedLabels); - return this; - } - - /** - * Like mergeLabels but pulls insns from other list into this so LabelNodes can be transferred - * - * @return this - */ - public ASMBlock pullLabels(ASMBlock other) { - other.list.remove(); - return mergeLabels(other); - } - - public ASMBlock copy() { - BiMap labels = HashBiMap.create(); - Map labelMap = list.cloneLabels(); - - for (Entry entry : this.labels.entrySet()) { - labels.put(entry.getKey(), labelMap.get(entry.getValue())); - } - - return new ASMBlock(list.copy(labelMap), labels); - } - - public ASMBlock applyLabels(InsnListSection list2) { - if (labels.isEmpty()) { - return new ASMBlock(list2); - } - - Set cFlowLabels1 = labels.values(); - Set cFlowLabels2 = InsnComparator.getControlFlowLabels(list2); - ASMBlock block = new ASMBlock(list2); - - HashMap labelMap = new HashMap(); - - for (int i = 0, k = 0; i < list.size() && k < list2.size(); ) { - AbstractInsnNode insn1 = list.get(i); - if (!InsnComparator.insnImportant(insn1, cFlowLabels1)) { - i++; - continue; - } - - AbstractInsnNode insn2 = list2.get(k); - if (!InsnComparator.insnImportant(insn2, cFlowLabels2)) { - k++; - continue; - } - - if (insn1.getOpcode() != insn2.getOpcode()) { - throw new IllegalArgumentException("Lists do not match:\n" + list + "\n\n" + list2); - } - - switch (insn1.getType()) { - case LABEL: - labelMap.put((LabelNode) insn1, (LabelNode) insn2); - break; - case JUMP_INSN: - labelMap.put(((JumpInsnNode) insn1).label, ((JumpInsnNode) insn2).label); - break; - } - i++; - k++; - } - - for (Entry entry : labels.entrySet()) { - block.labels.put(entry.getKey(), labelMap.get(entry.getValue())); - } - - return block; - } - - public InsnList rawListCopy() { - return list.copy().list; - } -} diff --git a/dependencies/main/java/codechicken/lib/asm/ASMHelper.java b/dependencies/main/java/codechicken/lib/asm/ASMHelper.java deleted file mode 100644 index dd0b8f55ea..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/ASMHelper.java +++ /dev/null @@ -1,213 +0,0 @@ -package codechicken.lib.asm; - -import codechicken.lib.config.ConfigFile; -import codechicken.lib.config.DefaultingConfigFile; -import net.minecraft.launchwrapper.Launch; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.tree.*; -import org.objectweb.asm.util.ASMifier; -import org.objectweb.asm.util.Textifier; -import org.objectweb.asm.util.TraceClassVisitor; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class ASMHelper { - - public static ConfigFile config = loadConfig(); - public static Logger logger = LogManager.getLogger("CCL ASM"); - - private static ConfigFile loadConfig() { - try {//weak reference for environments without FML - File mcDir = (File) ((Object[]) Class.forName("net.minecraftforge.fml.relauncher.FMLInjectionData").getMethod("data").invoke(null))[6]; - File file = new File(mcDir, "config/CodeChickenLib.cfg"); - boolean obf = true; - try {//TODO Move the config initializer to a better spot.. - obf = Launch.classLoader.getClassBytes("net.minecraft.world.World") == null; - } catch (Exception ignored) { - } - if (obf) { - return new DefaultingConfigFile(file); - } else { - return new ConfigFile(file).setComment("CodeChickenLib development configuration file."); - } - } catch (Exception ignored) { - return null;//no config for these systems - } - } - - public interface Acceptor { - - void accept(ClassVisitor cv) throws IOException; - } - - public static MethodNode findMethod(ObfMapping methodmap, ClassNode cnode) { - for (MethodNode mnode : cnode.methods) { - if (methodmap.matches(mnode)) { - return mnode; - } - } - return null; - } - - public static FieldNode findField(ObfMapping fieldmap, ClassNode cnode) { - for (FieldNode fnode : cnode.fields) { - if (fieldmap.matches(fnode)) { - return fnode; - } - } - return null; - } - - public static ClassNode createClassNode(byte[] bytes) { - return createClassNode(bytes, 0); - } - - public static ClassNode createClassNode(byte[] bytes, int flags) { - ClassNode cnode = new ClassNode(); - ClassReader reader = new ClassReader(bytes); - reader.accept(cnode, flags); - return cnode; - } - - public static byte[] createBytes(ClassNode cnode, int flags) { - ClassWriter cw = new CC_ClassWriter(flags); - cnode.accept(cw); - return cw.toByteArray(); - } - - public static Map cloneLabels(InsnList list) { - return new InsnListSection(list).cloneLabels(); - } - - public static InsnList cloneInsnList(InsnList list) { - return new InsnListSection(list).copy().list; - } - - public static InsnList cloneInsnList(Map labelMap, InsnList list) { - return new InsnListSection(list).copy(labelMap).list; - } - - public static List cloneTryCatchBlocks(Map labelMap, List tcblocks) { - ArrayList clone = new ArrayList(); - for (TryCatchBlockNode node : tcblocks) { - clone.add(new TryCatchBlockNode(labelMap.get(node.start), labelMap.get(node.end), labelMap.get(node.handler), node.type)); - } - - return clone; - } - - public static List cloneLocals(Map labelMap, List locals) { - ArrayList clone = new ArrayList(locals.size()); - for (LocalVariableNode node : locals) { - clone.add(new LocalVariableNode(node.name, node.desc, node.signature, labelMap.get(node.start), labelMap.get(node.end), node.index)); - } - - return clone; - } - - public static void copy(MethodNode src, MethodNode dst) { - Map labelMap = cloneLabels(src.instructions); - dst.instructions = cloneInsnList(labelMap, src.instructions); - dst.tryCatchBlocks = cloneTryCatchBlocks(labelMap, src.tryCatchBlocks); - if (src.localVariables != null) { - dst.localVariables = cloneLocals(labelMap, src.localVariables); - } - dst.visibleAnnotations = src.visibleAnnotations; - dst.invisibleAnnotations = src.invisibleAnnotations; - dst.visitMaxs(src.maxStack, src.maxLocals); - } - - public static String toString(InsnList list) { - return new InsnListSection(list).toString(); - } - - public static int getLocal(List list, String name) { - int found = -1; - for (LocalVariableNode node : list) { - if (node.name.equals(name)) { - if (found >= 0) { - throw new RuntimeException("Duplicate local variable: " + name + " not coded to handle this scenario."); - } - - found = node.index; - } - } - return found; - } - - public static void replaceMethod(MethodNode original, MethodNode replacement) { - original.instructions.clear(); - if (original.localVariables != null) { - original.localVariables.clear(); - } - if (original.tryCatchBlocks != null) { - original.tryCatchBlocks.clear(); - } - replacement.accept(original); - } - - public static void dump(Acceptor acceptor, File file, boolean filterImportant, boolean sortLocals, boolean textify) { - try { - if (!file.getParentFile().exists()) { - file.getParentFile().mkdirs(); - } - if (!file.exists()) { - file.createNewFile(); - } - - PrintWriter pout = new PrintWriter(file); - ClassVisitor cv = new TraceClassVisitor(null, textify ? new Textifier() : new ASMifier(), pout); - if (filterImportant) { - cv = new ImportantInsnVisitor(cv); - } - if (sortLocals) { - cv = new LocalVariablesSorterVisitor(cv); - } - acceptor.accept(cv); - pout.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public static void dump(Acceptor acceptor, File file, boolean filterImportant, boolean sortLocals) { - dump(acceptor, file, filterImportant, sortLocals, config.getTag("textify").getBooleanValue(true)); - } - - public static void dump(final byte[] bytes, File file, boolean filterImportant, boolean sortLocals) { - dump(new Acceptor() { - @Override - public void accept(ClassVisitor cv) { - new ClassReader(bytes).accept(cv, ClassReader.EXPAND_FRAMES); - } - }, file, filterImportant, sortLocals); - } - - public static void dump(final InputStream is, File file, boolean filterImportant, boolean sortLocals) { - dump(new Acceptor() { - @Override - public void accept(ClassVisitor cv) throws IOException { - new ClassReader(is).accept(cv, ClassReader.EXPAND_FRAMES); - } - }, file, filterImportant, sortLocals); - } - - public static void dump(final ClassNode cnode, File file, boolean filterImportant, boolean sortLocals) { - dump(new Acceptor() { - @Override - public void accept(ClassVisitor cv) { - cnode.accept(cv); - } - }, file, filterImportant, sortLocals); - } -} diff --git a/dependencies/main/java/codechicken/lib/asm/ASMReader.java b/dependencies/main/java/codechicken/lib/asm/ASMReader.java deleted file mode 100644 index 95acb61483..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/ASMReader.java +++ /dev/null @@ -1,311 +0,0 @@ -package codechicken.lib.asm; - -import org.objectweb.asm.tree.AbstractInsnNode; -import org.objectweb.asm.tree.*; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.HashMap; -import java.util.Map; - -import static org.objectweb.asm.Opcodes.*; -import static org.objectweb.asm.tree.AbstractInsnNode.*; - -public class ASMReader { - - public static Map opCodes = new HashMap(); - public static byte[] TYPE; - - static { - opCodes.put("NOP", NOP); - opCodes.put("ACONST_NULL", ACONST_NULL); - opCodes.put("ICONST_M1", ICONST_M1); - opCodes.put("ICONST_0", ICONST_0); - opCodes.put("ICONST_1", ICONST_1); - opCodes.put("ICONST_2", ICONST_2); - opCodes.put("ICONST_3", ICONST_3); - opCodes.put("ICONST_4", ICONST_4); - opCodes.put("ICONST_5", ICONST_5); - opCodes.put("LCONST_0", LCONST_0); - opCodes.put("LCONST_1", LCONST_1); - opCodes.put("FCONST_0", FCONST_0); - opCodes.put("FCONST_1", FCONST_1); - opCodes.put("FCONST_2", FCONST_2); - opCodes.put("DCONST_0", DCONST_0); - opCodes.put("DCONST_1", DCONST_1); - opCodes.put("BIPUSH", BIPUSH); - opCodes.put("SIPUSH", SIPUSH); - opCodes.put("LDC", LDC); - opCodes.put("ILOAD", ILOAD); - opCodes.put("LLOAD", LLOAD); - opCodes.put("FLOAD", FLOAD); - opCodes.put("DLOAD", DLOAD); - opCodes.put("ALOAD", ALOAD); - opCodes.put("IALOAD", IALOAD); - opCodes.put("LALOAD", LALOAD); - opCodes.put("FALOAD", FALOAD); - opCodes.put("DALOAD", DALOAD); - opCodes.put("AALOAD", AALOAD); - opCodes.put("BALOAD", BALOAD); - opCodes.put("CALOAD", CALOAD); - opCodes.put("SALOAD", SALOAD); - opCodes.put("ISTORE", ISTORE); - opCodes.put("LSTORE", LSTORE); - opCodes.put("FSTORE", FSTORE); - opCodes.put("DSTORE", DSTORE); - opCodes.put("ASTORE", ASTORE); - opCodes.put("IASTORE", IASTORE); - opCodes.put("LASTORE", LASTORE); - opCodes.put("FASTORE", FASTORE); - opCodes.put("DASTORE", DASTORE); - opCodes.put("AASTORE", AASTORE); - opCodes.put("BASTORE", BASTORE); - opCodes.put("CASTORE", CASTORE); - opCodes.put("SASTORE", SASTORE); - opCodes.put("POP", POP); - opCodes.put("POP2", POP2); - opCodes.put("DUP", DUP); - opCodes.put("DUP_X1", DUP_X1); - opCodes.put("DUP_X2", DUP_X2); - opCodes.put("DUP2", DUP2); - opCodes.put("DUP2_X1", DUP2_X1); - opCodes.put("DUP2_X2", DUP2_X2); - opCodes.put("SWAP", SWAP); - opCodes.put("IADD", IADD); - opCodes.put("LADD", LADD); - opCodes.put("FADD", FADD); - opCodes.put("DADD", DADD); - opCodes.put("ISUB", ISUB); - opCodes.put("LSUB", LSUB); - opCodes.put("FSUB", FSUB); - opCodes.put("DSUB", DSUB); - opCodes.put("IMUL", IMUL); - opCodes.put("LMUL", LMUL); - opCodes.put("FMUL", FMUL); - opCodes.put("DMUL", DMUL); - opCodes.put("IDIV", IDIV); - opCodes.put("LDIV", LDIV); - opCodes.put("FDIV", FDIV); - opCodes.put("DDIV", DDIV); - opCodes.put("IREM", IREM); - opCodes.put("LREM", LREM); - opCodes.put("FREM", FREM); - opCodes.put("DREM", DREM); - opCodes.put("INEG", INEG); - opCodes.put("LNEG", LNEG); - opCodes.put("FNEG", FNEG); - opCodes.put("DNEG", DNEG); - opCodes.put("ISHL", ISHL); - opCodes.put("LSHL", LSHL); - opCodes.put("ISHR", ISHR); - opCodes.put("LSHR", LSHR); - opCodes.put("IUSHR", IUSHR); - opCodes.put("LUSHR", LUSHR); - opCodes.put("IAND", IAND); - opCodes.put("LAND", LAND); - opCodes.put("IOR", IOR); - opCodes.put("LOR", LOR); - opCodes.put("IXOR", IXOR); - opCodes.put("LXOR", LXOR); - opCodes.put("IINC", IINC); - opCodes.put("I2L", I2L); - opCodes.put("I2F", I2F); - opCodes.put("I2D", I2D); - opCodes.put("L2I", L2I); - opCodes.put("L2F", L2F); - opCodes.put("L2D", L2D); - opCodes.put("F2I", F2I); - opCodes.put("F2L", F2L); - opCodes.put("F2D", F2D); - opCodes.put("D2I", D2I); - opCodes.put("D2L", D2L); - opCodes.put("D2F", D2F); - opCodes.put("I2B", I2B); - opCodes.put("I2C", I2C); - opCodes.put("I2S", I2S); - opCodes.put("LCMP", LCMP); - opCodes.put("FCMPL", FCMPL); - opCodes.put("FCMPG", FCMPG); - opCodes.put("DCMPL", DCMPL); - opCodes.put("DCMPG", DCMPG); - opCodes.put("IFEQ", IFEQ); - opCodes.put("IFNE", IFNE); - opCodes.put("IFLT", IFLT); - opCodes.put("IFGE", IFGE); - opCodes.put("IFGT", IFGT); - opCodes.put("IFLE", IFLE); - opCodes.put("IF_ICMPEQ", IF_ICMPEQ); - opCodes.put("IF_ICMPNE", IF_ICMPNE); - opCodes.put("IF_ICMPLT", IF_ICMPLT); - opCodes.put("IF_ICMPGE", IF_ICMPGE); - opCodes.put("IF_ICMPGT", IF_ICMPGT); - opCodes.put("IF_ICMPLE", IF_ICMPLE); - opCodes.put("IF_ACMPEQ", IF_ACMPEQ); - opCodes.put("IF_ACMPNE", IF_ACMPNE); - opCodes.put("GOTO", GOTO); - opCodes.put("JSR", JSR); - opCodes.put("RET", RET); - opCodes.put("TABLESWITCH", TABLESWITCH); - opCodes.put("LOOKUPSWITCH", LOOKUPSWITCH); - opCodes.put("IRETURN", IRETURN); - opCodes.put("LRETURN", LRETURN); - opCodes.put("FRETURN", FRETURN); - opCodes.put("DRETURN", DRETURN); - opCodes.put("ARETURN", ARETURN); - opCodes.put("RETURN", RETURN); - opCodes.put("GETSTATIC", GETSTATIC); - opCodes.put("PUTSTATIC", PUTSTATIC); - opCodes.put("GETFIELD", GETFIELD); - opCodes.put("PUTFIELD", PUTFIELD); - opCodes.put("INVOKEVIRTUAL", INVOKEVIRTUAL); - opCodes.put("INVOKESPECIAL", INVOKESPECIAL); - opCodes.put("INVOKESTATIC", INVOKESTATIC); - opCodes.put("INVOKEINTERFACE", INVOKEINTERFACE); - opCodes.put("INVOKEDYNAMIC", INVOKEDYNAMIC); - opCodes.put("NEW", NEW); - opCodes.put("NEWARRAY", NEWARRAY); - opCodes.put("ANEWARRAY", ANEWARRAY); - opCodes.put("ARRAYLENGTH", ARRAYLENGTH); - opCodes.put("ATHROW", ATHROW); - opCodes.put("CHECKCAST", CHECKCAST); - opCodes.put("INSTANCEOF", INSTANCEOF); - opCodes.put("MONITORENTER", MONITORENTER); - opCodes.put("MONITOREXIT", MONITOREXIT); - opCodes.put("MULTIANEWARRAY", MULTIANEWARRAY); - opCodes.put("IFNULL", IFNULL); - opCodes.put("IFNONNULL", IFNONNULL); - - //derived from classWriter, mapped to AbstractInsnNode - TYPE = new byte[200]; - String s = "AAAAAAAAAAAAAAAABBJ__CCCCC____________________AAAAAAAACC" + "CCC____________________AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHCLMAA" + "AAAAEEEEFFFFGDBDAADDAA_NHH"; - for (int i = 0; i < s.length(); i++) { - TYPE[i] = (byte) (s.charAt(i) - 'A'); - } - } - - public static Map loadResource(String res) { - return loadResource(ASMHelper.class.getResourceAsStream(res), res); - } - - public static Map loadResource(InputStream in, String res) { - HashMap blocks = new HashMap(); - String current = "unnamed"; - ASMBlock block = new ASMBlock(); - try { - BufferedReader r = new BufferedReader(new InputStreamReader(in)); - String line; - while ((line = r.readLine()) != null) { - { - int hpos = line.indexOf('#'); - if (hpos >= 0) { - line = line.substring(0, hpos); - } - } - line = line.trim(); - if (line.length() == 0) { - continue; - } - if (line.startsWith("list ")) { - if (block.list.size() > 0) { - blocks.put(current, block); - } - current = line.substring(5); - block = new ASMBlock(); - continue; - } - - try { - AbstractInsnNode insn = null; - String[] split = line.replace(" : ", ":").split(" "); - Integer i_opcode = opCodes.get(split[0]); - if (i_opcode == null) { - if (split[0].equals("LINENUMBER")) { - insn = new LineNumberNode(Integer.parseInt(split[1]), block.getOrAdd(split[2])); - } else if (split[0].startsWith("L")) { - insn = block.getOrAdd(split[0]); - } else { - throw new Exception("Unknown opcode " + split[0]); - } - } else { - int opcode = i_opcode; - switch (TYPE[opcode]) { - case INSN: - insn = new InsnNode(opcode); - break; - case INT_INSN: - insn = new IntInsnNode(opcode, Integer.parseInt(split[1])); - break; - case VAR_INSN: - insn = new VarInsnNode(opcode, Integer.parseInt(split[1])); - break; - case TYPE_INSN: - insn = new ObfMapping(split[1]).toClassloading().toInsn(opcode); - break; - case FIELD_INSN: - case METHOD_INSN: - StringBuilder sb = new StringBuilder(); - for (int i = 1; i < split.length; i++) { - sb.append(split[i]); - } - insn = ObfMapping.fromDesc(sb.toString()).toClassloading().toInsn(opcode); - break; - case INVOKE_DYNAMIC_INSN: - throw new Exception("Found INVOKEDYNAMIC while reading"); - case JUMP_INSN: - insn = new JumpInsnNode(opcode, block.getOrAdd(split[1])); - break; - case LDC_INSN: - String cst = split[1]; - if (cst.equals("*")) { - insn = new LdcInsnNode(null); - } else if (cst.endsWith("\"")) { - insn = new LdcInsnNode(cst.substring(1, cst.length() - 1)); - } else if (cst.endsWith("L")) { - insn = new LdcInsnNode(Long.valueOf(cst.substring(0, cst.length() - 1))); - } else if (cst.endsWith("F")) { - insn = new LdcInsnNode(Float.valueOf(cst.substring(0, cst.length() - 1))); - } else if (cst.endsWith("D")) { - insn = new LdcInsnNode(Double.valueOf(cst.substring(0, cst.length() - 1))); - } else if (cst.contains(".")) { - insn = new LdcInsnNode(Double.valueOf(cst)); - } else { - insn = new LdcInsnNode(Integer.valueOf(cst)); - } - break; - case IINC_INSN: - insn = new IincInsnNode(opcode, Integer.parseInt(split[1])); - break; - case LABEL: - throw new Exception("Use L# for labels"); - case TABLESWITCH_INSN: - case LOOKUPSWITCH_INSN: - throw new Exception("I don't know how to deal with this insn type"); - case MULTIANEWARRAY_INSN: - insn = new MultiANewArrayInsnNode(split[1], Integer.parseInt(split[2])); - break; - case FRAME: - throw new Exception("Use ClassWriter.COMPUTE_FRAMES"); - } - } - - if (insn != null) { - block.list.add(insn); - } - } catch (Exception e) { - System.err.println("Error while reading ASM Block " + current + " from " + res + ", line: " + line); - e.printStackTrace(); - } - } - - r.close(); - if (block.list.size() > 0) { - blocks.put(current, block); - } - } catch (IOException e) { - throw new RuntimeException("Failed to read ASM resource: " + res, e); - } - return blocks; - } -} diff --git a/dependencies/main/java/codechicken/lib/asm/CCLCorePlugin.java b/dependencies/main/java/codechicken/lib/asm/CCLCorePlugin.java deleted file mode 100644 index 8da96d44be..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/CCLCorePlugin.java +++ /dev/null @@ -1,103 +0,0 @@ -package codechicken.lib.asm; - -import net.minecraft.launchwrapper.Launch; -import net.minecraftforge.fml.relauncher.FMLInjectionData; -import net.minecraftforge.fml.relauncher.IFMLCallHook; -import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; -import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.io.File; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.jar.Attributes; -import java.util.jar.JarFile; -import java.util.jar.Manifest; - -@TransformerExclusions ({ "codechicken.lib.asm", "codechicken.lib.config", "codechicken.lib.fingerprint" }) -public class CCLCorePlugin implements IFMLLoadingPlugin, IFMLCallHook { - - public static Logger logger = LogManager.getLogger("CodeChicken Lib"); - - @Override - public String[] getASMTransformerClass() { - return new String[] { "codechicken.lib.asm.ClassHeirachyManager", "codechicken.lib.asm.CCL_ASMTransformer" }; - } - - @Override - public String getModContainerClass() { - return null; - } - - @Override - public String getSetupClass() { - return getClass().getName(); - } - - @Override - public void injectData(Map data) { - - } - - @Override - public String getAccessTransformerClass() { - return null; - } - - @Override - public Void call() throws Exception { - scanMods(); - new ASMHelper(); - return null; - } - - private void scanMods() { - File modsDir = new File((File) FMLInjectionData.data()[6], "mods"); - for (File file : modsDir.listFiles()) { - scanMod(file); - } - File versionModsDir = new File(modsDir, (String) FMLInjectionData.data()[4]); - if (versionModsDir.exists()) { - File[] files = versionModsDir.listFiles(); - if (files != null) { - for (File file : files) { - scanMod(file); - } - } - } - } - - private void scanMod(File file) { - if (!file.getName().endsWith(".jar") && !file.getName().endsWith(".zip")) { - return; - } - - try { - JarFile jar = new JarFile(file); - try { - Manifest manifest = jar.getManifest(); - if (manifest == null) { - return; - } - Attributes attr = manifest.getMainAttributes(); - if (attr == null) { - return; - } - - String transformer = attr.getValue("CCTransformerExclusions"); - if (transformer != null) { - List exclusions = Arrays.asList(transformer.split(",")); - for (String ex : exclusions) { - Launch.classLoader.addTransformerExclusion(ex); - } - } - } finally { - jar.close(); - } - } catch (Exception e) { - logger.error("CodeChickenLib: Failed to read jar file: " + file.getName(), e); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/asm/CCL_ASMTransformer.java b/dependencies/main/java/codechicken/lib/asm/CCL_ASMTransformer.java deleted file mode 100644 index a1c5c03f41..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/CCL_ASMTransformer.java +++ /dev/null @@ -1,31 +0,0 @@ -package codechicken.lib.asm; - -import codechicken.lib.asm.ModularASMTransformer.MethodInjector; -import net.minecraft.launchwrapper.IClassTransformer; - -import java.util.Map; - -/** - * Created by covers1624 on 15/02/2017. - * - * Internal CCL class for ASM. - */ -public class CCL_ASMTransformer implements IClassTransformer { - - private ModularASMTransformer transformer = new ModularASMTransformer(); - - public CCL_ASMTransformer() { - Map blocks = ASMReader.loadResource("/assets/ccl/asm/hooks.asm"); - - ObfMapping mapping = new ObfMapping("net/minecraft/client/renderer/block/model/ModelBlockDefinition", "func_178331_a", "(Ljava/io/Reader;)Lnet/minecraft/client/renderer/block/model/ModelBlockDefinition;"); - transformer.add(new MethodInjector(mapping, blocks.get("i_BlockStateLoader"), true)); - - mapping = new ObfMapping("net/minecraft/client/renderer/ItemRenderer", "func_187461_a", "(Lnet/minecraft/item/ItemStack;)V"); - transformer.add(new MethodInjector(mapping, blocks.get("i_renderMapFirstPerson"), true)); - } - - @Override - public byte[] transform(String name, String transformedName, byte[] basicClass) { - return transformer.transform(name, basicClass); - } -} diff --git a/dependencies/main/java/codechicken/lib/asm/CC_ClassWriter.java b/dependencies/main/java/codechicken/lib/asm/CC_ClassWriter.java deleted file mode 100644 index f0da66770a..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/CC_ClassWriter.java +++ /dev/null @@ -1,33 +0,0 @@ -package codechicken.lib.asm; - -import org.objectweb.asm.ClassWriter; - -public class CC_ClassWriter extends ClassWriter { - - private final boolean runtime; - - public CC_ClassWriter(int flags) { - this(flags, false); - } - - public CC_ClassWriter(int flags, boolean runtime) { - super(flags); - this.runtime = runtime; - } - - @Override - protected String getCommonSuperClass(String type1, String type2) { - String c = type1.replace('/', '.'); - String d = type2.replace('/', '.'); - if (ClassHeirachyManager.classExtends(d, c)) { - return type1; - } - if (ClassHeirachyManager.classExtends(c, d)) { - return type2; - } - do - c = ClassHeirachyManager.getSuperClass(c, runtime); while (!ClassHeirachyManager.classExtends(d, c)); - - return c.replace('.', '/'); - } -} diff --git a/dependencies/main/java/codechicken/lib/asm/ClassHeirachyManager.java b/dependencies/main/java/codechicken/lib/asm/ClassHeirachyManager.java deleted file mode 100644 index ee16cbc3da..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/ClassHeirachyManager.java +++ /dev/null @@ -1,181 +0,0 @@ -package codechicken.lib.asm; - -import net.minecraft.launchwrapper.IClassTransformer; -import net.minecraft.launchwrapper.Launch; -import net.minecraft.launchwrapper.LaunchClassLoader; -import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; -import org.objectweb.asm.tree.ClassNode; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; - -/** - * This is added as a class transformer if CodeChickenCore is installed. Adding it as a class transformer will speed evaluation up slightly by automatically caching superclasses when they are first loaded. - */ -public class ClassHeirachyManager implements IClassTransformer { - - public static class SuperCache { - - String superclass; - public HashSet parents = new HashSet(); - private boolean flattened; - - public void add(String parent) { - parents.add(parent); - } - - public void flatten() { - if (flattened) { - return; - } - - for (String s : new ArrayList(parents)) { - SuperCache c = declareClass(s); - if (c != null) { - c.flatten(); - parents.addAll(c.parents); - } - } - flattened = true; - } - } - - public static HashMap superclasses = new HashMap(); - private static LaunchClassLoader cl = Launch.classLoader; - - public static String toKey(String name) { - if (ObfMapping.obfuscated) { - name = FMLDeobfuscatingRemapper.INSTANCE.map(name.replace('.', '/')).replace('/', '.'); - } - return name; - } - - public static String unKey(String name) { - if (ObfMapping.obfuscated) { - name = FMLDeobfuscatingRemapper.INSTANCE.unmap(name.replace('.', '/')).replace('/', '.'); - } - return name; - } - - /** - * @param name The class in question - * @param superclass The class being extended - * @return true if clazz extends, either directly or indirectly, superclass. - */ - public static boolean classExtends(String name, String superclass) { - name = toKey(name); - superclass = toKey(superclass); - - if (name.equals(superclass)) { - return true; - } - - SuperCache cache = declareClass(name); - if (cache == null)//just can't handle this - { - return false; - } - - cache.flatten(); - return cache.parents.contains(superclass); - } - - private static SuperCache declareClass(String name) { - name = toKey(name); - SuperCache cache = superclasses.get(name); - - if (cache != null) { - return cache; - } - - try { - byte[] bytes = cl.getClassBytes(unKey(name)); - if (bytes != null) { - cache = declareASM(bytes); - } - } catch (Exception e) { - } - - if (cache != null) { - return cache; - } - - try { - cache = declareReflection(name); - } catch (ClassNotFoundException e) { - } - - return cache; - } - - private static SuperCache declareReflection(String name) throws ClassNotFoundException { - Class aclass = Class.forName(name); - - SuperCache cache = getOrCreateCache(name); - if (aclass.isInterface()) { - cache.superclass = "java.lang.Object"; - } else if (name.equals("java.lang.Object")) { - return cache; - } else { - cache.superclass = toKey(aclass.getSuperclass().getName()); - } - - cache.add(cache.superclass); - for (Class iclass : aclass.getInterfaces()) { - cache.add(toKey(iclass.getName())); - } - - return cache; - } - - private static SuperCache declareASM(byte[] bytes) { - ClassNode node = ASMHelper.createClassNode(bytes); - String name = toKey(node.name); - - SuperCache cache = getOrCreateCache(name); - cache.superclass = toKey(node.superName.replace('/', '.')); - cache.add(cache.superclass); - for (String iclass : node.interfaces) { - cache.add(toKey(iclass.replace('/', '.'))); - } - - return cache; - } - - @Override - public byte[] transform(String name, String tname, byte[] bytes) { - if (bytes == null) { - return null; - } - - if (!superclasses.containsKey(tname)) { - declareASM(bytes); - } - - return bytes; - } - - public static SuperCache getOrCreateCache(String name) { - SuperCache cache = superclasses.get(name); - if (cache == null) { - superclasses.put(name, cache = new SuperCache()); - } - return cache; - } - - public static String getSuperClass(String name, boolean runtime) { - name = toKey(name); - SuperCache cache = declareClass(name); - if (cache == null) { - return "java.lang.Object"; - } - - cache.flatten(); - String s = cache.superclass; - if (!runtime) { - s = FMLDeobfuscatingRemapper.INSTANCE.unmap(s); - } - return s; - } -} diff --git a/dependencies/main/java/codechicken/lib/asm/ImportantInsnVisitor.java b/dependencies/main/java/codechicken/lib/asm/ImportantInsnVisitor.java deleted file mode 100644 index c6b32eda54..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/ImportantInsnVisitor.java +++ /dev/null @@ -1,36 +0,0 @@ -package codechicken.lib.asm; - -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.tree.MethodNode; - -public class ImportantInsnVisitor extends ClassVisitor { - - public class ImportantInsnMethodVisitor extends MethodVisitor { - - MethodVisitor delegate; - - public ImportantInsnMethodVisitor(int access, String name, String desc, String signature, String[] exceptions) { - super(Opcodes.ASM4, new MethodNode(access, name, desc, signature, exceptions)); - delegate = cv.visitMethod(access, name, desc, signature, exceptions); - } - - @Override - public void visitEnd() { - super.visitEnd(); - MethodNode mnode = (MethodNode) mv; - mnode.instructions = InsnComparator.getImportantList(mnode.instructions); - mnode.accept(delegate); - } - } - - public ImportantInsnVisitor(ClassVisitor cv) { - super(Opcodes.ASM4, cv); - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - return new ImportantInsnMethodVisitor(access, name, desc, signature, exceptions); - } -} diff --git a/dependencies/main/java/codechicken/lib/asm/InsnComparator.java b/dependencies/main/java/codechicken/lib/asm/InsnComparator.java deleted file mode 100644 index 1c735e5003..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/InsnComparator.java +++ /dev/null @@ -1,200 +0,0 @@ -package codechicken.lib.asm; - -import com.google.common.base.Function; -import com.google.common.collect.Maps; -import org.objectweb.asm.tree.AbstractInsnNode; -import org.objectweb.asm.tree.*; - -import java.util.*; - -import static org.objectweb.asm.tree.AbstractInsnNode.*; - -public class InsnComparator { - - public static boolean varInsnEqual(VarInsnNode insn1, VarInsnNode insn2) { - return insn1.var == -1 || insn2.var == -1 || insn1.var == insn2.var; - } - - public static boolean methodInsnEqual(MethodInsnNode insn1, MethodInsnNode insn2) { - return insn1.owner.equals(insn2.owner) && insn1.name.equals(insn2.name) && insn1.desc.equals(insn2.desc); - } - - public static boolean fieldInsnEqual(FieldInsnNode insn1, FieldInsnNode insn2) { - return insn1.owner.equals(insn2.owner) && insn1.name.equals(insn2.name) && insn1.desc.equals(insn2.desc); - } - - public static boolean ldcInsnEqual(LdcInsnNode insn1, LdcInsnNode insn2) { - return insn1.cst == null || insn2.cst == null || insn1.cst.equals(insn2.cst); - } - - public static boolean typeInsnEqual(TypeInsnNode insn1, TypeInsnNode insn2) { - return insn1.desc.equals("*") || insn2.desc.equals("*") || insn1.desc.equals(insn2.desc); - } - - public static boolean iincInsnEqual(IincInsnNode node1, IincInsnNode node2) { - return node1.var == node2.var && node1.incr == node2.incr; - } - - public static boolean intInsnEqual(IntInsnNode node1, IntInsnNode node2) { - return node1.operand == -1 || node2.operand == -1 || node1.operand == node2.operand; - } - - public static boolean insnEqual(AbstractInsnNode node1, AbstractInsnNode node2) { - if (node1.getOpcode() != node2.getOpcode()) { - return false; - } - - switch (node2.getType()) { - case VAR_INSN: - return varInsnEqual((VarInsnNode) node1, (VarInsnNode) node2); - case TYPE_INSN: - return typeInsnEqual((TypeInsnNode) node1, (TypeInsnNode) node2); - case FIELD_INSN: - return fieldInsnEqual((FieldInsnNode) node1, (FieldInsnNode) node2); - case METHOD_INSN: - return methodInsnEqual((MethodInsnNode) node1, (MethodInsnNode) node2); - case LDC_INSN: - return ldcInsnEqual((LdcInsnNode) node1, (LdcInsnNode) node2); - case IINC_INSN: - return iincInsnEqual((IincInsnNode) node1, (IincInsnNode) node2); - case INT_INSN: - return intInsnEqual((IntInsnNode) node1, (IntInsnNode) node2); - default: - return true; - } - } - - public static boolean insnImportant(AbstractInsnNode insn, Set controlFlowLabels) { - switch (insn.getType()) { - case LINE: - case FRAME: - return false; - case LABEL: - return controlFlowLabels.contains(insn); - default: - return true; - } - } - - public static Set getControlFlowLabels(InsnListSection list) { - return getControlFlowLabels(list.list); - } - - public static Set getControlFlowLabels(InsnList list) { - HashSet controlFlowLabels = new HashSet(); - for (AbstractInsnNode insn = list.getFirst(); insn != null; insn = insn.getNext()) { - switch (insn.getType()) { - case JUMP_INSN: - JumpInsnNode jinsn = (JumpInsnNode) insn; - controlFlowLabels.add(jinsn.label); - break; - case TABLESWITCH_INSN: - TableSwitchInsnNode tsinsn = (TableSwitchInsnNode) insn; - controlFlowLabels.add(tsinsn.dflt); - for (LabelNode label : tsinsn.labels) { - controlFlowLabels.add(label); - } - break; - case LOOKUPSWITCH_INSN: - LookupSwitchInsnNode lsinsn = (LookupSwitchInsnNode) insn; - controlFlowLabels.add(lsinsn.dflt); - for (LabelNode label : lsinsn.labels) { - controlFlowLabels.add(label); - } - break; - } - } - return controlFlowLabels; - } - - public static InsnList getImportantList(InsnList list) { - return getImportantList(new InsnListSection(list)).list; - } - - public static InsnListSection getImportantList(InsnListSection list) { - if (list.size() == 0) { - return list; - } - - Set controlFlowLabels = getControlFlowLabels(list); - Map labelMap = Maps.asMap(controlFlowLabels, new Function() { - @Override - public LabelNode apply(LabelNode input) { - return input; - } - }); - - InsnListSection importantNodeList = new InsnListSection(); - for (AbstractInsnNode insn : list) { - if (insnImportant(insn, controlFlowLabels)) { - importantNodeList.add(insn.clone(labelMap)); - } - } - - return importantNodeList; - } - - public static List find(InsnListSection haystack, InsnListSection needle) { - Set controlFlowLabels = getControlFlowLabels(haystack); - LinkedList list = new LinkedList(); - for (int start = 0; start <= haystack.size() - needle.size(); start++) { - InsnListSection section = matches(haystack.drop(start), needle, controlFlowLabels); - if (section != null) { - list.add(section); - start = section.end - 1; - } - } - - return list; - } - - public static List find(InsnList haystack, InsnListSection needle) { - return find(new InsnListSection(haystack), needle); - } - - public static InsnListSection matches(InsnListSection haystack, InsnListSection needle, Set controlFlowLabels) { - int h = 0, n = 0; - for (; h < haystack.size() && n < needle.size(); h++) { - AbstractInsnNode insn = haystack.get(h); - if (!insnImportant(insn, controlFlowLabels)) { - continue; - } - - if (!insnEqual(haystack.get(h), needle.get(n))) { - return null; - } - n++; - } - if (n != needle.size()) { - return null; - } - - return haystack.take(h); - } - - public static InsnListSection findOnce(InsnListSection haystack, InsnListSection needle) { - List list = find(haystack, needle); - if (list.size() != 1) { - throw new RuntimeException("Needle found " + list.size() + " times in Haystack:\n" + haystack + "\n\n" + needle); - } - - return list.get(0); - } - - public static InsnListSection findOnce(InsnList haystack, InsnListSection needle) { - return findOnce(new InsnListSection(haystack), needle); - } - - public static List findN(InsnListSection haystack, InsnListSection needle) { - List list = find(haystack, needle); - if (list.isEmpty()) { - throw new RuntimeException("Needle not found in Haystack:\n" + haystack + "\n\n" + needle); - } - - return list; - } - - public static List findN(InsnList haystack, InsnListSection needle) { - return findN(new InsnListSection(haystack), needle); - } -} diff --git a/dependencies/main/java/codechicken/lib/asm/InsnListSection.java b/dependencies/main/java/codechicken/lib/asm/InsnListSection.java deleted file mode 100644 index dd47505336..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/InsnListSection.java +++ /dev/null @@ -1,260 +0,0 @@ -package codechicken.lib.asm; - -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.tree.AbstractInsnNode; -import org.objectweb.asm.tree.*; -import org.objectweb.asm.util.Textifier; -import org.objectweb.asm.util.TraceMethodVisitor; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import static org.objectweb.asm.tree.AbstractInsnNode.*; - -/** - * A section of an InsnList, may become invalid if the insn list is modified - */ -public class InsnListSection implements Iterable { - - private class InsnListSectionIterator implements Iterator { - - int i = 0; - - @Override - public boolean hasNext() { - return i < size(); - } - - @Override - public AbstractInsnNode next() { - return get(i++); - } - - @Override - public void remove() { - InsnListSection.this.remove(--i); - } - } - - public InsnList list; - public int start; - public int end; - - public InsnListSection(InsnList list, int start, int end) { - this.list = list; - this.start = start; - this.end = end; - } - - public InsnListSection(InsnList list, AbstractInsnNode first, AbstractInsnNode last) { - this(list, list.indexOf(first), list.indexOf(last) + 1); - } - - public InsnListSection(InsnList list) { - this(list, 0, list.size()); - } - - public InsnListSection() { - this(new InsnList()); - } - - public void accept(MethodVisitor mv) { - for (AbstractInsnNode insn : this) { - insn.accept(mv); - } - } - - public AbstractInsnNode getFirst() { - return size() == 0 ? null : list.get(start); - } - - public AbstractInsnNode getLast() { - return size() == 0 ? null : list.get(end - 1); - } - - public int size() { - return end - start; - } - - public AbstractInsnNode get(int i) { - return list.get(start + i); - } - - public void set(int i, AbstractInsnNode insn) { - list.set(get(i), insn); - } - - public void remove(int i) { - list.remove(get(i)); - end--; - } - - public void replace(AbstractInsnNode location, AbstractInsnNode insn) { - list.set(location, insn); - } - - public void add(AbstractInsnNode insn) { - list.add(insn); - end++; - } - - public void insertBefore(InsnList insns) { - int s = insns.size(); - if (this.list.size() == 0) { - list.insert(insns); - } else { - list.insertBefore(list.get(start), insns); - } - start += s; - end += s; - } - - public void insert(InsnList insns) { - if (end == 0) { - list.insert(insns); - } else { - list.insert(list.get(end - 1), insns); - } - } - - public void replace(InsnList insns) { - int s = insns.size(); - remove(); - insert(insns); - end = start + s; - } - - public void remove() { - while (end != start) { - remove(0); - } - } - - public void setLast(AbstractInsnNode last) { - end = list.indexOf(last) + 1; - } - - public void setFirst(AbstractInsnNode first) { - start = list.indexOf(first); - } - - public InsnListSection drop(int n) { - return slice(n, size()); - } - - public InsnListSection take(int n) { - return slice(0, n); - } - - public InsnListSection slice(int start, int end) { - return new InsnListSection(list, this.start + start, this.start + end); - } - - /** - * Removes leading and trailing labels and line number nodes that don't affect control flow - * - * @return this - */ - public InsnListSection trim(Set controlFlowLabels) { - while (start < end && !InsnComparator.insnImportant(getFirst(), controlFlowLabels)) { - start++; - } - - while (start < end && !InsnComparator.insnImportant(getLast(), controlFlowLabels)) { - end--; - } - - return this; - } - - public String toString() { - Textifier t = new Textifier(); - accept(new TraceMethodVisitor(t)); - StringWriter sw = new StringWriter(); - t.print(new PrintWriter(sw)); - return sw.toString(); - } - - public void println() { - System.out.println(toString()); - } - - public HashMap identityLabelMap() { - HashMap labelMap = new HashMap(); - for (AbstractInsnNode insn : this) { - switch (insn.getType()) { - case LABEL: - labelMap.put((LabelNode) insn, (LabelNode) insn); - break; - case JUMP_INSN: - labelMap.put(((JumpInsnNode) insn).label, ((JumpInsnNode) insn).label); - break; - case LOOKUPSWITCH_INSN: - LookupSwitchInsnNode linsn = (LookupSwitchInsnNode) insn; - labelMap.put(linsn.dflt, linsn.dflt); - for (LabelNode label : linsn.labels) { - labelMap.put(label, label); - } - break; - case TABLESWITCH_INSN: - TableSwitchInsnNode tinsn = (TableSwitchInsnNode) insn; - labelMap.put(tinsn.dflt, tinsn.dflt); - for (LabelNode label : tinsn.labels) { - labelMap.put(label, label); - } - break; - case FRAME: - FrameNode fnode = (FrameNode) insn; - if (fnode.local != null) { - for (Object o : fnode.local) { - if (o instanceof LabelNode) { - labelMap.put((LabelNode) o, (LabelNode) o); - } - } - } - if (fnode.stack != null) { - for (Object o : fnode.stack) { - if (o instanceof LabelNode) { - labelMap.put((LabelNode) o, (LabelNode) o); - } - } - } - break; - } - } - - return labelMap; - } - - public Map cloneLabels() { - Map labelMap = identityLabelMap(); - for (Entry entry : labelMap.entrySet()) { - entry.setValue(new LabelNode()); - } - - return labelMap; - } - - public InsnListSection copy() { - return copy(cloneLabels()); - } - - public InsnListSection copy(Map labelMap) { - InsnListSection copy = new InsnListSection(); - for (AbstractInsnNode insn : this) { - copy.add(insn.clone(labelMap)); - } - - return copy; - } - - @Override - public Iterator iterator() { - return new InsnListSectionIterator(); - } -} diff --git a/dependencies/main/java/codechicken/lib/asm/LocalVariablesSorterVisitor.java b/dependencies/main/java/codechicken/lib/asm/LocalVariablesSorterVisitor.java deleted file mode 100644 index 2b1fb1aad3..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/LocalVariablesSorterVisitor.java +++ /dev/null @@ -1,36 +0,0 @@ -package codechicken.lib.asm; - -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.commons.LocalVariablesSorter; - -import java.util.Set; - -public class LocalVariablesSorterVisitor extends ClassVisitor { - - public Set methods; - public String owner; - - public LocalVariablesSorterVisitor(Set methods, ClassVisitor cv) { - super(Opcodes.ASM4, cv); - this.methods = methods; - } - - public LocalVariablesSorterVisitor(ClassVisitor cv) { - this(null, cv); - } - - @Override - public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { - super.visit(version, access, name, signature, superName, interfaces); - owner = name; - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor mv = cv.visitMethod(access, name, desc, signature, exceptions); - return methods == null || methods.contains(new ObfMapping(owner, name, desc)) ? new LocalVariablesSorter(access, desc, mv) : mv; - } -} - diff --git a/dependencies/main/java/codechicken/lib/asm/MethodASMifier.java b/dependencies/main/java/codechicken/lib/asm/MethodASMifier.java deleted file mode 100644 index 9d00a50527..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/MethodASMifier.java +++ /dev/null @@ -1,73 +0,0 @@ -package codechicken.lib.asm; - -import net.minecraft.launchwrapper.Launch; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.util.Printer; -import org.objectweb.asm.util.TraceMethodVisitor; - -import java.io.File; -import java.io.PrintWriter; - -import static org.objectweb.asm.Opcodes.ASM4; - -public class MethodASMifier extends ClassVisitor { - - PrintWriter printWriter; - ObfMapping method; - Printer asmifier; - - public MethodASMifier(ObfMapping method, Printer printer, PrintWriter printWriter) { - super(ASM4); - this.method = method; - this.printWriter = printWriter; - asmifier = printer; - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - if (method.matches(name, desc)) { - Printer localPrinter = asmifier.visitMethod(access, name, desc, signature, exceptions); - return new TraceMethodVisitor(null, localPrinter); - } - - return null; - } - - @Override - public void visitEnd() { - asmifier.visitClassEnd(); - asmifier.print(printWriter); - super.visitEnd(); - } - - public static void printMethod(ObfMapping method, Printer printer, File toFile) { - try { - printMethod(method, Launch.classLoader.getClassBytes(method.javaClass()), printer, toFile); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void printMethod(ObfMapping method, byte[] bytes, Printer printer, File toFile) { - try { - if (!toFile.getParentFile().exists()) { - toFile.getParentFile().mkdirs(); - } - if (!toFile.exists()) { - toFile.createNewFile(); - } - - PrintWriter printWriter = new PrintWriter(toFile); - - ClassVisitor cv = new MethodASMifier(method, printer, printWriter); - ClassReader cr = new ClassReader(bytes); - cr.accept(cv, 0); - - printWriter.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/asm/ModularASMTransformer.java b/dependencies/main/java/codechicken/lib/asm/ModularASMTransformer.java deleted file mode 100644 index 91edeafb34..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/ModularASMTransformer.java +++ /dev/null @@ -1,345 +0,0 @@ -package codechicken.lib.asm; - -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.InsnList; -import org.objectweb.asm.tree.MethodNode; - -import java.io.File; -import java.io.FileOutputStream; -import java.util.*; - -import static codechicken.lib.asm.ASMHelper.*; - -//TODO Java doc all the internal class constructors. -public class ModularASMTransformer { - - /** - * Contains a list of transformers for a given class. - * Also contains some basic logic for doing the actual transform. - */ - public static class ClassNodeTransformerList { - - List transformers = new LinkedList(); - HashSet methodsToSort = new HashSet(); - - public void add(ClassNodeTransformer t) { - transformers.add(t); - t.addMethodsToSort(methodsToSort); - } - - public byte[] transform(byte[] bytes) { - ClassNode cnode = new ClassNode(); - ClassReader reader = new ClassReader(bytes); - ClassVisitor cv = cnode; - if (!methodsToSort.isEmpty()) { - cv = new LocalVariablesSorterVisitor(methodsToSort, cv); - } - reader.accept(cv, ClassReader.EXPAND_FRAMES); - - try { - int writeFlags = 0; - for (ClassNodeTransformer t : transformers) { - t.transform(cnode); - writeFlags |= t.writeFlags; - } - - bytes = createBytes(cnode, writeFlags); - if (config.getTag("dump_asm_raw").getBooleanValue(false)) { - File file = new File("asm/ccl_modular/" + cnode.name.replace('/', '#') + ".class"); - FileOutputStream fos = new FileOutputStream(file); - fos.write(bytes); - fos.flush(); - fos.close(); - - } else if (config.getTag("dump_asm").getBooleanValue(true)) { - dump(bytes, new File("asm/ccl_modular/" + cnode.name.replace('/', '#') + ".txt"), false, false); - } - return bytes; - } catch (Exception e) { - dump(bytes, new File("asm/ccl_modular/" + cnode.name.replace('/', '#') + ".txt"), false, false); - throw new RuntimeException(e); - } - } - } - - /** - * Parent to all transformer's. - */ - public static abstract class ClassNodeTransformer { - - public int writeFlags; - - public ClassNodeTransformer(int writeFlags) { - this.writeFlags = writeFlags; - } - - public ClassNodeTransformer() { - this(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); - } - - public abstract String className(); - - public abstract void transform(ClassNode cnode); - - public void addMethodsToSort(Set set) { - } - } - - /** - * Base Method transformer. - */ - public static abstract class MethodTransformer extends ClassNodeTransformer { - - public final ObfMapping method; - - public MethodTransformer(ObfMapping method) { - this.method = method.toClassloading(); - } - - @Override - public String className() { - return method.javaClass(); - } - - @Override - public void transform(ClassNode cnode) { - MethodNode mv = findMethod(method, cnode); - if (mv == null) { - throw new RuntimeException("Method not found: " + method); - } - - try { - transform(mv); - } catch (Exception e) { - throw new RuntimeException("Error transforming method: " + method, e); - } - } - - public abstract void transform(MethodNode mv); - } - - /** - * Writes a method containing the provided InsnList with the ObfMapping as the method name and desc. - */ - public static class MethodWriter extends ClassNodeTransformer { - - public final int access; - public final ObfMapping method; - public final String[] exceptions; - public InsnList list; - - public MethodWriter(int access, ObfMapping method) { - this(access, method, null, (InsnList) null); - } - - public MethodWriter(int access, ObfMapping method, InsnList list) { - this(access, method, null, list); - } - - public MethodWriter(int access, ObfMapping method, ASMBlock block) { - this(access, method, null, block); - } - - public MethodWriter(int access, ObfMapping method, String[] exceptions) { - this(access, method, exceptions, (InsnList) null); - } - - public MethodWriter(int access, ObfMapping method, String[] exceptions, InsnList list) { - this.access = access; - this.method = method.toClassloading(); - this.exceptions = exceptions; - this.list = list; - } - - public MethodWriter(int access, ObfMapping method, String[] exceptions, ASMBlock block) { - this(access, method, exceptions, block.rawListCopy()); - } - - @Override - public String className() { - return method.javaClass(); - } - - @Override - public void transform(ClassNode cnode) { - MethodNode mv = findMethod(method, cnode); - if (mv == null) { - mv = (MethodNode) method.visitMethod(cnode, access, exceptions); - } else { - mv.access = access; - mv.instructions.clear(); - if (mv.localVariables != null) { - mv.localVariables.clear(); - } - if (mv.tryCatchBlocks != null) { - mv.tryCatchBlocks.clear(); - } - } - - write(mv); - } - - public void write(MethodNode mv) { - logger.debug("Writing method " + method); - list.accept(mv); - } - } - - /** - * Injects a call before or after the needle. - * If needle is null it will inject at the start or end of the method. - */ - public static class MethodInjector extends MethodTransformer { - - public ASMBlock needle; - public ASMBlock injection; - public boolean before; - - public MethodInjector(ObfMapping method, ASMBlock needle, ASMBlock injection, boolean before) { - super(method); - this.needle = needle; - this.injection = injection; - this.before = before; - } - - public MethodInjector(ObfMapping method, ASMBlock injection, boolean before) { - this(method, null, injection, before); - } - - public MethodInjector(ObfMapping method, InsnList needle, InsnList injection, boolean before) { - this(method, new ASMBlock(needle), new ASMBlock(injection), before); - } - - public MethodInjector(ObfMapping method, InsnList injection, boolean before) { - this(method, null, new ASMBlock(injection), before); - } - - @Override - public void addMethodsToSort(Set set) { - set.add(method); - } - - @Override - public void transform(MethodNode mv) { - if (needle == null) { - logger.debug("Injecting " + (before ? "before" : "after") + " method " + method); - if (before) { - mv.instructions.insert(injection.rawListCopy()); - } else { - mv.instructions.add(injection.rawListCopy()); - } - } else { - for (InsnListSection key : InsnComparator.findN(mv.instructions, needle.list)) { - logger.debug("Injecting " + (before ? "before" : "after") + " method " + method + " @ " + key.start + " - " + key.end); - ASMBlock injectBlock = injection.copy().mergeLabels(needle.applyLabels(key)); - - if (before) { - key.insertBefore(injectBlock.list.list); - } else { - key.insert(injectBlock.list.list); - } - } - } - } - } - - /** - * Replaces a specific needle with a specific replacement. - * Can replace more than one needle. - */ - public static class MethodReplacer extends MethodTransformer { - - public ASMBlock needle; - public ASMBlock replacement; - - public MethodReplacer(ObfMapping method, ASMBlock needle, ASMBlock replacement) { - super(method); - this.needle = needle; - this.replacement = replacement; - } - - public MethodReplacer(ObfMapping method, InsnList needle, InsnList replacement) { - this(method, new ASMBlock(needle), new ASMBlock(replacement)); - } - - @Override - public void addMethodsToSort(Set set) { - set.add(method); - } - - @Override - public void transform(MethodNode mv) { - for (InsnListSection key : InsnComparator.findN(mv.instructions, needle.list)) { - logger.debug("Replacing method " + method + " @ " + key.start + " - " + key.end); - ASMBlock replaceBlock = replacement.copy().pullLabels(needle.applyLabels(key)); - key.insert(replaceBlock.list.list); - } - } - } - - /** - * Writes a field to a class. - * ObfMapping contains the class to put the field. - */ - public static class FieldWriter extends ClassNodeTransformer { - - public final ObfMapping field; - public final int access; - public final Object value; - - public FieldWriter(int access, ObfMapping field, Object value) { - this.field = field.toClassloading(); - this.access = access; - this.value = value; - } - - public FieldWriter(int access, ObfMapping field) { - this(access, field, null); - } - - @Override - public String className() { - return field.javaClass(); - } - - @Override - public void transform(ClassNode cnode) { - field.visitField(cnode, access, value); - } - } - - public HashMap transformers = new HashMap(); - - /** - * Adds a ClassNodeTransformer to this transformer. - * - * @param t Transformer to add. - */ - public void add(ClassNodeTransformer t) { - ClassNodeTransformerList list = transformers.get(t.className()); - if (list == null) { - transformers.put(t.className(), list = new ClassNodeTransformerList()); - } - list.add(t); - } - - /** - * Runs the transform. - * - * @param name name of the class being loaded. - * @param bytes Class bytes. - * @return Returns null if the class passed is null, returns original class if there are no transformers for a given class. - * Otherwise returns transformed class. - */ - public byte[] transform(String name, byte[] bytes) { - if (bytes == null) { - return null; - } - - ClassNodeTransformerList list = transformers.get(name); - return list == null ? bytes : list.transform(bytes); - } -} diff --git a/dependencies/main/java/codechicken/lib/asm/ObfMapping.java b/dependencies/main/java/codechicken/lib/asm/ObfMapping.java deleted file mode 100644 index 7d4414ed0f..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/ObfMapping.java +++ /dev/null @@ -1,446 +0,0 @@ -package codechicken.lib.asm; - -import codechicken.lib.config.ConfigTag; -import com.google.common.base.Charsets; -import com.google.common.base.Objects; -import com.google.common.base.Strings; -import com.google.common.io.LineProcessor; -import com.google.common.io.Resources; -import net.minecraft.launchwrapper.Launch; -import net.minecraftforge.common.ForgeVersion; -import net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper; -import net.minecraftforge.fml.relauncher.FMLInjectionData; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.FieldVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.commons.Remapper; -import org.objectweb.asm.tree.*; - -import javax.swing.*; -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -public class ObfMapping { - - public static class ObfRemapper extends Remapper { - - private HashMap fields = new HashMap(); - private HashMap funcs = new HashMap(); - - public ObfRemapper() { - try { - Field rawFieldMapsField = FMLDeobfuscatingRemapper.class.getDeclaredField("rawFieldMaps"); - Field rawMethodMapsField = FMLDeobfuscatingRemapper.class.getDeclaredField("rawMethodMaps"); - rawFieldMapsField.setAccessible(true); - rawMethodMapsField.setAccessible(true); - Map> rawFieldMaps = (Map>) rawFieldMapsField.get(FMLDeobfuscatingRemapper.INSTANCE); - Map> rawMethodMaps = (Map>) rawMethodMapsField.get(FMLDeobfuscatingRemapper.INSTANCE); - - if (rawFieldMaps == null) { - throw new IllegalStateException("codechicken.lib.asm.ObfMapping loaded too early. Make sure all references are in or after the asm transformer load stage"); - } - - for (Map map : rawFieldMaps.values()) { - for (Entry entry : map.entrySet()) { - if (entry.getValue().startsWith("field")) { - fields.put(entry.getValue(), entry.getKey().substring(0, entry.getKey().indexOf(':'))); - } - } - } - for (Map map : rawMethodMaps.values()) { - for (Entry entry : map.entrySet()) { - if (entry.getValue().startsWith("func")) { - funcs.put(entry.getValue(), entry.getKey().substring(0, entry.getKey().indexOf('('))); - } - } - } - - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - @Override - public String mapMethodName(String owner, String name, String desc) { - String s = funcs.get(name); - return s == null ? name : s; - } - - @Override - public String mapFieldName(String owner, String name, String desc) { - String s = fields.get(name); - return s == null ? name : s; - } - - @Override - public String map(String typeName) { - return FMLDeobfuscatingRemapper.INSTANCE.unmap(typeName); - } - - public String unmap(String typeName) { - return FMLDeobfuscatingRemapper.INSTANCE.map(typeName); - } - - public boolean isObf(String typeName) { - return !map(typeName).equals(typeName) || !unmap(typeName).equals(typeName); - } - } - - public static class MCPRemapper extends Remapper implements LineProcessor { - - public static File[] getConfFiles() { - - // check for GradleStart system vars - if (!Strings.isNullOrEmpty(System.getProperty("net.minecraftforge.gradle.GradleStart.srg.notch-srg"))) { - File notchSrg = new File(System.getProperty("net.minecraftforge.gradle.GradleStart.srg.notch-srg")); - File csvDir = new File(System.getProperty("net.minecraftforge.gradle.GradleStart.csvDir")); - - if (notchSrg.exists() && csvDir.exists()) { - File fieldCsv = new File(csvDir, "fields.csv"); - File methodCsv = new File(csvDir, "methods.csv"); - - if (notchSrg.exists() && fieldCsv.exists() && methodCsv.exists()) { - return new File[] { notchSrg, fieldCsv, methodCsv }; - } - } - } - - ConfigTag tag = ASMHelper.config.getTag("mappingDir").setComment("Path to directory holding packaged.srg, fields.csv and methods.csv for mcp remapping"); - for (int i = 0; i < DIR_GUESSES + DIR_ASKS; i++) { - File dir = confDirectoryGuess(i, tag); - if (dir == null || dir.isFile()) { - continue; - } - - File[] mappings; - try { - mappings = parseConfDir(dir); - } catch (Exception e) { - if (i >= DIR_GUESSES) { - e.printStackTrace(); - } - continue; - } - - tag.setValue(dir.getPath()); - return mappings; - } - - throw new RuntimeException("Failed to select mappings directory, set it manually in the config"); - } - - private static final int DIR_GUESSES = 4; - private static final int DIR_ASKS = 3; - - public static File confDirectoryGuess(int i, ConfigTag tag) { - File mcDir = (File) FMLInjectionData.data()[6]; - switch (i) { - case 0: - return tag.value != null ? new File(tag.getValue()) : null; - case 1: - return new File(mcDir, "../conf"); - case 2: - return new File(mcDir, "../build/unpacked/conf"); - case 3: - return new File(System.getProperty("user.home"), ".gradle/caches/minecraft/net/minecraftforge/forge/" + FMLInjectionData.data()[4] + "-" + ForgeVersion.getVersion() + "/unpacked/conf"); - default: - JFileChooser fc = new JFileChooser(mcDir); - fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - fc.setDialogTitle("Select an mcp conf dir for the deobfuscator."); - int ret = fc.showDialog(null, "Select"); - return ret == JFileChooser.APPROVE_OPTION ? fc.getSelectedFile() : null; - } - } - - public static File[] parseConfDir(File confDir) { - File srgDir = new File(confDir, "conf"); - if (!srgDir.exists()) { - srgDir = confDir; - } - - File srgs = new File(srgDir, "packaged.srg"); - if (!srgs.exists()) { - srgs = new File(srgDir, "joined.srg"); - } - if (!srgs.exists()) { - throw new RuntimeException("Could not find packaged.srg or joined.srg"); - } - - File mapDir = new File(confDir, "mappings"); - if (!mapDir.exists()) { - mapDir = confDir; - } - - File methods = new File(mapDir, "methods.csv"); - if (!methods.exists()) { - throw new RuntimeException("Could not find methods.csv"); - } - File fields = new File(mapDir, "fields.csv"); - if (!fields.exists()) { - throw new RuntimeException("Could not find fields.csv"); - } - - return new File[] { srgs, methods, fields }; - } - - private HashMap fields = new HashMap(); - private HashMap funcs = new HashMap(); - - public MCPRemapper() { - File[] mappings = getConfFiles(); - try { - Resources.readLines(mappings[1].toURI().toURL(), Charsets.UTF_8, this); - Resources.readLines(mappings[2].toURI().toURL(), Charsets.UTF_8, this); - } catch (IOException e) { - e.printStackTrace(); - } - } - - @Override - public String mapMethodName(String owner, String name, String desc) { - String s = funcs.get(name); - return s == null ? name : s; - } - - @Override - public String mapFieldName(String owner, String name, String desc) { - String s = fields.get(name); - return s == null ? name : s; - } - - @Override - public boolean processLine(String line) throws IOException { - int i = line.indexOf(','); - String srg = line.substring(0, i); - int i2 = i + 1; - i = line.indexOf(',', i2); - String mcp = line.substring(i2, i); - (srg.startsWith("func") ? funcs : fields).put(srg, mcp); - return true; - } - - @Override - public Void getResult() { - return null; - } - } - - public static ObfRemapper obfMapper = new ObfRemapper(); - public static Remapper mcpMapper = null; - - public static void loadMCPRemapper() { - if (mcpMapper == null) { - mcpMapper = new MCPRemapper(); - } - } - - public static final boolean obfuscated; - - static { - boolean obf = true; - try { - obf = Launch.classLoader.getClassBytes("net.minecraft.world.World") == null; - } catch (IOException ignored) { - } - obfuscated = obf; - if (!obf) { - loadMCPRemapper(); - } - } - - public String s_owner; - public String s_name; - public String s_desc; - - public ObfMapping(String owner) { - this(owner, "", ""); - } - - public ObfMapping(String owner, String name, String desc) { - this.s_owner = owner; - this.s_name = name; - this.s_desc = desc; - - if (s_owner.contains(".")) { - throw new IllegalArgumentException(s_owner); - } - } - - public ObfMapping(ObfMapping descmap, String subclass) { - this(subclass, descmap.s_name, descmap.s_desc); - } - - public static ObfMapping fromDesc(String s) { - int lastDot = s.lastIndexOf('.'); - if (lastDot < 0) { - return new ObfMapping(s, "", ""); - } - int sep = s.indexOf('(');//methods - int sep_end = sep; - if (sep < 0) { - sep = s.indexOf(' ');//some stuffs - sep_end = sep + 1; - } - if (sep < 0) { - sep = s.indexOf(':');//fields - sep_end = sep + 1; - } - if (sep < 0) { - return new ObfMapping(s.substring(0, lastDot), s.substring(lastDot + 1), ""); - } - - return new ObfMapping(s.substring(0, lastDot), s.substring(lastDot + 1, sep), s.substring(sep_end)); - } - - public ObfMapping subclass(String subclass) { - return new ObfMapping(this, subclass); - } - - public boolean matches(MethodNode node) { - return s_name.equals(node.name) && s_desc.equals(node.desc); - } - - public boolean matches(MethodInsnNode node) { - return s_owner.equals(node.owner) && s_name.equals(node.name) && s_desc.equals(node.desc); - } - - public AbstractInsnNode toInsn(int opcode) { - if (isClass()) { - return new TypeInsnNode(opcode, s_owner); - } else if (isMethod()) { - return new MethodInsnNode(opcode, s_owner, s_name, s_desc); - } else { - return new FieldInsnNode(opcode, s_owner, s_name, s_desc); - } - } - - public void visitTypeInsn(MethodVisitor mv, int opcode) { - mv.visitTypeInsn(opcode, s_owner); - } - - public void visitMethodInsn(MethodVisitor mv, int opcode) { - mv.visitMethodInsn(opcode, s_owner, s_name, s_desc); - } - - public void visitFieldInsn(MethodVisitor mv, int opcode) { - mv.visitFieldInsn(opcode, s_owner, s_name, s_desc); - } - - public MethodVisitor visitMethod(ClassVisitor visitor, int access, String[] exceptions) { - return visitor.visitMethod(access, s_name, s_desc, null, exceptions); - } - - public FieldVisitor visitField(ClassVisitor visitor, int access, Object value) { - return visitor.visitField(access, s_name, s_desc, null, value); - } - - public boolean isClass(String name) { - return name.replace('.', '/').equals(s_owner); - } - - public boolean matches(String name, String desc) { - return s_name.equals(name) && s_desc.equals(desc); - } - - public boolean matches(FieldNode node) { - return s_name.equals(node.name) && s_desc.equals(node.desc); - } - - public boolean matches(FieldInsnNode node) { - return s_owner.equals(node.owner) && s_name.equals(node.name) && s_desc.equals(node.desc); - } - - public String javaClass() { - return s_owner.replace('/', '.'); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof ObfMapping)) { - return false; - } - - ObfMapping desc = (ObfMapping) obj; - return s_owner.equals(desc.s_owner) && s_name.equals(desc.s_name) && s_desc.equals(desc.s_desc); - } - - @Override - public int hashCode() { - return Objects.hashCode(s_desc, s_name, s_owner); - } - - @Override - public String toString() { - if (s_name.length() == 0) { - return "[" + s_owner + "]"; - } - if (s_desc.length() == 0) { - return "[" + s_owner + "." + s_name + "]"; - } - return "[" + (isMethod() ? methodDesc() : fieldDesc()) + "]"; - } - - public String methodDesc() { - return s_owner + "." + s_name + s_desc; - } - - public String fieldDesc() { - return s_owner + "." + s_name + ":" + s_desc; - } - - public boolean isClass() { - return s_name.length() == 0; - } - - public boolean isMethod() { - return s_desc.contains("("); - } - - public boolean isField() { - return !isClass() && !isMethod(); - } - - public ObfMapping map(Remapper mapper) { - if (mapper == null) { - return this; - } - - if (isMethod()) { - s_name = mapper.mapMethodName(s_owner, s_name, s_desc); - } else if (isField()) { - s_name = mapper.mapFieldName(s_owner, s_name, s_desc); - } - - s_owner = mapper.mapType(s_owner); - - if (isMethod()) { - s_desc = mapper.mapMethodDesc(s_desc); - } else if (s_desc.length() > 0) { - s_desc = mapper.mapDesc(s_desc); - } - - return this; - } - - public ObfMapping toRuntime() { - map(mcpMapper); - return this; - } - - public ObfMapping toClassloading() { - if (!obfuscated) { - map(mcpMapper); - } else if (obfMapper.isObf(s_owner)) { - map(obfMapper); - } - return this; - } - - public ObfMapping copy() { - return new ObfMapping(s_owner, s_name, s_desc); - } -} diff --git a/dependencies/main/java/codechicken/lib/asm/discovery/ClassDiscoverer.java b/dependencies/main/java/codechicken/lib/asm/discovery/ClassDiscoverer.java deleted file mode 100644 index 5632a15a60..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/discovery/ClassDiscoverer.java +++ /dev/null @@ -1,138 +0,0 @@ -package codechicken.lib.asm.discovery; - -import codechicken.lib.asm.ASMHelper; -import codechicken.lib.asm.CCLCorePlugin; -import codechicken.lib.util.CommonUtils; -import net.minecraft.launchwrapper.Launch; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModClassLoader; -import net.minecraftforge.fml.common.ModContainer; -import org.objectweb.asm.tree.ClassNode; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -public class ClassDiscoverer { - - public IStringMatcher matcher; - public String[] superclasses; - public ArrayList> classes; - public ModClassLoader modClassLoader; - - public ClassDiscoverer(IStringMatcher matcher, Class... superclasses) { - this.matcher = matcher; - this.superclasses = new String[superclasses.length]; - for (int i = 0; i < superclasses.length; i++) { - this.superclasses[i] = superclasses[i].getName().replace('.', '/'); - } - - classes = new ArrayList>(); - modClassLoader = Loader.instance().getModClassLoader(); - } - - public ClassDiscoverer(Class... superclasses) { - this(new IStringMatcher() { - public boolean matches(String test) { - return true; - } - }, superclasses); - } - - public ArrayList> findClasses() { - try { - findClasspathMods(); - } catch (Exception e) { - throw new RuntimeException(e); - } - return classes; - } - - private void checkAddClass(String resource) { - try { - String classname = resource.replace(".class", "").replace("\\", ".").replace("/", "."); - byte[] bytes = Launch.classLoader.getClassBytes(classname); - if (bytes == null) { - return; - } - - ClassNode cnode = ASMHelper.createClassNode(bytes); - for (String superclass : superclasses) { - if (!cnode.interfaces.contains(superclass) && !cnode.superName.equals(superclass)) { - return; - } - } - - addClass(classname); - } catch (IOException e) { - CCLCorePlugin.logger.error("Unable to load class: " + resource, e); - } - } - - private void addClass(String classname) { - try { - Class class1 = Class.forName(classname, true, modClassLoader); - classes.add(class1); - } catch (Throwable t) { - CCLCorePlugin.logger.error("Unable to load class: " + classname, t); - } - } - - private void findClasspathMods() { - List mods = Loader.instance().getActiveModList(); - HashSet searched = new HashSet(); - for (ModContainer mod : mods) { - File source = mod.getSource(); - if (source == null || searched.contains(source.getAbsolutePath())) { - continue; - } - searched.add(source.getAbsolutePath()); - - if (source.isFile()) { - CCLCorePlugin.logger.debug("Found a mod container %s, examining for codechicken classes", source.getAbsolutePath()); - try { - readFromZipFile(source); - } catch (Exception e) { - CCLCorePlugin.logger.error("Failed to scan " + source.getAbsolutePath() + ", the zip file is invalid", e); - } - } else if (source.isDirectory()) { - CCLCorePlugin.logger.debug("Found a minecraft related directory at %s, examining for codechicken classes", source.getAbsolutePath()); - readFromDirectory(source, source); - } - } - } - - private void readFromZipFile(File file) throws IOException { - FileInputStream fileinputstream = new FileInputStream(file); - ZipInputStream zipinputstream = new ZipInputStream(fileinputstream); - do { - ZipEntry zipentry = zipinputstream.getNextEntry(); - if (zipentry == null) { - break; - } - String fullname = zipentry.getName().replace('\\', '/'); - int pos = fullname.lastIndexOf('/'); - String name = pos == -1 ? fullname : fullname.substring(pos + 1); - if (!zipentry.isDirectory() && matcher.matches(name)) { - checkAddClass(fullname); - } - } while (true); - fileinputstream.close(); - } - - private void readFromDirectory(File directory, File basedirectory) { - for (File child : directory.listFiles()) { - if (child.isDirectory()) { - readFromDirectory(child, basedirectory); - } else if (child.isFile() && matcher.matches(child.getName())) { - String fullname = CommonUtils.getRelativePath(basedirectory, child); - checkAddClass(fullname); - } - } - } -} diff --git a/dependencies/main/java/codechicken/lib/asm/discovery/IStringMatcher.java b/dependencies/main/java/codechicken/lib/asm/discovery/IStringMatcher.java deleted file mode 100644 index 45f69d3fdb..0000000000 --- a/dependencies/main/java/codechicken/lib/asm/discovery/IStringMatcher.java +++ /dev/null @@ -1,7 +0,0 @@ -package codechicken.lib.asm.discovery; - -//TODO Predicate? -public interface IStringMatcher { - - boolean matches(String test); -} diff --git a/dependencies/main/java/codechicken/lib/block/BlockMultiTile.java b/dependencies/main/java/codechicken/lib/block/BlockMultiTile.java deleted file mode 100644 index 7c3f4c7e70..0000000000 --- a/dependencies/main/java/codechicken/lib/block/BlockMultiTile.java +++ /dev/null @@ -1,55 +0,0 @@ -package codechicken.lib.block; - -import net.minecraft.block.Block; -import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.material.Material; -import net.minecraft.item.Item; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.registry.GameRegistry; -import org.apache.logging.log4j.Level; - -/** - * Created by covers1624 on 3/27/2016. - */ -public class BlockMultiTile extends Block implements ITileEntityProvider { - - @SuppressWarnings ("unchecked") - private Class[] tileEntityMap = new Class[16]; - - public BlockMultiTile(Material material) { - super(material); - } - - public void registerSubItemAndTile(int meta, String name, Class clazz) { - GameRegistry.registerTileEntity(clazz, Loader.instance().activeModContainer().getModId() + ":" + name); - addSubItemAndTile(meta, name, clazz); - } - - public void addSubItemAndTile(int meta, String name, Class clazz) { - addTileEntityMapping(meta, clazz); - setItemName(meta, name); - } - - public void setItemName(int meta, String name) { - Item item = Item.getItemFromBlock(this); - ((ItemBlockMultiType) item).registerSubItem(meta, name); - } - - public void addTileEntityMapping(int meta, Class clazz) { - this.tileEntityMap[meta] = clazz; - } - - @Override - public TileEntity createNewTileEntity(World worldIn, int meta) { - Class clazz = tileEntityMap[meta]; - try { - return clazz.getDeclaredConstructor(new Class[0]).newInstance(); - } catch (Exception e) { - FMLLog.log("CodeChicken Lib", Level.FATAL, "Unable to create tile with meta of %s", meta); - return null; - } - } -} diff --git a/dependencies/main/java/codechicken/lib/block/IParticleProvider.java b/dependencies/main/java/codechicken/lib/block/IParticleProvider.java deleted file mode 100644 index ff261266ed..0000000000 --- a/dependencies/main/java/codechicken/lib/block/IParticleProvider.java +++ /dev/null @@ -1,10 +0,0 @@ -package codechicken.lib.block; - -/** - * Created by covers1624 on 20/11/2016. - */ -public interface IParticleProvider extends IType { - - String getParticleTexture(); - -} diff --git a/dependencies/main/java/codechicken/lib/block/IType.java b/dependencies/main/java/codechicken/lib/block/IType.java deleted file mode 100644 index 6445f14a91..0000000000 --- a/dependencies/main/java/codechicken/lib/block/IType.java +++ /dev/null @@ -1,15 +0,0 @@ -package codechicken.lib.block; - -import net.minecraft.block.properties.IProperty; -import net.minecraft.util.IStringSerializable; - -/** - * Created by covers1624 on 20/11/2016. - */ -public interface IType extends IStringSerializable { - - IProperty getTypeProperty(); - - int meta(); - -} diff --git a/dependencies/main/java/codechicken/lib/block/ItemBlockMultiType.java b/dependencies/main/java/codechicken/lib/block/ItemBlockMultiType.java deleted file mode 100644 index 26aa8e5181..0000000000 --- a/dependencies/main/java/codechicken/lib/block/ItemBlockMultiType.java +++ /dev/null @@ -1,55 +0,0 @@ -package codechicken.lib.block; - -import net.minecraft.block.Block; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by covers1624 on 3/27/2016. - */ -//TODO Merge Model variant code in to here. maybe. -public class ItemBlockMultiType extends ItemBlock { - - private HashMap names = new HashMap(); - - public ItemBlockMultiType(Block block) { - super(block); - setMaxDamage(0); - setHasSubtypes(true); - } - - @Override - public int getMetadata(int meta) { - return meta; - } - - public ItemBlockMultiType registerBulkArray(String[] names) { - for (int i = 0; i < names.length; i++) { - registerSubItem(i, names[i]); - } - return this; - } - - public ItemBlockMultiType registerSubItem(int meta, String name) { - names.put(meta, name); - return this; - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - return "tile." + names.get(stack.getItemDamage()); - } - - @Override - public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) { - for (Map.Entry entry : names.entrySet()) { - subItems.add(new ItemStack(this, 1, entry.getKey())); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/block/StateReference.java b/dependencies/main/java/codechicken/lib/block/StateReference.java deleted file mode 100644 index 85bb6aa5bc..0000000000 --- a/dependencies/main/java/codechicken/lib/block/StateReference.java +++ /dev/null @@ -1,14 +0,0 @@ -package codechicken.lib.block; - -import codechicken.lib.block.property.PropertyEnumFacingAll; -import codechicken.lib.block.property.PropertyEnumFacingHoz; - -/** - * Created by covers1624 on 3/28/2016. - */ -public class StateReference { - - public static final PropertyEnumFacingHoz FACING_HOZ = PropertyEnumFacingHoz.create("facinghoz"); - public static final PropertyEnumFacingAll FACING_ALL = PropertyEnumFacingAll.create("facingall"); - -} diff --git a/dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingAll.java b/dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingAll.java deleted file mode 100644 index f5779280db..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingAll.java +++ /dev/null @@ -1,21 +0,0 @@ -package codechicken.lib.block.property; - -import com.google.common.collect.Lists; -import net.minecraft.block.properties.PropertyDirection; -import net.minecraft.util.EnumFacing; - -import java.util.Collection; - -/** - * Created by covers1624 on 3/27/2016. - */ -public class PropertyEnumFacingAll extends PropertyDirection { - - protected PropertyEnumFacingAll(String name, Collection values) { - super(name, values); - } - - public static PropertyEnumFacingAll create(String name) { - return new PropertyEnumFacingAll(name, Lists.newArrayList(EnumFacing.VALUES)); - } -} diff --git a/dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingHoz.java b/dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingHoz.java deleted file mode 100644 index 0502626042..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/PropertyEnumFacingHoz.java +++ /dev/null @@ -1,22 +0,0 @@ -package codechicken.lib.block.property; - -import com.google.common.collect.Lists; -import net.minecraft.block.properties.PropertyDirection; -import net.minecraft.util.EnumFacing; - -import java.util.Collection; - -/** - * Created by covers1624 on 3/27/2016. - */ -public class PropertyEnumFacingHoz extends PropertyDirection { - - protected PropertyEnumFacingHoz(String name, Collection values) { - super(name, values); - } - - public static PropertyEnumFacingHoz create(String name) { - return new PropertyEnumFacingHoz(name, Lists.newArrayList(EnumFacing.HORIZONTALS)); - } - -} diff --git a/dependencies/main/java/codechicken/lib/block/property/PropertyInteger.java b/dependencies/main/java/codechicken/lib/block/property/PropertyInteger.java deleted file mode 100644 index 586f9f50ef..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/PropertyInteger.java +++ /dev/null @@ -1,48 +0,0 @@ -package codechicken.lib.block.property; - -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableSet; -import net.minecraft.block.properties.PropertyHelper; - -import java.util.Collection; - -/** - * Created by covers1624 on 5/23/2016. - */ -public class PropertyInteger extends PropertyHelper { - - private final ImmutableSet valueSet; - - public PropertyInteger(String name, Collection values) { - super(name, Integer.class); - valueSet = ImmutableSet.copyOf(values); - } - - //EG, 16 = 0 - 15, 4 = 0 - 3 - public PropertyInteger(String name, int max) { - super(name, Integer.class); - ImmutableSet.Builder builder = ImmutableSet.builder(); - for (int i = 0; i < max; i++) { - builder.add(i); - } - valueSet = builder.build(); - } - - @Override - public Collection getAllowedValues() { - return valueSet; - } - - @Override - public Optional parseValue(String value) { - if (valueSet.contains(Integer.valueOf(value))) { - return Optional.of(Integer.valueOf(value)); - } - return Optional.absent(); - } - - @Override - public String getName(Integer value) { - return String.valueOf(value); - } -} diff --git a/dependencies/main/java/codechicken/lib/block/property/PropertyString.java b/dependencies/main/java/codechicken/lib/block/property/PropertyString.java deleted file mode 100644 index 9c263e1e2c..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/PropertyString.java +++ /dev/null @@ -1,52 +0,0 @@ -package codechicken.lib.block.property; - -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableList; -import net.minecraft.block.properties.PropertyHelper; - -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -/** - * Created by covers1624 on 2/6/2016. - */ -public class PropertyString extends PropertyHelper { - - private final List valuesSet; - - public PropertyString(String name, Collection values) { - super(name, String.class); - valuesSet = new LinkedList(values); - } - - public PropertyString(String name, String... values) { - super(name, String.class); - valuesSet = new LinkedList(); - Collections.addAll(valuesSet, values); - } - - public List values() { - return ImmutableList.copyOf(valuesSet); - } - - @Override - public Collection getAllowedValues() { - return ImmutableList.copyOf(valuesSet); - } - - @Override - public Optional parseValue(String value) { - if (valuesSet.contains(value)) { - return Optional.of(value); - } - return Optional.absent(); - } - - @Override - public String getName(String value) { - return value; - } -} - diff --git a/dependencies/main/java/codechicken/lib/block/property/TileEntityProperty.java b/dependencies/main/java/codechicken/lib/block/property/TileEntityProperty.java deleted file mode 100644 index bda47941f1..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/TileEntityProperty.java +++ /dev/null @@ -1,39 +0,0 @@ -package codechicken.lib.block.property; - -import com.google.common.base.Objects; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.property.IUnlistedProperty; - -/** - * Created by covers1624 on 5/10/2016. - * Used to store a TileEntity as an UnlistedProperty for the use of baking models, useful for anything to do with tile access dependent baking. - */ -public class TileEntityProperty implements IUnlistedProperty { - - private String name; - - public TileEntityProperty(String name) { - this.name = name; - } - - @Override - public String getName() { - return name; - } - - @Override - public boolean isValid(TileEntity value) { - return true; - } - - @Override - public Class getType() { - return TileEntity.class; - } - - @Override - public String valueToString(TileEntity value) { - Object worldID = value.hasWorldObj() ? value.getWorld().provider.getDimension() : "NoWorld!"; - return Objects.toStringHelper(value).add("position", value.getPos().toString()).add("worldID", worldID).toString(); - } -} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedBooleanProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedBooleanProperty.java deleted file mode 100644 index 8303399732..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedBooleanProperty.java +++ /dev/null @@ -1,21 +0,0 @@ -package codechicken.lib.block.property.unlisted; - -/** - * Created by covers1624 on 28/10/2016. - */ -public class UnlistedBooleanProperty extends UnlistedPropertyBase { - - public UnlistedBooleanProperty(String name) { - super(name); - } - - @Override - public Class getType() { - return Boolean.class; - } - - @Override - public String valueToString(Boolean value) { - return value.toString(); - } -} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteArrayProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteArrayProperty.java deleted file mode 100644 index 307af6758c..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteArrayProperty.java +++ /dev/null @@ -1,31 +0,0 @@ -package codechicken.lib.block.property.unlisted; - -import com.google.common.base.Objects; -import com.google.common.base.Objects.ToStringHelper; - -/** - * Created by covers1624 on 21/02/2017. - */ -public class UnlistedByteArrayProperty extends UnlistedPropertyBase { - - public UnlistedByteArrayProperty(String name) { - super(name); - } - - @Override - public Class getType() { - return byte[].class; - } - - @Override - public String valueToString(byte[] value) { - ToStringHelper helper = Objects.toStringHelper("ByteArray"); - if (value != null) { - for (int i1 = 0; i1 < value.length; i1++) { - byte i = value[i1]; - helper.add("Index:" + i1, i); - } - } - return helper.toString(); - } -} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteProperty.java deleted file mode 100644 index 41c1c33f46..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedByteProperty.java +++ /dev/null @@ -1,21 +0,0 @@ -package codechicken.lib.block.property.unlisted; - -/** - * Created by covers1624 on 28/10/2016. - */ -public class UnlistedByteProperty extends UnlistedPropertyBase { - - public UnlistedByteProperty(String name) { - super(name); - } - - @Override - public Class getType() { - return Byte.class; - } - - @Override - public String valueToString(Byte value) { - return value.toString(); - } -} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedEnumFacingProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedEnumFacingProperty.java deleted file mode 100644 index f9b81b5661..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedEnumFacingProperty.java +++ /dev/null @@ -1,23 +0,0 @@ -package codechicken.lib.block.property.unlisted; - -import net.minecraft.util.EnumFacing; - -/** - * Created by covers1624 on 23/11/2016. - */ -public class UnlistedEnumFacingProperty extends UnlistedPropertyBase { - - public UnlistedEnumFacingProperty(String name) { - super(name); - } - - @Override - public Class getType() { - return EnumFacing.class; - } - - @Override - public String valueToString(EnumFacing value) { - return value.toString(); - } -} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedFluidStackProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedFluidStackProperty.java deleted file mode 100644 index bbdc89c46f..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedFluidStackProperty.java +++ /dev/null @@ -1,24 +0,0 @@ -package codechicken.lib.block.property.unlisted; - -import com.google.common.base.Objects; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by covers1624 on 30/10/2016. - */ -public class UnlistedFluidStackProperty extends UnlistedPropertyBase { - - public UnlistedFluidStackProperty(String name) { - super(name); - } - - @Override - public Class getType() { - return FluidStack.class; - } - - @Override - public String valueToString(FluidStack value) { - return Objects.toStringHelper("FluidStack").add("Fluid", value.getFluid().getName()).add("Amount", value.amount).add("Tag", value.tag.toString()).toString(); - } -} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntArrayProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntArrayProperty.java deleted file mode 100644 index 9fa4a9251c..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntArrayProperty.java +++ /dev/null @@ -1,31 +0,0 @@ -package codechicken.lib.block.property.unlisted; - -import com.google.common.base.Objects; -import com.google.common.base.Objects.ToStringHelper; - -/** - * Created by covers1624 on 21/02/2017. - */ -public class UnlistedIntArrayProperty extends UnlistedPropertyBase { - - public UnlistedIntArrayProperty(String name) { - super(name); - } - - @Override - public Class getType() { - return int[].class; - } - - @Override - public String valueToString(int[] value) { - ToStringHelper helper = Objects.toStringHelper("IntArray"); - if (value != null) { - for (int i1 = 0; i1 < value.length; i1++) { - int i = value[i1]; - helper.add("Index:" + i1, i); - } - } - return helper.toString(); - } -} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntegerProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntegerProperty.java deleted file mode 100644 index 7ebb17fbe2..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedIntegerProperty.java +++ /dev/null @@ -1,21 +0,0 @@ -package codechicken.lib.block.property.unlisted; - -/** - * Created by covers1624 on 28/10/2016. - */ -public class UnlistedIntegerProperty extends UnlistedPropertyBase { - - public UnlistedIntegerProperty(String name) { - super(name); - } - - @Override - public Class getType() { - return Integer.class; - } - - @Override - public String valueToString(Integer value) { - return value.toString(); - } -} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedMapProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedMapProperty.java deleted file mode 100644 index 28b5961feb..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedMapProperty.java +++ /dev/null @@ -1,41 +0,0 @@ -package codechicken.lib.block.property.unlisted; - -import java.util.Map; - -/** - * Created by covers1624 on 25/10/2016. - */ -public class UnlistedMapProperty extends UnlistedPropertyBase { - - private IMapStringGenerator generator = null; - - public UnlistedMapProperty(String name) { - super(name); - } - - public UnlistedMapProperty setStringGenerator(IMapStringGenerator generator) { - if (generator == null) { - this.generator = generator; - } - return this; - } - - @Override - public Class getType() { - return Map.class; - } - - @Override - public String valueToString(Map value) { - if (value == null) { - return "null"; - } - return generator != null ? generator.makeString(value) : value.toString(); - } - - public interface IMapStringGenerator { - - String makeString(Map map); - } - -} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedPropertyBase.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedPropertyBase.java deleted file mode 100644 index 4604b82797..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedPropertyBase.java +++ /dev/null @@ -1,25 +0,0 @@ -package codechicken.lib.block.property.unlisted; - -import net.minecraftforge.common.property.IUnlistedProperty; - -/** - * Created by covers1624 on 30/10/2016. - */ -public abstract class UnlistedPropertyBase implements IUnlistedProperty { - - protected final String name; - - public UnlistedPropertyBase(String name) { - this.name = name; - } - - @Override - public String getName() { - return name; - } - - @Override - public boolean isValid(V value) { - return true; - } -} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedResourceLocationProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedResourceLocationProperty.java deleted file mode 100644 index 39b68fa0a2..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedResourceLocationProperty.java +++ /dev/null @@ -1,23 +0,0 @@ -package codechicken.lib.block.property.unlisted; - -import net.minecraft.util.ResourceLocation; - -/** - * Created by covers1624 on 28/10/2016. - */ -public class UnlistedResourceLocationProperty extends UnlistedPropertyBase { - - public UnlistedResourceLocationProperty(String name) { - super(name); - } - - @Override - public Class getType() { - return ResourceLocation.class; - } - - @Override - public String valueToString(ResourceLocation value) { - return value.toString(); - } -} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedSpriteProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedSpriteProperty.java deleted file mode 100644 index 8dc3333f75..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedSpriteProperty.java +++ /dev/null @@ -1,27 +0,0 @@ -package codechicken.lib.block.property.unlisted; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** - * Created by covers1624 on 25/10/2016. - */ -@SideOnly (Side.CLIENT) -public class UnlistedSpriteProperty extends UnlistedPropertyBase { - - public UnlistedSpriteProperty(String name) { - super(name); - } - - @SuppressWarnings ("unchecked") - public Class getType() { - return TextureAtlasSprite.class; - } - - @Override - public String valueToString(TextureAtlasSprite value) { - return value.toString(); - } - -} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedStringProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedStringProperty.java deleted file mode 100644 index 29214ec712..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedStringProperty.java +++ /dev/null @@ -1,21 +0,0 @@ -package codechicken.lib.block.property.unlisted; - -/** - * Created by covers1624 on 28/10/2016. - */ -public class UnlistedStringProperty extends UnlistedPropertyBase { - - public UnlistedStringProperty(String name) { - super(name); - } - - @Override - public Class getType() { - return String.class; - } - - @Override - public String valueToString(String value) { - return value; - } -} diff --git a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedTileEntityProperty.java b/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedTileEntityProperty.java deleted file mode 100644 index 9c4948a43c..0000000000 --- a/dependencies/main/java/codechicken/lib/block/property/unlisted/UnlistedTileEntityProperty.java +++ /dev/null @@ -1,23 +0,0 @@ -package codechicken.lib.block.property.unlisted; - -import net.minecraft.tileentity.TileEntity; - -/** - * Created by covers1624 on 28/02/2017. - */ -public class UnlistedTileEntityProperty extends UnlistedPropertyBase { - - public UnlistedTileEntityProperty(String name) { - super(name); - } - - @Override - public Class getType() { - return TileEntity.class; - } - - @Override - public String valueToString(TileEntity value) { - return value.toString(); - } -} diff --git a/dependencies/main/java/codechicken/lib/colour/Colour.java b/dependencies/main/java/codechicken/lib/colour/Colour.java deleted file mode 100644 index 569854789e..0000000000 --- a/dependencies/main/java/codechicken/lib/colour/Colour.java +++ /dev/null @@ -1,208 +0,0 @@ -package codechicken.lib.colour; - -import codechicken.lib.config.ConfigTag.IConfigType; -import codechicken.lib.math.MathHelper; -import codechicken.lib.util.Copyable; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public abstract class Colour implements Copyable { - - public static IConfigType configRGB = new IConfigType() { - @Override - public String configValue(Colour entry) { - String s = Long.toString(((long) entry.rgb()) << 32 >>> 32, 16); - while (s.length() < 6) { - s = "0" + s; - } - return "0x" + s.toUpperCase(); - } - - private final Pattern patternRGB = Pattern.compile("(\\d+),(\\d+),(\\d+)"); - - @Override - public Colour valueOf(String text) throws Exception { - Matcher matcherRGB = patternRGB.matcher(text.replaceAll("\\s", "")); - if (matcherRGB.matches()) { - return new ColourRGBA(Integer.parseInt(matcherRGB.group(1)), Integer.parseInt(matcherRGB.group(2)), Integer.parseInt(matcherRGB.group(3)), 0xFF); - } - - int hex = (int) Long.parseLong(text.replace("0x", ""), 16); - return new ColourRGBA(hex << 8 | 0xFF); - } - }; - - public byte r; - public byte g; - public byte b; - public byte a; - - public Colour(int r, int g, int b, int a) { - this.r = (byte) r; - this.g = (byte) g; - this.b = (byte) b; - this.a = (byte) a; - } - - public Colour(Colour colour) { - r = colour.r; - g = colour.g; - b = colour.b; - a = colour.a; - } - - @SideOnly (Side.CLIENT) - public void glColour() { - GlStateManager.color((r & 0xFF) / 255F, (g & 0xFF) / 255F, (b & 0xFF) / 255F, (a & 0xFF) / 255F); - } - - @SideOnly (Side.CLIENT) - public void glColour(int a) { - GlStateManager.color((r & 0xFF) / 255F, (g & 0xFF) / 255F, (b & 0xFF) / 255F, a / 255F); - } - - public abstract int pack(); - - public abstract float[] packArray(); - - @Override - public String toString() { - return getClass().getSimpleName() + "[0x" + Integer.toHexString(pack()).toUpperCase() + "]"; - } - - public Colour add(Colour colour2) { - a += colour2.a; - r += colour2.r; - g += colour2.g; - b += colour2.b; - return this; - } - - public Colour sub(Colour colour2) { - int ia = (a & 0xFF) - (colour2.a & 0xFF); - int ir = (r & 0xFF) - (colour2.r & 0xFF); - int ig = (g & 0xFF) - (colour2.g & 0xFF); - int ib = (b & 0xFF) - (colour2.b & 0xFF); - a = (byte) (ia < 0 ? 0 : ia); - r = (byte) (ir < 0 ? 0 : ir); - g = (byte) (ig < 0 ? 0 : ig); - b = (byte) (ib < 0 ? 0 : ib); - return this; - } - - public Colour invert() { - a = (byte) (0xFF - (a & 0xFF)); - r = (byte) (0xFF - (r & 0xFF)); - g = (byte) (0xFF - (g & 0xFF)); - b = (byte) (0xFF - (b & 0xFF)); - return this; - } - - public Colour multiply(Colour colour2) { - a = (byte) ((a & 0xFF) * ((colour2.a & 0xFF) / 255D)); - r = (byte) ((r & 0xFF) * ((colour2.r & 0xFF) / 255D)); - g = (byte) ((g & 0xFF) * ((colour2.g & 0xFF) / 255D)); - b = (byte) ((b & 0xFF) * ((colour2.b & 0xFF) / 255D)); - return this; - } - - public Colour scale(double d) { - a = (byte) ((a & 0xFF) * d); - r = (byte) ((r & 0xFF) * d); - g = (byte) ((g & 0xFF) * d); - b = (byte) ((b & 0xFF) * d); - return this; - } - - public Colour interpolate(Colour colour2, double d) { - return this.add(colour2.copy().sub(this).scale(d)); - } - - public Colour multiplyC(double d) { - r = (byte) MathHelper.clip((r & 0xFF) * d, 0, 255); - g = (byte) MathHelper.clip((g & 0xFF) * d, 0, 255); - b = (byte) MathHelper.clip((b & 0xFF) * d, 0, 255); - - return this; - } - - public abstract Colour copy(); - - public int rgb() { - return (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF); - } - - public int argb() { - return (a & 0xFF) << 24 | (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF); - } - - public int rgba() { - return (r & 0xFF) << 24 | (g & 0xFF) << 16 | (b & 0xFF) << 8 | (a & 0xFF); - } - - public abstract Colour set(int colour); - - public Colour set(Colour colour) { - r = colour.r; - g = colour.g; - b = colour.b; - a = colour.a; - return this; - } - - public static int packRGBA(byte r, byte g, byte b, byte a) { - return (r & 0xFF) << 24 | (g & 0xFF) << 16 | (b & 0xFF) << 8 | (a & 0xFF); - } - - public static int packARGB(byte r, byte g, byte b, byte a) { - return (a & 0xFF) << 24 | (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF); - } - - public static int packRGBA(int r, int g, int b, int a) { - return r << 24 | g << 16 | b << 8 | a; - } - - public static int packARGB(int r, int g, int b, int a) { - return a << 24 | r << 16 | g << 8 | b; - } - - public static int packRGBA(double r, double g, double b, double a) { - return (int) (r * 255) << 24 | (int) (g * 255) << 16 | (int) (b * 255) << 8 | (int) (a * 255); - } - - public static int packARGB(double r, double g, double b, double a) { - return (int) (a * 255) << 24 | (int) (r * 255) << 16 | (int) (g * 255) << 8 | (int) (b * 255); - } - - public static int packRGBA(float[] data) { - return packRGBA(data[0], data[1], data[2], data[3]); - } - - public static int packARGB(float[] data) { - return packARGB(data[0], data[1], data[2], data[3]); - } - - public static void glColourRGBA(int colour) { - float r = ((colour >> 24) & 0xFF) / 255F; - float g = ((colour >> 16) & 0xFF) / 255F; - float b = ((colour >> 8) & 0xFF) / 255F; - float a = (colour & 0xFF) / 255F; - GlStateManager.color(r, g, b, a); - } - - public static void glColourARGB(int colour) { - float r = ((colour >> 16) & 0xFF) / 255F; - float g = ((colour >> 8) & 0xFF) / 255F; - float b = (colour & 0xFF) / 255F; - float a = ((colour >> 24 & 0xFF)) / 255F; - GlStateManager.color(r, g, b, a); - } - - public boolean equals(Colour colour) { - return colour != null && rgba() == colour.rgba(); - } -} diff --git a/dependencies/main/java/codechicken/lib/colour/ColourARGB.java b/dependencies/main/java/codechicken/lib/colour/ColourARGB.java deleted file mode 100644 index 9d3a9ddbc9..0000000000 --- a/dependencies/main/java/codechicken/lib/colour/ColourARGB.java +++ /dev/null @@ -1,37 +0,0 @@ -package codechicken.lib.colour; - -public class ColourARGB extends Colour { - - public ColourARGB(int colour) { - super((colour >> 16) & 0xFF, (colour >> 8) & 0xFF, colour & 0xFF, (colour >> 24) & 0xFF); - } - - public ColourARGB(int a, int r, int g, int b) { - super(r, g, b, a); - } - - public ColourARGB(ColourARGB colour) { - super(colour); - } - - public ColourARGB copy() { - return new ColourARGB(this); - } - - @Override - public Colour set(int colour) { - return set(new ColourARGB(colour)); - } - - public int pack() { - return pack(this); - } - - public float[] packArray() { - return new float[] { (a & 0xFF) / 255, (r & 0xFF) / 255, (g & 0xFF) / 255, (b & 0xFF) / 255 }; - } - - public static int pack(Colour colour) { - return (colour.a & 0xFF) << 24 | (colour.r & 0xFF) << 16 | (colour.g & 0xFF) << 8 | (colour.b & 0xFF); - } -} diff --git a/dependencies/main/java/codechicken/lib/colour/ColourRGBA.java b/dependencies/main/java/codechicken/lib/colour/ColourRGBA.java deleted file mode 100644 index 328c57cf4a..0000000000 --- a/dependencies/main/java/codechicken/lib/colour/ColourRGBA.java +++ /dev/null @@ -1,67 +0,0 @@ -package codechicken.lib.colour; - -public class ColourRGBA extends Colour { - - public ColourRGBA(int colour) { - super((colour >> 24) & 0xFF, (colour >> 16) & 0xFF, (colour >> 8) & 0xFF, colour & 0xFF); - } - - public ColourRGBA(double r, double g, double b, double a) { - super((int) (255 * r), (int) (255 * g), (int) (255 * b), (int) (255 * a)); - } - - public ColourRGBA(int r, int g, int b, int a) { - super(r, g, b, a); - } - - public ColourRGBA(float[] data) { - this(data[0], data[1], data[2], data[3]); - } - - public ColourRGBA(ColourRGBA colour) { - super(colour); - } - - public int pack() { - return pack(this); - } - - public float[] packArray() { - return new float[] { (r & 0xFF) / 255, (g & 0xFF) / 255, (b & 0xFF) / 255, (a & 0xFF) / 255 }; - } - - @Override - public Colour copy() { - return new ColourRGBA(this); - } - - @Override - public Colour set(int colour) { - return set(new ColourRGBA(colour)); - } - - public static int pack(Colour colour) { - return (colour.r & 0xFF) << 24 | (colour.g & 0xFF) << 16 | (colour.b & 0xFF) << 8 | (colour.a & 0xFF); - } - - public static int multiply(int c1, int c2) { - if (c1 == -1) { - return c2; - } - if (c2 == -1) { - return c1; - } - int r = (((c1 >>> 24) * (c2 >>> 24)) & 0xFF00) << 16; - int g = (((c1 >> 16 & 0xFF) * (c2 >> 16 & 0xFF)) & 0xFF00) << 8; - int b = ((c1 >> 8 & 0xFF) * (c2 >> 8 & 0xFF)) & 0xFF00; - int a = ((c1 & 0xFF) * (c2 & 0xFF)) >> 8; - return r | g | b | a; - } - - public static int multiplyC(int c, float f) { - int r = (int) ((c >>> 24) * f); - int g = (int) ((c >> 16 & 0xFF) * f); - int b = (int) ((c >> 8 & 0xFF) * f); - return r << 24 | g << 16 | b << 8 | c & 0xFF; - } -} diff --git a/dependencies/main/java/codechicken/lib/colour/CustomGradient.java b/dependencies/main/java/codechicken/lib/colour/CustomGradient.java deleted file mode 100644 index 382e8323e4..0000000000 --- a/dependencies/main/java/codechicken/lib/colour/CustomGradient.java +++ /dev/null @@ -1,35 +0,0 @@ -package codechicken.lib.colour; - -import codechicken.lib.math.MathHelper; -import codechicken.lib.texture.TextureUtils; -import net.minecraft.util.ResourceLocation; - -import java.awt.image.BufferedImage; - -public class CustomGradient { - - public int[] gradient; - - public CustomGradient(ResourceLocation textureFile) { - BufferedImage img = TextureUtils.loadBufferedImage(textureFile); - if (img == null) { - throw new RuntimeException("File not found: " + textureFile.toString()); - } - - int[] data = new int[img.getWidth()]; - img.getRGB(0, 0, img.getWidth(), 1, data, 0, img.getWidth()); - gradient = new int[img.getWidth()]; - for (int i = 0; i < data.length; i++) { - gradient[i] = (data[i] << 8) | (((data[i]) >> 24) & 0xFF); - } - } - - public ColourRGBA getColour(double position) { - return new ColourRGBA(getColourI(position)); - } - - public int getColourI(double position) { - int off = (int) MathHelper.clip(gradient.length * position, 0, gradient.length - 1); - return gradient[off]; - } -} diff --git a/dependencies/main/java/codechicken/lib/colour/EnumColour.java b/dependencies/main/java/codechicken/lib/colour/EnumColour.java deleted file mode 100644 index 5bb9923438..0000000000 --- a/dependencies/main/java/codechicken/lib/colour/EnumColour.java +++ /dev/null @@ -1,193 +0,0 @@ -package codechicken.lib.colour; - -import codechicken.lib.util.TripleABC; -import com.google.common.collect.ImmutableList; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IStringSerializable; -import net.minecraftforge.oredict.OreDictionary; - -/** - * Created by covers1624 on 16/09/2016. - */ -public enum EnumColour implements IStringSerializable { - //Formatted like this due to the cancerous nature of the constructors.. - //TODO Should we have our own localizations for this? - //@formatter:off - WHITE ("white", "dyeWhite", "item.fireworksCharge.white", 0xFFFFFF), - ORANGE ("orange", "dyeOrange", "item.fireworksCharge.orange", 0xC06300), - MAGENTA ("magenta", "dyeMagenta", "item.fireworksCharge.magenta", 0xB51AB5), - LIGHT_BLUE("light_blue", "dyeLightBlue", "item.fireworksCharge.lightBlue", 0x6F84F1), - YELLOW ("yellow", "dyeYellow", "item.fireworksCharge.yellow", 0xBFBF00), - LIME ("lime", "dyeLime", "item.fireworksCharge.lime", 0x6BF100), - PINK ("pink", "dyePink", "item.fireworksCharge.pink", 0xF14675), - GRAY ("gray", "dyeGray", "item.fireworksCharge.gray", 0x535353), - LIGHT_GRAY("light_gray", "dyeLightGray", "item.fireworksCharge.silver", 0x939393), - CYAN ("cyan", "dyeCyan", "item.fireworksCharge.cyan", 0x008787), - PURPLE ("purple", "dyePurple", "item.fireworksCharge.purple", 0x5E00C0), - BLUE ("blue", "dyeBlue", "item.fireworksCharge.blue", 0x1313C0), - BROWN ("brown", "dyeBrown", "item.fireworksCharge.brown", 0x4F2700), - GREEN ("green", "dyeGreen", "item.fireworksCharge.green", 0x088700), - RED ("red", "dyeRed", "item.fireworksCharge.red", 0xA20F06), - BLACK ("black", "dyeBlack", "item.fireworksCharge.black", 0x1F1F1F); - //@formatter:on - - private String minecraftName; - private String oreDictionaryName; - private String unlocalizedName; - private int rgb; - - private static final ImmutableList> mixMap; - - EnumColour(String minecraftName, String oreDictionaryName, String unlocalizedName, int rgb) { - this.minecraftName = minecraftName; - this.oreDictionaryName = oreDictionaryName; - this.unlocalizedName = unlocalizedName; - this.rgb = rgb; - } - - @Override - public String getName() { - return minecraftName; - } - - public String getMinecraftName() { - return minecraftName; - } - - public String getOreDictionaryName() { - return oreDictionaryName; - } - - public String getUnlocalizedName() { - return unlocalizedName; - } - - public int getWoolDamage() { - return ordinal(); - } - - public int getDyeDamage() { - return 15 - ordinal(); - } - - public int rgba() { - return rgba(0xFF); - } - - public int rgba(int alpha) { - return rgb << 8 | (alpha & 0xFF); - } - - public int argb() { - return argb(0xFF); - } - - public int argb(int alpha) { - return (alpha & 0xFF) << 24 | rgb; - } - - public int rgb() { - return rgb; - } - - public float rF() { - return (rgb >> 16 & 255) / 255.0f; - } - - public float gF() { - return (rgb >> 8 & 255) / 255.0f; - } - - public float bF() { - return (rgb & 255) / 255.0f; - } - - public ColourRGBA getColour() { - return getColour(0xFF); - } - - public ColourRGBA getColour(int alpha) { - return new ColourRGBA(rgba(alpha)); - } - - public EnumColour mix(EnumColour b) { - return mix(this, b); - } - - public static EnumColour mix(EnumColour a, EnumColour b) { - if (a == b) { - return a; - } - synchronized (mixMap) { - for (TripleABC triple : mixMap) { - if ((triple.getA().equals(a) && triple.getB().equals(b)) || (triple.getA().equals(b) && triple.getB().equals(a))) { - return triple.getC(); - } - } - } - return null; - } - - public static EnumColour fromWoolID(int id) { - return values()[id]; - } - - public static EnumColour fromDyeID(int id) { - return values()[15 - id]; - } - - public static EnumColour fromOreDictID(String id) { - for (EnumColour c : values()) { - if (c.getOreDictionaryName().equals(id)) { - return c; - } - } - return null; - } - - public static EnumColour fromStack(ItemStack stack) { - for (int id : OreDictionary.getOreIDs(stack)) { - EnumColour c = fromOreDictID(OreDictionary.getOreName(id)); - if (c != null) { - return c; - } - } - return null; - } - - public static EnumColour fromName(String name) { - for (EnumColour colour : values()) { - if (colour.getName().equalsIgnoreCase(name)) { - return colour; - } - } - return null; - } - - static { - ImmutableList.Builder> builder = ImmutableList.builder(); - //WHITE - builder.add(getTriple(YELLOW, RED, ORANGE)); - builder.add(getTriple(PINK, PURPLE, MAGENTA)); - builder.add(getTriple(WHITE, BLUE, LIGHT_BLUE)); - //YELLOW - builder.add(getTriple(WHITE, GREEN, LIME)); - builder.add(getTriple(WHITE, RED, PINK)); - builder.add(getTriple(WHITE, BLACK, GRAY)); - builder.add(getTriple(WHITE, GRAY, LIGHT_GRAY)); - builder.add(getTriple(BLUE, GREEN, CYAN)); - builder.add(getTriple(BLUE, RED, PURPLE)); - //Blue - builder.add(getTriple(ORANGE, RED, BROWN)); - builder.add(getTriple(YELLOW, BLUE, GREEN)); - //RED - //BLACK - - mixMap = builder.build(); - } - - private static TripleABC getTriple(EnumColour a, EnumColour b, EnumColour result) { - return new TripleABC(a, b, result); - } - -} diff --git a/dependencies/main/java/codechicken/lib/config/ConfigFile.java b/dependencies/main/java/codechicken/lib/config/ConfigFile.java deleted file mode 100644 index 4e01079084..0000000000 --- a/dependencies/main/java/codechicken/lib/config/ConfigFile.java +++ /dev/null @@ -1,117 +0,0 @@ -package codechicken.lib.config; - -import java.io.*; - -public class ConfigFile extends ConfigTagParent { - - public static final byte[] crlf = new byte[] { 0xD, 0xA }; - - public File file; - private boolean loading; - - public ConfigFile(File file) { - newlinemode = 2; - load(file); - } - - protected ConfigFile() { - } - - protected void load(File file) { - try { - if (!file.getParentFile().exists()) { - file.getParentFile().mkdirs(); - } - if (!file.exists()) { - file.createNewFile(); - } - } catch (IOException e) { - throw new RuntimeException(e); - } - this.file = file; - loadConfig(); - } - - protected void loadConfig() { - loading = true; - BufferedReader reader; - try { - reader = new BufferedReader(new FileReader(file)); - - while (true) { - reader.mark(2000); - String line = reader.readLine(); - if (line != null && line.startsWith("#")) { - if (comment == null || comment.equals("")) { - comment = line.substring(1); - } else { - comment = comment + "\n" + line.substring(1); - } - } else { - reader.reset(); - break; - } - } - loadChildren(reader); - reader.close(); - - } catch (IOException e) { - throw new RuntimeException(e); - } - - loading = false; - } - - @Override - public ConfigFile setComment(String header) { - super.setComment(header); - return this; - } - - @Override - public ConfigFile setSortMode(int mode) { - super.setSortMode(mode); - return this; - } - - @Override - public String getNameQualifier() { - return ""; - } - - public static String readLine(BufferedReader reader) throws IOException { - String line = reader.readLine(); - return line == null ? null : line.replace("\t", ""); - } - - public static void writeLine(PrintWriter writer, String line, int tabs) { - for (int i = 0; i < tabs; i++) { - writer.print('\t'); - } - - writer.println(line); - } - - public void saveConfig() { - if (loading) { - return; - } - - PrintWriter writer; - try { - writer = new PrintWriter(file); - } catch (FileNotFoundException e) { - throw new RuntimeException(e); - } - - writeComment(writer, 0); - ConfigFile.writeLine(writer, "", 0); - saveTagTree(writer, 0, ""); - writer.flush(); - writer.close(); - } - - public boolean isLoading() { - return loading; - } -} diff --git a/dependencies/main/java/codechicken/lib/config/ConfigTag.java b/dependencies/main/java/codechicken/lib/config/ConfigTag.java deleted file mode 100644 index 1dd11d13bd..0000000000 --- a/dependencies/main/java/codechicken/lib/config/ConfigTag.java +++ /dev/null @@ -1,252 +0,0 @@ -package codechicken.lib.config; - -import java.io.PrintWriter; - -public class ConfigTag extends ConfigTagParent { - - public ConfigTagParent parent; - public String name; - public String qualifiedname; - public String value; - public boolean brace; - public boolean newline; - public int position = Integer.MAX_VALUE; - - private int IDBase; - - public interface IConfigType { - - String configValue(T entry); - - T valueOf(String text) throws Exception; - } - - public ConfigTag(ConfigTagParent parent, String name) { - this.parent = parent; - this.name = name; - qualifiedname = parent.getNameQualifier() + name; - newline = parent.newlinemode == 2; - parent.addChild(this); - } - - @Override - public String getNameQualifier() { - return qualifiedname + "."; - } - - @Override - public void saveConfig() { - parent.saveConfig(); - } - - /** - * Called when the tag is loaded from a config file as opposed to constructed by a mod - * - * @return this - */ - public ConfigTag onLoaded() { - return this; - } - - public void setValue(String value) { - this.value = value; - saveConfig(); - } - - public void setDefaultValue(String defaultValue) { - if (value == null) { - value = defaultValue; - saveConfig(); - } - } - - public void setIntValue(int i) { - setValue(Integer.toString(i)); - } - - public void setBooleanValue(boolean b) { - setValue(Boolean.toString(b)); - } - - public void setHexValue(int i) { - setValue("0x" + Long.toString(((long) i) << 32 >>> 32, 16)); - } - - public void set(IConfigType type, T entry) { - setValue(type.configValue(entry)); - } - - public String getValue() { - return value; - } - - public String getValue(String defaultValue) { - setDefaultValue(defaultValue); - return value; - } - - public int getIntValue() { - return Integer.parseInt(getValue()); - } - - public int getIntValue(int defaultValue) { - try { - if (value != null) { - return getIntValue(); - } - } catch (NumberFormatException ignored) { - } - - setIntValue(defaultValue); - return defaultValue; - } - - public boolean getBooleanValue() { - String value = getValue(); - if (value != null && (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes"))) { - return true; - } else if (value != null && (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("no"))) { - return false; - } - - throw new NumberFormatException(qualifiedname + ".value=" + value); - } - - public boolean getBooleanValue(boolean defaultValue) { - try { - if (value != null) { - return getBooleanValue(); - } - } catch (NumberFormatException ignored) { - } - - setBooleanValue(defaultValue); - return defaultValue; - } - - public int getHexValue() { - return (int) Long.parseLong(getValue().replace("0x", ""), 16); - } - - public int getHexValue(int defaultValue) { - try { - if (value != null) { - return getHexValue(); - } - } catch (NumberFormatException ignored) { - } - - setHexValue(defaultValue); - return defaultValue; - } - - public T get(IConfigType type) { - try { - return type.valueOf(getValue()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public T get(IConfigType type, T defaultValue) { - try { - if (value != null) { - return get(type); - } - } catch (Exception ignored) { - } - - set(type, defaultValue); - return defaultValue; - } - - public void save(PrintWriter writer, int tabs, String bracequalifier, boolean first) { - String vname; - if (qualifiedname.contains(".") && bracequalifier.length() > 0) { - vname = qualifiedname.substring(bracequalifier.length() + 1); - } else { - vname = qualifiedname; - } - - if (newline && !first) { - ConfigFile.writeLine(writer, "", tabs); - } - - writeComment(writer, tabs); - if (value != null) { - ConfigFile.writeLine(writer, vname + "=" + value, tabs); - } - - if (!hasChildTags()) { - return; - } - - if (brace) { - if (value == null) { - ConfigFile.writeLine(writer, vname, tabs); - } - ConfigFile.writeLine(writer, "{", tabs); - saveTagTree(writer, tabs + 1, qualifiedname); - ConfigFile.writeLine(writer, "}", tabs); - } else { - saveTagTree(writer, tabs, bracequalifier); - } - } - - @Override - public ConfigTag setComment(String comment) { - super.setComment(comment); - return this; - } - - @Override - public ConfigTag setSortMode(int mode) { - super.setSortMode(mode); - return this; - } - - public ConfigTag setNewLine(boolean b) { - newline = b; - saveConfig(); - return this; - } - - public ConfigTag useBraces() { - brace = true; - if (parent.newlinemode == 1) { - newline = true; - } - - saveConfig(); - return this; - } - - public ConfigTag setPosition(int pos) { - position = pos; - saveConfig(); - return this; - } - - public boolean containsTag(String tagname) { - return getTag(tagname, false) != null; - } - - public int getId(String name, int defaultValue) { - return getTag(name).getIntValue(defaultValue); - } - - public int getId(String name) { - int ret = getId(name, IDBase); - IDBase = ret + 1; - return ret; - } - - public int getAcheivementId(String name, int defaultValue) { - return getTag(name).getIntValue(defaultValue); - } - - public ConfigTag setBaseID(int i) { - IDBase = i; - return this; - } -} diff --git a/dependencies/main/java/codechicken/lib/config/ConfigTagParent.java b/dependencies/main/java/codechicken/lib/config/ConfigTagParent.java deleted file mode 100644 index be5d683f7d..0000000000 --- a/dependencies/main/java/codechicken/lib/config/ConfigTagParent.java +++ /dev/null @@ -1,215 +0,0 @@ -package codechicken.lib.config; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.*; -import java.util.Map.Entry; - -public abstract class ConfigTagParent { - - public static class TagOrderComparator implements Comparator { - - int sortMode; - - public TagOrderComparator(int sortMode) { - this.sortMode = sortMode; - } - - public int compare(ConfigTag o1, ConfigTag o2) { - if (o1.position != o2.position) { - return compareInt(o1.position, o2.position); - } - if (o1.brace != o2.brace) { - return o1.brace ? 1 : -1;//braced one goes after - } - switch (sortMode) { - case 1: - if (o1.value.equals(o2.value)) { - return 0; - } - if (o1.value == null) { - return 1; - } - if (o2.value == null) { - return -1; - } - return o1.value.compareTo(o2.value); - default: - return o1.name.compareTo(o2.name); - } - } - - private int compareInt(int a, int b) { - return a == b ? 0 : a < b ? -1 : 1; - } - } - - private TreeMap childtags = new TreeMap(); - public String comment; - /** - * 0 = name, 1 = value - */ - public int sortMode = 0; - /** - * The mode for determining when child tags should leave a blank line between them and the one above - * 0 = never, 1 = when braced, 2 = always - */ - public int newlinemode = 1; - - public abstract void saveConfig(); - - public abstract String getNameQualifier(); - - public ConfigTagParent setComment(String comment) { - this.comment = comment; - saveConfig(); - return this; - } - - public ConfigTagParent setSortMode(int mode) { - sortMode = mode; - saveConfig(); - return this; - } - - public ConfigTagParent setNewLineMode(int mode) { - newlinemode = mode; - for (Entry entry : childtags.entrySet()) { - ConfigTag tag = entry.getValue(); - if (newlinemode == 0) { - tag.newline = false; - } else if (newlinemode == 1) { - tag.newline = tag.brace; - } else if (newlinemode == 2) { - tag.newline = true; - } - } - saveConfig(); - return this; - } - - public Map childTagMap() { - return childtags; - } - - public boolean hasChildTags() { - return !childtags.isEmpty(); - } - - public boolean containsTag(String tagname) { - return getTag(tagname, false) != null; - } - - public ConfigTag getNewTag(String tagname) { - return new ConfigTag(this, tagname); - } - - public ConfigTag getTag(String tagname, boolean create) { - int dotpos = tagname.indexOf("."); - String basetagname = dotpos == -1 ? tagname : tagname.substring(0, dotpos); - ConfigTag basetag = childtags.get(basetagname); - if (basetag == null) { - if (!create) { - return null; - } - - basetag = getNewTag(basetagname); - saveConfig(); - } - if (dotpos == -1) { - return basetag; - } - - return basetag.getTag(tagname.substring(dotpos + 1), create); - } - - public ConfigTag getTag(String tagname) { - return getTag(tagname, true); - } - - public boolean removeTag(String tagname) { - ConfigTag tag = getTag(tagname, false); - if (tag == null) { - return false; - } - - int dotpos = tagname.lastIndexOf("."); - String lastpart = dotpos == -1 ? tagname : tagname.substring(dotpos + 1, tagname.length()); - if (tag.parent != null) { - boolean ret = tag.parent.childtags.remove(lastpart) != null; - if (ret) { - saveConfig(); - } - return ret; - } - - return false; - } - - public void addChild(ConfigTag tag) { - childtags.put(tag.name, tag); - } - - public ArrayList getSortedTagList() { - ArrayList taglist = new ArrayList(childtags.size()); - for (Entry tag : childtags.entrySet()) { - taglist.add((T) tag.getValue()); - } - - Collections.sort(taglist, new TagOrderComparator(sortMode)); - return taglist; - } - - public void loadChildren(BufferedReader reader) { - String comment = ""; - String bracequalifier = ""; - try { - while (true) { - String line = ConfigFile.readLine(reader); - if (line == null) { - break; - } - if (line.startsWith("#")) { - if (comment.equals("")) { - comment = line.substring(1); - } else { - comment = comment + "\n" + line.substring(1); - } - } else if (line.contains("=")) { - String qualifiedname = line.substring(0, line.indexOf("=")); - getTag(qualifiedname).onLoaded().setComment(comment).setValue(line.substring(line.indexOf("=") + 1)); - comment = ""; - bracequalifier = qualifiedname; - } else if (line.equals("{")) { - getTag(bracequalifier).setComment(comment).useBraces().loadChildren(reader); - comment = ""; - bracequalifier = ""; - } else if (line.equals("}")) { - break; - } else { - bracequalifier = line; - } - } - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void saveTagTree(PrintWriter writer, int tabs, String bracequalifier) { - boolean first = true; - for (ConfigTag tag : getSortedTagList()) { - tag.save(writer, tabs, bracequalifier, first); - first = false; - } - } - - public void writeComment(PrintWriter writer, int tabs) { - if (comment != null && !comment.equals("")) { - String[] comments = comment.split("\n"); - for (int i = 0; i < comments.length; i++) { - ConfigFile.writeLine(writer, "#" + comments[i], tabs); - } - } - } -} diff --git a/dependencies/main/java/codechicken/lib/config/DefaultingConfigFile.java b/dependencies/main/java/codechicken/lib/config/DefaultingConfigFile.java deleted file mode 100644 index 829aa40eee..0000000000 --- a/dependencies/main/java/codechicken/lib/config/DefaultingConfigFile.java +++ /dev/null @@ -1,20 +0,0 @@ -package codechicken.lib.config; - -import java.io.File; - -public class DefaultingConfigFile extends ConfigFile { - - public DefaultingConfigFile(File file) { - super(); - if (file.exists()) { - load(file); - } - } - - @Override - public void saveConfig() { - if (file != null) { - super.saveConfig(); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/config/SimpleProperties.java b/dependencies/main/java/codechicken/lib/config/SimpleProperties.java deleted file mode 100644 index 652d088eeb..0000000000 --- a/dependencies/main/java/codechicken/lib/config/SimpleProperties.java +++ /dev/null @@ -1,128 +0,0 @@ -package codechicken.lib.config; - -import java.io.*; -import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.Map.Entry; - -public class SimpleProperties { - - public HashMap propertyMap = new HashMap(); - public File propertyFile; - public boolean saveOnChange = false; - public String encoding; - - private boolean loading = false; - - public SimpleProperties(File file, boolean saveOnChange, String encoding) { - propertyFile = file; - this.saveOnChange = saveOnChange; - this.encoding = encoding; - } - - public SimpleProperties(File file, boolean saveOnChange) { - this(file, saveOnChange, Charset.defaultCharset().name()); - } - - public SimpleProperties(File file) { - this(file, true); - } - - public void load() { - clear(); - loading = true; - - try { - BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(propertyFile), encoding)); - while (true) { - String read = reader.readLine(); - if (read == null) { - break; - } - - int equalIndex = read.indexOf('='); - if (equalIndex == -1) { - continue; - } - - setProperty(read.substring(0, equalIndex), read.substring(equalIndex + 1)); - } - reader.close(); - } catch (Exception e) { - throw new RuntimeException(e); - } - loading = false; - } - - public void save() { - try { - PrintStream writer = new PrintStream(propertyFile); - - for (Entry entry : propertyMap.entrySet()) { - writer.println(entry.getKey() + "=" + entry.getValue()); - } - - writer.close(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public void clear() { - propertyMap.clear(); - } - - public boolean hasProperty(String key) { - return propertyMap.containsKey(key); - } - - public void removeProperty(String key) { - if (propertyMap.remove(key) != null && saveOnChange && !loading) { - save(); - } - } - - public void setProperty(String key, int value) { - setProperty(key, Integer.toString(value)); - } - - public void setProperty(String key, boolean value) { - setProperty(key, Boolean.toString(value)); - } - - public void setProperty(String key, String value) { - propertyMap.put(key, value); - if (saveOnChange && !loading) { - save(); - } - } - - public int getProperty(String property, int defaultvalue) { - try { - return Integer.parseInt(getProperty(property, Integer.toString(defaultvalue))); - } catch (NumberFormatException nfe) { - return defaultvalue; - } - } - - public boolean getProperty(String property, boolean defaultvalue) { - try { - return Boolean.parseBoolean(getProperty(property, Boolean.toString(defaultvalue))); - } catch (NumberFormatException nfe) { - return defaultvalue; - } - } - - public String getProperty(String property, String defaultvalue) { - String value = propertyMap.get(property); - if (value == null) { - setProperty(property, defaultvalue); - return defaultvalue; - } - return value; - } - - public String getProperty(String property) { - return propertyMap.get(property); - } -} diff --git a/dependencies/main/java/codechicken/lib/data/MCDataHandler.java b/dependencies/main/java/codechicken/lib/data/MCDataHandler.java deleted file mode 100644 index 30e2d984fc..0000000000 --- a/dependencies/main/java/codechicken/lib/data/MCDataHandler.java +++ /dev/null @@ -1,8 +0,0 @@ -package codechicken.lib.data; - -/** - * Created by covers1624 on 5/28/2016. - */ -public interface MCDataHandler extends MCDataInput, MCDataOutput { - -} diff --git a/dependencies/main/java/codechicken/lib/data/MCDataIO.java b/dependencies/main/java/codechicken/lib/data/MCDataIO.java deleted file mode 100644 index a5d3de4329..0000000000 --- a/dependencies/main/java/codechicken/lib/data/MCDataIO.java +++ /dev/null @@ -1,134 +0,0 @@ -package codechicken.lib.data; - -import com.google.common.base.Charsets; -import io.netty.handler.codec.EncoderException; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -public class MCDataIO { - - /** - * PacketBuffer.readVarIntFromBuffer - */ - public static int readVarInt(MCDataInput in) { - int i = 0; - int j = 0; - byte b0; - - do { - b0 = in.readByte(); - i |= (b0 & 127) << j++ * 7; - - if (j > 5) { - throw new RuntimeException("VarInt too big"); - } - } while ((b0 & 128) == 128); - - return i; - } - - public static int readVarShort(MCDataInput in) { - int low = in.readUShort(); - int high = 0; - if ((low & 0x8000) != 0) { - low = low & 0x7FFF; - high = in.readUByte(); - } - return ((high & 0xFF) << 15) | low; - } - - public static String readString(MCDataInput in) { - return new String(in.readArray(in.readVarInt()), Charsets.UTF_8); - } - - public static ItemStack readItemStack(MCDataInput in) { - ItemStack item = null; - short itemID = in.readShort(); - - if (itemID >= 0) { - int stackSize = in.readVarInt(); - short damage = in.readShort(); - item = new ItemStack(Item.getItemById(itemID), stackSize, damage); - item.setTagCompound(in.readNBTTagCompound()); - } - - return item; - } - - public static FluidStack readFluidStack(MCDataInput in) { - FluidStack fluid = null; - String fluidName = in.readString(); - - if (fluidName.length() > 0) { - fluid = new FluidStack(FluidRegistry.getFluid(fluidName), in.readVarInt(), in.readNBTTagCompound()); - } - - return fluid; - } - - /** - * PacketBuffer.writeVarIntToBuffer - */ - public static void writeVarInt(MCDataOutput out, int i) { - while ((i & 0x80) != 0) { - out.writeByte(i & 0x7F | 0x80); - i >>>= 7; - } - - out.writeByte(i); - } - - /** - * ByteBufUtils.readVarShort - */ - public static void writeVarShort(MCDataOutput out, int s) { - int low = s & 0x7FFF; - int high = (s & 0x7F8000) >> 15; - if (high != 0) { - low |= 0x8000; - } - out.writeShort(low); - if (high != 0) { - out.writeByte(high); - } - } - - /** - * PacketBuffer.writeString - */ - public static void writeString(MCDataOutput out, String string) { - byte[] abyte = string.getBytes(Charsets.UTF_8); - if (abyte.length > 32767) { - throw new EncoderException("String too big (was " + string.length() + " bytes encoded, max " + 32767 + ")"); - } - - out.writeVarInt(abyte.length); - out.writeArray(abyte); - } - - /** - * Supports large stacks by writing stackSize as a varInt - */ - public static void writeItemStack(MCDataOutput out, ItemStack stack) { - if (stack == null) { - out.writeShort(-1); - } else { - out.writeShort(Item.getIdFromItem(stack.getItem())); - out.writeVarInt(stack.stackSize); - out.writeShort(stack.getItemDamage()); - out.writeNBTTagCompound(stack.getItem().getShareTag() ? stack.getTagCompound() : null); - } - } - - public static void writeFluidStack(MCDataOutput out, FluidStack fluid) { - if (fluid == null || FluidRegistry.getFluidName(fluid) == null) { - out.writeString(""); - } else { - out.writeString(FluidRegistry.getFluidName(fluid)); - out.writeVarInt(fluid.amount); - out.writeNBTTagCompound(fluid.tag); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/data/MCDataInput.java b/dependencies/main/java/codechicken/lib/data/MCDataInput.java deleted file mode 100644 index aea7147c9c..0000000000 --- a/dependencies/main/java/codechicken/lib/data/MCDataInput.java +++ /dev/null @@ -1,47 +0,0 @@ -package codechicken.lib.data; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fluids.FluidStack; - -public interface MCDataInput { - - long readLong(); - - int readInt(); - - short readShort(); - - int readUShort(); - - byte readByte(); - - short readUByte(); - - double readDouble(); - - float readFloat(); - - boolean readBoolean(); - - char readChar(); - - int readVarShort(); - - int readVarInt(); - - long readVarLong(); - - byte[] readArray(int length); - - String readString(); - - BlockPos readPos(); - - NBTTagCompound readNBTTagCompound(); - - ItemStack readItemStack(); - - FluidStack readFluidStack(); -} diff --git a/dependencies/main/java/codechicken/lib/data/MCDataInputStream.java b/dependencies/main/java/codechicken/lib/data/MCDataInputStream.java deleted file mode 100644 index 210a36c895..0000000000 --- a/dependencies/main/java/codechicken/lib/data/MCDataInputStream.java +++ /dev/null @@ -1,17 +0,0 @@ -package codechicken.lib.data; - -import java.io.InputStream; - -public class MCDataInputStream extends InputStream { - - private MCDataInput in; - - public MCDataInputStream(MCDataInput in) { - this.in = in; - } - - @Override - public int read() { - return in.readByte() & 0xFF; - } -} diff --git a/dependencies/main/java/codechicken/lib/data/MCDataOutput.java b/dependencies/main/java/codechicken/lib/data/MCDataOutput.java deleted file mode 100644 index 3f178e617d..0000000000 --- a/dependencies/main/java/codechicken/lib/data/MCDataOutput.java +++ /dev/null @@ -1,44 +0,0 @@ -package codechicken.lib.data; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fluids.FluidStack; - -public interface MCDataOutput { - - MCDataOutput writeLong(long l); - - MCDataOutput writeInt(int i); - - MCDataOutput writeShort(int s); - - MCDataOutput writeByte(int b); - - MCDataOutput writeDouble(double d); - - MCDataOutput writeFloat(float f); - - MCDataOutput writeBoolean(boolean b); - - MCDataOutput writeChar(char c); - - MCDataOutput writeVarInt(int i); - - MCDataOutput writeVarShort(int s); - - MCDataOutput writeArray(byte[] array); - - MCDataOutput writeString(String s); - - MCDataOutput writePos(BlockPos pos); - - MCDataOutput writeNBTTagCompound(NBTTagCompound tag); - - /** - * Supports large stacks by writing stackSize as a varInt - */ - MCDataOutput writeItemStack(ItemStack stack); - - MCDataOutput writeFluidStack(FluidStack liquid); -} diff --git a/dependencies/main/java/codechicken/lib/data/MCDataOutputStream.java b/dependencies/main/java/codechicken/lib/data/MCDataOutputStream.java deleted file mode 100644 index ec9cfd86b4..0000000000 --- a/dependencies/main/java/codechicken/lib/data/MCDataOutputStream.java +++ /dev/null @@ -1,17 +0,0 @@ -package codechicken.lib.data; - -import java.io.OutputStream; - -public class MCDataOutputStream extends OutputStream { - - private MCDataOutput out; - - public MCDataOutputStream(MCDataOutput out) { - this.out = out; - } - - @Override - public void write(int b) { - out.writeByte(b); - } -} diff --git a/dependencies/main/java/codechicken/lib/data/MCDataOutputWrapper.java b/dependencies/main/java/codechicken/lib/data/MCDataOutputWrapper.java deleted file mode 100644 index a48e1366b8..0000000000 --- a/dependencies/main/java/codechicken/lib/data/MCDataOutputWrapper.java +++ /dev/null @@ -1,150 +0,0 @@ -package codechicken.lib.data; - -import io.netty.handler.codec.EncoderException; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fluids.FluidStack; - -import java.io.DataOutput; -import java.io.IOException; - -public class MCDataOutputWrapper implements MCDataOutput { - - public DataOutput dataout; - - public MCDataOutputWrapper(DataOutput out) { - dataout = out; - } - - public MCDataOutputWrapper writeBoolean(boolean b) { - try { - dataout.writeBoolean(b); - } catch (IOException e) { - throw new EncoderException(e); - } - return this; - } - - public MCDataOutputWrapper writeByte(int b) { - try { - dataout.writeByte(b); - } catch (IOException e) { - throw new EncoderException(e); - } - return this; - } - - public MCDataOutputWrapper writeShort(int s) { - try { - dataout.writeShort(s); - } catch (IOException e) { - throw new EncoderException(e); - } - return this; - } - - public MCDataOutputWrapper writeInt(int i) { - try { - dataout.writeInt(i); - } catch (IOException e) { - throw new EncoderException(e); - } - return this; - } - - public MCDataOutputWrapper writeFloat(float f) { - try { - dataout.writeFloat(f); - } catch (IOException e) { - throw new EncoderException(e); - } - return this; - } - - public MCDataOutputWrapper writeDouble(double d) { - try { - dataout.writeDouble(d); - } catch (IOException e) { - throw new EncoderException(e); - } - return this; - } - - public MCDataOutputWrapper writeLong(long l) { - try { - dataout.writeLong(l); - } catch (IOException e) { - throw new EncoderException(e); - } - return this; - } - - @Override - public MCDataOutputWrapper writeChar(char c) { - try { - dataout.writeChar(c); - } catch (IOException e) { - throw new EncoderException(e); - } - return this; - } - - @Override - public MCDataOutput writeVarInt(int i) { - MCDataIO.writeVarInt(this, i); - return this; - } - - @Override - public MCDataOutput writeVarShort(int s) { - MCDataIO.writeVarShort(this, s); - return this; - } - - public MCDataOutputWrapper writeArray(byte[] barray) { - try { - dataout.write(barray); - } catch (IOException e) { - throw new EncoderException(e); - } - return this; - } - - @Override - public MCDataOutputWrapper writePos(BlockPos pos) { - writeInt(pos.getX()); - writeInt(pos.getY()); - writeInt(pos.getZ()); - return this; - } - - public MCDataOutputWrapper writeString(String s) { - MCDataIO.writeString(this, s); - return this; - } - - public MCDataOutputWrapper writeItemStack(ItemStack stack) { - MCDataIO.writeItemStack(this, stack); - return this; - } - - public MCDataOutputWrapper writeNBTTagCompound(NBTTagCompound nbt) { - if (nbt == null) { - this.writeByte(0); - } else { - try { - CompressedStreamTools.write(nbt, dataout); - } catch (IOException ioexception) { - throw new EncoderException(ioexception); - } - } - return this; - } - - public MCDataOutputWrapper writeFluidStack(FluidStack fluid) { - MCDataIO.writeFluidStack(this, fluid); - return this; - } -} diff --git a/dependencies/main/java/codechicken/lib/data/NBTHelper.java b/dependencies/main/java/codechicken/lib/data/NBTHelper.java deleted file mode 100644 index 0e3d633743..0000000000 --- a/dependencies/main/java/codechicken/lib/data/NBTHelper.java +++ /dev/null @@ -1,33 +0,0 @@ -package codechicken.lib.data; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -/** - * Created by covers1624 on 6/3/2016. - */ -public class NBTHelper { - - public static void writeFluidStack(NBTTagCompound tag, FluidStack fluid) { - if (fluid == null || FluidRegistry.getFluidName(fluid) == null) { - tag.setString("id", ""); - } else { - tag.setString("id", FluidRegistry.getFluidName(fluid)); - tag.setInteger("amount", fluid.amount); - tag.setTag("tag", fluid.tag); - } - } - - public static FluidStack readFluidStack(NBTTagCompound tag) { - FluidStack fluid = null; - String fluidName = tag.getString("id"); - - if (fluidName.length() > 0) { - fluid = new FluidStack(FluidRegistry.getFluid(fluidName), tag.getInteger("amount"), tag.getCompoundTag("tag")); - } - - return fluid; - } - -} diff --git a/dependencies/main/java/codechicken/lib/fingerprint/FingerprintChecker.java b/dependencies/main/java/codechicken/lib/fingerprint/FingerprintChecker.java deleted file mode 100644 index 4517df72e4..0000000000 --- a/dependencies/main/java/codechicken/lib/fingerprint/FingerprintChecker.java +++ /dev/null @@ -1,85 +0,0 @@ -package codechicken.lib.fingerprint; - -import com.google.common.collect.ImmutableList; -import net.minecraftforge.fml.common.*; -import org.apache.logging.log4j.Level; - -import java.security.cert.Certificate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -/** - * Created by covers1624 on 13/12/2016. - * To be packaged in each mod runtime, used to cross verify jar fingerprints. - * Idea behind this: - * A malicious user would have to override the fingerprint data in all mod jars this is packaged with in order to avoid detection. - * This is not to be used as DRM. It is used simply to provide cross verification of jars. - */ -public class FingerprintChecker { - - private static final Map modCertMap = new HashMap(); - private static final List invalidMods = new ArrayList(); - - static { - //@formatter:off - modCertMap.put("CodeChickenLib" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("CodeChickenCore" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("ChickenChunks" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("EnderStorage" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("Translocator" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("NotEnoughItems" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("forgemultipartcbe" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - //@formatter:on - } - - public static void runFingerprintChecks() { - try { - ModContainer activeContainer = Loader.instance().activeModContainer(); - for (Entry modEntry : Loader.instance().getIndexedModList().entrySet()) { - for (Entry certEntry : modCertMap.entrySet()) { - if (modEntry.getKey().equals(certEntry.getKey())) { - Object modInstance = modEntry.getValue().getMod(); - if (modInstance == null) { - FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "Unable to do Fingerprint Verification for mod %s! ModContainer returned a null mod instance!", modEntry.getKey()); - break; - } - if (modInstance.getClass().getName().contains("net.minecraftforge.")) { - FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "Unable to do Fingerprint Verification for mod %s! ModContainer returned is a suspected FML class! [%s]", modEntry.getKey(), modInstance.getClass().getName()); - } - - Certificate[] certificates = modInstance.getClass().getProtectionDomain().getCodeSource().getCertificates(); - ImmutableList.Builder certBuilder = ImmutableList.builder(); - if (certificates != null) { - for (Certificate cert : certificates) { - certBuilder.add(CertificateHelper.getFingerprint(cert)); - } - } - - ImmutableList certList = certBuilder.build(); - - String expectedFingerprint = certEntry.getValue(); - - if (expectedFingerprint != null && !expectedFingerprint.isEmpty()) { - if (!certList.contains(expectedFingerprint)) { - FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "The fingerprint for mod %s is invalid! Expected: %s", modEntry.getKey(), expectedFingerprint); - invalidMods.add(modEntry.getKey()); - break; - } else { - FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.DEBUG, "Valid fingerprint found for mod %s.", modEntry.getKey()); - } - } - - break; - } - } - } - FMLCommonHandler.instance().registerCrashCallable(new FingerprintViolatedCrashCallable(activeContainer.getModId(), invalidMods)); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/dependencies/main/java/codechicken/lib/fingerprint/FingerprintViolatedCrashCallable.java b/dependencies/main/java/codechicken/lib/fingerprint/FingerprintViolatedCrashCallable.java deleted file mode 100644 index b0e4653e46..0000000000 --- a/dependencies/main/java/codechicken/lib/fingerprint/FingerprintViolatedCrashCallable.java +++ /dev/null @@ -1,37 +0,0 @@ -package codechicken.lib.fingerprint; - -import com.google.common.collect.ImmutableList; -import net.minecraftforge.fml.common.ICrashCallable; - -import java.util.List; - -/** - * Created by covers1624 on 12/12/2016. - * TODO, report all good when no invalid mods are found. - */ -public class FingerprintViolatedCrashCallable implements ICrashCallable { - - private final String mod; - private final ImmutableList invalidMods; - - public FingerprintViolatedCrashCallable(String mod, List invalidMods) { - this.mod = mod; - this.invalidMods = ImmutableList.copyOf(invalidMods); - } - - @Override - public String getLabel() { - return mod + " Invalid Fingerprint Reports"; - } - - @Override - public String call() throws Exception { - StringBuilder builder = new StringBuilder(); - for (String invalidMod : invalidMods) { - builder.append("\n\t\t"); - builder.append(invalidMod); - builder.append(" has an invalid fingerprint."); - } - return builder.toString(); - } -} diff --git a/dependencies/main/java/codechicken/lib/gui/GuiDraw.java b/dependencies/main/java/codechicken/lib/gui/GuiDraw.java deleted file mode 100644 index 1606a47873..0000000000 --- a/dependencies/main/java/codechicken/lib/gui/GuiDraw.java +++ /dev/null @@ -1,406 +0,0 @@ -package codechicken.lib.gui; - -import codechicken.lib.colour.Colour; -import codechicken.lib.math.MathHelper; -import codechicken.lib.texture.TextureUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.VertexBuffer; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.client.event.RenderTooltipEvent; -import net.minecraftforge.common.MinecraftForge; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; - -import javax.annotation.Nullable; -import java.awt.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class GuiDraw { - - public static class GuiHook extends Gui { - - public void setZLevel(float f) { - zLevel = f; - } - - public float getZLevel() { - return zLevel; - } - - public void incZLevel(float f) { - zLevel += f; - } - - @Override - public void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) { - super.drawGradientRect(par1, par2, par3, par4, par5, par6); - } - } - - public static final GuiHook gui = new GuiHook(); - public static FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; - public static TextureManager renderEngine = Minecraft.getMinecraft().renderEngine; - - public static void drawRect(int x, int y, int w, int h, int colour) { - drawGradientRect(x, y, w, h, colour, colour); - } - - public static void drawGradientRectDirect(int left, int top, int right, int bottom, int colour1, int colour2) { - gui.drawGradientRect(left, top, right, bottom, colour1, colour2); - } - - public static void drawGradientRect(int x, int y, int w, int h, int colour1, int colour2) { - gui.drawGradientRect(x, y, x + w, y + h, colour1, colour2); - } - - public static void drawTexturedModalRect(int x, int y, int tx, int ty, int w, int h) { - gui.drawTexturedModalRect(x, y, tx, ty, w, h); - } - - public static void drawLine(int x1, int y1, int x2, int y2, float thickness, int colour) { - GlStateManager.glLineWidth(thickness); - GlStateManager.disableTexture2D(); - GlStateManager.enableBlend(); - GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - Colour.glColourRGBA(colour); - - VertexBuffer vb = Tessellator.getInstance().getBuffer(); - vb.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION); - vb.pos(x1, y1, gui.getZLevel()).endVertex(); - vb.pos(x2, y2, gui.getZLevel()).endVertex(); - vb.finishDrawing(); - - GlStateManager.resetColor(); - GlStateManager.disableBlend(); - GlStateManager.enableTexture2D(); - } - - public static void drawString(String text, int x, int y, int colour, boolean shadow) { - if (shadow) { - fontRenderer.drawStringWithShadow(text, x, y, colour); - } else { - fontRenderer.drawString(text, x, y, colour); - } - } - - public static void drawString(String text, int x, int y, int colour) { - drawString(text, x, y, colour, true); - } - - public static void drawStringC(String text, int x, int y, int w, int h, int colour, boolean shadow) { - drawString(text, x + (w - getStringWidth(text)) / 2, y + (h - 8) / 2, colour, shadow); - } - - public static void drawStringC(String text, int x, int y, int w, int h, int colour) { - drawStringC(text, x, y, w, h, colour, true); - } - - public static void drawStringC(String text, int x, int y, int colour, boolean shadow) { - drawString(text, x - getStringWidth(text) / 2, y, colour, shadow); - } - - public static void drawStringC(String text, int x, int y, int colour) { - drawStringC(text, x, y, colour, true); - } - - public static void drawStringR(String text, int x, int y, int colour, boolean shadow) { - drawString(text, x - getStringWidth(text), y, colour, shadow); - } - - public static void drawStringR(String text, int x, int y, int colour) { - drawStringR(text, x, y, colour, true); - } - - public static int getStringWidth(String s) { - if (s == null || s.equals("")) { - return 0; - } - return fontRenderer.getStringWidth(TextFormatting.getTextWithoutFormattingCodes(s)); - } - - //TODO, getDisplaySize. - public static Dimension displaySize() { - Minecraft mc = Minecraft.getMinecraft(); - ScaledResolution res = new ScaledResolution(mc); - return new Dimension(res.getScaledWidth(), res.getScaledHeight()); - } - - //TODO, getDisplayRes - public static Dimension displayRes() { - Minecraft mc = Minecraft.getMinecraft(); - return new Dimension(mc.displayWidth, mc.displayHeight); - } - - public static Point getMousePosition(int eventX, int eventY) { - Dimension size = displaySize(); - Dimension res = displayRes(); - return new Point(eventX * size.width / res.width, size.height - eventY * size.height / res.height - 1); - } - - public static Point getMousePosition() { - return getMousePosition(Mouse.getX(), Mouse.getY()); - } - - public static void changeTexture(String s) { - TextureUtils.changeTexture(s); - } - - public static void changeTexture(ResourceLocation r) { - TextureUtils.changeTexture(r); - } - - public static void drawTip(int x, int y, String text) { - drawMultilineTip(x, y, Arrays.asList(text)); - } - - /** - * Append a string in the tooltip list with TOOLTIP_LINESPACE to have a small gap between it and the next line - */ - public static final String TOOLTIP_LINESPACE = "\u00A7h"; - /** - * Have a string in the tooltip list with TOOLTIP_HANDLER + getTipLineId(handler) for a custom handler - */ - @Deprecated - public static final String TOOLTIP_HANDLER = "\u00A7x"; - @Deprecated - private static List tipLineHandlers = new ArrayList(); - - @Deprecated//This is dead as there are forge events. - public interface ITooltipLineHandler { - - Dimension getSize(); - - void draw(int x, int y); - } - - @Deprecated - public static int getTipLineId(ITooltipLineHandler handler) { - return -1; - } - - public static ITooltipLineHandler getTipLine(String line) { - return null; - } - - @Deprecated - public static void drawMultilineTip(int x, int y, List list) { - drawMultilineTip(null, x, y, list); - } - - public static void drawMultilineTip(@Nullable ItemStack stack, int x, int y, List lines) { - //TODO TOOLTIP_LINESPACE support, pr forge to clip the box in the top bound of the screen + TOOLTIP_LINESPACE - /*if (lines.isEmpty()) { - return; - } - - GlStateManager.disableRescaleNormal(); - RenderHelper.disableStandardItemLighting(); - GlStateManager.disableDepth(); - - int w = 0; - int h = -2; - for (int i = 0; i < lines.size(); i++) { - String s = lines.get(i); - ITooltipLineHandler line = getTipLine(s); - Dimension d = line != null ? line.getSize() : new Dimension(getStringWidth(s), lines.get(i).endsWith(TOOLTIP_LINESPACE) && i + 1 < lines.size() ? 12 : 10); - w = Math.max(w, d.width); - h += d.height; - } - - if (x < 8) { - x = 8; - } else if (x > displaySize().width - w - 8) { - x -= 24 + w;//flip side of cursor - if (x < 8) { - x = 8; - } - } - y = (int) MathHelper.clip(y, 8, displaySize().height - 8 - h); - - gui.incZLevel(300); - drawTooltipBox(x - 4, y - 4, w + 7, h + 7); - for (String s : lines) { - ITooltipLineHandler line = getTipLine(s); - if (line != null) { - line.draw(x, y); - y += line.getSize().height; - } else { - fontRenderer.drawStringWithShadow(s, x, y, -1); - y += s.endsWith(TOOLTIP_LINESPACE) ? 12 : 10; - } - } - - tipLineHandlers.clear(); - gui.incZLevel(-300); - - GlStateManager.enableDepth(); - RenderHelper.enableStandardItemLighting(); - GlStateManager.enableRescaleNormal();*/ - - ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft()); - int screenWidth = res.getScaledWidth(); - int screenHeight = res.getScaledHeight(); - - if (lines.isEmpty()) { - return; - } - - RenderTooltipEvent.Pre event = new RenderTooltipEvent.Pre(stack, lines, x, y, screenWidth, screenHeight, -1, fontRenderer); - if (MinecraftForge.EVENT_BUS.post(event)) { - return; - } - x = event.getX(); - y = event.getY(); - screenWidth = event.getScreenWidth(); - screenHeight = event.getScreenHeight(); - int maxTextWidth = event.getMaxWidth(); - FontRenderer font = event.getFontRenderer(); - - GlStateManager.disableRescaleNormal(); - RenderHelper.disableStandardItemLighting(); - GlStateManager.disableLighting(); - GlStateManager.disableDepth(); - - if (x < 8) { - x = 8; - } - y = MathHelper.clip(y, 8, displaySize().height - 8); - int tooltipTextWidth = 0; - - for (String textLine : lines) { - int textLineWidth = font.getStringWidth(textLine); - - if (textLineWidth > tooltipTextWidth) { - tooltipTextWidth = textLineWidth; - } - } - - boolean needsWrap = false; - - int titleLinesCount = 1; - int tooltipX = x + 12; - if (tooltipX + tooltipTextWidth + 4 > screenWidth) { - tooltipX = x - 16 - tooltipTextWidth; - if (tooltipX < 4) // if the tooltip doesn't fit on the screen - { - if (x > screenWidth / 2) { - tooltipTextWidth = x - 12 - 8; - } else { - tooltipTextWidth = screenWidth - 16 - x; - } - needsWrap = true; - } - } - - if (maxTextWidth > 0 && tooltipTextWidth > maxTextWidth) { - tooltipTextWidth = maxTextWidth; - needsWrap = true; - } - - if (needsWrap) { - int wrappedTooltipWidth = 0; - List wrappedTextLines = new ArrayList(); - for (int i = 0; i < lines.size(); i++) { - String textLine = lines.get(i); - List wrappedLine = font.listFormattedStringToWidth(textLine, tooltipTextWidth); - if (i == 0) { - titleLinesCount = wrappedLine.size(); - } - - for (String line : wrappedLine) { - int lineWidth = font.getStringWidth(line); - if (lineWidth > wrappedTooltipWidth) { - wrappedTooltipWidth = lineWidth; - } - wrappedTextLines.add(line); - } - } - tooltipTextWidth = wrappedTooltipWidth; - lines = wrappedTextLines; - - if (x > screenWidth / 2) { - tooltipX = x - 16 - tooltipTextWidth; - } else { - tooltipX = x; - } - } - - int tooltipY = y; - int tooltipHeight = 8; - - if (lines.size() > 1) { - tooltipHeight += (lines.size() - 1) * 10; - if (lines.size() > titleLinesCount) { - tooltipHeight += 2; // gap between title lines and next lines - } - } - - if (tooltipY + tooltipHeight + 6 > screenHeight) { - tooltipY = screenHeight - tooltipHeight - 6; - } - - int backgroundColor = 0xF0100010; - drawGradientRectDirect(tooltipX - 3, tooltipY - 4, tooltipX + tooltipTextWidth + 3, tooltipY - 3, backgroundColor, backgroundColor); - drawGradientRectDirect(tooltipX - 3, tooltipY + tooltipHeight + 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 4, backgroundColor, backgroundColor); - drawGradientRectDirect(tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); - drawGradientRectDirect(tooltipX - 4, tooltipY - 3, tooltipX - 3, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); - drawGradientRectDirect(tooltipX + tooltipTextWidth + 3, tooltipY - 3, tooltipX + tooltipTextWidth + 4, tooltipY + tooltipHeight + 3, backgroundColor, backgroundColor); - int borderColorStart = 0x505000FF; - int borderColorEnd = (borderColorStart & 0xFEFEFE) >> 1 | borderColorStart & 0xFF000000; - drawGradientRectDirect(tooltipX - 3, tooltipY - 3 + 1, tooltipX - 3 + 1, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); - drawGradientRectDirect(tooltipX + tooltipTextWidth + 2, tooltipY - 3 + 1, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3 - 1, borderColorStart, borderColorEnd); - drawGradientRectDirect(tooltipX - 3, tooltipY - 3, tooltipX + tooltipTextWidth + 3, tooltipY - 3 + 1, borderColorStart, borderColorStart); - drawGradientRectDirect(tooltipX - 3, tooltipY + tooltipHeight + 2, tooltipX + tooltipTextWidth + 3, tooltipY + tooltipHeight + 3, borderColorEnd, borderColorEnd); - - MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostBackground(stack, lines, tooltipX, tooltipY, font, tooltipTextWidth, tooltipHeight)); - int tooltipTop = tooltipY; - - for (int lineNumber = 0; lineNumber < lines.size(); ++lineNumber) { - String line = lines.get(lineNumber); - font.drawStringWithShadow(line, (float) tooltipX, (float) tooltipY, -1); - - if (lineNumber + 1 == titleLinesCount) { - tooltipY += 2; - } - - tooltipY += 10; - } - - MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostText(stack, lines, tooltipX, tooltipTop, font, tooltipTextWidth, tooltipHeight)); - - GlStateManager.enableLighting(); - GlStateManager.enableDepth(); - RenderHelper.enableStandardItemLighting(); - GlStateManager.enableRescaleNormal(); - - } - - @Deprecated//TODO 1.11, update this to do what is done in the other method(vague, i know what it means tho :P) - public static void drawTooltipBox(int x, int y, int w, int h) { - int bg = 0xf0100010; - drawGradientRect(x + 1, y, w - 1, 1, bg, bg); - drawGradientRect(x + 1, y + h, w - 1, 1, bg, bg); - drawGradientRect(x + 1, y + 1, w - 1, h - 1, bg, bg);//center - drawGradientRect(x, y + 1, 1, h - 1, bg, bg); - drawGradientRect(x + w, y + 1, 1, h - 1, bg, bg); - int grad1 = 0x505000ff; - int grad2 = 0x5028007F; - drawGradientRect(x + 1, y + 2, 1, h - 3, grad1, grad2); - drawGradientRect(x + w - 1, y + 2, 1, h - 3, grad1, grad2); - - drawGradientRect(x + 1, y + 1, w - 1, 1, grad1, grad1); - drawGradientRect(x + 1, y + h - 1, w - 1, 1, grad2, grad2); - } -} diff --git a/dependencies/main/java/codechicken/lib/gui/IGuiPacketSender.java b/dependencies/main/java/codechicken/lib/gui/IGuiPacketSender.java deleted file mode 100644 index aca3fe929c..0000000000 --- a/dependencies/main/java/codechicken/lib/gui/IGuiPacketSender.java +++ /dev/null @@ -1,8 +0,0 @@ -package codechicken.lib.gui; - -import net.minecraft.entity.player.EntityPlayerMP; - -public interface IGuiPacketSender { - - void sendPacket(EntityPlayerMP player, int windowId); -} diff --git a/dependencies/main/java/codechicken/lib/gui/SimpleCreativeTab.java b/dependencies/main/java/codechicken/lib/gui/SimpleCreativeTab.java deleted file mode 100644 index c6bbb4776e..0000000000 --- a/dependencies/main/java/codechicken/lib/gui/SimpleCreativeTab.java +++ /dev/null @@ -1,81 +0,0 @@ -package codechicken.lib.gui; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.registry.ForgeRegistries; - -/** - * Created by covers1624 on 7/11/2016. - * Provides a Simple way to create a CreativeTab - * TODO BlockState parsing. - */ -public class SimpleCreativeTab extends CreativeTabs { - - private ItemStack tabIcon; - private final String name; - private final int meta; - - /** - * Create a SimpleCreativeTab! - * The tab icon will be "baked" when the icon is requested the first time. - * If the item cannot be found it will throw a RuntimeException, This can be avoided by setting "-Dccl.ignoreInvalidTabItem=true" in your command line args, this will default the tab to Redstone. - * - * @param tabLabel The label to be displayed, This WILL be localized by minecraft. - * @param tabIcon The item to find in the Item Registry e.g "minecraft:redstone" or "chickenchunks:chickenChunkLoader" - */ - public SimpleCreativeTab(String tabLabel, String tabIcon) { - this(tabLabel, tabIcon, 0); - } - - /** - * Create a SimpleCreativeTab! - * The tab icon will be "baked" when the icon is requested the first time. - * If the item cannot be found it will throw a RuntimeException, This can be avoided by setting "-Dccl.ignoreInvalidTabItem=true" in your command line args, this will default the tab to Redstone. - * - * @param tabLabel The label to be displayed, This WILL be localized by minecraft. - * @param tabIcon The item to find in the Item Registry e.g "minecraft:redstone" or "chickenchunks:chickenChunkLoader" - * @param meta The metadata of the item. - */ - public SimpleCreativeTab(String tabLabel, String tabIcon, int meta) { - super(tabLabel); - this.name = tabIcon; - this.meta = meta; - } - - /** - * "Bakes" the SimpleCreativeTab when the icon is requested the first time. - * If the item cannot be found it will throw a RuntimeException. - * This can be avoided by setting "-Dccl.ignoreInvalidTabItem=true" in your command line args. - * This will default the tab to Redstone. - */ - private void bakeTab() { - ResourceLocation location = new ResourceLocation(name); - Item item = ForgeRegistries.ITEMS.getValue(location); - if (item == null) { - if (Boolean.parseBoolean(System.getProperty("ccl.ignoreInvalidTabItem", "false"))) { - FMLLog.warning("Unable to find [%s] in the Item Registry. Please ensure the name for the item is correct. Unable to craft SimpleCreativeTab icon."); - tabIcon = new ItemStack(Items.REDSTONE); - } else { - throw new RuntimeException("Unable to find [%s] in the Item Registry. Please ensure the name for the item is correct. Unable to craft SimpleCreativeTab icon!"); - } - } - tabIcon = new ItemStack(item, 1, meta); - } - - @Override - public Item getTabIconItem() { - return Items.REDSTONE; - } - - @Override - public ItemStack getIconItemStack() { - if (tabIcon == null) { - bakeTab(); - } - return tabIcon; - } -} diff --git a/dependencies/main/java/codechicken/lib/internal/command/DevEnvCommand.java b/dependencies/main/java/codechicken/lib/internal/command/DevEnvCommand.java deleted file mode 100644 index 0e3c264640..0000000000 --- a/dependencies/main/java/codechicken/lib/internal/command/DevEnvCommand.java +++ /dev/null @@ -1,90 +0,0 @@ -package codechicken.lib.internal.command; - -import codechicken.lib.raytracer.RayTracer; -import codechicken.lib.thread.TaskProfiler; -import codechicken.lib.thread.TaskProfiler.ProfilerResult; -import codechicken.lib.util.BlockStateUtils; -import net.minecraft.block.state.IBlockState; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.text.TextComponentString; - -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by covers1624 on 9/01/2017. - */ -public class DevEnvCommand implements ICommand { - - @Override - public String getCommandName() { - return "devStuff"; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "Does dev stuff."; - } - - @Override - public List getCommandAliases() { - return new ArrayList(); - } - - @Override - public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { - if (sender instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) sender; - RayTraceResult trace = RayTracer.retrace(player); - if (trace == null) { - addMessage(sender, "Null trace."); - return; - } - IBlockState state = player.worldObj.getBlockState(trace.getBlockPos()); - addMessage(sender, state); - TaskProfiler timer = new TaskProfiler(); - timer.startOnce("task"); - int hash = BlockStateUtils.hashBlockState(state.getBlock().getExtendedState(state, player.worldObj, trace.getBlockPos())); - ProfilerResult result = timer.endOnce(); - - addMessage(sender, "Hash: " + hash); - - addMessage(sender, "Time: " + result.time / 1000); - - } else { - addMessage(sender, "You are not an EntityPlayer.."); - } - - } - - private static void addMessage(ICommandSender sender, Object object, Object... format) { - sender.addChatMessage(new TextComponentString(String.format(String.valueOf(object), format))); - } - - @Override - public boolean checkPermission(MinecraftServer server, ICommandSender sender) { - return true; - } - - @Override - public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos) { - return new ArrayList(); - } - - @Override - public boolean isUsernameIndex(String[] args, int index) { - return false; - } - - @Override - public int compareTo(ICommand o) { - return 0; - } -} diff --git a/dependencies/main/java/codechicken/lib/internal/command/client/DumpModelLocationsCommand.java b/dependencies/main/java/codechicken/lib/internal/command/client/DumpModelLocationsCommand.java deleted file mode 100644 index 38dff396a2..0000000000 --- a/dependencies/main/java/codechicken/lib/internal/command/client/DumpModelLocationsCommand.java +++ /dev/null @@ -1,76 +0,0 @@ -package codechicken.lib.internal.command.client; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.client.renderer.block.statemap.BlockStateMapper; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentString; -import net.minecraftforge.fml.common.FMLLog; - -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; -import java.util.Map.Entry; - -/** - * Created by covers1624 on 19/12/2016. - * TODO Items. - */ -public class DumpModelLocationsCommand implements ICommand { - - @Override - public String getCommandName() { - return "dumpModelLocations"; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "Takes the item in your hand and dumps all model locations."; - } - - @Override - public List getCommandAliases() { - return new ArrayList(); - } - - @Override - public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { - ItemStack stack = Minecraft.getMinecraft().thePlayer.getHeldItemMainhand(); - if (stack != null && stack.getItem() instanceof ItemBlock) { - Block block = Block.getBlockFromItem(stack.getItem()); - BlockStateMapper stateMapper = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getBlockStateMapper(); - for (Entry entry : stateMapper.getVariants(block).entrySet()) { - sender.addChatMessage(new TextComponentString(entry.getKey().toString() + " | " + entry.getValue().toString())); - FMLLog.info(entry.getKey().toString() + " | " + entry.getValue().toString()); - } - } - } - - @Override - public boolean checkPermission(MinecraftServer server, ICommandSender sender) { - return true; - } - - @Override - public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos) { - return new ArrayList(); - } - - @Override - public boolean isUsernameIndex(String[] args, int index) { - return false; - } - - @Override - public int compareTo(ICommand o) { - return 0; - } -} diff --git a/dependencies/main/java/codechicken/lib/internal/command/client/NukeCCModelCacheCommand.java b/dependencies/main/java/codechicken/lib/internal/command/client/NukeCCModelCacheCommand.java deleted file mode 100644 index 83a0b15ee5..0000000000 --- a/dependencies/main/java/codechicken/lib/internal/command/client/NukeCCModelCacheCommand.java +++ /dev/null @@ -1,60 +0,0 @@ -package codechicken.lib.internal.command.client; - -import codechicken.lib.model.blockbakery.BlockBakery; -import net.minecraft.command.CommandException; -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentString; - -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by covers1624 on 30/12/2016. - */ -public class NukeCCModelCacheCommand implements ICommand { - - @Override - public String getCommandName() { - return "nukeCCModelCache"; - } - - @Override - public String getCommandUsage(ICommandSender sender) { - return "Clears all of CCL's BakedModel cache, requiring models to be re-baked.\nReally only useful for debugging in dev.\nOnly works on blocks / items that use CCL's BakedModel pipe."; - } - - @Override - public List getCommandAliases() { - return new ArrayList(); - } - - @Override - public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { - BlockBakery.nukeModelCache(); - sender.addChatMessage(new TextComponentString("Model cache nuked!")); - } - - @Override - public boolean checkPermission(MinecraftServer server, ICommandSender sender) { - return true; - } - - @Override - public List getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos) { - return new ArrayList(); - } - - @Override - public boolean isUsernameIndex(String[] args, int index) { - return false; - } - - @Override - public int compareTo(ICommand o) { - return 0; - } -} diff --git a/dependencies/main/java/codechicken/lib/internal/proxy/ClientProxy.java b/dependencies/main/java/codechicken/lib/internal/proxy/ClientProxy.java deleted file mode 100644 index f6513ccff7..0000000000 --- a/dependencies/main/java/codechicken/lib/internal/proxy/ClientProxy.java +++ /dev/null @@ -1,37 +0,0 @@ -package codechicken.lib.internal.proxy; - -import codechicken.lib.internal.command.client.DumpModelLocationsCommand; -import codechicken.lib.internal.command.client.NukeCCModelCacheCommand; -import codechicken.lib.model.blockbakery.BlockBakery; -import codechicken.lib.model.blockbakery.loader.CCBakeryModelLoader; -import codechicken.lib.model.cube.CCCubeLoader; -import codechicken.lib.render.CCRenderEventHandler; -import codechicken.lib.render.block.CCExtendedBlockRendererDispatcher; -import codechicken.lib.render.item.CCRenderItem; -import codechicken.lib.render.item.map.MapRenderRegistry; -import net.minecraftforge.client.ClientCommandHandler; -import net.minecraftforge.client.model.ModelLoaderRegistry; -import net.minecraftforge.common.MinecraftForge; - -/** - * Created by covers1624 on 23/11/2016. - */ -public class ClientProxy extends CommonProxy { - - @Override - public void preInit() { - BlockBakery.init(); - CCRenderEventHandler.init(); - MinecraftForge.EVENT_BUS.register(new MapRenderRegistry()); - ModelLoaderRegistry.registerLoader(CCCubeLoader.INSTANCE); - ModelLoaderRegistry.registerLoader(CCBakeryModelLoader.INSTANCE); - ClientCommandHandler.instance.registerCommand(new DumpModelLocationsCommand()); - ClientCommandHandler.instance.registerCommand(new NukeCCModelCacheCommand()); - } - - @Override - public void init() { - CCExtendedBlockRendererDispatcher.init(); - CCRenderItem.init(); - } -} diff --git a/dependencies/main/java/codechicken/lib/internal/proxy/CommonProxy.java b/dependencies/main/java/codechicken/lib/internal/proxy/CommonProxy.java deleted file mode 100644 index b21701d0b4..0000000000 --- a/dependencies/main/java/codechicken/lib/internal/proxy/CommonProxy.java +++ /dev/null @@ -1,24 +0,0 @@ -package codechicken.lib.internal.proxy; - -import net.minecraftforge.fml.common.event.FMLServerStartingEvent; - -/** - * Created by covers1624 on 23/11/2016. - */ -public class CommonProxy { - - public void preInit() { - - } - - public void init() { - - } - - public void serverStarting(FMLServerStartingEvent event) { - //if (!ObfMapping.obfuscated) { - // event.registerServerCommand(new DevEnvCommand()); - //} - } - -} diff --git a/dependencies/main/java/codechicken/lib/inventory/InventoryCopy.java b/dependencies/main/java/codechicken/lib/inventory/InventoryCopy.java deleted file mode 100644 index 748497df28..0000000000 --- a/dependencies/main/java/codechicken/lib/inventory/InventoryCopy.java +++ /dev/null @@ -1,135 +0,0 @@ -package codechicken.lib.inventory; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentString; - -/** - * Creates a copy of an IInventory for extended simulation - */ -public class InventoryCopy implements IInventory { - - public boolean[] accessible; - public ItemStack[] items; - public IInventory inv; - - public InventoryCopy(IInventory inv) { - items = new ItemStack[inv.getSizeInventory()]; - accessible = new boolean[inv.getSizeInventory()]; - this.inv = inv; - update(); - } - - public void update() { - for (int i = 0; i < items.length; i++) { - ItemStack stack = inv.getStackInSlot(i); - if (stack != null) { - items[i] = stack.copy(); - } - } - } - - public InventoryCopy open(InventoryRange access) { - int lslot = access.lastSlot(); - if (lslot > accessible.length) { - boolean[] l_accessible = new boolean[lslot]; - ItemStack[] l_items = new ItemStack[lslot]; - System.arraycopy(accessible, 0, l_accessible, 0, accessible.length); - System.arraycopy(items, 0, l_items, 0, items.length); - accessible = l_accessible; - items = l_items; - } - - for (int slot : access.slots) { - accessible[slot] = true; - } - return this; - } - - @Override - public int getSizeInventory() { - return items.length; - } - - @Override - public ItemStack getStackInSlot(int slot) { - return items[slot]; - } - - public ItemStack decrStackSize(int slot, int amount) { - return InventoryUtils.decrStackSize(this, slot, amount); - } - - @Override - public ItemStack removeStackFromSlot(int slot) { - return InventoryUtils.removeStackFromSlot(this, slot); - } - - @Override - public void setInventorySlotContents(int slot, ItemStack stack) { - items[slot] = stack; - markDirty(); - } - - @Override - public boolean isUseableByPlayer(EntityPlayer player) { - return true; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public void markDirty() { - } - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return inv.isItemValidForSlot(i, itemstack); - } - - @Override - public void openInventory(EntityPlayer player) { - } - - @Override - public void closeInventory(EntityPlayer player) { - } - - @Override - public int getField(int id) { - return 0; - } - - @Override - public void setField(int id, int value) { - } - - @Override - public int getFieldCount() { - return 0; - } - - @Override - public void clear() { - } - - @Override - public String getName() { - return "copy"; - } - - @Override - public boolean hasCustomName() { - return true; - } - - @Override - public ITextComponent getDisplayName() { - return new TextComponentString(getName()); - } -} diff --git a/dependencies/main/java/codechicken/lib/inventory/InventoryNBT.java b/dependencies/main/java/codechicken/lib/inventory/InventoryNBT.java deleted file mode 100644 index 470f62b9a1..0000000000 --- a/dependencies/main/java/codechicken/lib/inventory/InventoryNBT.java +++ /dev/null @@ -1,124 +0,0 @@ -package codechicken.lib.inventory; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentString; - -/** - * IInventory implementation which saves and loads from an NBT tag - */ -public class InventoryNBT implements IInventory { - - protected ItemStack[] items; - protected NBTTagCompound tag; - - public InventoryNBT(int size, NBTTagCompound tag) { - this.tag = tag; - items = new ItemStack[size]; - readNBT(); - } - - private void writeNBT() { - tag.setTag("items", InventoryUtils.writeItemStacksToTag(items, getInventoryStackLimit())); - } - - private void readNBT() { - if (tag.hasKey("items")) { - InventoryUtils.readItemStacksFromTag(items, tag.getTagList("items", 10)); - } - } - - @Override - public int getSizeInventory() { - return items.length; - } - - @Override - public ItemStack getStackInSlot(int slot) { - return items[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int amount) { - return InventoryUtils.decrStackSize(this, slot, amount); - } - - @Override - public ItemStack removeStackFromSlot(int slot) { - return InventoryUtils.removeStackFromSlot(this, slot); - } - - @Override - public void setInventorySlotContents(int slot, ItemStack stack) { - items[slot] = stack; - markDirty(); - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public void markDirty() { - writeNBT(); - } - - @Override - public void clear() { - for (int i = 0; i < items.length; i++) { - items[i] = null; - } - markDirty(); - } - - @Override - public int getField(int id) { - return 0; - } - - @Override - public void setField(int id, int value) { - } - - @Override - public int getFieldCount() { - return 0; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer var1) { - return true; - } - - @Override - public void openInventory(EntityPlayer player) { - } - - @Override - public void closeInventory(EntityPlayer player) { - } - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return true; - } - - @Override - public String getName() { - return "NBT"; - } - - @Override - public boolean hasCustomName() { - return true; - } - - @Override - public ITextComponent getDisplayName() { - return new TextComponentString(getName()); - } -} diff --git a/dependencies/main/java/codechicken/lib/inventory/InventoryRange.java b/dependencies/main/java/codechicken/lib/inventory/InventoryRange.java deleted file mode 100644 index 5155bf1a0c..0000000000 --- a/dependencies/main/java/codechicken/lib/inventory/InventoryRange.java +++ /dev/null @@ -1,75 +0,0 @@ -package codechicken.lib.inventory; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; - -/** - * Inventory wrapper for unified ISided/IInventory access - */ -public class InventoryRange { - - public IInventory inv; - public EnumFacing face; - public ISidedInventory sidedInv; - public int[] slots; - - @Deprecated// Use EnumFacing version. - public InventoryRange(IInventory inv, int side) { - this(inv, EnumFacing.values()[side]); - } - - public InventoryRange(IInventory inv, EnumFacing side) { - this.inv = inv; - this.face = side; - if (inv instanceof ISidedInventory) { - sidedInv = (ISidedInventory) inv; - slots = sidedInv.getSlotsForFace(face); - } else { - slots = new int[inv.getSizeInventory()]; - for (int i = 0; i < slots.length; i++) { - slots[i] = i; - } - } - } - - public InventoryRange(IInventory inv) { - this(inv, EnumFacing.DOWN); - } - - public InventoryRange(IInventory inv, int fslot, int lslot) { - this.inv = inv; - slots = new int[lslot - fslot]; - for (int i = 0; i < slots.length; i++) { - slots[i] = fslot + i; - } - } - - public InventoryRange(IInventory inv, InventoryRange access) { - this.inv = inv; - this.slots = access.slots; - this.face = access.face; - if (inv instanceof ISidedInventory) { - sidedInv = (ISidedInventory) inv; - } - } - - public boolean canInsertItem(int slot, ItemStack item) { - return sidedInv == null ? inv.isItemValidForSlot(slot, item) : sidedInv.canInsertItem(slot, item, face); - } - - public boolean canExtractItem(int slot, ItemStack item) { - return sidedInv == null ? inv.isItemValidForSlot(slot, item) : sidedInv.canExtractItem(slot, item, face); - } - - public int lastSlot() { - int last = 0; - for (int slot : slots) { - if (slot > last) { - last = slot; - } - } - return last; - } -} diff --git a/dependencies/main/java/codechicken/lib/inventory/InventorySimple.java b/dependencies/main/java/codechicken/lib/inventory/InventorySimple.java deleted file mode 100644 index 2eb52f9b5f..0000000000 --- a/dependencies/main/java/codechicken/lib/inventory/InventorySimple.java +++ /dev/null @@ -1,159 +0,0 @@ -package codechicken.lib.inventory; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentString; -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.items.CapabilityItemHandler; -import net.minecraftforge.items.wrapper.InvWrapper; - -/** - * Simple IInventory implementation with an array of items, name and maximum stack size - */ -public class InventorySimple implements IInventory, ICapabilityProvider { - - public ItemStack[] items; - public int limit; - public String name; - - public InventorySimple(ItemStack[] items, int limit, String name) { - this.items = items; - this.limit = limit; - this.name = name; - } - - public InventorySimple(ItemStack[] items, String name) { - this(items, 64, name); - } - - public InventorySimple(ItemStack[] items, int limit) { - this(items, limit, "inv"); - } - - public InventorySimple(ItemStack[] items) { - this(items, 64, "inv"); - } - - public InventorySimple(int size, int limit, String name) { - this(new ItemStack[size], limit, name); - } - - public InventorySimple(int size, int limit) { - this(size, limit, "inv"); - } - - public InventorySimple(int size, String name) { - this(size, 64, name); - } - - public InventorySimple(int size) { - this(size, 64, "inv"); - } - - @Override - public int getSizeInventory() { - return items.length; - } - - @Override - public ItemStack getStackInSlot(int slot) { - return items[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int amount) { - return InventoryUtils.decrStackSize(this, slot, amount); - } - - @Override - public ItemStack removeStackFromSlot(int slot) { - return InventoryUtils.removeStackFromSlot(this, slot); - } - - @Override - public void setInventorySlotContents(int slot, ItemStack stack) { - items[slot] = stack; - markDirty(); - } - - @Override - public int getInventoryStackLimit() { - return limit; - } - - @Override - public boolean isUseableByPlayer(EntityPlayer var1) { - return true; - } - - @Override - public boolean isItemValidForSlot(int i, ItemStack itemstack) { - return true; - } - - @Override - public void markDirty() { - } - - @Override - public void openInventory(EntityPlayer player) { - } - - @Override - public void closeInventory(EntityPlayer player) { - } - - @Override - public int getField(int id) { - return 0; - } - - @Override - public void setField(int id, int value) { - } - - @Override - public int getFieldCount() { - return 0; - } - - @Override - public void clear() { - for (int i = 0; i < items.length; i++) { - items[i] = null; - } - } - - @Override - public String getName() { - return "name"; - } - - @Override - public boolean hasCustomName() { - return true; - } - - @Override - public ITextComponent getDisplayName() { - return new TextComponentString(getName()); - } - - @Override - public boolean hasCapability(Capability capability, EnumFacing facing) { - return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY; - } - - @SuppressWarnings ("unchecked") - @Override - public T getCapability(Capability capability, EnumFacing facing) { - if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { - return (T) new InvWrapper(this); - } - return null; - } -} diff --git a/dependencies/main/java/codechicken/lib/inventory/InventoryUtils.java b/dependencies/main/java/codechicken/lib/inventory/InventoryUtils.java deleted file mode 100644 index 02ebc0eefb..0000000000 --- a/dependencies/main/java/codechicken/lib/inventory/InventoryUtils.java +++ /dev/null @@ -1,372 +0,0 @@ -package codechicken.lib.inventory; - -import codechicken.lib.vec.Vector3; -import com.google.common.base.Objects; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.inventory.InventoryLargeChest; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTPrimitive; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumFacing.Plane; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.items.CapabilityItemHandler; -import net.minecraftforge.items.IItemHandler; -import net.minecraftforge.items.wrapper.EmptyHandler; -import net.minecraftforge.items.wrapper.InvWrapper; -import net.minecraftforge.items.wrapper.SidedInvWrapper; - -public class InventoryUtils { - - public static boolean hasItemHandlerCap(TileEntity tileEntity, EnumFacing face) { - return tileEntity != null && (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, face) || tileEntity instanceof ISidedInventory || tileEntity instanceof IInventory); - } - - public static IItemHandler getItemHandlerCap(TileEntity tileEntity, EnumFacing face) { - if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, face)) { - return tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, face); - } else if (tileEntity instanceof ISidedInventory) { - return new SidedInvWrapper(((ISidedInventory) tileEntity), face); - } else if (tileEntity instanceof IInventory) { - return new InvWrapper(((IInventory) tileEntity)); - } - return new EmptyHandler(); - } - - /** - * Constructor for ItemStack with tag - */ - public static ItemStack newItemStack(Item item, int size, int damage, NBTTagCompound tag) { - ItemStack stack = new ItemStack(item, size, damage); - stack.setTagCompound(tag); - return stack; - } - - /** - * Gets the actual damage of an item without asking the Item - */ - public static int actualDamage(ItemStack stack) { - return Items.DIAMOND.getDamage(stack); - } - - /** - * Static default implementation for IInventory method - */ - public static ItemStack decrStackSize(IInventory inv, int slot, int size) { - ItemStack item = inv.getStackInSlot(slot); - - if (item != null) { - if (item.stackSize <= size) { - inv.setInventorySlotContents(slot, null); - inv.markDirty(); - return item; - } - ItemStack itemstack1 = item.splitStack(size); - if (item.stackSize == 0) { - inv.setInventorySlotContents(slot, null); - } else { - inv.setInventorySlotContents(slot, item); - } - - inv.markDirty(); - return itemstack1; - } - return null; - } - - /** - * Static default implementation for IInventory method - */ - public static ItemStack removeStackFromSlot(IInventory inv, int slot) { - ItemStack stack = inv.getStackInSlot(slot); - inv.setInventorySlotContents(slot, null); - return stack; - } - - /** - * @return The quantity of items from addition that can be added to base - */ - public static int incrStackSize(ItemStack base, ItemStack addition) { - if (canStack(base, addition)) { - return incrStackSize(base, addition.stackSize); - } - - return 0; - } - - /** - * @return The quantity of items from addition that can be added to base - */ - public static int incrStackSize(ItemStack base, int addition) { - int totalSize = base.stackSize + addition; - - if (totalSize <= base.getMaxStackSize()) { - return addition; - } else if (base.stackSize < base.getMaxStackSize()) { - return base.getMaxStackSize() - base.stackSize; - } - - return 0; - } - - /** - * NBT item saving function - */ - public static NBTTagList writeItemStacksToTag(ItemStack[] items) { - return writeItemStacksToTag(items, 64); - } - - /** - * NBT item saving function with support for stack sizes > 32K - */ - public static NBTTagList writeItemStacksToTag(ItemStack[] items, int maxQuantity) { - NBTTagList tagList = new NBTTagList(); - for (int i = 0; i < items.length; i++) { - if (items[i] != null) { - NBTTagCompound tag = new NBTTagCompound(); - tag.setShort("Slot", (short) i); - items[i].writeToNBT(tag); - - if (maxQuantity > Short.MAX_VALUE) { - tag.setInteger("Quantity", items[i].stackSize); - } else if (maxQuantity > Byte.MAX_VALUE) { - tag.setShort("Quantity", (short) items[i].stackSize); - } - - tagList.appendTag(tag); - } - } - return tagList; - } - - /** - * NBT item loading function with support for stack sizes > 32K - */ - public static void readItemStacksFromTag(ItemStack[] items, NBTTagList tagList) { - for (int i = 0; i < tagList.tagCount(); i++) { - NBTTagCompound tag = tagList.getCompoundTagAt(i); - int b = tag.getShort("Slot"); - items[b] = ItemStack.loadItemStackFromNBT(tag); - if (tag.hasKey("Quantity")) { - items[b].stackSize = ((NBTPrimitive) tag.getTag("Quantity")).getInt(); - } - } - } - - /** - * Spawns an itemstack in the world at a location - */ - public static void dropItem(ItemStack stack, World world, Vector3 dropLocation) { - EntityItem item = new EntityItem(world, dropLocation.x, dropLocation.y, dropLocation.z, stack); - item.motionX = world.rand.nextGaussian() * 0.05; - item.motionY = world.rand.nextGaussian() * 0.05 + 0.2F; - item.motionZ = world.rand.nextGaussian() * 0.05; - world.spawnEntity(item); - } - - /** - * Copies an itemstack with a new quantity - */ - public static ItemStack copyStack(ItemStack stack, int quantity) { - if (stack == null) { - return null; - } - - stack = stack.copy(); - stack.stackSize = quantity; - return stack; - } - - /** - * Gets the maximum quantity of an item that can be inserted into inv - */ - public static int getInsertibleQuantity(InventoryRange inv, ItemStack stack) { - int quantity = 0; - stack = copyStack(stack, Integer.MAX_VALUE); - for (int slot : inv.slots) { - quantity += fitStackInSlot(inv, slot, stack); - } - - return quantity; - } - - public static int getInsertibleQuantity(IInventory inv, ItemStack stack) { - return getInsertibleQuantity(new InventoryRange(inv), stack); - } - - public static int fitStackInSlot(InventoryRange inv, int slot, ItemStack stack) { - ItemStack base = inv.inv.getStackInSlot(slot); - if (!canStack(base, stack) || !inv.canInsertItem(slot, stack)) { - return 0; - } - - int fit = base != null ? incrStackSize(base, inv.inv.getInventoryStackLimit() - base.stackSize) : inv.inv.getInventoryStackLimit(); - return Math.min(fit, stack.stackSize); - } - - public static int fitStackInSlot(IInventory inv, int slot, ItemStack stack) { - return fitStackInSlot(new InventoryRange(inv), slot, stack); - } - - /** - * @param simulate If set to true, no items will actually be inserted - * @return The number of items unable to be inserted - */ - public static int insertItem(InventoryRange inv, ItemStack stack, boolean simulate) { - stack = stack.copy(); - for (int pass = 0; pass < 2; pass++) { - for (int slot : inv.slots) { - ItemStack base = inv.inv.getStackInSlot(slot); - if ((pass == 0) == (base == null)) { - continue; - } - int fit = fitStackInSlot(inv, slot, stack); - if (fit == 0) { - continue; - } - - if (base != null) { - stack.stackSize -= fit; - if (!simulate) { - base.stackSize += fit; - inv.inv.setInventorySlotContents(slot, base); - } - } else { - if (!simulate) { - inv.inv.setInventorySlotContents(slot, copyStack(stack, fit)); - } - stack.stackSize -= fit; - } - if (stack.stackSize == 0) { - return 0; - } - } - } - return stack.stackSize; - } - - public static int insertItem(IInventory inv, ItemStack stack, boolean simulate) { - return insertItem(new InventoryRange(inv), stack, simulate); - } - - /** - * Gets the stack in slot if it can be extracted - */ - public static ItemStack getExtractableStack(InventoryRange inv, int slot) { - ItemStack stack = inv.inv.getStackInSlot(slot); - if (stack == null || !inv.canExtractItem(slot, stack)) { - return null; - } - - return stack; - } - - public static ItemStack getExtractableStack(IInventory inv, int slot) { - return getExtractableStack(new InventoryRange(inv), slot); - } - - public static boolean areStacksIdentical(ItemStack stack1, ItemStack stack2) { - if (stack1 == null || stack2 == null) { - return stack1 == stack2; - } - - return stack1.getItem() == stack2.getItem() && stack1.getItemDamage() == stack2.getItemDamage() && stack1.stackSize == stack2.stackSize && Objects.equal(stack1.getTagCompound(), stack2.getTagCompound()); - } - - /** - * Gets an IInventory from a coordinate with support for double chests - */ - public static IInventory getInventory(World world, BlockPos pos) { - return getInventory(world.getTileEntity(pos)); - } - - public static IInventory getInventory(TileEntity tile) { - if (!(tile instanceof IInventory)) { - return null; - } - - if (tile instanceof TileEntityChest) { - return getChest((TileEntityChest) tile); - } - return (IInventory) tile; - } - - public static IInventory getChest(TileEntityChest chest) { - for (EnumFacing fside : Plane.HORIZONTAL) { - if (chest.getWorld().getBlockState(chest.getPos().offset(fside)).getBlock() == chest.getBlockType()) { - return new InventoryLargeChest("container.chestDouble", (TileEntityChest) chest.getWorld().getTileEntity(chest.getPos().offset(fside)), chest); - } - } - return chest; - } - - public static boolean canStack(ItemStack stack1, ItemStack stack2) { - return stack1 == null || stack2 == null || (stack1.getItem() == stack2.getItem() && (!stack2.getHasSubtypes() || stack2.getItemDamage() == stack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(stack2, stack1)) && stack1.isStackable(); - } - - /** - * Consumes one item from slot in inv with support for containers. - */ - public static void consumeItem(IInventory inv, int slot) { - ItemStack stack = inv.getStackInSlot(slot); - Item item = stack.getItem(); - if (item.hasContainerItem(stack)) { - ItemStack container = item.getContainerItem(stack); - inv.setInventorySlotContents(slot, container); - } else { - inv.decrStackSize(slot, 1); - } - } - - /** - * Gets the size of the stack in a slot. Returns 0 on null stacks - */ - public static int stackSize(IInventory inv, int slot) { - ItemStack stack = inv.getStackInSlot(slot); - return stack == null ? 0 : stack.stackSize; - } - - /** - * Drops all items from inv using removeStackFromSlot - */ - public static void dropOnClose(EntityPlayer player, IInventory inv) { - for (int i = 0; i < inv.getSizeInventory(); i++) { - ItemStack stack = inv.removeStackFromSlot(i); - if (stack != null) { - player.dropItem(stack, false); - } - } - } - - public static NBTTagCompound savePersistant(ItemStack stack, NBTTagCompound tag) { - stack.writeToNBT(tag); - tag.removeTag("id"); - tag.setString("name", stack.getItem().getRegistryName().toString()); - return tag; - } - - public static ItemStack loadPersistant(NBTTagCompound tag) { - String name = tag.getString("name"); - Item item = Item.REGISTRY.getObject(new ResourceLocation(name)); - if (item == null) { - return null; - } - int count = tag.hasKey("Count") ? tag.getByte("Count") : 1; - int damage = tag.hasKey("Damage") ? tag.getShort("Damage") : 0; - ItemStack stack = new ItemStack(item, count, damage); - if (tag.hasKey("tag", 10)) { - stack.setTagCompound(tag.getCompoundTag("tag")); - } - return stack; - } -} diff --git a/dependencies/main/java/codechicken/lib/inventory/ItemKey.java b/dependencies/main/java/codechicken/lib/inventory/ItemKey.java deleted file mode 100644 index 2e3beb3418..0000000000 --- a/dependencies/main/java/codechicken/lib/inventory/ItemKey.java +++ /dev/null @@ -1,65 +0,0 @@ -package codechicken.lib.inventory; - -import com.google.common.base.Objects; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.oredict.OreDictionary; - -import static codechicken.lib.inventory.InventoryUtils.actualDamage; - -/** - * Comparable ItemStack with a hashCode implementation. - */ -public class ItemKey implements Comparable { - - public ItemStack stack; - private int hashcode = 0; - - public ItemKey(ItemStack k) { - stack = k; - } - - public ItemKey(Item item, int damage) { - this(new ItemStack(item, 1, damage)); - } - - public ItemKey(Item item, NBTTagCompound tag) { - this(item, OreDictionary.WILDCARD_VALUE, tag); - } - - public ItemKey(Item item, int damage, NBTTagCompound tag) { - this(item, damage); - stack.setTagCompound(tag); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof ItemKey)) { - return false; - } - - ItemKey k = (ItemKey) obj; - return stack.getItem() == k.stack.getItem() && actualDamage(stack) == actualDamage(k.stack) && Objects.equal(stack.getTagCompound(), k.stack.getTagCompound()); - } - - @Override - public int hashCode() { - return hashcode != 0 ? hashcode : (hashcode = Objects.hashCode(stack.getItem(), actualDamage(stack), stack.getTagCompound())); - } - - public int compareInt(int a, int b) { - return a == b ? 0 : a < b ? -1 : 1; - } - - @Override - public int compareTo(ItemKey o) { - if (stack.getItem() != o.stack.getItem()) { - return compareInt(Item.getIdFromItem(stack.getItem()), Item.getIdFromItem(o.stack.getItem())); - } - if (actualDamage(stack) != actualDamage(o.stack)) { - return compareInt(actualDamage(stack), actualDamage(o.stack)); - } - return 0; - } -} diff --git a/dependencies/main/java/codechicken/lib/item/ItemMultiType.java b/dependencies/main/java/codechicken/lib/item/ItemMultiType.java deleted file mode 100644 index bbbaae0f14..0000000000 --- a/dependencies/main/java/codechicken/lib/item/ItemMultiType.java +++ /dev/null @@ -1,147 +0,0 @@ -package codechicken.lib.item; - -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.EnumRarity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by covers1624 on 3/27/2016. - * TODO cleanup. - */ -public class ItemMultiType extends Item { - - private HashMap names = new HashMap(); - private HashMap rarityMap = new HashMap(); - private int nextVariant = 0; - private boolean hasRegistered = false; - private boolean registerToStackRegistry = false; - - /** - * @param registryName The name to be registered with." - */ - public ItemMultiType(CreativeTabs tab, String registryName) { - setRegistryName(registryName); - setMaxDamage(0); - setHasSubtypes(true); - setCreativeTab(tab); - setUnlocalizedName(new ResourceLocation(registryName).getResourcePath()); - setMaxStackSize(64); - } - - @Override - public ItemMultiType setUnlocalizedName(String unlocalizedName) { - super.setUnlocalizedName(unlocalizedName); - return this; - } - - public ItemMultiType setUseStackRegistry() { - registerToStackRegistry = true; - return this; - } - - public ItemStack registerSubItem(int meta, String name) { - if (names.containsKey(meta)) { - FMLLog.warning("[ItemMultiType.%s]: Variant %s with meta %s is already registered to %s with meta %s", getRegistryName(), name, meta, names.get(meta), meta); - } - names.put(meta, name); - ItemStack stack = new ItemStack(this, 1, meta); - incVariant(); - return stack; - } - - public ItemStack registerSubItem(int meta, String name, EnumRarity rarity) { - rarityMap.put(meta, rarity); - return registerSubItem(meta, name); - } - - public ItemStack registerSubItemOreDict(int meta, String name) { - ItemStack stack = registerSubItem(meta, name); - OreDictionary.registerOre(name, stack); - if (registerToStackRegistry) { - ItemStackRegistry.registerCustomItemStack(name, stack); - } - return stack; - } - - public ItemStack registerSubItemOreDict(int meta, String name, EnumRarity rarity) { - rarityMap.put(meta, rarity); - return registerSubItemOreDict(meta, name); - } - - public ItemStack registerSubItem(String name) { - return registerSubItem(nextVariant, name); - } - - public ItemStack registerSubItem(String name, EnumRarity rarity) { - rarityMap.put(nextVariant, rarity); - return registerSubItem(name); - } - - public ItemStack registerSubItemOreDict(String name) { - ItemStack stack = registerSubItem(nextVariant, name); - OreDictionary.registerOre(name, stack); - if (registerToStackRegistry) { - ItemStackRegistry.registerCustomItemStack(name, stack); - } - return stack; - } - - public ItemStack registerSubItemOreDict(String name, EnumRarity rarity) { - rarityMap.put(nextVariant, rarity); - return registerSubItemOreDict(name); - } - - private void incVariant() { - if (names.containsKey(nextVariant)) { - nextVariant++; - while (names.containsKey(nextVariant)) { - nextVariant++; - } - } - } - - @SuppressWarnings ("ConstantConditions") - @SideOnly (Side.CLIENT) - public void registerModelVariants() { - if (!hasRegistered) { - for (Map.Entry entry : names.entrySet()) { - ModelResourceLocation location = new ModelResourceLocation(getRegistryName(), "type=" + entry.getValue().toLowerCase()); - ModelLoader.setCustomModelResourceLocation(this, entry.getKey(), location); - } - hasRegistered = true; - } - } - - @Override - public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) { - for (Map.Entry entry : names.entrySet()) { - subItems.add(new ItemStack(itemIn, 1, entry.getKey())); - } - } - - @Override - public String getUnlocalizedName(ItemStack stack) { - int meta = stack.getItemDamage(); - return getUnlocalizedName() + "." + names.get(meta); - } - - @Override - public EnumRarity getRarity(ItemStack stack) { - if (rarityMap.containsKey(stack.getItemDamage())) { - return rarityMap.get(stack.getItemDamage()); - } - return super.getRarity(stack); - } -} diff --git a/dependencies/main/java/codechicken/lib/item/ItemStackRegistry.java b/dependencies/main/java/codechicken/lib/item/ItemStackRegistry.java deleted file mode 100644 index 4c1e9b5bfa..0000000000 --- a/dependencies/main/java/codechicken/lib/item/ItemStackRegistry.java +++ /dev/null @@ -1,52 +0,0 @@ -package codechicken.lib.item; - -import com.google.common.collect.HashBasedTable; -import com.google.common.collect.Table; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.registry.ForgeRegistries; - -/** - * Created by covers1624 on 22/10/2016. - * TODO, We need to find another way to do this. - */ -public class ItemStackRegistry { - - private static Table stackRegistry = HashBasedTable.create(); - - public static void registerCustomItemStack(String name, ItemStack stack) { - stackRegistry.put(Loader.instance().activeModContainer().getModId(), name, stack); - } - - public static ItemStack findItemStack(String modId, String name, int stackSize) { - ItemStack foundStack = findItemStack(modId, name); - if (foundStack != null) { - ItemStack copy = foundStack.copy(); - copy.stackSize = Math.min(stackSize, copy.getMaxStackSize()); - return copy; - } - return null; - } - - public static ItemStack findItemStack(String modId, String name) { - ItemStack stack = stackRegistry.get(modId, name); - if (stack == null) { - Item item = ForgeRegistries.ITEMS.getValue(new ResourceLocation(modId, name)); - if (item != null) { - stack = new ItemStack(item, 0, 0); - } - } - if (stack == null) { - Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(modId, name)); - if (block != null && block != Blocks.AIR) { - stack = new ItemStack(block, 0, Short.MAX_VALUE); - } - } - return stack; - } - -} diff --git a/dependencies/main/java/codechicken/lib/item/filtering/IItemFilter.java b/dependencies/main/java/codechicken/lib/item/filtering/IItemFilter.java deleted file mode 100644 index 7834b6c7fb..0000000000 --- a/dependencies/main/java/codechicken/lib/item/filtering/IItemFilter.java +++ /dev/null @@ -1,20 +0,0 @@ -package codechicken.lib.item.filtering; - -import net.minecraft.item.ItemStack; - -/** - * This is an item filter. - * Implement it and do stuff, Its pretty simple. - * There are some default filters provided as well. - */ -public interface IItemFilter { - - /** - * Checks to see if the item matches the filter. - * True means the item is allowed, false the item is not allowed. - * - * @param item Item to check. - * @return True if the item matches the filter. - */ - boolean matches(ItemStack item); -} diff --git a/dependencies/main/java/codechicken/lib/item/filtering/IItemFilterProvider.java b/dependencies/main/java/codechicken/lib/item/filtering/IItemFilterProvider.java deleted file mode 100644 index 6f9df2aba1..0000000000 --- a/dependencies/main/java/codechicken/lib/item/filtering/IItemFilterProvider.java +++ /dev/null @@ -1,13 +0,0 @@ -package codechicken.lib.item.filtering; - -/** - * Defines a class that can obtain filters, Really only used in NEI but here because reasons. - */ -public interface IItemFilterProvider { - - /** - * Provides an item filter. May be called from any thread. Returned filter should only reference objects with immutable state. - */ - IItemFilter getFilter(); - -} diff --git a/dependencies/main/java/codechicken/lib/lighting/LC.java b/dependencies/main/java/codechicken/lib/lighting/LC.java deleted file mode 100644 index 828e76d971..0000000000 --- a/dependencies/main/java/codechicken/lib/lighting/LC.java +++ /dev/null @@ -1,91 +0,0 @@ -package codechicken.lib.lighting; - -import codechicken.lib.util.Copyable; -import codechicken.lib.util.VectorUtils; -import codechicken.lib.vec.Rotation; -import codechicken.lib.vec.Vector3; - -public class LC implements Copyable { - - public int side; - public float fa; - public float fb; - public float fc; - public float fd; - - public LC() { - this(0, 0, 0, 0, 0); - } - - public LC(int s, float a, float b, float c, float d) { - side = s; - fa = a; - fb = b; - fc = c; - fd = d; - } - - public LC set(int s, float a, float b, float c, float d) { - side = s; - fa = a; - fb = b; - fc = c; - fd = d; - return this; - } - - public LC set(LC lc) { - return set(lc.side, lc.fa, lc.fb, lc.fc, lc.fd); - } - - public LC compute(Vector3 vec, Vector3 normal) { - int side = VectorUtils.findSide(normal); - if (side < 0) { - return set(12, 1, 0, 0, 0); - } - return compute(vec, side); - } - - public LC compute(Vector3 vec, int side) { - boolean offset = false; - switch (side) { - case 0: - offset = vec.y <= 0; - break; - case 1: - offset = vec.y >= 1; - break; - case 2: - offset = vec.z <= 0; - break; - case 3: - offset = vec.z >= 1; - break; - case 4: - offset = vec.x <= 0; - break; - case 5: - offset = vec.x >= 1; - break; - } - if (!offset) { - side += 6; - } - return computeO(vec, side); - } - - public LC computeO(Vector3 vec, int side) { - Vector3 v1 = Rotation.axes[((side & 0xE) + 3) % 6]; - Vector3 v2 = Rotation.axes[((side & 0xE) + 5) % 6]; - float d1 = (float) vec.scalarProject(v1); - float d2 = 1 - d1; - float d3 = (float) vec.scalarProject(v2); - float d4 = 1 - d3; - return set(side, d2 * d4, d2 * d3, d1 * d4, d1 * d3); - } - - @Override - public LC copy() { - return new LC(side, fa, fb, fc, fd); - } -} diff --git a/dependencies/main/java/codechicken/lib/lighting/LightMatrix.java b/dependencies/main/java/codechicken/lib/lighting/LightMatrix.java deleted file mode 100644 index 24b7505c26..0000000000 --- a/dependencies/main/java/codechicken/lib/lighting/LightMatrix.java +++ /dev/null @@ -1,173 +0,0 @@ -package codechicken.lib.lighting; - -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; - -/** - * Note that when using the class as a vertex transformer, the vertices are assumed to be within the BB (x, y, z) -> (x+1, y+1, z+1) - */ -public class LightMatrix implements IVertexOperation { - - public static final int operationIndex = CCRenderState.registerOperation(); - - public int computed = 0; - public float[][] ao = new float[13][4]; - public int[][] brightness = new int[13][4]; - - public IBlockAccess access; - public BlockPos pos = BlockPos.ORIGIN; - - private int sampled = 0; - private float[] aSamples = new float[27]; - private int[] bSamples = new int[27]; - - /** - * The 9 positions in the sample array for each side, sides >= 6 are centered on sample 13 (the block itself) - */ - //@formatter:off - public static final int[][] ssamplem = new int[][]{ - { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, - {18,19,20,21,22,23,24,25,26 }, - { 0, 9,18, 1,10,19, 2,11,20 }, - { 6,15,24, 7,16,25, 8,17,26 }, - { 0, 3, 6, 9,12,15,18,21,24 }, - { 2, 5, 8,11,14,17,20,23,26 }, - { 9,10,11,12,13,14,15,16,17 }, - { 9,10,11,12,13,14,15,16,17 }, - { 3,12,21, 4,13,22, 5,14,23 }, - { 3,12,21, 4,13,22, 5,14,23 }, - { 1, 4, 7,10,13,16,19,22,25 }, - { 1, 4, 7,10,13,16,19,22,25 }, - {13,13,13,13,13,13,13,13,13 }}; - public static final int[][] qsamplem = new int[][] {//the positions in the side sample array for each corner - {0,1,3,4}, - {5,1,2,4}, - {6,7,3,4}, - {5,7,8,4}}; - public static final float[] sideao = new float[]{ - 0.5F, 1F, 0.8F, 0.8F, 0.6F, 0.6F, - 0.5F, 1F, 0.8F, 0.8F, 0.6F, 0.6F, - 1F }; - - //@formatter:on - /*static - { - int[][] os = new int[][]{ - {0,-1,0}, - {0, 1,0}, - {0,0,-1}, - {0,0, 1}, - {-1,0,0}, - { 1,0,0}}; - - for(int s = 0; s < 12; s++) - { - int[] d0 = s < 6 ? new int[]{os[s][0]+1, os[s][1]+1, os[s][2]+1} : new int[]{1, 1, 1}; - int[] d1 = os[((s&0xE)+3)%6]; - int[] d2 = os[((s&0xE)+5)%6]; - for(int a = -1; a <= 1; a++) - for(int b = -1; b <= 1; b++) - ssamplem[s][(a+1)*3+b+1] = (d0[1]+d1[1]*a+d2[1]*b)*9+(d0[2]+d1[2]*a+d2[2]*b)*3+(d0[0]+d1[0]*a+d2[0]*b); - } - System.out.println(Arrays.deepToString(ssamplem)); - }*/ - - public void locate(IBlockAccess a, BlockPos bPos) { - access = a; - pos = bPos; - computed = 0; - sampled = 0; - } - - public void sample(int i) { - if ((sampled & 1 << i) == 0) { - BlockPos bp = new BlockPos(pos.getX() + (i % 3) - 1, pos.getY() + (i / 9) - 1, pos.getZ() + (i / 3 % 3) - 1); - IBlockState b = access.getBlockState(bp); - bSamples[i] = access.getCombinedLight(bp, b.getLightValue(access, bp)); - aSamples[i] = b.getBlock().getAmbientOcclusionLightValue(b); - sampled |= 1 << i; - } - } - - public int[] brightness(int side) { - sideSample(side); - return brightness[side]; - } - - public float[] ao(int side) { - sideSample(side); - return ao[side]; - } - - public void sideSample(int side) { - if ((computed & 1 << side) == 0) { - int[] ssample = ssamplem[side]; - for (int q = 0; q < 4; q++) { - int[] qsample = qsamplem[q]; - if (Minecraft.isAmbientOcclusionEnabled()) { - interp(side, q, ssample[qsample[0]], ssample[qsample[1]], ssample[qsample[2]], ssample[qsample[3]]); - } else { - interp(side, q, ssample[4], ssample[4], ssample[4], ssample[4]); - } - } - computed |= 1 << side; - } - } - - protected void interp(int s, int q, int a, int b, int c, int d) { - sample(a); - sample(b); - sample(c); - sample(d); - ao[s][q] = interpAO(aSamples[a], aSamples[b], aSamples[c], aSamples[d]) * sideao[s]; - brightness[s][q] = interpBrightness(bSamples[a], bSamples[b], bSamples[c], bSamples[d]); - } - - public static float interpAO(float a, float b, float c, float d) { - return (a + b + c + d) / 4F; - } - - public static int interpBrightness(int a, int b, int c, int d) { - if (a == 0) { - a = d; - } - if (b == 0) { - b = d; - } - if (c == 0) { - c = d; - } - return (a + b + c + d) >> 2 & 0xFF00FF; - } - - @Override - public boolean load(CCRenderState state) { - if (!state.computeLighting) { - return false; - } - - state.pipeline.addDependency(state.colourAttrib); - state.pipeline.addDependency(state.lightCoordAttrib); - return true; - } - - @Override - public void operate(CCRenderState state) { - LC lc = state.lc; - float[] a = ao(lc.side); - float f = (a[0] * lc.fa + a[1] * lc.fb + a[2] * lc.fc + a[3] * lc.fd); - int[] b = brightness(lc.side); - state.colour = ColourRGBA.multiplyC(state.colour, f); - state.brightness = (int) (b[0] * lc.fa + b[1] * lc.fb + b[2] * lc.fc + b[3] * lc.fd) & 0xFF00FF; - } - - @Override - public int operationID() { - return operationIndex; - } -} diff --git a/dependencies/main/java/codechicken/lib/lighting/LightModel.java b/dependencies/main/java/codechicken/lib/lighting/LightModel.java deleted file mode 100644 index 32a35352ed..0000000000 --- a/dependencies/main/java/codechicken/lib/lighting/LightModel.java +++ /dev/null @@ -1,111 +0,0 @@ -package codechicken.lib.lighting; - -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.Rotation; -import codechicken.lib.vec.Vector3; - -public class LightModel implements IVertexOperation { - - public static final int operationIndex = CCRenderState.registerOperation(); - - public static class Light { - - public Vector3 ambient = new Vector3(); - public Vector3 diffuse = new Vector3(); - public Vector3 position; - - public Light(Vector3 pos) { - position = pos.copy().normalize(); - } - - public Light setDiffuse(Vector3 vec) { - diffuse.set(vec); - return this; - } - - public Light setAmbient(Vector3 vec) { - ambient.set(vec); - return this; - } - } - - public static LightModel standardLightModel; - - static { - standardLightModel = new LightModel().setAmbient(new Vector3(0.4, 0.4, 0.4)).addLight(new Light(new Vector3(0.2, 1, -0.7)).setDiffuse(new Vector3(0.6, 0.6, 0.6))).addLight(new Light(new Vector3(-0.2, 1, 0.7)).setDiffuse(new Vector3(0.6, 0.6, 0.6))); - } - - private Vector3 ambient = new Vector3(); - private Light[] lights = new Light[8]; - private int lightCount; - - public LightModel addLight(Light light) { - lights[lightCount++] = light; - return this; - } - - public LightModel setAmbient(Vector3 vec) { - ambient.set(vec); - return this; - } - - /** - * @param colour The pre-lighting vertex colour. RGBA format - * @param normal The normal at the vertex - * @return The lighting applied colour - */ - public int apply(int colour, Vector3 normal) { - Vector3 n_colour = ambient.copy(); - for (int l = 0; l < lightCount; l++) { - Light light = lights[l]; - double n_l = light.position.dotProduct(normal); - double f = n_l > 0 ? 1 : 0; - n_colour.x += light.ambient.x + f * light.diffuse.x * n_l; - n_colour.y += light.ambient.y + f * light.diffuse.y * n_l; - n_colour.z += light.ambient.z + f * light.diffuse.z * n_l; - } - - if (n_colour.x > 1) { - n_colour.x = 1; - } - if (n_colour.y > 1) { - n_colour.y = 1; - } - if (n_colour.z > 1) { - n_colour.z = 1; - } - - n_colour.multiply((colour >>> 24) / 255D, (colour >> 16 & 0xFF) / 255D, (colour >> 8 & 0xFF) / 255D); - return (int) (n_colour.x * 255) << 24 | (int) (n_colour.y * 255) << 16 | (int) (n_colour.z * 255) << 8 | colour & 0xFF; - } - - @Override - public boolean load(CCRenderState state) { - if (!state.computeLighting) { - return false; - } - - state.pipeline.addDependency(state.normalAttrib); - state.pipeline.addDependency(state.colourAttrib); - return true; - } - - @Override - public void operate(CCRenderState state) { - state.colour = apply(state.colour, state.normal); - } - - @Override - public int operationID() { - return operationIndex; - } - - public PlanarLightModel reducePlanar() { - int[] colours = new int[6]; - for (int i = 0; i < 6; i++) { - colours[i] = apply(-1, Rotation.axes[i]); - } - return new PlanarLightModel(colours); - } -} diff --git a/dependencies/main/java/codechicken/lib/lighting/PlanarLightMatrix.java b/dependencies/main/java/codechicken/lib/lighting/PlanarLightMatrix.java deleted file mode 100644 index d04823d84c..0000000000 --- a/dependencies/main/java/codechicken/lib/lighting/PlanarLightMatrix.java +++ /dev/null @@ -1,55 +0,0 @@ -package codechicken.lib.lighting; - -import codechicken.lib.render.CCRenderState; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; - -public class PlanarLightMatrix extends PlanarLightModel { - - public static final int operationIndex = CCRenderState.registerOperation(); - public static PlanarLightMatrix instance = new PlanarLightMatrix(); - - public IBlockAccess access; - public BlockPos pos = BlockPos.ORIGIN; - - private int sampled = 0; - public int[] brightness = new int[6]; - - public PlanarLightMatrix() { - super(PlanarLightModel.standardLightModel.colours); - } - - public PlanarLightMatrix locate(IBlockAccess a, BlockPos bPos) { - access = a; - pos = bPos; - sampled = 0; - return this; - } - - public int brightness(int side) { - if ((sampled & 1 << side) == 0) { - IBlockState b = access.getBlockState(pos); - brightness[side] = access.getCombinedLight(pos, b.getBlock().getLightValue(b, access, pos)); - sampled |= 1 << side; - } - return brightness[side]; - } - - @Override - public boolean load(CCRenderState state) { - state.pipeline.addDependency(state.sideAttrib); - return true; - } - - @Override - public void operate(CCRenderState state) { - super.operate(state); - state.brightness = brightness(state.side); - } - - @Override - public int operationID() { - return operationIndex; - } -} diff --git a/dependencies/main/java/codechicken/lib/lighting/PlanarLightModel.java b/dependencies/main/java/codechicken/lib/lighting/PlanarLightModel.java deleted file mode 100644 index d280d9d9bd..0000000000 --- a/dependencies/main/java/codechicken/lib/lighting/PlanarLightModel.java +++ /dev/null @@ -1,40 +0,0 @@ -package codechicken.lib.lighting; - -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; - -/** - * Faster precomputed version of LightModel that only works for axis planar sides - */ -public class PlanarLightModel implements IVertexOperation { - - public static PlanarLightModel standardLightModel = LightModel.standardLightModel.reducePlanar(); - - public int[] colours; - - public PlanarLightModel(int[] colours) { - this.colours = colours; - } - - @Override - public boolean load(CCRenderState state) { - if (!state.computeLighting) { - return false; - } - - state.pipeline.addDependency(state.sideAttrib); - state.pipeline.addDependency(state.colourAttrib); - return true; - } - - @Override - public void operate(CCRenderState state) { - state.colour = ColourRGBA.multiply(state.colour, colours[state.side]); - } - - @Override - public int operationID() { - return LightModel.operationIndex; - } -} diff --git a/dependencies/main/java/codechicken/lib/lighting/SimpleBrightnessModel.java b/dependencies/main/java/codechicken/lib/lighting/SimpleBrightnessModel.java deleted file mode 100644 index 71efc8e026..0000000000 --- a/dependencies/main/java/codechicken/lib/lighting/SimpleBrightnessModel.java +++ /dev/null @@ -1,57 +0,0 @@ -package codechicken.lib.lighting; - -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; - -/** - * Simple brightness model that only works for axis planar sides - */ -public class SimpleBrightnessModel implements IVertexOperation { - - public static final int operationIndex = CCRenderState.registerOperation(); - public static SimpleBrightnessModel instance = new SimpleBrightnessModel(); - - public IBlockAccess access; - public BlockPos pos = BlockPos.ORIGIN; - - private int sampled = 0; - private int[] samples = new int[6]; - private BlockPos c = BlockPos.ORIGIN; - - public void locate(IBlockAccess a, BlockPos bPos) { - access = a; - pos = bPos; - sampled = 0; - } - - public int sample(int side) { - if ((sampled & 1 << side) == 0) { - c = pos.offset(EnumFacing.VALUES[side]); - IBlockState b = access.getBlockState(c); - samples[side] = access.getCombinedLight(c, b.getBlock().getLightValue(b, access, c)); - sampled |= 1 << side; - } - return samples[side]; - } - - @Override - public boolean load(CCRenderState state) { - - state.pipeline.addDependency(state.sideAttrib); - return true; - } - - @Override - public void operate(CCRenderState state) { - state.brightness = sample(state.side); - } - - @Override - public int operationID() { - return operationIndex; - } -} diff --git a/dependencies/main/java/codechicken/lib/math/MathHelper.java b/dependencies/main/java/codechicken/lib/math/MathHelper.java deleted file mode 100644 index ff6b591e5e..0000000000 --- a/dependencies/main/java/codechicken/lib/math/MathHelper.java +++ /dev/null @@ -1,312 +0,0 @@ -package codechicken.lib.math; - -import net.minecraft.util.math.BlockPos; - -//TODO cleanup. -public class MathHelper { - - public static final double phi = 1.618033988749894; - public static final double pi = Math.PI; - public static final double todeg = 57.29577951308232; - public static final double torad = 0.017453292519943; - public static final double sqrt2 = 1.414213562373095; - - public static double[] SIN_TABLE = new double[65536]; - - static { - for (int i = 0; i < 65536; ++i) { - SIN_TABLE[i] = Math.sin(i / 65536D * 2 * Math.PI); - } - - SIN_TABLE[0] = 0; - SIN_TABLE[16384] = 1; - SIN_TABLE[32768] = 0; - SIN_TABLE[49152] = 1; - } - - public static double sin(double d) { - return SIN_TABLE[(int) ((float) d * 10430.378F) & 65535]; - } - - public static double cos(double d) { - return SIN_TABLE[(int) ((float) d * 10430.378F + 16384.0F) & 65535]; - } - - /** - * @param a The value - * @param b The value to approach - * @param max The maximum step - * @return the closed value to b no less than max from a - */ - public static float approachLinear(float a, float b, float max) { - return (a > b) ? (a - b < max ? b : a - max) : (b - a < max ? b : a + max); - } - - /** - * @param a The value - * @param b The value to approach - * @param max The maximum step - * @return the closed value to b no less than max from a - */ - public static double approachLinear(double a, double b, double max) { - return (a > b) ? (a - b < max ? b : a - max) : (b - a < max ? b : a + max); - } - - /** - * @param a The first value - * @param b The second value - * @param d The interpolation factor, between 0 and 1 - * @return a+(b-a)*d - */ - public static float interpolate(float a, float b, float d) { - return a + (b - a) * d; - } - - /** - * @param a The first value - * @param b The second value - * @param d The interpolation factor, between 0 and 1 - * @return a+(b-a)*d - */ - public static double interpolate(double a, double b, double d) { - return a + (b - a) * d; - } - - /** - * @param a The value - * @param b The value to approach - * @param ratio The ratio to reduce the difference by - * @return a+(b-a)*ratio - */ - public static double approachExp(double a, double b, double ratio) { - return a + (b - a) * ratio; - } - - /** - * @param a The value - * @param b The value to approach - * @param ratio The ratio to reduce the difference by - * @param cap The maximum amount to advance by - * @return a+(b-a)*ratio - */ - public static double approachExp(double a, double b, double ratio, double cap) { - double d = (b - a) * ratio; - if (Math.abs(d) > cap) { - d = Math.signum(d) * cap; - } - return a + d; - } - - /** - * @param a The value - * @param b The value to approach - * @param ratio The ratio to reduce the difference by - * @param c The value to retreat from - * @param kick The difference when a == c - * @return - */ - public static double retreatExp(double a, double b, double c, double ratio, double kick) { - double d = (Math.abs(c - a) + kick) * ratio; - if (d > Math.abs(b - a)) { - return b; - } - return a + Math.signum(b - a) * d; - } - - /** - * @param value The value - * @param min The min value - * @param max The max value - * @return The clipped value between min and max - */ - public static double clip(double value, double min, double max) { - if (value > max) { - value = max; - } - if (value < min) { - value = min; - } - return value; - } - - /** - * @param value The value - * @param min The min value - * @param max The max value - * @return The clipped value between min and max - */ - public static float clip(float value, float min, float max) { - if (value > max) { - value = max; - } - if (value < min) { - value = min; - } - return value; - } - - /** - * @param value The value - * @param min The min value - * @param max The max value - * @return The clipped value between min and max - */ - public static int clip(int value, int min, int max) { - if (value > max) { - value = max; - } - if (value < min) { - value = min; - } - return value; - } - - /** - * Maps a value range to another value range. - * - * @param valueIn The value to map. - * @param inMin The minimum of the input value range. - * @param inMax The maximum of the input value range - * @param outMin The minimum of the output value range. - * @param outMax The maximum of the output value range. - * @return The mapped value. - */ - public static double map(double valueIn, double inMin, double inMax, double outMin, double outMax) { - return (valueIn - inMin) * (outMax - outMin) / (inMax - inMin) + outMin; - } - - /** - * Maps a value range to another value range. - * - * @param valueIn The value to map. - * @param inMin The minimum of the input value range. - * @param inMax The maximum of the input value range - * @param outMin The minimum of the output value range. - * @param outMax The maximum of the output value range. - * @return The mapped value. - */ - public static float map(float valueIn, float inMin, float inMax, float outMin, float outMax) { - return (valueIn - inMin) * (outMax - outMin) / (inMax - inMin) + outMin; - } - - /** - * Rounds the number of decimal places based on the given multiplier.
- * e.g.
- * Input: 17.5245743
- * multiplier: 1000
- * Output: 17.534
- * multiplier: 10
- * Output 17.5

- * - * @param number The input value. - * @param multiplier The multiplier. - * @return The input rounded to a number of decimal places based on the multiplier. - */ - public static double round(double number, double multiplier) { - return Math.round(number * multiplier) / multiplier; - } - - /** - * Rounds the number of decimal places based on the given multiplier.
- * e.g.
- * Input: 17.5245743
- * multiplier: 1000
- * Output: 17.534
- * multiplier: 10
- * Output 17.5

- * - * @param number The input value. - * @param multiplier The multiplier. - * @return The input rounded to a number of decimal places based on the multiplier. - */ - public static float round(float number, float multiplier) { - return Math.round(number * multiplier) / multiplier; - } - - /** - * @return min <= value <= max - */ - public static boolean between(double min, double value, double max) { - return min <= value && value <= max; - } - - public static int approachExpI(int a, int b, double ratio) { - int r = (int) Math.round(approachExp(a, b, ratio)); - return r == a ? b : r; - } - - public static int retreatExpI(int a, int b, int c, double ratio, int kick) { - int r = (int) Math.round(retreatExp(a, b, c, ratio, kick)); - return r == a ? b : r; - } - - public static int floor(double d) { - return net.minecraft.util.math.MathHelper.floor_double(d); - } - - public static int floor(float d) { - return net.minecraft.util.math.MathHelper.floor_float(d); - } - - public static int ceil(double d) { - return net.minecraft.util.math.MathHelper.ceiling_double_int(d); - } - - public static int ceil(float d) { - return net.minecraft.util.math.MathHelper.ceiling_float_int(d); - } - - public static float sqrt(float f) { - return net.minecraft.util.math.MathHelper.sqrt_float(f); - } - - public static float sqrt(double f) { - return net.minecraft.util.math.MathHelper.sqrt_double(f); - } - - public static int roundAway(double d) { - return (int) (d < 0 ? Math.floor(d) : Math.ceil(d)); - } - - public static int compare(int a, int b) { - return a == b ? 0 : a < b ? -1 : 1; - } - - public static int compare(double a, double b) { - return a == b ? 0 : a < b ? -1 : 1; - } - - public static int absSum(BlockPos pos) { - return (pos.getX() < 0 ? -pos.getX() : pos.getX()) + (pos.getY() < 0 ? -pos.getY() : pos.getY()) + (pos.getZ() < 0 ? -pos.getZ() : pos.getZ()); - } - - public static boolean isAxial(BlockPos pos) { - return pos.getX() == 0 ? (pos.getY() == 0 || pos.getZ() == 0) : (pos.getY() == 0 && pos.getZ() == 0); - } - - public static int toSide(BlockPos pos) { - if (!isAxial(pos)) { - return -1; - } - if (pos.getY() < 0) { - return 0; - } - if (pos.getY() > 0) { - return 1; - } - if (pos.getZ() < 0) { - return 2; - } - if (pos.getZ() > 0) { - return 3; - } - if (pos.getX() < 0) { - return 4; - } - if (pos.getX() > 0) { - return 5; - } - - return -1; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/BakedModelProperties.java b/dependencies/main/java/codechicken/lib/model/BakedModelProperties.java deleted file mode 100644 index eb33d7a3e9..0000000000 --- a/dependencies/main/java/codechicken/lib/model/BakedModelProperties.java +++ /dev/null @@ -1,60 +0,0 @@ -package codechicken.lib.model; - -import codechicken.lib.util.Copyable; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; - -/** - * Created by covers1624 on 19/11/2016. - */ -public class BakedModelProperties implements Copyable { - - private final boolean isAO; - private final boolean isGui3D; - private final boolean isBuiltInRenderer; - private final TextureAtlasSprite particle; - - public BakedModelProperties(boolean isAO, boolean isGui3D) { - this(isAO, isGui3D, false, null); - } - - public BakedModelProperties(BakedModelProperties properties, TextureAtlasSprite sprite) { - this(properties.isAmbientOcclusion(), properties.isGui3d(), properties.isBuiltInRenderer(), sprite); - } - - public BakedModelProperties(boolean isAO, boolean isGui3D, TextureAtlasSprite sprite) { - this(isAO, isGui3D, false, sprite); - } - - public BakedModelProperties(boolean isAO, boolean isGui3D, boolean isBuiltInRenderer, TextureAtlasSprite particle) { - this.isAO = isAO; - this.isGui3D = isGui3D; - this.isBuiltInRenderer = isBuiltInRenderer; - this.particle = particle; - } - - public static BakedModelProperties createFromModel(IBakedModel model) { - return new BakedModelProperties(model.isAmbientOcclusion(), model.isGui3d(), model.isBuiltInRenderer(), model.getParticleTexture()); - } - - public boolean isAmbientOcclusion() { - return isAO; - } - - public boolean isGui3d() { - return isGui3D; - } - - public boolean isBuiltInRenderer() { - return isBuiltInRenderer; - } - - public TextureAtlasSprite getParticleTexture() { - return particle; - } - - @Override - public BakedModelProperties copy() { - return new BakedModelProperties(isAO, isGui3D, isBuiltInRenderer, particle); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/CCMultiModel.java b/dependencies/main/java/codechicken/lib/model/CCMultiModel.java deleted file mode 100644 index d9276c4cc7..0000000000 --- a/dependencies/main/java/codechicken/lib/model/CCMultiModel.java +++ /dev/null @@ -1,91 +0,0 @@ -package codechicken.lib.model; - -import codechicken.lib.model.bakedmodels.PerspectiveAwareMultiModel; -import codechicken.lib.texture.TextureUtils; -import com.google.common.base.Function; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.IModel; -import net.minecraftforge.common.model.IModelState; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * Created by covers1624 on 16/12/2016. - */ -public class CCMultiModel implements IModel { - - private final IModel base; - private final BakedModelProperties baseProperties; - private final List subModels; - - public CCMultiModel(IModel base, BakedModelProperties baseProperties, List subModels) { - this.base = base; - this.baseProperties = baseProperties; - this.subModels = subModels; - } - - @Override - public Collection getDependencies() { - List deps = new ArrayList(); - if (base != null) { - deps.addAll(base.getDependencies()); - } - for (IModel subModel : subModels) { - deps.addAll(subModel.getDependencies()); - } - return deps; - } - - @Override - public Collection getTextures() { - List deps = new ArrayList(); - if (base != null) { - deps.addAll(base.getTextures()); - } - for (IModel subModel : subModels) { - deps.addAll(subModel.getTextures()); - } - return deps; - } - - @Override - public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { - IBakedModel baseBakedModel = null; - if (base != null) { - baseBakedModel = base.bake(state, format, bakedTextureGetter); - } - List subBakedModels = new ArrayList(); - TextureAtlasSprite particle = null; - if (baseBakedModel != null) { - particle = baseBakedModel.getParticleTexture(); - } - for (IModel subModel : subModels) { - TextureAtlasSprite particleCandidate = null; - IBakedModel bakedSubModel = subModel.bake(subModel.getDefaultState(), format, bakedTextureGetter); - subBakedModels.add(bakedSubModel); - if (particle == null || particle == TextureUtils.getMissingSprite()) { - if (particleCandidate == null || particleCandidate == TextureUtils.getMissingSprite()) { - particleCandidate = bakedSubModel.getParticleTexture(); - } - if (particleCandidate != null || particleCandidate != TextureUtils.getMissingSprite()) { - particle = particleCandidate; - } - } - } - if (particle == null) { - particle = TextureUtils.getMissingSprite(); - } - - return new PerspectiveAwareMultiModel(baseBakedModel, subBakedModels, state, new BakedModelProperties(baseProperties, particle)); - } - - @Override - public IModelState getDefaultState() { - return base.getDefaultState(); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/CCOverrideBakedBlockModel.java b/dependencies/main/java/codechicken/lib/model/CCOverrideBakedBlockModel.java deleted file mode 100644 index c9b6c08db0..0000000000 --- a/dependencies/main/java/codechicken/lib/model/CCOverrideBakedBlockModel.java +++ /dev/null @@ -1,83 +0,0 @@ -package codechicken.lib.model; - -import codechicken.lib.model.loader.CCBakedModelLoader; -import codechicken.lib.texture.TextureUtils; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemOverrideList; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.EnumFacing; - -import javax.annotation.Nullable; -import java.util.LinkedList; -import java.util.List; - -/** - * Created by covers1624 on 7/31/2016. - */ -@Deprecated -public class CCOverrideBakedBlockModel implements IBakedModel { - - private final String particle; - private final boolean isAmbientOcclusion; - private final ItemOverrideList overrideList; - - public CCOverrideBakedBlockModel(String particle) { - this(particle, ItemOverrideList.NONE); - } - - public CCOverrideBakedBlockModel(String particle, ItemOverrideList overrideList) { - this(particle, false, overrideList); - } - - public CCOverrideBakedBlockModel(String particle, boolean isAmbientOcclusion, ItemOverrideList overrideList) { - this.particle = particle; - this.isAmbientOcclusion = isAmbientOcclusion; - this.overrideList = overrideList; - } - - @Override - public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { - LinkedList quads = new LinkedList(); - if (state == null) { - return quads; - } - IBakedModel correctModel = CCBakedModelLoader.getModel(state); - if (correctModel != null) { - quads.addAll(correctModel.getQuads(state, side, rand)); - } - return quads; - } - - @Override - public boolean isAmbientOcclusion() { - return isAmbientOcclusion; - } - - @Override - public boolean isGui3d() { - return false; - } - - @Override - public boolean isBuiltInRenderer() { - return false; - } - - @Override - public TextureAtlasSprite getParticleTexture() { - return TextureUtils.getTexture(particle); - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() { - return ItemCameraTransforms.DEFAULT; - } - - @Override - public ItemOverrideList getOverrides() { - return overrideList; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/CCOverrideBakedModel.java b/dependencies/main/java/codechicken/lib/model/CCOverrideBakedModel.java deleted file mode 100644 index ceb085d8a2..0000000000 --- a/dependencies/main/java/codechicken/lib/model/CCOverrideBakedModel.java +++ /dev/null @@ -1,13 +0,0 @@ -package codechicken.lib.model; - -/** - * Created by covers1624 on 7/25/2016. - * Default implementation for CCOverrideListHandler. - */ -@Deprecated -public class CCOverrideBakedModel extends SimpleOverrideBakedModel { - - public CCOverrideBakedModel() { - super(new CCOverrideListHandler()); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/CCOverrideListHandler.java b/dependencies/main/java/codechicken/lib/model/CCOverrideListHandler.java deleted file mode 100644 index 3744845c32..0000000000 --- a/dependencies/main/java/codechicken/lib/model/CCOverrideListHandler.java +++ /dev/null @@ -1,32 +0,0 @@ -package codechicken.lib.model; - -import codechicken.lib.model.loader.CCBakedModelLoader; -import com.google.common.collect.ImmutableList; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemOverride; -import net.minecraft.client.renderer.block.model.ItemOverrideList; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * Created by covers1624 on 7/25/2016. - *

- * Default implementation for CCBakedModelLoader. - */ -@Deprecated -public class CCOverrideListHandler extends ItemOverrideList { - - public CCOverrideListHandler() { - super(ImmutableList.of()); - } - - @Override - public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) { - IBakedModel model = CCBakedModelLoader.getModel(stack); - if (model == null) { - return originalModel; - } - return model; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/DummyBakedModel.java b/dependencies/main/java/codechicken/lib/model/DummyBakedModel.java deleted file mode 100644 index 1743131235..0000000000 --- a/dependencies/main/java/codechicken/lib/model/DummyBakedModel.java +++ /dev/null @@ -1,56 +0,0 @@ -package codechicken.lib.model; - -import com.google.common.collect.ImmutableList; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemOverrideList; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.EnumFacing; - -import javax.annotation.Nullable; -import java.util.List; - -/** - * Created by covers1624 on 7/25/2016. - * A baked model to make minecraft shut the fuck up with baked model errors. - * TODO, Json support. - */ -public class DummyBakedModel implements IBakedModel { - - @Override - public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { - return ImmutableList.of(); - } - - @Override - public boolean isAmbientOcclusion() { - return false; - } - - @Override - public boolean isGui3d() { - return false; - } - - @Override - public boolean isBuiltInRenderer() { - return false; - } - - @Override - public TextureAtlasSprite getParticleTexture() { - return null; - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() { - return ItemCameraTransforms.DEFAULT; - } - - @Override - public ItemOverrideList getOverrides() { - return ItemOverrideList.NONE; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/ModelRegistryHelper.java b/dependencies/main/java/codechicken/lib/model/ModelRegistryHelper.java deleted file mode 100644 index 14e750105f..0000000000 --- a/dependencies/main/java/codechicken/lib/model/ModelRegistryHelper.java +++ /dev/null @@ -1,107 +0,0 @@ -package codechicken.lib.model; - -import codechicken.lib.render.item.IItemRenderer; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.util.TransformUtils; -import com.google.common.base.Function; -import com.google.common.collect.Maps; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.renderer.block.model.BuiltInModel; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemOverrideList; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.client.renderer.block.statemap.IStateMapper; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.registry.IRegistry; -import net.minecraftforge.client.event.ModelBakeEvent; -import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -//TODO General cleanup, move to a less modular fashion now that CCL is a ModContainer. -public class ModelRegistryHelper { - - private static List> registerModels = new LinkedList>(); - private static List modelBakeCallbacks = new LinkedList(); - - static { - MinecraftForge.EVENT_BUS.register(new ModelRegistryHelper()); - } - - public static void registerCallback(IModelBakeCallback callback) { - modelBakeCallbacks.add(callback); - } - - public static void register(ModelResourceLocation location, IBakedModel model) { - registerModels.add(new ImmutablePair(location, model)); - } - - /** - * Inserts the item renderer at itemRegistry.getNameForObject(block)#inventory and binds it to the item with a custom mesh definition - */ - public static void registerItemRenderer(Item item, IItemRenderer renderer) { - final ModelResourceLocation modelLoc = new ModelResourceLocation(item.getRegistryName(), "inventory"); - register(modelLoc, renderer); - ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() { - @Override - public ModelResourceLocation getModelLocation(ItemStack stack) { - return modelLoc; - } - }); - } - - @SubscribeEvent - public void onModelBake(ModelBakeEvent event) { - for (Pair pair : registerModels) { - event.getModelRegistry().putObject(pair.getKey(), pair.getValue()); - } - for (IModelBakeCallback callback : modelBakeCallbacks) { - callback.onModelBake(event.getModelRegistry()); - } - } - - /** - * Creates a dummy model at blockRegistry.getNameForObject(block)#particle for all states of the block overriding getParticleTexture - */ - public static void setParticleTexture(Block block, final ResourceLocation tex) { - final ModelResourceLocation modelLoc = new ModelResourceLocation(block.getRegistryName(), "particle"); - register(modelLoc, new BuiltInModel(TransformUtils.DEFAULT_BLOCK.toVanillaTransform(), ItemOverrideList.NONE) { - @Override - public TextureAtlasSprite getParticleTexture() { - return TextureUtils.getTexture(tex); - } - }); - ModelLoader.setCustomStateMapper(block, new IStateMapper() { - @Override - public Map putStateModelLocations(Block blockIn) { - return Maps.toMap(blockIn.getBlockState().getValidStates(), new Function() { - @Override - public ModelResourceLocation apply(IBlockState input) { - return modelLoc; - } - }); - } - }); - } - - public interface IModelBakeCallback { - - /** - * A Simple callback for model baking. - * - * @param modelRegistry - */ - void onModelBake(IRegistry modelRegistry); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/PerspectiveAwareModelProperties.java b/dependencies/main/java/codechicken/lib/model/PerspectiveAwareModelProperties.java deleted file mode 100644 index 152a8c4125..0000000000 --- a/dependencies/main/java/codechicken/lib/model/PerspectiveAwareModelProperties.java +++ /dev/null @@ -1,34 +0,0 @@ -package codechicken.lib.model; - -import codechicken.lib.util.TransformUtils; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraftforge.common.model.IModelState; - -/** - * Created by covers1624 on 21/02/2017. - */ -public class PerspectiveAwareModelProperties { - - public static final PerspectiveAwareModelProperties DEFAULT_ITEM = new PerspectiveAwareModelProperties(TransformUtils.DEFAULT_ITEM, true, false); - public static final PerspectiveAwareModelProperties DEFAULT_BLOCK = new PerspectiveAwareModelProperties(TransformUtils.DEFAULT_BLOCK, true, true); - - private final IModelState modelState; - private final BakedModelProperties properties; - - public PerspectiveAwareModelProperties(IModelState state, boolean isAO, boolean isGui3D) { - this(state, isAO, isGui3D, false, null); - } - - public PerspectiveAwareModelProperties(IModelState state, boolean isAO, boolean isGui3D, boolean isBuiltInRenderer, TextureAtlasSprite particle) { - this.modelState = state; - properties = new BakedModelProperties(isAO, isGui3D, isBuiltInRenderer, particle); - } - - public IModelState getModelState() { - return modelState; - } - - public BakedModelProperties getProperties() { - return properties; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/SimpleBakedBlockModel.java b/dependencies/main/java/codechicken/lib/model/SimpleBakedBlockModel.java deleted file mode 100644 index 16b18a5299..0000000000 --- a/dependencies/main/java/codechicken/lib/model/SimpleBakedBlockModel.java +++ /dev/null @@ -1,66 +0,0 @@ -package codechicken.lib.model; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemOverrideList; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.EnumFacing; - -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - -/** - * Created by covers1624 on 8/4/2016. - */ -@Deprecated -public class SimpleBakedBlockModel implements IBakedModel { - - public List quads; - - public SimpleBakedBlockModel(List quads) { - //Copy the quads because reasons. - this.quads = new LinkedList(quads); - } - - @Override - public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { - if (side == null) { - return quads; - } - return new ArrayList(); - } - - @Override - public boolean isAmbientOcclusion() { - return false; - } - - @Override - public boolean isGui3d() { - return false; - } - - @Override - public boolean isBuiltInRenderer() { - return false; - } - - @Override - public TextureAtlasSprite getParticleTexture() { - return null; - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() { - return null; - } - - @Override - public ItemOverrideList getOverrides() { - return null; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/SimpleBakedItemModel.java b/dependencies/main/java/codechicken/lib/model/SimpleBakedItemModel.java deleted file mode 100644 index ffc54b986a..0000000000 --- a/dependencies/main/java/codechicken/lib/model/SimpleBakedItemModel.java +++ /dev/null @@ -1,100 +0,0 @@ -package codechicken.lib.model; - -import codechicken.lib.util.TransformUtils; -import com.google.common.base.Function; -import com.google.common.collect.ImmutableList; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.block.model.ItemOverrideList; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.IPerspectiveAwareModel; -import net.minecraftforge.client.model.ItemLayerModel; -import org.apache.commons.lang3.tuple.Pair; - -import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by covers1624 on 7/18/2016. - * TODO, Cleanup and move to bakedmodels package. - */ -public class SimpleBakedItemModel implements IPerspectiveAwareModel { - - private ImmutableList quads; - private TextureAtlasSprite sprite; - private ResourceLocation spriteName; - - public SimpleBakedItemModel(ResourceLocation sprite) { - spriteName = sprite; - } - - @Override - public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { - if (state == null && side == null) { - if (quads == null) { - bake(); - } - return quads; - } - return new ArrayList(); - } - - @Override - public boolean isAmbientOcclusion() { - return false; - } - - @Override - public boolean isGui3d() { - return false; - } - - @Override - public boolean isBuiltInRenderer() { - return false; - } - - @Override - public TextureAtlasSprite getParticleTexture() { - return sprite; - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() { - return ItemCameraTransforms.DEFAULT; - } - - @Override - public ItemOverrideList getOverrides() { - return ItemOverrideList.NONE; - } - - @Override - public Pair handlePerspective(TransformType cameraTransformType) { - return MapWrapper.handlePerspective(this, TransformUtils.DEFAULT_ITEM.getTransforms(), cameraTransformType); - } - - private void bake() { - Function bakedTextureGetter = new Function() { - @Override - public TextureAtlasSprite apply(ResourceLocation input) { - return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(input.toString()); - } - }; - IBakedModel layerModel = new ItemLayerModel(ImmutableList.of(spriteName)).bake(TransformUtils.DEFAULT_ITEM, DefaultVertexFormats.ITEM, bakedTextureGetter); - ImmutableList.Builder quadBuilder = ImmutableList.builder(); - quadBuilder.addAll(layerModel.getQuads(null, null, 0)); - this.quads = quadBuilder.build(); - this.sprite = bakedTextureGetter.apply(spriteName); - } - -} diff --git a/dependencies/main/java/codechicken/lib/model/SimpleOverrideBakedModel.java b/dependencies/main/java/codechicken/lib/model/SimpleOverrideBakedModel.java deleted file mode 100644 index eeb6c66dce..0000000000 --- a/dependencies/main/java/codechicken/lib/model/SimpleOverrideBakedModel.java +++ /dev/null @@ -1,61 +0,0 @@ -package codechicken.lib.model; - -import com.google.common.collect.ImmutableList; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemOverrideList; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.EnumFacing; - -import java.util.List; - -/** - * Created by covers1624 on 7/25/2016. - * This defines a model that's soul purpose is to act as a wrapper for an ItemOverrideList. - * TODO Cleanup, BakedModelProperties support and move to bakedmodels package. - */ -public class SimpleOverrideBakedModel implements IBakedModel { - - private ItemOverrideList overrideList; - - public SimpleOverrideBakedModel(ItemOverrideList overrideList) { - this.overrideList = overrideList; - } - - @Override - public List getQuads(IBlockState state, EnumFacing side, long rand) { - return ImmutableList.of(); - } - - @Override - public boolean isAmbientOcclusion() { - return false; - } - - @Override - public boolean isGui3d() { - return false; - } - - @Override - public boolean isBuiltInRenderer() { - return false; - } - - @Override - public TextureAtlasSprite getParticleTexture() { - return null; - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() { - return ItemCameraTransforms.DEFAULT; - } - - @Override - public ItemOverrideList getOverrides() { - return overrideList; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/SimplePerspectiveAwareBakedModel.java b/dependencies/main/java/codechicken/lib/model/SimplePerspectiveAwareBakedModel.java deleted file mode 100644 index 9c2dc1c6ea..0000000000 --- a/dependencies/main/java/codechicken/lib/model/SimplePerspectiveAwareBakedModel.java +++ /dev/null @@ -1,91 +0,0 @@ -package codechicken.lib.model; - -import codechicken.lib.render.CCModelState; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.block.model.ItemOverrideList; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.model.IPerspectiveAwareModel; -import net.minecraftforge.common.model.TRSRTransformation; -import org.apache.commons.lang3.tuple.Pair; - -import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; -import java.util.List; - -/** - * Created by covers1624 on 7/25/2016. - * A simple IPerspectiveAwareModel see SimplePerspectiveAwareLayerModelBakery for baking to this. - *

- * Basically a wrapper for baked quads and IPerspectiveAwareModel. - */ -@Deprecated -public class SimplePerspectiveAwareBakedModel implements IPerspectiveAwareModel { - - private final ImmutableMap transforms; - private final ImmutableList quads; - private final TextureAtlasSprite particle; - - public SimplePerspectiveAwareBakedModel(List quads, CCModelState modelState) { - this(quads, null, modelState.getTransforms()); - } - - public SimplePerspectiveAwareBakedModel(List quads, ImmutableMap transforms) { - this(quads, null, transforms); - } - - public SimplePerspectiveAwareBakedModel(List quads, TextureAtlasSprite particle, ImmutableMap transforms) { - this.transforms = transforms; - this.quads = ImmutableList.copyOf(quads); - this.particle = particle; - } - - @Override - public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { - if (side == null) { - return quads; - } - return ImmutableList.of(); - } - - @Override - public Pair handlePerspective(TransformType cameraTransformType) { - return MapWrapper.handlePerspective(this, transforms, cameraTransformType); - } - - @Override - public boolean isAmbientOcclusion() { - return false; - } - - @Override - public boolean isGui3d() { - return false; - } - - @Override - public boolean isBuiltInRenderer() { - return false; - } - - @Override - public TextureAtlasSprite getParticleTexture() { - return particle; - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() { - return ItemCameraTransforms.DEFAULT; - } - - @Override - public ItemOverrideList getOverrides() { - return ItemOverrideList.NONE; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/StateOverrideIModel.java b/dependencies/main/java/codechicken/lib/model/StateOverrideIModel.java deleted file mode 100644 index 67cc3c3027..0000000000 --- a/dependencies/main/java/codechicken/lib/model/StateOverrideIModel.java +++ /dev/null @@ -1,77 +0,0 @@ -package codechicken.lib.model; - -import com.google.common.base.Function; -import com.google.common.collect.ImmutableMap; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.*; -import net.minecraftforge.common.model.IModelState; - -import java.util.Collection; - -/** - * Created by covers1624 on 17/12/2016. - * TODO Decide on a standard place for CCL's IModels. - */ -public class StateOverrideIModel implements IModel, IRetexturableModel, IModelCustomData, IModelSimpleProperties, IModelUVLock { - - private IModel wrapped; - private final IModelState wrappedState; - - public StateOverrideIModel(IModel wrapped, IModelState wrappedState) { - this.wrapped = wrapped; - this.wrappedState = wrappedState; - } - - @Override - public Collection getDependencies() { - return wrapped.getDependencies(); - } - - @Override - public Collection getTextures() { - return wrapped.getTextures(); - } - - @Override - public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { - return wrapped.bake(state, format, bakedTextureGetter); - } - - @Override - public IModelState getDefaultState() { - return wrappedState; - } - - @Override - public IModel retexture(ImmutableMap textures) { - wrapped = ModelProcessingHelper.retexture(wrapped, textures); - return this; - } - - @Override - public IModel uvlock(boolean value) { - wrapped = ModelProcessingHelper.uvlock(wrapped, value); - return this; - } - - @Override - public IModel smoothLighting(boolean value) { - wrapped = ModelProcessingHelper.smoothLighting(wrapped, value); - return this; - } - - @Override - public IModel gui3d(boolean value) { - wrapped = ModelProcessingHelper.gui3d(wrapped, value); - return this; - } - - @Override - public IModel process(ImmutableMap customData) { - wrapped = ModelProcessingHelper.customData(wrapped, customData); - return this; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/bakedmodels/AbstractBakedPropertiesModel.java b/dependencies/main/java/codechicken/lib/model/bakedmodels/AbstractBakedPropertiesModel.java deleted file mode 100644 index 7e8f2428d6..0000000000 --- a/dependencies/main/java/codechicken/lib/model/bakedmodels/AbstractBakedPropertiesModel.java +++ /dev/null @@ -1,43 +0,0 @@ -package codechicken.lib.model.bakedmodels; - -import codechicken.lib.model.BakedModelProperties; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; - -/** - * Created by covers1624 on 1/02/2017. - */ -public abstract class AbstractBakedPropertiesModel implements IBakedModel { - - private final BakedModelProperties properties; - - public AbstractBakedPropertiesModel(BakedModelProperties properties) { - this.properties = properties; - } - - @Override - public boolean isAmbientOcclusion() { - return properties.isAmbientOcclusion(); - } - - @Override - public boolean isGui3d() { - return properties.isGui3d(); - } - - @Override - public boolean isBuiltInRenderer() { - return properties.isBuiltInRenderer(); - } - - @Override - public TextureAtlasSprite getParticleTexture() { - return properties.getParticleTexture(); - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() { - return ItemCameraTransforms.DEFAULT; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareBakedModel.java b/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareBakedModel.java deleted file mode 100644 index d53dd1589c..0000000000 --- a/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareBakedModel.java +++ /dev/null @@ -1,94 +0,0 @@ -package codechicken.lib.model.bakedmodels; - -import codechicken.lib.model.BakedModelProperties; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.block.model.ItemOverrideList; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.model.IPerspectiveAwareModel; -import net.minecraftforge.common.model.IModelState; -import org.apache.commons.lang3.tuple.Pair; - -import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; -import java.util.List; -import java.util.Map; - -/** - * Created by covers1624 on 25/11/2016. - */ -public class PerspectiveAwareBakedModel implements IPerspectiveAwareModel { - - private final ImmutableMap> faceQuads; - private final ImmutableList generalQuads; - private final IModelState state; - private final BakedModelProperties properties; - - public PerspectiveAwareBakedModel(Map> faceQuads, IModelState state, BakedModelProperties properties) { - this(faceQuads, ImmutableList.of(), state, properties); - } - - public PerspectiveAwareBakedModel(List generalQuads, IModelState state, BakedModelProperties properties) { - this(ImmutableMap.>of(), generalQuads, state, properties); - } - - public PerspectiveAwareBakedModel(Map> faceQuads, List generalQuads, IModelState state, BakedModelProperties properties) { - this.faceQuads = ImmutableMap.copyOf(faceQuads); - this.generalQuads = ImmutableList.copyOf(generalQuads); - this.state = state; - this.properties = properties.copy(); - } - - @Override - public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { - if (side == null) { - return generalQuads; - } else { - if (faceQuads.containsKey(side)) { - return faceQuads.get(side); - } - } - return ImmutableList.of(); - } - - @Override - public Pair handlePerspective(TransformType cameraTransformType) { - return MapWrapper.handlePerspective(this, state, cameraTransformType); - } - - @Override - public boolean isAmbientOcclusion() { - return properties.isAmbientOcclusion(); - } - - @Override - public boolean isGui3d() { - return properties.isGui3d(); - } - - @Override - public boolean isBuiltInRenderer() { - return properties.isBuiltInRenderer(); - } - - @Override - public TextureAtlasSprite getParticleTexture() { - return properties.getParticleTexture(); - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() { - return ItemCameraTransforms.DEFAULT; - } - - @Override - public ItemOverrideList getOverrides() { - return ItemOverrideList.NONE; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModel.java b/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModel.java deleted file mode 100644 index f4ebc24937..0000000000 --- a/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModel.java +++ /dev/null @@ -1,100 +0,0 @@ -package codechicken.lib.model.bakedmodels; - -import codechicken.lib.model.BakedModelProperties; -import com.google.common.collect.ImmutableMap; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.block.model.ItemOverrideList; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.MinecraftForgeClient; -import net.minecraftforge.client.model.IPerspectiveAwareModel; -import net.minecraftforge.common.model.IModelState; -import org.apache.commons.lang3.tuple.Pair; - -import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * Created by covers1624 on 19/11/2016. - */ -public class PerspectiveAwareLayeredModel implements IPerspectiveAwareModel { - - private final ImmutableMap>> layerFaceQuadMap; - private final ImmutableMap> layerGeneralQuads; - private final IModelState state; - private final BakedModelProperties properties; - - public PerspectiveAwareLayeredModel(Map>> layerFaceQuadMap, IModelState state, BakedModelProperties properties) { - this(layerFaceQuadMap, ImmutableMap.>of(), state, properties); - } - - public PerspectiveAwareLayeredModel(Map>> layerFaceQuadMap, Map> layerGeneralQuads, IModelState state, BakedModelProperties properties) { - this.layerFaceQuadMap = ImmutableMap.copyOf(layerFaceQuadMap); - this.layerGeneralQuads = ImmutableMap.copyOf(layerGeneralQuads); - this.state = state; - this.properties = properties.copy(); - - } - - @Override - public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { - BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer(); - if (layer == null) { - layer = BlockRenderLayer.SOLID;//Default to solid. Constructor param?? - } - if (side == null) { - if (layerGeneralQuads.containsKey(layer)) { - return layerGeneralQuads.get(layer); - } - } else if (layerFaceQuadMap.containsKey(layer)) { - Map> faceQuadMap = layerFaceQuadMap.get(layer); - if (faceQuadMap.containsKey(side)) { - return faceQuadMap.get(side); - } - } - return new ArrayList(); - } - - @Override - public boolean isAmbientOcclusion() { - return properties.isAmbientOcclusion(); - } - - @Override - public boolean isGui3d() { - return properties.isGui3d(); - } - - @Override - public boolean isBuiltInRenderer() { - return properties.isBuiltInRenderer(); - } - - @Override - public TextureAtlasSprite getParticleTexture() { - return properties.getParticleTexture(); - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() { - return ItemCameraTransforms.DEFAULT; - } - - @Override - public ItemOverrideList getOverrides() { - return ItemOverrideList.NONE; - } - - @Override - public Pair handlePerspective(TransformType cameraTransformType) { - return MapWrapper.handlePerspective(this, state, cameraTransformType); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModelWrapper.java b/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModelWrapper.java deleted file mode 100644 index abd2ff03ac..0000000000 --- a/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareLayeredModelWrapper.java +++ /dev/null @@ -1,87 +0,0 @@ -package codechicken.lib.model.bakedmodels; - -import codechicken.lib.model.BakedModelProperties; -import com.google.common.collect.ImmutableMap; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.block.model.ItemOverrideList; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.MinecraftForgeClient; -import net.minecraftforge.client.model.IPerspectiveAwareModel; -import net.minecraftforge.common.model.IModelState; -import org.apache.commons.lang3.tuple.Pair; - -import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * Created by covers1624 on 19/11/2016. - */ -public class PerspectiveAwareLayeredModelWrapper implements IPerspectiveAwareModel { - - private final ImmutableMap layerModelMap; - private final IModelState state; - private final BakedModelProperties properties; - - public PerspectiveAwareLayeredModelWrapper(Map layerModelMap, IModelState state, BakedModelProperties properties) { - - this.layerModelMap = ImmutableMap.copyOf(layerModelMap); - this.state = state; - this.properties = properties.copy(); - } - - @Override - public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { - BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer(); - if (layer == null) { - layer = BlockRenderLayer.SOLID; - } - if (layerModelMap.containsKey(layer)) { - return layerModelMap.get(layer).getQuads(state, side, rand); - } - return new ArrayList(); - } - - @Override - public boolean isAmbientOcclusion() { - return properties.isAmbientOcclusion(); - } - - @Override - public boolean isGui3d() { - return properties.isGui3d(); - } - - @Override - public boolean isBuiltInRenderer() { - return properties.isBuiltInRenderer(); - } - - @Override - public TextureAtlasSprite getParticleTexture() { - return properties.getParticleTexture(); - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() { - return ItemCameraTransforms.DEFAULT; - } - - @Override - public ItemOverrideList getOverrides() { - return ItemOverrideList.NONE; - } - - @Override - public Pair handlePerspective(TransformType cameraTransformType) { - return MapWrapper.handlePerspective(this, state, cameraTransformType); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareMultiModel.java b/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareMultiModel.java deleted file mode 100644 index 03111eb066..0000000000 --- a/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareMultiModel.java +++ /dev/null @@ -1,84 +0,0 @@ -package codechicken.lib.model.bakedmodels; - -import codechicken.lib.model.BakedModelProperties; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.block.model.ItemOverrideList; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.model.IPerspectiveAwareModel; -import net.minecraftforge.common.model.IModelState; -import org.apache.commons.lang3.tuple.Pair; - -import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; -import java.util.LinkedList; -import java.util.List; - -/** - * Created by covers1624 on 16/12/2016. - */ -public class PerspectiveAwareMultiModel implements IPerspectiveAwareModel { - - private final IBakedModel baseModel; - private final List subModels; - private final IModelState baseState; - private final BakedModelProperties properties; - - public PerspectiveAwareMultiModel(IBakedModel baseModel, List subModels, IModelState baseState, BakedModelProperties properties) { - this.baseModel = baseModel; - this.subModels = subModels; - this.baseState = baseState; - this.properties = properties; - } - - @Override - public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { - List quads = new LinkedList(); - if (baseModel != null) { - quads.addAll(baseModel.getQuads(state, side, rand)); - } - for (IBakedModel subModel : subModels) { - quads.addAll(subModel.getQuads(state, side, rand)); - } - return quads; - } - - @Override - public boolean isAmbientOcclusion() { - return properties.isAmbientOcclusion(); - } - - @Override - public boolean isGui3d() { - return properties.isGui3d(); - } - - @Override - public boolean isBuiltInRenderer() { - return properties.isBuiltInRenderer(); - } - - @Override - public TextureAtlasSprite getParticleTexture() { - return properties.getParticleTexture(); - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() { - return ItemCameraTransforms.DEFAULT; - } - - @Override - public ItemOverrideList getOverrides() { - return ItemOverrideList.NONE; - } - - @Override - public Pair handlePerspective(TransformType cameraTransformType) { - return MapWrapper.handlePerspective(this, baseState, cameraTransformType); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareOverrideModel.java b/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareOverrideModel.java deleted file mode 100644 index 562d187ea7..0000000000 --- a/dependencies/main/java/codechicken/lib/model/bakedmodels/PerspectiveAwareOverrideModel.java +++ /dev/null @@ -1,59 +0,0 @@ -package codechicken.lib.model.bakedmodels; - -import codechicken.lib.model.BakedModelProperties; -import com.google.common.collect.ImmutableList; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.block.model.ItemOverrideList; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.model.IPerspectiveAwareModel; -import net.minecraftforge.common.model.IModelState; -import org.apache.commons.lang3.tuple.Pair; - -import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; -import java.util.List; - -/** - * Created by covers1624 on 1/02/2017. - */ -public class PerspectiveAwareOverrideModel extends AbstractBakedPropertiesModel implements IPerspectiveAwareModel { - - private final ItemOverrideList overrideList; - private final IModelState state; - private final List quads; - - public PerspectiveAwareOverrideModel(ItemOverrideList overrideList, IModelState state, BakedModelProperties properties) { - super(properties); - this.state = state; - this.overrideList = overrideList; - this.quads = ImmutableList.of(); - } - - public PerspectiveAwareOverrideModel(ItemOverrideList overrideList, IModelState state, BakedModelProperties properties, List quads) { - super(properties); - this.state = state; - this.overrideList = overrideList; - this.quads = quads; - } - - @Override - public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { - if (state == null && side == null) { - return quads; - } - return ImmutableList.of(); - } - - @Override - public ItemOverrideList getOverrides() { - return overrideList; - } - - @Override - public Pair handlePerspective(TransformType cameraTransformType) { - return MapWrapper.handlePerspective(this, state, cameraTransformType); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/BlockModelBakery.java b/dependencies/main/java/codechicken/lib/model/bakery/BlockModelBakery.java deleted file mode 100644 index 2ca6e1dbaf..0000000000 --- a/dependencies/main/java/codechicken/lib/model/bakery/BlockModelBakery.java +++ /dev/null @@ -1,628 +0,0 @@ -package codechicken.lib.model.bakery; - -import codechicken.lib.colour.Colour; -import codechicken.lib.colour.ColourRGBA; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.util.EnumFacing; - -import java.util.LinkedList; - -/** - * Created by covers1624 on 8/3/2016. - * TODO, Move the back end of this to the BakingVertexBuffer wrapped through the CCL render pipe. - */ -@Deprecated// Use CCModel.generateBlock(0, new Cuboid6()).apply -public class BlockModelBakery { - - public boolean flipTexture; - public boolean renderFromInside = false; - - public double renderMinX; - public double renderMaxX; - public double renderMinY; - public double renderMaxY; - public double renderMinZ; - public double renderMaxZ; - - public int uvRotateEast, uvRotateWest, uvRotateSouth, uvRotateNorth, uvRotateTop, uvRotateBottom; - - public Colour colourTopLeft = new ColourRGBA(0xFFFFFFFF); - public Colour colourBottomLeft = new ColourRGBA(0xFFFFFFFF); - public Colour colourBottomRight = new ColourRGBA(0xFFFFFFFF); - public Colour colourTopRight = new ColourRGBA(0xFFFFFFFF); - - private CCQuadBakery quadBakery; - private LinkedList quadList = new LinkedList(); - - public BlockModelBakery() { - this(DefaultVertexFormats.BLOCK); - } - - public BlockModelBakery(VertexFormat format) { - quadBakery = new CCQuadBakery(format, null); - reset(); - } - - public void reset() { - quadList.clear(); - colourTopLeft = new ColourRGBA(0xFFFFFFFF); - colourBottomLeft = new ColourRGBA(0xFFFFFFFF); - colourBottomRight = new ColourRGBA(0xFFFFFFFF); - colourTopRight = new ColourRGBA(0xFFFFFFFF); - - uvRotateEast = 0; - uvRotateWest = 0; - uvRotateSouth = 0; - uvRotateNorth = 0; - uvRotateTop = 0; - uvRotateBottom = 0; - - flipTexture = false; - renderFromInside = false; - - setRenderBounds(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); - } - - public LinkedList finishBaking() { - return new LinkedList(quadList); - } - - public CCQuadBakery getQuadBakery() { - return quadBakery; - } - - public void setRenderBounds(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { - - this.renderMinX = minX; - this.renderMaxX = maxX; - this.renderMinY = minY; - this.renderMaxY = maxY; - this.renderMinZ = minZ; - this.renderMaxZ = maxZ; - - } - - public void bakeFace(TextureAtlasSprite sprite, EnumFacing face) { - switch (face) { - - case DOWN: - bakeFaceYNeg(sprite); - break; - case UP: - bakeFaceYPos(sprite); - break; - case NORTH: - bakeFaceZNeg(sprite); - break; - case SOUTH: - bakeFaceZPos(sprite); - break; - case WEST: - bakeFaceXNeg(sprite); - break; - case EAST: - bakeFaceXPos(sprite); - break; - } - } - - public void bakeFaceYNeg(TextureAtlasSprite sprite) { - bakeFaceYNeg(0, 0, 0, sprite); - } - - public void bakeFaceYNeg(double posX, double posY, double posZ, TextureAtlasSprite sprite) { - quadBakery.startBakingQuads().setSprite(sprite); - - double d3 = (double) sprite.getInterpolatedU(this.renderMinX * 16.0D); - double d4 = (double) sprite.getInterpolatedU(this.renderMaxX * 16.0D); - double d5 = (double) sprite.getInterpolatedV(this.renderMinZ * 16.0D); - double d6 = (double) sprite.getInterpolatedV(this.renderMaxZ * 16.0D); - double d7; - if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D) { - d3 = (double) sprite.getMinU(); - d4 = (double) sprite.getMaxU(); - } - - if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) { - d5 = (double) sprite.getMinV(); - d6 = (double) sprite.getMaxV(); - } - - if (this.flipTexture) { - d7 = d3; - d3 = d4; - d4 = d7; - } - - d7 = d4; - double d8 = d3; - double d9 = d5; - double d10 = d6; - - if (this.uvRotateBottom == 2) { - d3 = (double) sprite.getInterpolatedU(this.renderMinZ * 16.0D); - d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxX * 16.0D); - d4 = (double) sprite.getInterpolatedU(this.renderMaxZ * 16.0D); - d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinX * 16.0D); - d9 = d5; - d10 = d6; - d7 = d3; - d8 = d4; - d5 = d6; - d6 = d9; - } else if (this.uvRotateBottom == 1) { - d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D); - d5 = (double) sprite.getInterpolatedV(this.renderMinX * 16.0D); - d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMinZ * 16.0D); - d6 = (double) sprite.getInterpolatedV(this.renderMaxX * 16.0D); - d7 = d4; - d8 = d3; - d3 = d4; - d4 = d8; - d9 = d6; - d10 = d5; - } else if (this.uvRotateBottom == 3) { - d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMinX * 16.0D); - d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxX * 16.0D); - d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMinZ * 16.0D); - d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D); - d7 = d4; - d8 = d3; - d9 = d5; - d10 = d6; - } - - double d11 = posX + this.renderMinX; - double d12 = posX + this.renderMaxX; - double d13 = posY + this.renderMinY; - double d14 = posZ + this.renderMinZ; - double d15 = posZ + this.renderMaxZ; - - if (this.renderFromInside) { - d11 = posX + this.renderMaxX; - d12 = posX + this.renderMinX; - } - - quadBakery.setColour(colourTopLeft).addVertexWithUV(d11, d13, d15, d8, d10); - quadBakery.setColour(colourBottomLeft).addVertexWithUV(d11, d13, d14, d3, d5); - quadBakery.setColour(colourBottomRight).addVertexWithUV(d12, d13, d14, d7, d9); - quadBakery.setColour(colourTopRight).addVertexWithUV(d12, d13, d15, d4, d6); - - quadList.addAll(quadBakery.finishBaking()); - } - - public void bakeFaceYPos(TextureAtlasSprite sprite) { - bakeFaceYPos(0, 0, 0, sprite); - } - - public void bakeFaceYPos(double posX, double posY, double posZ, TextureAtlasSprite sprite) { - quadBakery.startBakingQuads().setSprite(sprite); - - double d3 = (double) sprite.getInterpolatedU(this.renderMinX * 16.0D); - double d4 = (double) sprite.getInterpolatedU(this.renderMaxX * 16.0D); - double d5 = (double) sprite.getInterpolatedV(this.renderMinZ * 16.0D); - double d6 = (double) sprite.getInterpolatedV(this.renderMaxZ * 16.0D); - double d7; - - if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D) { - d3 = (double) sprite.getMinU(); - d4 = (double) sprite.getMaxU(); - } - - if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) { - d5 = (double) sprite.getMinV(); - d6 = (double) sprite.getMaxV(); - } - - if (this.flipTexture) { - d7 = d3; - d3 = d4; - d4 = d7; - } - - d7 = d4; - double d8 = d3; - double d9 = d5; - double d10 = d6; - - if (this.uvRotateTop == 1) { - d3 = (double) sprite.getInterpolatedU(this.renderMinZ * 16.0D); - d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxX * 16.0D); - d4 = (double) sprite.getInterpolatedU(this.renderMaxZ * 16.0D); - d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinX * 16.0D); - d9 = d5; - d10 = d6; - d7 = d3; - d8 = d4; - d5 = d6; - d6 = d9; - } else if (this.uvRotateTop == 2) { - d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D); - d5 = (double) sprite.getInterpolatedV(this.renderMinX * 16.0D); - d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMinZ * 16.0D); - d6 = (double) sprite.getInterpolatedV(this.renderMaxX * 16.0D); - d7 = d4; - d8 = d3; - d3 = d4; - d4 = d8; - d9 = d6; - d10 = d5; - } else if (this.uvRotateTop == 3) { - d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMinX * 16.0D); - d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxX * 16.0D); - d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMinZ * 16.0D); - d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D); - d7 = d4; - d8 = d3; - d9 = d5; - d10 = d6; - } - - double d11 = posX + this.renderMinX; - double d12 = posX + this.renderMaxX; - double d13 = posY + this.renderMaxY; - double d14 = posZ + this.renderMinZ; - double d15 = posZ + this.renderMaxZ; - - if (this.renderFromInside) { - d11 = posX + this.renderMaxX; - d12 = posX + this.renderMinX; - } - - quadBakery.setColour(colourTopLeft).addVertexWithUV(d12, d13, d15, d4, d6); - quadBakery.setColour(colourBottomLeft).addVertexWithUV(d12, d13, d14, d7, d9); - quadBakery.setColour(colourBottomRight).addVertexWithUV(d11, d13, d14, d3, d5); - quadBakery.setColour(colourTopRight).addVertexWithUV(d11, d13, d15, d8, d10); - - quadList.addAll(quadBakery.finishBaking()); - } - - public void bakeFaceZNeg(TextureAtlasSprite sprite) { - bakeFaceZNeg(0, 0, 0, sprite); - } - - public void bakeFaceZNeg(double posX, double posY, double posZ, TextureAtlasSprite sprite) { - quadBakery.startBakingQuads().setSprite(sprite); - - double d3 = (double) sprite.getInterpolatedU(this.renderMinX * 16.0D); - double d4 = (double) sprite.getInterpolatedU(this.renderMaxX * 16.0D); - - double d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); - double d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinY * 16.0D); - double d7; - - if (this.flipTexture) { - d7 = d3; - d3 = d4; - d4 = d7; - } - - if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D) { - d3 = (double) sprite.getMinU(); - d4 = (double) sprite.getMaxU(); - } - - if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) { - d5 = (double) sprite.getMinV(); - d6 = (double) sprite.getMaxV(); - } - - d7 = d4; - double d8 = d3; - double d9 = d5; - double d10 = d6; - - if (this.uvRotateEast == 2) { - d3 = (double) sprite.getInterpolatedU(this.renderMinY * 16.0D); - d4 = (double) sprite.getInterpolatedU(this.renderMaxY * 16.0D); - d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMinX * 16.0D); - d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxX * 16.0D); - d9 = d5; - d10 = d6; - d7 = d3; - d8 = d4; - d5 = d6; - d6 = d9; - } else if (this.uvRotateEast == 1) { - d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxY * 16.0D); - d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMinY * 16.0D); - d5 = (double) sprite.getInterpolatedV(this.renderMaxX * 16.0D); - d6 = (double) sprite.getInterpolatedV(this.renderMinX * 16.0D); - d7 = d4; - d8 = d3; - d3 = d4; - d4 = d8; - d9 = d6; - d10 = d5; - } else if (this.uvRotateEast == 3) { - d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMinX * 16.0D); - d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxX * 16.0D); - d5 = (double) sprite.getInterpolatedV(this.renderMaxY * 16.0D); - d6 = (double) sprite.getInterpolatedV(this.renderMinY * 16.0D); - d7 = d4; - d8 = d3; - d9 = d5; - d10 = d6; - } - - double d11 = posX + this.renderMinX; - double d12 = posX + this.renderMaxX; - double d13 = posY + this.renderMinY; - double d14 = posY + this.renderMaxY; - double d15 = posZ + this.renderMinZ; - - if (this.renderFromInside) { - d11 = posX + this.renderMaxX; - d12 = posX + this.renderMinX; - } - - quadBakery.setColour(colourTopLeft).addVertexWithUV(d11, d14, d15, d7, d9); - quadBakery.setColour(colourBottomLeft).addVertexWithUV(d12, d14, d15, d3, d5); - quadBakery.setColour(colourBottomRight).addVertexWithUV(d12, d13, d15, d8, d10); - quadBakery.setColour(colourTopRight).addVertexWithUV(d11, d13, d15, d4, d6); - - quadList.addAll(quadBakery.finishBaking()); - } - - public void bakeFaceZPos(TextureAtlasSprite sprite) { - bakeFaceZPos(0, 0, 0, sprite); - } - - public void bakeFaceZPos(double posX, double posY, double posZ, TextureAtlasSprite sprite) { - quadBakery.startBakingQuads().setSprite(sprite); - - double d3 = (double) sprite.getInterpolatedU(this.renderMinX * 16.0D); - double d4 = (double) sprite.getInterpolatedU(this.renderMaxX * 16.0D); - double d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); - double d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinY * 16.0D); - double d7; - - if (this.flipTexture) { - d7 = d3; - d3 = d4; - d4 = d7; - } - - if (this.renderMinX < 0.0D || this.renderMaxX > 1.0D) { - d3 = (double) sprite.getMinU(); - d4 = (double) sprite.getMaxU(); - } - - if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) { - d5 = (double) sprite.getMinV(); - d6 = (double) sprite.getMaxV(); - } - - d7 = d4; - double d8 = d3; - double d9 = d5; - double d10 = d6; - - if (this.uvRotateWest == 1) { - d3 = (double) sprite.getInterpolatedU(this.renderMinY * 16.0D); - d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinX * 16.0D); - d4 = (double) sprite.getInterpolatedU(this.renderMaxY * 16.0D); - d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxX * 16.0D); - d9 = d5; - d10 = d6; - d7 = d3; - d8 = d4; - d5 = d6; - d6 = d9; - } else if (this.uvRotateWest == 2) { - d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxY * 16.0D); - d5 = (double) sprite.getInterpolatedV(this.renderMinX * 16.0D); - d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMinY * 16.0D); - d6 = (double) sprite.getInterpolatedV(this.renderMaxX * 16.0D); - d7 = d4; - d8 = d3; - d3 = d4; - d4 = d8; - d9 = d6; - d10 = d5; - } else if (this.uvRotateWest == 3) { - d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMinX * 16.0D); - d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxX * 16.0D); - d5 = (double) sprite.getInterpolatedV(this.renderMaxY * 16.0D); - d6 = (double) sprite.getInterpolatedV(this.renderMinY * 16.0D); - d7 = d4; - d8 = d3; - d9 = d5; - d10 = d6; - } - - double d11 = posX + this.renderMinX; - double d12 = posX + this.renderMaxX; - double d13 = posY + this.renderMinY; - double d14 = posY + this.renderMaxY; - double d15 = posZ + this.renderMaxZ; - - if (this.renderFromInside) { - d11 = posX + this.renderMaxX; - d12 = posX + this.renderMinX; - } - - quadBakery.setColour(colourTopLeft).addVertexWithUV(d11, d14, d15, d3, d5); - quadBakery.setColour(colourBottomLeft).addVertexWithUV(d11, d13, d15, d8, d10); - quadBakery.setColour(colourBottomRight).addVertexWithUV(d12, d13, d15, d4, d6); - quadBakery.setColour(colourTopRight).addVertexWithUV(d12, d14, d15, d7, d9); - - quadList.addAll(quadBakery.finishBaking()); - } - - public void bakeFaceXNeg(TextureAtlasSprite sprite) { - bakeFaceXNeg(0, 0, 0, sprite); - } - - public void bakeFaceXNeg(double posX, double posY, double posZ, TextureAtlasSprite sprite) { - quadBakery.startBakingQuads().setSprite(sprite); - - double d3 = (double) sprite.getInterpolatedU(this.renderMinZ * 16.0D); - double d4 = (double) sprite.getInterpolatedU(this.renderMaxZ * 16.0D); - double d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); - double d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinY * 16.0D); - double d7; - - if (this.flipTexture) { - d7 = d3; - d3 = d4; - d4 = d7; - } - - if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) { - d3 = (double) sprite.getMinU(); - d4 = (double) sprite.getMaxU(); - } - - if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) { - d5 = (double) sprite.getMinV(); - d6 = (double) sprite.getMaxV(); - } - - d7 = d4; - double d8 = d3; - double d9 = d5; - double d10 = d6; - - if (this.uvRotateNorth == 1) { - d3 = (double) sprite.getInterpolatedU(this.renderMinY * 16.0D); - d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D); - d4 = (double) sprite.getInterpolatedU(this.renderMaxY * 16.0D); - d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinZ * 16.0D); - d9 = d5; - d10 = d6; - d7 = d3; - d8 = d4; - d5 = d6; - d6 = d9; - } else if (this.uvRotateNorth == 2) { - d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxY * 16.0D); - d5 = (double) sprite.getInterpolatedV(this.renderMinZ * 16.0D); - d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMinY * 16.0D); - d6 = (double) sprite.getInterpolatedV(this.renderMaxZ * 16.0D); - d7 = d4; - d8 = d3; - d3 = d4; - d4 = d8; - d9 = d6; - d10 = d5; - } else if (this.uvRotateNorth == 3) { - d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMinZ * 16.0D); - d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D); - d5 = (double) sprite.getInterpolatedV(this.renderMaxY * 16.0D); - d6 = (double) sprite.getInterpolatedV(this.renderMinY * 16.0D); - d7 = d4; - d8 = d3; - d9 = d5; - d10 = d6; - } - - double d11 = posX + this.renderMinX; - double d12 = posY + this.renderMinY; - double d13 = posY + this.renderMaxY; - double d14 = posZ + this.renderMinZ; - double d15 = posZ + this.renderMaxZ; - - if (this.renderFromInside) { - d14 = posZ + this.renderMaxZ; - d15 = posZ + this.renderMinZ; - } - - quadBakery.setColour(colourTopLeft).addVertexWithUV(d11, d13, d15, d7, d9); - quadBakery.setColour(colourBottomLeft).addVertexWithUV(d11, d13, d14, d3, d5); - quadBakery.setColour(colourBottomRight).addVertexWithUV(d11, d12, d14, d8, d10); - quadBakery.setColour(colourTopRight).addVertexWithUV(d11, d12, d15, d4, d6); - - quadList.addAll(quadBakery.finishBaking()); - } - - public void bakeFaceXPos(TextureAtlasSprite sprite) { - bakeFaceXPos(0, 0, 0, sprite); - } - - public void bakeFaceXPos(double posX, double posY, double posZ, TextureAtlasSprite sprite) { - quadBakery.startBakingQuads().setSprite(sprite); - - double d3 = (double) sprite.getInterpolatedU(this.renderMinZ * 16.0D); - double d4 = (double) sprite.getInterpolatedU(this.renderMaxZ * 16.0D); - - double d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxY * 16.0D); - double d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMinY * 16.0D); - double d7; - - if (this.flipTexture) { - d7 = d3; - d3 = d4; - d4 = d7; - } - - if (this.renderMinZ < 0.0D || this.renderMaxZ > 1.0D) { - d3 = (double) sprite.getMinU(); - d4 = (double) sprite.getMaxU(); - } - - if (this.renderMinY < 0.0D || this.renderMaxY > 1.0D) { - d5 = (double) sprite.getMinV(); - d6 = (double) sprite.getMaxV(); - } - - d7 = d4; - double d8 = d3; - double d9 = d5; - double d10 = d6; - - if (this.uvRotateSouth == 2) { - d3 = (double) sprite.getInterpolatedU(this.renderMinY * 16.0D); - d5 = (double) sprite.getInterpolatedV(16.0D - this.renderMinZ * 16.0D); - d4 = (double) sprite.getInterpolatedU(this.renderMaxY * 16.0D); - d6 = (double) sprite.getInterpolatedV(16.0D - this.renderMaxZ * 16.0D); - d9 = d5; - d10 = d6; - d7 = d3; - d8 = d4; - d5 = d6; - d6 = d9; - } else if (this.uvRotateSouth == 1) { - d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxY * 16.0D); - d5 = (double) sprite.getInterpolatedV(this.renderMaxZ * 16.0D); - d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMinY * 16.0D); - d6 = (double) sprite.getInterpolatedV(this.renderMinZ * 16.0D); - d7 = d4; - d8 = d3; - d3 = d4; - d4 = d8; - d9 = d6; - d10 = d5; - } else if (this.uvRotateSouth == 3) { - d3 = (double) sprite.getInterpolatedU(16.0D - this.renderMinZ * 16.0D); - d4 = (double) sprite.getInterpolatedU(16.0D - this.renderMaxZ * 16.0D); - d5 = (double) sprite.getInterpolatedV(this.renderMaxY * 16.0D); - d6 = (double) sprite.getInterpolatedV(this.renderMinY * 16.0D); - d7 = d4; - d8 = d3; - d9 = d5; - d10 = d6; - } - - double d11 = posX + this.renderMaxX; - double d12 = posY + this.renderMinY; - double d13 = posY + this.renderMaxY; - double d14 = posZ + this.renderMinZ; - double d15 = posZ + this.renderMaxZ; - - if (this.renderFromInside) { - d14 = posZ + this.renderMaxZ; - d15 = posZ + this.renderMinZ; - } - - quadBakery.setColour(colourTopLeft).addVertexWithUV(d11, d12, d15, d8, d10); - quadBakery.setColour(colourBottomLeft).addVertexWithUV(d11, d12, d14, d4, d6); - quadBakery.setColour(colourBottomRight).addVertexWithUV(d11, d13, d14, d7, d9); - quadBakery.setColour(colourTopRight).addVertexWithUV(d11, d13, d15, d3, d5); - - quadList.addAll(quadBakery.finishBaking()); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/CCModelBakery.java b/dependencies/main/java/codechicken/lib/model/bakery/CCModelBakery.java deleted file mode 100644 index 888de94afd..0000000000 --- a/dependencies/main/java/codechicken/lib/model/bakery/CCModelBakery.java +++ /dev/null @@ -1,96 +0,0 @@ -package codechicken.lib.model.bakery; - -import codechicken.lib.render.CCModel; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.buffer.BakingVertexBuffer; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.render.pipeline.IVertexSource; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.renderer.vertex.VertexFormat; - -import java.util.List; - -/** - * Created by covers1624 on 8/20/2016. - * Uses the CCL RenderPipe to bake a CCModel to an array of BakedQuads with the provided VertexFormat. - */ -@Deprecated// Use CCRenderState with a BakingVertexBuffer bound. -public class CCModelBakery { - - /** - * Bakes a CCModel to a List of BakedQuads. - * Assumes DefaultVertexFormats.BLOCK. - * Assumes you want to bake the entire model. - * - * @param model Model to bake. - * @param ops Any Operations to apply. - * @return The BakedQuads for the model. - */ - public static List bakeModel(CCModel model, IVertexOperation... ops) { - return bakeModel(model, 0, model.getVertices().length, ops); - } - - /** - * Bakes a CCModel to a List of BakedQuads. - * Assumes DefaultVertexFormats.BLOCK. - * - * @param model Model to bake. - * @param start The first vertex index to bake. - * @param end The Vertex index to bake until. - * @param ops Any Operations to apply. - * @return The BakedQuads for the model. - */ - public static List bakeModel(CCModel model, int start, int end, IVertexOperation... ops) { - return bakeModel(model, DefaultVertexFormats.ITEM, start, end, ops); - } - - /** - * Bakes a CCModel to a List of BakedQuads. - * Assumes you want to bake the entire model. - * - * @param model Model to bake. - * @param format VertexFormat to bake to. - * @param ops Any Operations to apply. - * @return The BakedQuads for the model. - */ - public static List bakeModel(CCModel model, VertexFormat format, IVertexOperation... ops) { - return bakeModel(model, format, 0, model.getVertices().length, ops); - } - - /** - * Bakes a IVertexSource model to a List of BakedQuads. - * - * @param model Vertex source to bake. - * @param format VertexFormat to bake to. - * @param start The first vertex index to bake. - * @param end The Vertex index to bake until. - * @param ops Any Operations to apply. - * @return The BakedQuads for the model. - */ - public static List bakeModel(CCModel model, VertexFormat format, int start, int end, IVertexOperation... ops) { - return bakeModel(model, model.vp == 3, format, start, end, ops); - } - - /** - * Bakes a IVertexSource model to a List of BakedQuads. - * - * @param model Vertex source to bake. - * @param isTriangles Specifies if the model's vertices are triangles. - * @param format VertexFormat to bake to, You almost always want this to be ITEM. - * @param start The first vertex index to bake. - * @param end The Vertex index to bake until. - * @param ops Any Operations to apply. - * @return The BakedQuads for the model. - */ - public static List bakeModel(IVertexSource model, boolean isTriangles, VertexFormat format, int start, int end, IVertexOperation... ops) { - BakingVertexBuffer buffer = BakingVertexBuffer.create(); - buffer.begin(isTriangles ? 4 : 7, format); - CCRenderState ccrs = CCRenderState.instance(); - ccrs.bind(buffer); - ccrs.setPipeline(model, start, end, ops); - ccrs.render(); - buffer.finishDrawing(); - return buffer.bake(); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/CCQuad.java b/dependencies/main/java/codechicken/lib/model/bakery/CCQuad.java deleted file mode 100644 index 09a5511b5b..0000000000 --- a/dependencies/main/java/codechicken/lib/model/bakery/CCQuad.java +++ /dev/null @@ -1,309 +0,0 @@ -package codechicken.lib.model.bakery; - -import codechicken.lib.colour.Colour; -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.util.ArrayUtils; -import codechicken.lib.util.Copyable; -import codechicken.lib.util.VectorUtils; -import codechicken.lib.vec.Transformation; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.Vertex5; -import codechicken.lib.vec.uv.UV; -import codechicken.lib.vec.uv.UVTransformation; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.renderer.vertex.VertexFormatElement; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.model.pipeline.IVertexConsumer; -import net.minecraftforge.client.model.pipeline.IVertexProducer; -import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; - -import java.util.LinkedList; -import java.util.List; - -/** - * Created by covers1624 on 8/20/2016. - * Basically just a holder for quads before baking. - */ -public class CCQuad implements Copyable, IVertexProducer { - - public Vertex5[] vertices = new Vertex5[4]; - public Vector3[] normals = new Vector3[4]; - public Colour[] colours = new Colour[4]; - public Integer[] lightMaps = new Integer[4]; - - public EnumFacing face = null; - public int tintIndex = -1; - public boolean applyDifuseLighting = true; - public TextureAtlasSprite sprite; - - public CCQuad() { - } - - public CCQuad(Vertex5... vertices) { - if (vertices.length > 4) { - throw new IllegalArgumentException("CCQuad is a... Quad.. only 3 or 4 vertices allowed!"); - } - for (int i = 0; i < 4; i++) { - this.vertices[i] = vertices[i].copy(); - } - } - - public CCQuad(BakedQuad quad) { - this(); - - VertexFormat format = quad.getFormat(); - face = quad.getFace(); - tintIndex = quad.getTintIndex(); - sprite = quad.getSprite(); - ArrayUtils.fillArray(vertices, new Vertex5()); - UnpackingVertexConsumer consumer = new UnpackingVertexConsumer(quad.getFormat()); - quad.pipe(consumer); - float[][][] unpackedData = consumer.getUnpackedData(); - for (int v = 0; v < 4; v++) { - for (int e = 0; e < format.getElementCount(); e++) { - float[] data = unpackedData[v][e]; - switch (format.getElement(e).getUsage()) { - case POSITION: - vertices[v].vec.set(data); - break; - case NORMAL: - normals[v] = new Vector3(data); - break; - case COLOR: - colours[v] = new ColourRGBA(data[0], data[1], data[2], data[3]); - break; - case UV: - if (format.getElement(e).getIndex() == 0) { - vertices[v].uv.set(data[0], data[1]); - } else {//TODO This SHOULD be fine..... - lightMaps[v] = (int) (data[1] * 65535 / 32) << 20 | (int) (data[0] * 65535 / 32) << 4; - } - break; - default: - break; - } - } - } - if (!format.hasColor()) { - ArrayUtils.fillArray(colours, new ColourRGBA(0xFFFFFFFF)); - } - if (!format.hasUvOffset(1)) { - ArrayUtils.fillArray(lightMaps, 0); - } - if (!format.hasNormal()) { - computeNormals(); - } - } - - public CCQuad(CCQuad quad) { - this(); - for (int i = 0; i < vertices.length; i++) { - vertices[i] = quad.vertices[i].copy(); - } - for (int i = 0; i < vertices.length; i++) { - normals[i] = quad.normals[i].copy(); - } - for (int i = 0; i < vertices.length; i++) { - colours[i] = quad.colours[i].copy(); - } - System.arraycopy(quad.lightMaps, 0, lightMaps, 0, vertices.length); - face = quad.face; - tintIndex = quad.tintIndex; - applyDifuseLighting = quad.applyDifuseLighting; - sprite = quad.sprite; - } - - public void apply(Transformation... transforms) { - for (Transformation t : transforms) { - apply(t); - } - } - - public void apply(UVTransformation... transforms) { - for (UVTransformation t : transforms) { - apply(t); - } - } - - public void apply(Transformation t) { - quadulate(); - if (ArrayUtils.countNoNull(normals) != 4) { - computeNormals(); - } - for (int i = 0; i < 4; i++) { - Vertex5 vert = vertices[i]; - Vector3 normal = normals[i]; - t.apply(vert.vec); - t.applyN(normal); - } - } - - public void apply(UVTransformation t) { - quadulate(); - for (int i = 0; i < 4; i++) { - Vertex5 vert = vertices[i]; - t.apply(vert.uv); - } - } - - public boolean isQuads() { - int counter = ArrayUtils.countNoNull(vertices); - return counter == 4; - } - - public boolean hasTint() { - return tintIndex != -1; - } - - /** - * Quadulates the quad by copying any element at index 2 to index 3 only if there are 3 of any given element. - */ - public void quadulate() { - int verticesCount = ArrayUtils.countNoNull(vertices); - int normalCount = ArrayUtils.countNoNull(normals); - int colourCount = ArrayUtils.countNoNull(colours); - int lightMapCount = ArrayUtils.countNoNull(lightMaps); - if (verticesCount == 3) { - vertices[3] = vertices[2].copy(); - } - if (normalCount == 3) { - normals[3] = normals[2].copy(); - } - if (colourCount == 3) { - colours[3] = colours[2].copy(); - } - if (lightMapCount == 3) { - lightMaps[3] = lightMaps[2]; - } - } - - /** - * Creates a set of normals for the quad. - * Will attempt to Quadulate the model first. - */ - public void computeNormals() { - if (ArrayUtils.countNoNull(normals) != 4) { - quadulate(); - Vector3 normal = VectorUtils.calculateNormal(vertices[0].vec, vertices[1].vec, vertices[3].vec); - - for (int i = 0; i < 4; i++) { - normals[i] = normal.copy(); - } - } - } - - public EnumFacing getQuadFace() { - if (face == null) { - if (ArrayUtils.countNoNull(normals) != 4) { - computeNormals(); - } - face = VectorUtils.calcNormalSide(normals[0]); - } - return face; - } - - public BakedQuad bake() { - return bake(DefaultVertexFormats.BLOCK); - } - - public BakedQuad bake(VertexFormat format) { - quadulate(); - computeNormals(); - UnpackedBakedQuad.Builder quadBuilder = new UnpackedBakedQuad.Builder(format); - quadBuilder.setApplyDiffuseLighting(applyDifuseLighting); - quadBuilder.setTexture(sprite); - quadBuilder.setQuadOrientation(getQuadFace()); - quadBuilder.setQuadTint(tintIndex); - for (int v = 0; v < 4; v++) { - for (int e = 0; e < format.getElementCount(); e++) { - VertexFormatElement element = format.getElement(e); - switch (element.getUsage()) { - case POSITION: - Vector3 pos = vertices[v].vec; - quadBuilder.put(e, (float) pos.x, (float) pos.y, (float) pos.z, 1); - break; - case NORMAL: - Vector3 normal = normals[v]; - quadBuilder.put(e, (float) normal.x, (float) normal.y, (float) normal.z, 0); - break; - case COLOR: - Colour colour = colours[v]; - quadBuilder.put(e, (colour.r & 0xFF) / 255, (colour.g & 0xFF) / 255, (colour.b & 0xFF) / 255, (colour.a & 0xFF) / 255); - break; - case UV: - if (element.getIndex() == 0) { - UV uv = vertices[v].uv; - quadBuilder.put(e, (float) uv.u, (float) uv.v, 0, 1); - } else { - int brightness = lightMaps[v]; - quadBuilder.put(e, (float) ((brightness >> 4) & 15 * 32) / 65535, (float) ((brightness >> 20) & 15 * 32) / 65535, 0, 1); - } - break; - case PADDING: - case GENERIC: - default: - quadBuilder.put(e); - } - } - } - return quadBuilder.build(); - } - - @Override - public void pipe(IVertexConsumer consumer) { - quadulate(); - computeNormals(); - consumer.setApplyDiffuseLighting(applyDifuseLighting); - consumer.setTexture(sprite); - consumer.setQuadOrientation(getQuadFace()); - consumer.setQuadTint(tintIndex); - for (int v = 0; v < 4; v++) { - for (int e = 0; e < consumer.getVertexFormat().getElementCount(); e++) { - VertexFormatElement element = consumer.getVertexFormat().getElement(e); - switch (element.getUsage()) { - case POSITION: - Vector3 pos = vertices[v].vec; - consumer.put(e, (float) pos.x, (float) pos.y, (float) pos.z, 1); - break; - case NORMAL: - Vector3 normal = normals[v]; - consumer.put(e, (float) normal.x, (float) normal.y, (float) normal.z, 0); - break; - case COLOR: - Colour colour = colours[v]; - consumer.put(e, (colour.r & 0xFF) / 255, (colour.g & 0xFF) / 255, (colour.b & 0xFF) / 255, (colour.a & 0xFF) / 255); - break; - case UV: - if (element.getIndex() == 0) { - UV uv = vertices[v].uv; - consumer.put(e, (float) uv.u, (float) uv.v, 0, 1); - } else { - int brightness = lightMaps[v]; - consumer.put(e, (float) ((brightness >> 4) & 15 * 32) / 65535, (float) ((brightness >> 20) & 15 * 32) / 65535, 0, 1); - } - break; - case PADDING: - case GENERIC: - default: - consumer.put(e); - } - } - } - } - - public static List fromArray(List bakedQuads) { - List quads = new LinkedList(); - for (BakedQuad quad : bakedQuads) { - quads.add(new CCQuad(quad)); - } - return quads; - } - - @Override - public CCQuad copy() { - return new CCQuad(this); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/CCQuadBakery.java b/dependencies/main/java/codechicken/lib/model/bakery/CCQuadBakery.java deleted file mode 100644 index 7b66783ef1..0000000000 --- a/dependencies/main/java/codechicken/lib/model/bakery/CCQuadBakery.java +++ /dev/null @@ -1,202 +0,0 @@ -package codechicken.lib.model.bakery; - -import codechicken.lib.colour.Colour; -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.Vertex5; -import codechicken.lib.vec.uv.UV; -import com.google.common.collect.ImmutableList; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.util.EnumFacing; - -import java.util.LinkedList; - -/** - * Created by covers1624 on 8/2/2016. - * Bakes Quads.. - */ -@Deprecated//TODO a Tessellator style BakingVertexBuffer. -public class CCQuadBakery { - - private VertexFormat format; - private TextureAtlasSprite sprite; - private EnumFacing face; - - //Temp storage - private UV uv = new UV(); - private Vector3 normal = null; - private Colour colour = new ColourRGBA(0xFFFFFFFF); - private int brightness = 0; - - private boolean isBakingTriModel = false; - private boolean applyDifuseLighting = true; - private LinkedList bakedQuads = null; - - //Active storage. - private CCQuad quad = null; - private int index = 0; - - public CCQuadBakery(TextureAtlasSprite sprite) { - this(DefaultVertexFormats.BLOCK, sprite); - } - - public CCQuadBakery(VertexFormat format, TextureAtlasSprite sprite) { - this.format = format; - this.sprite = sprite; - } - - public CCQuadBakery startBakingQuads() { - return startBaking(false); - } - - public CCQuadBakery startBakingTriangles() { - return startBaking(true); - } - - //TODO Have the QuadBakery bake from any DrawMode to any DrawMode and from any VertexFormat to any VertexFormat. - //TODO Maybe a custom BakedQuad that holds all the raw info still, might make it more possible / cleaner for a VF > VF converter. - private CCQuadBakery startBaking(boolean isTriangles) { - if (quad != null || bakedQuads != null) { - throw new IllegalStateException("Quads are still baking or baking has not finished yet!"); - } - isBakingTriModel = isTriangles; - bakedQuads = new LinkedList(); - return this; - } - - public ImmutableList finishBaking() { - if (quad != null) { - throw new IllegalStateException("Quads are still baking!"); - } - if (bakedQuads == null) { - throw new IllegalStateException("The bakery has no baked quads!"); - } - ImmutableList returnQuads = ImmutableList.copyOf(bakedQuads); - reset(); - return returnQuads; - } - - public boolean hasIncompleteQuad() { - return quad != null; - } - - public void reset() { - applyDifuseLighting = true; - isBakingTriModel = false; - bakedQuads = null; - quad = null; - index = 0; - } - - public CCQuadBakery setSprite(TextureAtlasSprite sprite) { - if (this.sprite == sprite) { - return this; - } - if (quad != null) { - throw new IllegalStateException("Unable to set sprite whilst quad is still baking!"); - } - this.sprite = sprite; - return this; - } - - public CCQuadBakery setFace(EnumFacing face) { - if (quad != null) { - throw new IllegalStateException("Unable to set face whilst quad is still baking!"); - } - this.face = face; - return this; - } - - public CCQuadBakery disableDifuseLighting() { - return setDifuseLightingState(false); - } - - public CCQuadBakery setDifuseLightingState(boolean state) { - applyDifuseLighting = state; - return this; - } - - public CCQuadBakery setColour(int colour) { - return setColour(new ColourRGBA(colour)); - } - - public CCQuadBakery setColour(Colour colour) { - this.colour = colour.copy(); - return this; - } - - public CCQuadBakery setLightMap(int brightness) { - this.brightness = brightness; - return this; - //return setLightMap(new UV((double) ((brightness >> 4) & 15 * 32) / 65535, (double) ((brightness >> 20) & 15 * 32) / 65535)); - } - - public CCQuadBakery setNormal(Vector3 normal) { - this.normal = normal; - return this; - } - - public CCQuadBakery setUV(double u, double v) { - return setUV(new UV(u, v)); - } - - public CCQuadBakery setUV(UV uv) { - this.uv = uv.copy(); - return this; - } - - public CCQuadBakery addVertexWithUV(Vector3 vertex, double u, double v) { - return addVertexWithUV(vertex, new UV(u, v)); - } - - public CCQuadBakery addVertexWithUV(double x, double y, double z, UV uv) { - return addVertexWithUV(new Vector3(x, y, z), uv); - } - - public CCQuadBakery addVertexWithUV(double x, double y, double z, double u, double v) { - return addVertexWithUV(new Vector3(x, y, z), new UV(u, v)); - } - - public CCQuadBakery addVertexWithUV(Vector3 vertex, UV uv) { - return addVertexWithUV(new Vertex5(vertex, uv)); - } - - public CCQuadBakery addVertexWithUV(Vertex5 vertex) { - setUV(vertex.uv); - return addVertex(vertex.vec); - } - - public CCQuadBakery addVertex(double x, double y, double z) { - return addVertex(new Vector3(x, y, z)); - } - - public CCQuadBakery addVertex(Vector3 vertex) { - if (quad == null) { - quad = new CCQuad(); - if (face != null) { - quad.face = face; - } - quad.sprite = sprite; - quad.applyDifuseLighting = applyDifuseLighting; - index = 0; - } - quad.vertices[index] = new Vertex5(vertex.copy(), uv.copy()); - quad.normals[index] = normal != null ? normal.copy() : null; - quad.colours[index] = colour.copy(); - quad.lightMaps[index] = brightness; - index++; - - int max = isBakingTriModel ? 3 : 4; - - if (index == max) { - index = 0; - bakedQuads.add(quad.bake(format)); - quad = null; - } - return this; - } - -} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/ItemModelBakery.java b/dependencies/main/java/codechicken/lib/model/bakery/ItemModelBakery.java deleted file mode 100644 index e8b847cc83..0000000000 --- a/dependencies/main/java/codechicken/lib/model/bakery/ItemModelBakery.java +++ /dev/null @@ -1,42 +0,0 @@ -package codechicken.lib.model.bakery; - -import codechicken.lib.util.TransformUtils; -import com.google.common.base.Optional; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraftforge.client.model.ItemLayerModel; -import net.minecraftforge.common.model.IModelPart; -import net.minecraftforge.common.model.IModelState; - -import java.util.LinkedList; -import java.util.List; - -/** - * Created by covers1624 on 13/02/2017. - */ -public class ItemModelBakery { - - public static List bakeItem(List sprites) { - return bakeItem(sprites, DefaultVertexFormats.ITEM, TransformUtils.DEFAULT_ITEM); - } - - public static List bakeItem(List sprites, IModelState state) { - return bakeItem(sprites, DefaultVertexFormats.ITEM, state); - } - - public static List bakeItem(List sprites, VertexFormat format) { - return bakeItem(sprites, format, TransformUtils.DEFAULT_ITEM); - } - - public static List bakeItem(List sprites, VertexFormat format, IModelState state) { - List quads = new LinkedList(); - for (int i = 0; i < sprites.size(); i++) { - TextureAtlasSprite sprite = sprites.get(i); - quads.addAll(ItemLayerModel.getQuadsForSprite(i, sprite, format, state.apply(Optional.absent()))); - } - return quads; - } - -} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/PlanarFaceBakery.java b/dependencies/main/java/codechicken/lib/model/bakery/PlanarFaceBakery.java deleted file mode 100644 index c95f8b34f3..0000000000 --- a/dependencies/main/java/codechicken/lib/model/bakery/PlanarFaceBakery.java +++ /dev/null @@ -1,227 +0,0 @@ -package codechicken.lib.model.bakery; - -import codechicken.lib.colour.Colour; -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.util.VertexDataUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.Vertex5; -import codechicken.lib.vec.uv.IconTransformation; -import codechicken.lib.vec.uv.UV; -import codechicken.lib.vec.uv.UVTransformation; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.renderer.vertex.VertexFormatElement; -import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.model.pipeline.LightUtil; -import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -/** - * Created by covers1624 on 26/10/2016. - */ -//TODO General cleanup. -public class PlanarFaceBakery { - - public static BakedQuad bakeFace(EnumFacing face, TextureAtlasSprite sprite) { - return bakeFace(face, sprite, DefaultVertexFormats.ITEM); - } - - public static BakedQuad bakeFace(EnumFacing face, TextureAtlasSprite sprite, VertexFormat format) { - return bakeFace(face, sprite, format, 0xFFFFFFFF); - } - - public static BakedQuad bakeFace(EnumFacing face, TextureAtlasSprite sprite, VertexFormat format, int colour) { - return bakeFace(face, sprite, format, new ColourRGBA(colour)); - } - - public static BakedQuad bakeFace(EnumFacing face, TextureAtlasSprite sprite, VertexFormat format, Colour colour) { - UVTransformation t = new IconTransformation(sprite); - - double x1 = Cuboid6.full.min.x; - double x2 = Cuboid6.full.max.x; - double y1 = Cuboid6.full.min.y; - double y2 = Cuboid6.full.max.y; - double z1 = Cuboid6.full.min.z; - double z2 = Cuboid6.full.max.z; - double u1; - double u2; - double v1; - double v2; - Vertex5 vert1; - Vertex5 vert2; - Vertex5 vert3; - Vertex5 vert4; - - switch (face) { - case DOWN: - u1 = x1; - v1 = z1; - u2 = x2; - v2 = z2; - vert1 = new Vertex5(x1, y1, z2, u1, v2); - vert2 = new Vertex5(x1, y1, z1, u1, v1); - vert3 = new Vertex5(x2, y1, z1, u2, v1); - vert4 = new Vertex5(x2, y1, z2, u2, v2); - return buildQuad(format, sprite, face, colour, t, vert1, vert2, vert3, vert4); - case UP: - u1 = x1; - v1 = z1; - u2 = x2; - v2 = z2; - vert1 = new Vertex5(x2, y2, z2, u2, v2); - vert2 = new Vertex5(x2, y2, z1, u2, v1); - vert3 = new Vertex5(x1, y2, z1, u1, v1); - vert4 = new Vertex5(x1, y2, z2, u1, v2); - return buildQuad(format, sprite, face, colour, t, vert1, vert2, vert3, vert4); - case NORTH: - u1 = 1 - x1; - v1 = 1 - y2; - u2 = 1 - x2; - v2 = 1 - y1; - vert1 = new Vertex5(x1, y1, z1, u1, v2); - vert2 = new Vertex5(x1, y2, z1, u1, v1); - vert3 = new Vertex5(x2, y2, z1, u2, v1); - vert4 = new Vertex5(x2, y1, z1, u2, v2); - return buildQuad(format, sprite, face, colour, t, vert1, vert2, vert3, vert4); - case SOUTH: - u1 = x1; - v1 = 1 - y2; - u2 = x2; - v2 = 1 - y1; - vert1 = new Vertex5(x2, y1, z2, u2, v2); - vert2 = new Vertex5(x2, y2, z2, u2, v1); - vert3 = new Vertex5(x1, y2, z2, u1, v1); - vert4 = new Vertex5(x1, y1, z2, u1, v2); - return buildQuad(format, sprite, face, colour, t, vert1, vert2, vert3, vert4); - case WEST: - u1 = z1; - v1 = 1 - y2; - u2 = z2; - v2 = 1 - y1; - vert1 = new Vertex5(x1, y1, z2, u2, v2); - vert2 = new Vertex5(x1, y2, z2, u2, v1); - vert3 = new Vertex5(x1, y2, z1, u1, v1); - vert4 = new Vertex5(x1, y1, z1, u1, v2); - return buildQuad(format, sprite, face, colour, t, vert1, vert2, vert3, vert4); - - case EAST: - u1 = 1 - z1; - v1 = 1 - y2; - u2 = 1 - z2; - v2 = 1 - y1; - vert1 = new Vertex5(x2, y1, z1, u1, v2); - vert2 = new Vertex5(x2, y2, z1, u1, v1); - vert3 = new Vertex5(x2, y2, z2, u2, v1); - vert4 = new Vertex5(x2, y1, z2, u2, v2); - return buildQuad(format, sprite, face, colour, t, vert1, vert2, vert3, vert4); - } - //This case will never happen. only here due to INTELLIJ NOT SHUTTING UP ABOUT POTENTIAL NULLPOINTERS! - return new BakedQuad(null, 1, null, null, true, null); - } - - private static BakedQuad buildQuad(VertexFormat format, TextureAtlasSprite sprite, EnumFacing face, Colour colour, UVTransformation t, Vertex5 v1, Vertex5 v2, Vertex5 v3, Vertex5 v4) { - UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format); - builder.setQuadTint(-1); - builder.setQuadOrientation(face); - builder.setTexture(sprite); - - t.apply(v1.uv); - t.apply(v2.uv); - t.apply(v3.uv); - t.apply(v4.uv); - putVertex(builder, format, face, v1, colour); - putVertex(builder, format, face, v2, colour); - putVertex(builder, format, face, v3, colour); - putVertex(builder, format, face, v4, colour); - - return VertexDataUtils.copyQuad(builder.build()); - } - - private static void putVertex(UnpackedBakedQuad.Builder builder, VertexFormat format, EnumFacing face, Vertex5 vert, Colour colour) { - for (int e = 0; e < format.getElementCount(); e++) { - VertexFormatElement element = format.getElement(e); - switch (element.getUsage()) { - - case POSITION: - Vector3 vec = vert.vec; - builder.put(e, (float) vec.x, (float) vec.y, (float) vec.z, 1); - break; - case NORMAL: - builder.put(e, face.getFrontOffsetX(), face.getFrontOffsetY(), face.getFrontOffsetZ(), 0); - break; - case COLOR: - builder.put(e, (colour.r & 0xFF) / 255F, (colour.g & 0xFF) / 255F, (colour.b & 0xFF) / 255F, (colour.a & 0xFF) / 255F); - break; - case UV: - UV uv = vert.uv; - builder.put(e, (float) uv.u, (float) uv.v, 0, 1); - break; - default: - builder.put(e); - break; - } - } - } - - public static List shadeQuadFaces(BakedQuad... quads) { - return shadeQuadFaces(Arrays.asList(quads)); - } - - public static List shadeQuadFaces(List quads) { - LinkedList shadedQuads = new LinkedList(); - for (BakedQuad quad : quads) { - int[] rawData = quad.getVertexData(); - for (int v = 0; v < 4; v++) { - for (int e = 0; e < quad.getFormat().getElementCount(); e++) { - VertexFormatElement element = quad.getFormat().getElement(e); - if (element.getUsage() == EnumUsage.COLOR) { - float[] data = new float[4]; - LightUtil.unpack(rawData, data, quad.getFormat(), v, e); - - data = diffuseFaceLight(quad.getFace(), data); - - LightUtil.pack(data, rawData, quad.getFormat(), v, e); - } - } - } - shadedQuads.add(new BakedQuad(rawData, quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad.getFormat())); - } - - return shadedQuads; - } - - private static float[] diffuseFaceLight(EnumFacing face, float[] colour) { - double diffuse; - switch (face) { - case DOWN: - diffuse = 0.5D; - break; - case NORTH: - case SOUTH: - diffuse = 0.8D; - break; - case WEST: - case EAST: - diffuse = 0.6D; - break; - case UP: - default: - diffuse = 1.0D; - break; - } - - colour[0] *= diffuse; - colour[1] *= diffuse; - colour[2] *= diffuse; - - return colour; - } - -} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/SimplePerspectiveAwareLayerModelBakery.java b/dependencies/main/java/codechicken/lib/model/bakery/SimplePerspectiveAwareLayerModelBakery.java deleted file mode 100644 index 74820a10f2..0000000000 --- a/dependencies/main/java/codechicken/lib/model/bakery/SimplePerspectiveAwareLayerModelBakery.java +++ /dev/null @@ -1,40 +0,0 @@ -package codechicken.lib.model.bakery; - -import codechicken.lib.model.BakedModelProperties; -import codechicken.lib.model.bakedmodels.PerspectiveAwareBakedModel; -import codechicken.lib.texture.TextureUtils; -import com.google.common.collect.ImmutableList; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.ItemLayerModel; -import net.minecraftforge.common.model.IModelState; - -import java.util.Arrays; - -/** - * Created by covers1624 on 7/25/2016. - */ -//TODO Find better name and integrate with IModel / Jsons. -public class SimplePerspectiveAwareLayerModelBakery { - - private final ResourceLocation baseTexture; - private final ResourceLocation[] layers; - - public SimplePerspectiveAwareLayerModelBakery(ResourceLocation baseTexture, ResourceLocation... layers) { - this.baseTexture = baseTexture; - this.layers = layers; - } - - public IBakedModel bake(IModelState state) { - - ImmutableList.Builder quadBuilder = ImmutableList.builder(); - ImmutableList textureLayers = ImmutableList.builder().add(baseTexture).addAll(Arrays.asList(layers)).build(); - - IBakedModel layerModel = new ItemLayerModel(textureLayers).bake(state, DefaultVertexFormats.ITEM, TextureUtils.bakedTextureGetter); - quadBuilder.addAll(layerModel.getQuads(null, null, 0)); - - return new PerspectiveAwareBakedModel(quadBuilder.build(), state, BakedModelProperties.createFromModel(layerModel)); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/bakery/UnpackingVertexConsumer.java b/dependencies/main/java/codechicken/lib/model/bakery/UnpackingVertexConsumer.java deleted file mode 100644 index d294c5a059..0000000000 --- a/dependencies/main/java/codechicken/lib/model/bakery/UnpackingVertexConsumer.java +++ /dev/null @@ -1,66 +0,0 @@ -package codechicken.lib.model.bakery; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.model.pipeline.IVertexConsumer; - -/** - * Created by covers1624 on 5/11/2016. - * TODO Document. - */ -public class UnpackingVertexConsumer implements IVertexConsumer { - - public int tintIndex; - public EnumFacing face; - public VertexFormat format; - public boolean applyDiffuesLight; - public TextureAtlasSprite sprite; - - public float[][][] unpackedData; - - private int vertices = 0; - - public UnpackingVertexConsumer(VertexFormat format) { - this.format = format; - unpackedData = new float[4][format.getElementCount()][4]; - } - - @Override - public VertexFormat getVertexFormat() { - return format; - } - - @Override - public void setQuadTint(int tint) { - tintIndex = tint; - } - - @Override - public void setQuadOrientation(EnumFacing orientation) { - face = orientation; - } - - @Override - public void setApplyDiffuseLighting(boolean diffuse) { - applyDiffuesLight = diffuse; - } - - @Override - public void setTexture(TextureAtlasSprite texture) { - sprite = texture; - } - - @Override - public void put(int element, float... data) { - System.arraycopy(data, 0, unpackedData[vertices][element], 0, data.length); - if (element == getVertexFormat().getElementCount() - 1) { - vertices++; - } - } - - public float[][][] getUnpackedData() { - return unpackedData; - } - -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakery.java b/dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakery.java deleted file mode 100644 index eff3d97101..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakery.java +++ /dev/null @@ -1,343 +0,0 @@ -package codechicken.lib.model.blockbakery; - -import codechicken.lib.model.BakedModelProperties; -import codechicken.lib.model.ModelRegistryHelper; -import codechicken.lib.model.ModelRegistryHelper.IModelBakeCallback; -import codechicken.lib.model.PerspectiveAwareModelProperties; -import codechicken.lib.model.bakedmodels.PerspectiveAwareBakedModel; -import codechicken.lib.model.bakedmodels.PerspectiveAwareLayeredModel; -import codechicken.lib.model.bakery.PlanarFaceBakery; -import codechicken.lib.texture.IItemBlockTextureProvider; -import codechicken.lib.texture.IWorldBlockTextureProvider; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.util.TransformUtils; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.IResourceManagerReloadListener; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.registry.IRegistry; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.client.model.ModelLoaderRegistry; -import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.TimeUnit; - -/** - * Created by covers1624 on 25/10/2016. - */ -//TODO, We need a hook for CCRenderItem to allow switching the model being rendered on ItemOverrideList.handleItemState, possibly an interface. -//TODO, BlockBakery > CachedModelBakery? dunno. -@SideOnly (Side.CLIENT) -public class BlockBakery implements IResourceManagerReloadListener { - - private static boolean DEBUG = Boolean.parseBoolean(System.getProperty("ccl.debugBakeryLogging")); - - private static Cache keyModelCache = CacheBuilder.newBuilder().expireAfterAccess(30, TimeUnit.MINUTES).build(); - - private static Map itemKeyGeneratorMap = new HashMap(); - private static Map blockKeyGeneratorMap = new HashMap(); - private static IBakedModel missingModel; - - public static final IBlockStateKeyGenerator defaultBlockKeyGenerator = new IBlockStateKeyGenerator() { - @Override - public String generateKey(IExtendedBlockState state) { - if (state.getBlock() instanceof IWorldBlockTextureProvider) { - Map> layerFaceSpriteMap = state.getValue(BlockBakeryProperties.LAYER_FACE_SPRITE_MAP); - StringBuilder builder = new StringBuilder(state.getBlock().getRegistryName() + ","); - for (Entry> layerEntry : layerFaceSpriteMap.entrySet()) { - builder.append(layerEntry.getKey().toString()).append(","); - for (Entry faceSpriteEntry : layerEntry.getValue().entrySet()) { - builder.append(faceSpriteEntry.getKey()).append(",").append(faceSpriteEntry.getValue().getIconName()).append(","); - } - } - return builder.toString(); - } - return state.getBlock().getRegistryName().toString() + "|" + state.getBlock().getMetaFromState(state); - } - }; - - public static final IItemStackKeyGenerator defaultItemKeyGenerator = new IItemStackKeyGenerator() { - @Override - public String generateKey(ItemStack stack) { - return stack.getItem().getRegistryName().toString() + "|" + stack.getMetadata(); - } - }; - - public static void init() { - TextureUtils.registerReloadListener(new BlockBakery()); - ModelRegistryHelper.registerCallback(new IModelBakeCallback() { - @Override - public void onModelBake(IRegistry modelRegistry) { - missingModel = ModelLoaderRegistry.getMissingModel().bake(TransformUtils.DEFAULT_BLOCK, DefaultVertexFormats.ITEM, TextureUtils.bakedTextureGetter); - } - }); - } - - public static IBlockStateKeyGenerator getKeyGenerator(Block block) { - if (blockKeyGeneratorMap.containsKey(block)) { - return blockKeyGeneratorMap.get(block); - } - return defaultBlockKeyGenerator; - } - - public static IItemStackKeyGenerator getKeyGenerator(Item item) { - if (itemKeyGeneratorMap.containsKey(item)) { - return itemKeyGeneratorMap.get(item); - } - return defaultItemKeyGenerator; - } - - public static void registerBlockKeyGenerator(Block block, IBlockStateKeyGenerator generator) { - if (blockKeyGeneratorMap.containsKey(block)) { - throw new IllegalArgumentException("Unable to register IBlockStateKeyGenerator as one is already registered for block:" + block.getRegistryName()); - } - blockKeyGeneratorMap.put(block, generator); - } - - public static void registerItemKeyGenerator(Item item, IItemStackKeyGenerator generator) { - if (itemKeyGeneratorMap.containsKey(item)) { - throw new IllegalArgumentException("Unable to register IItemStackKeyGenerator as one is already registered for item: " + item.getRegistryName()); - } - itemKeyGeneratorMap.put(item, generator); - } - - //TODO, Move this to pass IExtendedBlockState, IBlockAccess, BlockPos. Leave tile usage to - public static IBlockState handleExtendedState(IExtendedBlockState state, TileEntity tileEntity) { - Block block = state.getBlock(); - - if (block instanceof IBakeryBlock) { - return ((IBakeryBlock) block).getCustomBakery().handleState(state, tileEntity); - } else if (block instanceof IWorldBlockTextureProvider) { - IWorldBlockTextureProvider provider = ((IWorldBlockTextureProvider) block); - Map> layerFaceSpriteMap = new HashMap>(); - for (BlockRenderLayer layer : BlockRenderLayer.values()) { - if (block.canRenderInLayer(state, layer)) { - Map faceSpriteMap = new HashMap(); - for (EnumFacing face : EnumFacing.VALUES) { - TextureAtlasSprite sprite = provider.getTexture(face, state, layer, tileEntity.getWorld(), tileEntity.getPos()); - if (sprite != null) { - faceSpriteMap.put(face, sprite); - } - } - layerFaceSpriteMap.put(layer, faceSpriteMap); - } - } - state = state.withProperty(BlockBakeryProperties.LAYER_FACE_SPRITE_MAP, layerFaceSpriteMap); - } - return state; - } - - public static IBakedModel getCachedItemModel(ItemStack stack) { - IBakedModel model; - IItemStackKeyGenerator generator = getKeyGenerator(stack.getItem()); - String key = generator.generateKey(stack); - model = keyModelCache.getIfPresent(key); - if (model == null) { - model = generateItemModel(stack); - if (DEBUG) { - FMLLog.info("Baking item model: " + key); - } - if (model != missingModel) { - keyModelCache.put(key, model); - } - } - return model; - - } - - public static IBakedModel generateItemModel(ItemStack stack) { - Item item = stack.getItem(); - if (item instanceof ItemBlock) { - Block block = Block.getBlockFromItem(item); - if (block instanceof IBakeryBlock) { - ICustomBlockBakery bakery = ((IBakeryBlock) block).getCustomBakery(); - List generalQuads = new LinkedList(); - Map> faceQuads = new HashMap>(); - generalQuads.addAll(bakery.bakeItemQuads(null, stack)); - - for (EnumFacing face : EnumFacing.VALUES) { - List quads = new LinkedList(); - - quads.addAll(PlanarFaceBakery.shadeQuadFaces(bakery.bakeItemQuads(face, stack))); - - faceQuads.put(face, quads); - } - - BakedModelProperties properties = new BakedModelProperties(true, true, null); - return new PerspectiveAwareBakedModel(faceQuads, generalQuads, TransformUtils.DEFAULT_BLOCK, properties); - - } else if (block instanceof IItemBlockTextureProvider) { - IItemBlockTextureProvider provider = ((IItemBlockTextureProvider) block); - Map> faceQuadMap = new HashMap>(); - for (EnumFacing face : EnumFacing.VALUES) { - List faceQuads = new LinkedList(); - - faceQuads.addAll(PlanarFaceBakery.shadeQuadFaces(PlanarFaceBakery.bakeFace(face, provider.getTexture(face, stack), DefaultVertexFormats.ITEM))); - - faceQuadMap.put(face, faceQuads); - } - BakedModelProperties properties = new BakedModelProperties(true, true, null); - return new PerspectiveAwareBakedModel(faceQuadMap, TransformUtils.DEFAULT_BLOCK, properties); - } - } else { - if (item instanceof IBakeryItem) { - IItemBakery bakery = ((IBakeryItem) item).getBakery(); - List generalQuads = new LinkedList(); - Map> faceQuads = new HashMap>(); - generalQuads.addAll(bakery.bakeItemQuads(null, stack)); - - for (EnumFacing face : EnumFacing.VALUES) { - List quads = new LinkedList(); - - quads.addAll(bakery.bakeItemQuads(face, stack)); - - faceQuads.put(face, quads); - } - - PerspectiveAwareModelProperties bakeryProperties = PerspectiveAwareModelProperties.DEFAULT_ITEM; - - try { - bakeryProperties = bakery.getModelProperties(stack); - } catch (Exception ignored) { - } - - BakedModelProperties properties = bakeryProperties.getProperties(); - return new PerspectiveAwareBakedModel(faceQuads, generalQuads, bakeryProperties.getModelState(), properties); - } - } - return missingModel; - } - - public static IBakedModel getCachedModel(IExtendedBlockState state) { - IBakedModel model; - IBlockStateKeyGenerator keyGenerator = getKeyGenerator(state.getBlock()); - String key = keyGenerator.generateKey(state); - model = keyModelCache.getIfPresent(key); - if (model == null) { - model = generateModel(state); - if (DEBUG) { - FMLLog.info("Baking block model: " + key); - } - if (model != missingModel) { - keyModelCache.put(key, model); - } - } - return model; - } - - public static IBakedModel generateModel(IExtendedBlockState state) { - if (state.getBlock() instanceof IBakeryBlock) { - ICustomBlockBakery bakery = ((IBakeryBlock) state.getBlock()).getCustomBakery(); - if (bakery instanceof ISimpleBlockBakery) { - ISimpleBlockBakery simpleBakery = ((ISimpleBlockBakery) bakery); - List generalQuads = new LinkedList(); - Map> faceQuads = new HashMap>(); - generalQuads.addAll(simpleBakery.bakeQuads(null, state)); - - for (EnumFacing face : EnumFacing.VALUES) { - List quads = new LinkedList(); - - quads.addAll(simpleBakery.bakeQuads(face, state)); - - faceQuads.put(face, quads); - } - BakedModelProperties properties = new BakedModelProperties(true, true, null); - return new PerspectiveAwareBakedModel(faceQuads, generalQuads, TransformUtils.DEFAULT_BLOCK, properties); - } - if (bakery instanceof ILayeredBlockBakery) { - ILayeredBlockBakery layeredBakery = ((ILayeredBlockBakery) bakery); - Map>> layerFaceQuadMap = new HashMap>>(); - Map> layerGeneralQuads = new HashMap>(); - for (BlockRenderLayer layer : BlockRenderLayer.values()) { - if (state.getBlock().canRenderInLayer(state, layer)) { - LinkedList quads = new LinkedList(); - quads.addAll(layeredBakery.bakeLayerFace(null, layer, state)); - layerGeneralQuads.put(layer, quads); - } - } - - for (BlockRenderLayer layer : BlockRenderLayer.values()) { - if (state.getBlock().canRenderInLayer(state, layer)) { - Map> faceQuadMap = new HashMap>(); - for (EnumFacing face : EnumFacing.VALUES) { - List quads = new LinkedList(); - quads.addAll(layeredBakery.bakeLayerFace(face, layer, state)); - faceQuadMap.put(face, quads); - } - layerFaceQuadMap.put(layer, faceQuadMap); - } - } - BakedModelProperties properties = new BakedModelProperties(true, true, null); - return new PerspectiveAwareLayeredModel(layerFaceQuadMap, layerGeneralQuads, TransformUtils.DEFAULT_BLOCK, properties); - } - } - if (state.getBlock() instanceof IWorldBlockTextureProvider) { - Map>> layerFaceQuadMap = generateLayerFaceQuadMap(state); - BakedModelProperties properties = new BakedModelProperties(true, true, null); - return new PerspectiveAwareLayeredModel(layerFaceQuadMap, TransformUtils.DEFAULT_BLOCK, properties); - } /*else if (state.getBlock() instanceof IBlockTextureProvider) { - IBlockTextureProvider provider = ((IBlockTextureProvider) state.getBlock()); - int meta = state.getBlock().getMetaFromState(state); - - Map> quadFaceMap = new HashMap>(); - for (EnumFacing face : EnumFacing.VALUES) { - LinkedList quads = new LinkedList(); - - quads.add(PlanarFaceBakery.bakeFace(face, provider.getTexture(face, meta))); - - quadFaceMap.put(face, quads); - } - BakedModelProperties properties = new BakedModelProperties(true, true, null); - return new PerspectiveAwareBakedModel(quadFaceMap, TransformUtils.DEFAULT_BLOCK, properties); - - }*/ - return missingModel; - } - - public static Map>> generateLayerFaceQuadMap(IExtendedBlockState state) { - Map> layerFaceSpriteMap = state.getValue(BlockBakeryProperties.LAYER_FACE_SPRITE_MAP); - Map>> layerFaceQuadMap = new HashMap>>(); - for (BlockRenderLayer layer : layerFaceSpriteMap.keySet()) { - Map faceSpriteMap = layerFaceSpriteMap.get(layer); - Map> faceQuadMap = new HashMap>(); - for (EnumFacing face : faceSpriteMap.keySet()) { - List quads = new LinkedList(); - quads.add(PlanarFaceBakery.bakeFace(face, faceSpriteMap.get(face))); - faceQuadMap.put(face, quads); - } - layerFaceQuadMap.put(layer, faceQuadMap); - } - return layerFaceQuadMap; - } - - @Override - public void onResourceManagerReload(IResourceManager resourceManager) { - nukeModelCache(); - } - - public static void nukeModelCache() { - keyModelCache.invalidateAll(); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakeryProperties.java b/dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakeryProperties.java deleted file mode 100644 index d8934a8e8e..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/BlockBakeryProperties.java +++ /dev/null @@ -1,38 +0,0 @@ -package codechicken.lib.model.blockbakery; - -import codechicken.lib.block.property.unlisted.UnlistedMapProperty; -import codechicken.lib.block.property.unlisted.UnlistedMapProperty.IMapStringGenerator; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; - -import java.util.Map; -import java.util.Map.Entry; - -/** - * Created by covers1624 on 26/12/2016. - * TODO, Maybe move away from this, Instead of storing the entire render context inside the state, store the important data, then compute if necessary, will require changes basically everywhere. - */ -public class BlockBakeryProperties { - - public static final UnlistedMapProperty LAYER_FACE_SPRITE_MAP; - - static { - LAYER_FACE_SPRITE_MAP = new UnlistedMapProperty("layer_face_sprite"); - - LAYER_FACE_SPRITE_MAP.setStringGenerator(new IMapStringGenerator() { - @SuppressWarnings ("unchecked") - @Override - public String makeString(Map map) { - StringBuilder builder = new StringBuilder(); - for (Entry> layerEntry : ((Map>) map).entrySet()) { - builder.append(layerEntry.getKey().toString()).append(","); - for (Entry faceSpriteEntry : layerEntry.getValue().entrySet()) { - builder.append(faceSpriteEntry.getKey()).append(",").append(faceSpriteEntry.getValue().getIconName()).append(","); - } - } - return builder.toString(); - } - }); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/CCBakeryModel.java b/dependencies/main/java/codechicken/lib/model/blockbakery/CCBakeryModel.java deleted file mode 100644 index 3ccb0ee243..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/CCBakeryModel.java +++ /dev/null @@ -1,71 +0,0 @@ -package codechicken.lib.model.blockbakery; - -import codechicken.lib.texture.TextureUtils; -import com.google.common.collect.ImmutableList; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.*; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; -import net.minecraftforge.common.property.IExtendedBlockState; - -import javax.annotation.Nullable; -import java.util.List; - -/** - * Created by covers1624 on 26/10/2016. - */ -public class CCBakeryModel implements IBakedModel { - - private final String particle; - - public CCBakeryModel(String particle) { - this.particle = particle; - } - - @Override - public List getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) { - return BlockBakery.getCachedModel((IExtendedBlockState) state).getQuads(state, side, rand); - } - - @Override - public boolean isAmbientOcclusion() { - return true; - } - - @Override - public boolean isGui3d() { - return false; - } - - @Override - public boolean isBuiltInRenderer() { - return false; - } - - @Override - public TextureAtlasSprite getParticleTexture() { - return TextureUtils.getTexture(particle); - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() { - return ItemCameraTransforms.DEFAULT; - } - - @Override - public ItemOverrideList getOverrides() { - return new ItemOverrideList(ImmutableList.of()) { - @Override - public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) { - IBakedModel model = BlockBakery.getCachedItemModel(stack); - if (model == null) { - return originalModel; - } - return model; - } - }; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryBlock.java b/dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryBlock.java deleted file mode 100644 index 800c67131a..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryBlock.java +++ /dev/null @@ -1,18 +0,0 @@ -package codechicken.lib.model.blockbakery; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** - * Created by covers1624 on 28/10/2016. - * TODO Document. - * TODO, Refactor, IBakeryBlock > IBakeryProvider - * TODO, Item and block implementation support. - */ -public interface IBakeryBlock { - - @SideOnly (Side.CLIENT) - //TODO ICustomBakery - ICustomBlockBakery getCustomBakery(); - -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryItem.java b/dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryItem.java deleted file mode 100644 index 4c872c5a9b..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/IBakeryItem.java +++ /dev/null @@ -1,18 +0,0 @@ -package codechicken.lib.model.blockbakery; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** - * Implement this on an item and register a model with an ItemOverrideList.handleItemState calling BlockBakery.getCachedItemModel to use this. - * Make sure you register an IItemStackKeyGenerator - * - * Created by covers1624 on 12/02/2017. - */ -@Deprecated//Still safe to use, 1.11 will have lots of changes to this entire pipeline. -public interface IBakeryItem { - - @SideOnly (Side.CLIENT) - IItemBakery getBakery(); - -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/IBlockStateKeyGenerator.java b/dependencies/main/java/codechicken/lib/model/blockbakery/IBlockStateKeyGenerator.java deleted file mode 100644 index cbd299a6e9..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/IBlockStateKeyGenerator.java +++ /dev/null @@ -1,13 +0,0 @@ -package codechicken.lib.model.blockbakery; - -import net.minecraftforge.common.property.IExtendedBlockState; - -/** - * Created by covers1624 on 26/11/2016. - * TODO Document. - */ -public interface IBlockStateKeyGenerator { - - String generateKey(IExtendedBlockState state); - -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/ICustomBlockBakery.java b/dependencies/main/java/codechicken/lib/model/blockbakery/ICustomBlockBakery.java deleted file mode 100644 index caa2d8f3d2..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/ICustomBlockBakery.java +++ /dev/null @@ -1,27 +0,0 @@ -package codechicken.lib.model.blockbakery; - -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.util.List; - -/** - * Created by covers1624 on 28/10/2016. - * TODO Document. - * TODO ICustomBlockBakery > IItemBakery - * TODO new Base class ICustomBakery - */ -public interface ICustomBlockBakery { - - //TODO Move to IBlockBakery. - @SideOnly (Side.CLIENT) - IExtendedBlockState handleState(IExtendedBlockState state, TileEntity tileEntity); - - @SideOnly (Side.CLIENT) - List bakeItemQuads(EnumFacing face, ItemStack stack); -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/IItemBakery.java b/dependencies/main/java/codechicken/lib/model/blockbakery/IItemBakery.java deleted file mode 100644 index a3f4fa20d2..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/IItemBakery.java +++ /dev/null @@ -1,29 +0,0 @@ -package codechicken.lib.model.blockbakery; - -import codechicken.lib.model.PerspectiveAwareModelProperties; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.util.List; - -/** - * Created by covers1624 on 12/02/2017. - */ -public interface IItemBakery { - - @SideOnly (Side.CLIENT) - List bakeItemQuads(EnumFacing face, ItemStack stack); - - /** - * Allows ItemModels to define a custom properties. Suitable for thinks like fake blocks. - * As this method has been added after release, we could potentially break binary compatibility. - * Suitable checks have been added where this method is called to preserve such compatibility. - * - * @return The transforms to use for the model. - */ - @SideOnly (Side.CLIENT) - PerspectiveAwareModelProperties getModelProperties(ItemStack stack); -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/IItemStackKeyGenerator.java b/dependencies/main/java/codechicken/lib/model/blockbakery/IItemStackKeyGenerator.java deleted file mode 100644 index 6f76a3d17a..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/IItemStackKeyGenerator.java +++ /dev/null @@ -1,13 +0,0 @@ -package codechicken.lib.model.blockbakery; - -import net.minecraft.item.ItemStack; - -/** - * Created by covers1624 on 2/11/2016. - * TODO Document. - */ -public interface IItemStackKeyGenerator { - - String generateKey(ItemStack stack); - -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/ILayeredBlockBakery.java b/dependencies/main/java/codechicken/lib/model/blockbakery/ILayeredBlockBakery.java deleted file mode 100644 index b2a74cf450..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/ILayeredBlockBakery.java +++ /dev/null @@ -1,21 +0,0 @@ -package codechicken.lib.model.blockbakery; - -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.util.List; - -/** - * Created by covers1624 on 28/10/2016. - * TODO Document. - */ -public interface ILayeredBlockBakery extends ICustomBlockBakery { - - @SideOnly (Side.CLIENT) - List bakeLayerFace(EnumFacing face, BlockRenderLayer layer, IExtendedBlockState state); - -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/ISimpleBlockBakery.java b/dependencies/main/java/codechicken/lib/model/blockbakery/ISimpleBlockBakery.java deleted file mode 100644 index 056e344a06..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/ISimpleBlockBakery.java +++ /dev/null @@ -1,19 +0,0 @@ -package codechicken.lib.model.blockbakery; - -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.util.List; - -/** - * Created by covers1624 on 28/10/2016. - * TODO Document. - */ -public interface ISimpleBlockBakery extends ICustomBlockBakery { - - @SideOnly (Side.CLIENT) - List bakeQuads(EnumFacing face, IExtendedBlockState state); -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/SimpleBlockRenderer.java b/dependencies/main/java/codechicken/lib/model/blockbakery/SimpleBlockRenderer.java deleted file mode 100644 index 80ca2ecc5e..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/SimpleBlockRenderer.java +++ /dev/null @@ -1,90 +0,0 @@ -package codechicken.lib.model.blockbakery; - -import codechicken.lib.render.CCModel; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.buffer.BakingVertexBuffer; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.util.TripleABC; -import codechicken.lib.util.VertexDataUtils; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Rotation; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.uv.UVTransformation; -import com.google.common.collect.ImmutableList; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.common.property.IExtendedBlockState; - -import java.util.List; - -/** - * Created by covers1624 on 26/12/2016. - * TODO Document. - */ -public abstract class SimpleBlockRenderer implements ISimpleBlockBakery, IIconRegister { - - //TODO Face based models. - private static final CCModel[][] models = new CCModel[6][4]; - - static { - CCModel model = CCModel.quadModel(24).generateBlock(0, Cuboid6.full); - for (int s = 0; s < 6; s++) { - for (int r = 0; r < 4; r++) { - CCModel m = model.copy().apply(Rotation.sideOrientation(s, r).at(Vector3.center)); - m.computeNormals(); - models[s][r] = m; - } - } - } - - public abstract TripleABC getWorldTransforms(IExtendedBlockState state); - - public abstract TripleABC getItemTransforms(ItemStack stack); - - public abstract boolean shouldCull(); - - @Override - public IExtendedBlockState handleState(IExtendedBlockState state, TileEntity tileEntity) { - return state; - } - - @Override - public List bakeQuads(EnumFacing face, IExtendedBlockState state) { - BakingVertexBuffer buffer = BakingVertexBuffer.create(); - TripleABC worldData = getWorldTransforms(state); - CCRenderState ccrs = CCRenderState.instance(); - ccrs.reset(); - ccrs.startDrawing(0x7, DefaultVertexFormats.ITEM, buffer); - models[worldData.getA()][worldData.getB()].render(ccrs, worldData.getC()); - buffer.finishDrawing(); - List quads = buffer.bake(); - if (face == null && !shouldCull()) { - return quads; - } else if (face != null) { - return VertexDataUtils.sortFaceData(quads).get(face); - } - return ImmutableList.of(); - } - - @Override - public List bakeItemQuads(EnumFacing face, ItemStack stack) { - BakingVertexBuffer buffer = BakingVertexBuffer.create(); - TripleABC worldData = getItemTransforms(stack); - CCRenderState ccrs = CCRenderState.instance(); - ccrs.reset(); - ccrs.startDrawing(0x7, DefaultVertexFormats.ITEM, buffer); - models[worldData.getA()][worldData.getB()].render(ccrs, worldData.getC()); - buffer.finishDrawing(); - List quads = buffer.bake(); - - if (face == null && !shouldCull()) { - return quads; - } else if (face != null) { - return VertexDataUtils.sortFaceData(quads).get(face); - } - return ImmutableList.of(); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/loader/BakeryModel.java b/dependencies/main/java/codechicken/lib/model/blockbakery/loader/BakeryModel.java deleted file mode 100644 index fbad1bd4c5..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/loader/BakeryModel.java +++ /dev/null @@ -1,44 +0,0 @@ -package codechicken.lib.model.blockbakery.loader; - -import codechicken.lib.model.blockbakery.CCBakeryModel; -import com.google.common.base.Function; -import com.google.common.collect.ImmutableList; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.IModel; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; - -import java.util.Collection; - -/** - * Basically a wrapper to allow the use of the BlockBakery from a json file. - * Created by covers1624 on 13/02/2017. - */ -public class BakeryModel implements IModel { - - public static final BakeryModel INSTANCE = new BakeryModel(); - - @Override - public Collection getDependencies() { - return ImmutableList.of(); - } - - @Override - public Collection getTextures() { - return ImmutableList.of(); - } - - @Override - public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { - return new CCBakeryModel(""); - } - - @Override - public IModelState getDefaultState() { - //This doesn't matter as we are a wrapper. - return TRSRTransformation.identity(); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/loader/CCBakeryModelLoader.java b/dependencies/main/java/codechicken/lib/model/blockbakery/loader/CCBakeryModelLoader.java deleted file mode 100644 index 5f051ff131..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/loader/CCBakeryModelLoader.java +++ /dev/null @@ -1,30 +0,0 @@ -package codechicken.lib.model.blockbakery.loader; - -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.ICustomModelLoader; -import net.minecraftforge.client.model.IModel; - -/** - * Basically a wrapper to allow the use of the BlockBakery from a json file. - * Created by covers1624 on 13/02/2017. - */ -public class CCBakeryModelLoader implements ICustomModelLoader { - - public static final CCBakeryModelLoader INSTANCE = new CCBakeryModelLoader(); - - @Override - public void onResourceManagerReload(IResourceManager resourceManager) { - } - - @Override - public boolean accepts(ResourceLocation modelLocation) { - String path = modelLocation.getResourcePath(); - return modelLocation.getResourceDomain().equals("ccl") && (path.equals("bakery") || path.equals("models/block/bakery") || path.equals("models/item/bakery")); - } - - @Override - public IModel loadModel(ResourceLocation modelLocation) throws Exception { - return BakeryModel.INSTANCE; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockBakery.java b/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockBakery.java deleted file mode 100644 index b074d3051c..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockBakery.java +++ /dev/null @@ -1,121 +0,0 @@ -package codechicken.lib.model.blockbakery.sub; - -import codechicken.lib.model.blockbakery.*; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import com.google.common.collect.ImmutableList; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by covers1624 on 26/12/2016. - * TODO Document. - */ -public class SubBlockBakery implements ILayeredBlockBakery, IIconRegister { - - private final Map subBakeries = new HashMap(); - private final SubBlockStateKeyGenerator blockKeyGenerator = new SubBlockStateKeyGenerator(); - private final SubItemStackKeyGenerator itemKeyGenerator = new SubItemStackKeyGenerator(); - - public void registerSubBakery(int meta, ICustomBlockBakery bakery) { - subBakeries.put(meta, bakery); - } - - public void registerSubBakery(int meta, ICustomBlockBakery bakery, IBlockStateKeyGenerator blockKeyGen) { - registerSubBakery(meta, bakery, blockKeyGen, null); - } - - public void registerSubBakery(int meta, ICustomBlockBakery bakery, IItemStackKeyGenerator itemKeyGen) { - registerSubBakery(meta, bakery, null, itemKeyGen); - } - - public void registerSubBakery(int meta, ICustomBlockBakery bakery, IBlockStateKeyGenerator blockKeyGen, IItemStackKeyGenerator itemKeyGen) { - subBakeries.put(meta, bakery); - if (blockKeyGen != null) { - blockKeyGenerator.register(meta, blockKeyGen); - } - if (itemKeyGen != null) { - itemKeyGenerator.register(meta, itemKeyGen); - } - } - - public SubBlockBakery registerKeyGens(Block block) { - registerBlockKeyGen(block); - registerItemKeyGen(Item.getItemFromBlock(block)); - return this; - } - - public SubBlockBakery registerBlockKeyGen(Block block) { - BlockBakery.registerBlockKeyGenerator(block, blockKeyGenerator); - return this; - } - - public SubBlockBakery registerItemKeyGen(Item block) { - BlockBakery.registerItemKeyGenerator(block, itemKeyGenerator); - return this; - } - - public SubBlockStateKeyGenerator getBlockKeyGen() { - return blockKeyGenerator; - } - - public SubItemStackKeyGenerator getItemKeyGen() { - return itemKeyGenerator; - } - - @Override - @SideOnly (Side.CLIENT) - public List bakeLayerFace(EnumFacing face, BlockRenderLayer layer, IExtendedBlockState state) { - ICustomBlockBakery bakery = subBakeries.get(state.getBlock().getMetaFromState(state)); - if (bakery instanceof ISimpleBlockBakery) { - if (state.getBlock().canRenderInLayer(state, layer)) { - return ((ISimpleBlockBakery) bakery).bakeQuads(face, state); - } - } else if (bakery instanceof ILayeredBlockBakery) { - return ((ILayeredBlockBakery) bakery).bakeLayerFace(face, layer, state); - } - return ImmutableList.of(); - } - - @Override - @SideOnly (Side.CLIENT) - public IExtendedBlockState handleState(IExtendedBlockState state, TileEntity tileEntity) { - ICustomBlockBakery bakery = subBakeries.get(state.getBlock().getMetaFromState(state)); - if (bakery == null) { - return state; - } - return bakery.handleState(state, tileEntity); - } - - @Override - @SideOnly (Side.CLIENT) - public List bakeItemQuads(EnumFacing face, ItemStack stack) { - ICustomBlockBakery bakery = subBakeries.get(stack.getMetadata()); - if (bakery == null) { - return ImmutableList.of(); - } - return bakery.bakeItemQuads(face, stack); - } - - @Override - @SideOnly (Side.CLIENT) - public void registerIcons(TextureMap textureMap) { - for (ICustomBlockBakery bakery : subBakeries.values()) { - if (bakery instanceof IIconRegister) { - ((IIconRegister) bakery).registerIcons(textureMap); - } - } - } -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockStateKeyGenerator.java b/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockStateKeyGenerator.java deleted file mode 100644 index a3d347bd1b..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubBlockStateKeyGenerator.java +++ /dev/null @@ -1,31 +0,0 @@ -package codechicken.lib.model.blockbakery.sub; - -import codechicken.lib.model.blockbakery.BlockBakery; -import codechicken.lib.model.blockbakery.IBlockStateKeyGenerator; -import net.minecraftforge.common.property.IExtendedBlockState; - -import java.util.HashMap; -import java.util.Map; - -/** - * Created by covers1624 on 27/12/2016. - * TODO Document. - */ -public class SubBlockStateKeyGenerator implements IBlockStateKeyGenerator { - - private final Map subKeyGenMap = new HashMap(); - - public void register(int meta, IBlockStateKeyGenerator subGenerator) { - subKeyGenMap.put(meta, subGenerator); - } - - @Override - public String generateKey(IExtendedBlockState state) { - int meta = state.getBlock().getMetaFromState(state); - if (subKeyGenMap.containsKey(meta)) { - IBlockStateKeyGenerator keyGenerator = subKeyGenMap.get(meta); - return keyGenerator.generateKey(state); - } - return BlockBakery.defaultBlockKeyGenerator.generateKey(state); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubItemStackKeyGenerator.java b/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubItemStackKeyGenerator.java deleted file mode 100644 index c7b4845401..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockbakery/sub/SubItemStackKeyGenerator.java +++ /dev/null @@ -1,31 +0,0 @@ -package codechicken.lib.model.blockbakery.sub; - -import codechicken.lib.model.blockbakery.BlockBakery; -import codechicken.lib.model.blockbakery.IItemStackKeyGenerator; -import net.minecraft.item.ItemStack; - -import java.util.HashMap; -import java.util.Map; - -/** - * Created by covers1624 on 30/12/2016. - * TODO Document. - */ -public class SubItemStackKeyGenerator implements IItemStackKeyGenerator { - - private final Map subKeyGenMap = new HashMap(); - - public void register(int meta, IItemStackKeyGenerator subGenerator) { - subKeyGenMap.put(meta, subGenerator); - } - - @Override - public String generateKey(ItemStack stack) { - int meta = stack.getMetadata(); - if (subKeyGenMap.containsKey(meta)) { - IItemStackKeyGenerator generator = subKeyGenMap.get(meta); - return generator.generateKey(stack); - } - return BlockBakery.defaultItemKeyGenerator.generateKey(stack); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/blockstate/CCBlockStateLoader.java b/dependencies/main/java/codechicken/lib/model/blockstate/CCBlockStateLoader.java deleted file mode 100644 index 6bcbb35e07..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockstate/CCBlockStateLoader.java +++ /dev/null @@ -1,279 +0,0 @@ -package codechicken.lib.model.blockstate; - -import codechicken.lib.util.ArrayUtils; -import com.google.common.base.Throwables; -import com.google.common.collect.Lists; -import com.google.gson.*; -import com.google.gson.stream.JsonReader; -import net.minecraft.client.renderer.block.model.ModelBlockDefinition; -import net.minecraft.client.renderer.block.model.ModelRotation; -import net.minecraft.client.renderer.block.model.Variant; -import net.minecraft.client.renderer.block.model.VariantList; -import net.minecraft.util.JsonUtils; -import net.minecraftforge.client.model.BlockStateLoader; -import net.minecraftforge.common.model.TRSRTransformation; -import org.apache.commons.io.IOUtils; - -import java.io.Reader; -import java.io.StringReader; -import java.util.*; -import java.util.Map.Entry; - -/** - * Created by covers1624 on 17/11/2016. - * TODO, ASM copy instructions from ModelBlockDefinition to bouncer method here, in case someone is doing the same thing as me. - * TODO, Vanilla Predicate support inside json. Maybe allow variants inside predicates?? - * TODO, Allow all unhandled BlockState Json data to be passed to custom IModels. - * TODO, Allow automatic assigning of IItemRenderer callbacks from json. - * TODO, Allow the BlockBakery to assign blocks models from json. - * TODO, Custom Sided particle system from json maybe / support for sided particles loaded from this loader. - */ -public class CCBlockStateLoader { - - public static final Gson GSON = new GsonBuilder().registerTypeAdapter(CCVariant.class, new CCVariant.Deserializer()).create(); - - public static ModelBlockDefinition handleLoad(Reader reader, Gson vanillaGSON) { - try { - String json = IOUtils.toString(reader); - ModelBlockDefinition cclDef = load(json); - if (cclDef != null) { - return cclDef; - } - return BlockStateLoader.load(new StringReader(json), vanillaGSON); - } catch (Exception e) { - Throwables.propagate(e); - } - return null; - } - - public static ModelBlockDefinition load(String json) { - try { - JsonParser parser = new JsonParser(); - JsonReader reader = new JsonReader(new StringReader(json)); - reader.setLenient(true); - JsonObject object = parser.parse(reader).getAsJsonObject(); - if (JsonUtils.hasField(object, "ccl_marker")) { - - String marker = JsonUtils.getString(object, "ccl_marker"); - List variantSets = new ArrayList(); - for (JsonElement element : object.getAsJsonArray("variant_sets")) { - variantSets.add(element.getAsString()); - } - - String textureDomain = ""; - if (object.has("texture_domain")) { - textureDomain = object.get("texture_domain").getAsString(); - } - - CCVariant defaultVariant = null; - if (object.has("defaults")) { - defaultVariant = GSON.fromJson(object.get("defaults"), CCVariant.class); - } - Map> variants = parseVariants(object.getAsJsonObject("variants")); - - Map>> subModels = parseSubModels(object.getAsJsonObject("sub_model")); - - Map compiledVariants = new LinkedHashMap(); - Map> compiledSubModelVariants = new LinkedHashMap>(); - - List possibleCombos = new ArrayList(); - - for (String variantSet : variantSets) { - Map> variantValueMap = generateVariantValueMap(Arrays.asList(variantSet.split(",")), variants, subModels); - possibleCombos.addAll(generatePossibleCombos(variantValueMap)); - } - - for (String var : possibleCombos) { - Map kvArray = ArrayUtils.convertKeyValueArrayToMap(var.split(",")); - CCVariant finalVariant = new CCVariant(); - if (defaultVariant != null) { - finalVariant = defaultVariant.copy(); - } - compiledVariants.put(var, compileVariant(finalVariant.copy(), kvArray, variants)); - - } - for (Entry>> subModelVariantEntry : subModels.entrySet()) { - Map compiledVariants2 = new LinkedHashMap(); - for (String var : possibleCombos) { - Map kvArray = ArrayUtils.convertKeyValueArrayToMap(var.split(",")); - CCVariant finalVariant = new CCVariant(); - if (defaultVariant != null) { - finalVariant = defaultVariant.copy(); - } - compiledVariants2.put(var, compileVariant(finalVariant.copy(), kvArray, subModelVariantEntry.getValue())); - } - compiledSubModelVariants.put(subModelVariantEntry.getKey(), compiledVariants2); - } - - Map variantList = new HashMap(); - for (Entry entry : compiledVariants.entrySet()) { - Map subModelVariants = getSubModelsForKey(entry.getKey(), compiledSubModelVariants); - List vars = new ArrayList(); - CCVariant variant = entry.getValue(); - - boolean uvLock = variant.uvLock.or(false); - boolean smooth = variant.smooth.or(true); - boolean gui3d = variant.gui3d.or(true); - int weight = variant.weight.or(1); - - if (variant.model != null && subModelVariants.size() == 0 && variant.textures.size() == 0 && variant.customData.size() == 0 && variant.state.orNull() instanceof ModelRotation) { - vars.add(new Variant(variant.model, ((ModelRotation) variant.state.get()), uvLock, weight)); - } else if (subModelVariants.size() == 0) { - vars.add(new CCFinalVariant(variant.model, variant.state.or(TRSRTransformation.identity()), uvLock, smooth, gui3d, weight, variant.textures, textureDomain, variant.customData)); - } else { - vars.add(new CCFinalMultiVariant(variant, textureDomain, subModelVariants)); - } - variantList.put(entry.getKey(), new VariantList(vars)); - } - return new ModelBlockDefinition(variantList, null); - - } - } catch (Exception e) { - e.printStackTrace(); - Throwables.propagate(e); - } - return null; - } - - public static Map> parseVariants(JsonObject variantElement) { - Map> variants = new LinkedHashMap>(); - for (Entry variantsEntry : variantElement.entrySet()) { - String variantName = variantsEntry.getKey(); - Map variantValues = variants.get(variantName); - if (variantValues == null) { - variantValues = new LinkedHashMap(); - variants.put(variantName, variantValues); - } - for (Entry variantEntry : variantsEntry.getValue().getAsJsonObject().entrySet()) { - String variantValue = variantEntry.getKey(); - CCVariant variant = GSON.fromJson(variantEntry.getValue(), CCVariant.class); - variantValues.put(variantValue, variant); - } - } - return variants; - } - - public static Map>> parseSubModels(JsonObject object) { - Map>> subModels = new LinkedHashMap>>(); - - if (object != null) { - for (Entry subModelEntry : object.entrySet()) { - subModels.put(subModelEntry.getKey(), parseVariants(subModelEntry.getValue().getAsJsonObject().getAsJsonObject("variants"))); - } - } - - return subModels; - } - - public static CCVariant compileVariant(CCVariant finalVariant, Map kvArray, Map> variants) { - for (Entry entry : kvArray.entrySet()) { - for (Entry> variantsEntry : variants.entrySet()) { - if (entry.getKey().equals(variantsEntry.getKey())) { - Map variantMap = variantsEntry.getValue(); - if (variantMap.containsKey(entry.getValue())) { - finalVariant = finalVariant.with(variantMap.get(entry.getValue())); - } - } - } - } - for (Entry entry : kvArray.entrySet()) { - for (Entry> variantsEntry : variants.entrySet()) { - if (entry.getKey().equals(variantsEntry.getKey())) { - Map variantMap = variantsEntry.getValue(); - if (variantMap.containsKey(entry.getValue())) { - finalVariant = variantMap.get(entry.getValue()).applySubOverrides(finalVariant, kvArray); - } - } - } - } - return finalVariant; - } - - public static Map getSubModelsForKey(String key, Map> subModels) { - Map subModelVariants = new LinkedHashMap(); - for (Entry> subModelEntry : subModels.entrySet()) { - for (Entry variantEntry : subModelEntry.getValue().entrySet()) { - if (variantEntry.getKey().equals(key)) { - subModelVariants.put(subModelEntry.getKey(), variantEntry.getValue()); - } - } - } - return subModelVariants; - } - - /** - * Generates a list of strings for all possible combos of Key=Value. - * Per key value list can have more than 1 valid value. - *

- * Credits to brandon3055 who wrote this for me! - * - * @param variantValueMap A map of all possible Keys to all possible values per key. - * @return A compiled list of all possible combos. - */ - public static List generatePossibleCombos(Map> variantValueMap) { - List possibleCombos = new ArrayList(); - - List keys = Lists.newArrayList(variantValueMap.keySet()); - - int comboCount = 1; - for (String key : variantValueMap.keySet()) { - comboCount *= variantValueMap.get(key).size(); - } - - int[] indexes = new int[variantValueMap.size()]; - for (int l = 0; l < comboCount; l++) { - for (int in = 0; in < indexes.length; in++) { - indexes[in]++; - if (indexes[in] >= variantValueMap.get(keys.get(in)).size()) { - indexes[in] = 0; - } else { - break; - } - } - - String combo = ""; - for (int i = 0; i < indexes.length; i++) { - combo += keys.get(i) + "=" + variantValueMap.get(keys.get(i)).get(indexes[i]) + ","; - } - possibleCombos.add(combo.substring(0, combo.length() - 1)); - } - return possibleCombos; - } - - /** - * Generates a map of Key -> List(Value) from the provided CCVariants. - * - * @param keys The keys to get all values for. - * @param variants The CCVariants parsed from json. - * @return Map of Key to value lists. - */ - public static Map> generateVariantValueMap(List keys, Map> variants, Map>> subModels) { - Map> variantValueMap = new LinkedHashMap>(); - for (String variant : keys) { - List variantValues = new ArrayList(); - for (String variantName : variants.keySet()) { - if (variantName.equals(variant) && variants.containsKey(variant)) { - variantValues.addAll(variants.get(variant).keySet()); - } - - for (CCVariant subVariant : variants.get(variantName).values()) { - variantValues.addAll(subVariant.getPossibleVariantValues(variant)); - } - } - for (Map> subModelVariants : subModels.values()) { - for (String variantName : subModelVariants.keySet()) { - if (variantName.equals(variant) && subModelVariants.containsKey(variant)) { - variantValues.addAll(subModelVariants.get(variant).keySet()); - } - - for (CCVariant subVariant : subModelVariants.get(variantName).values()) { - variantValues.addAll(subVariant.getPossibleVariantValues(variant)); - } - } - } - variantValueMap.put(variant, variantValues); - } - return variantValueMap; - } - -} diff --git a/dependencies/main/java/codechicken/lib/model/blockstate/CCFinalMultiVariant.java b/dependencies/main/java/codechicken/lib/model/blockstate/CCFinalMultiVariant.java deleted file mode 100644 index 096092a693..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockstate/CCFinalMultiVariant.java +++ /dev/null @@ -1,72 +0,0 @@ -package codechicken.lib.model.blockstate; - -import codechicken.lib.model.BakedModelProperties; -import codechicken.lib.model.CCMultiModel; -import codechicken.lib.model.StateOverrideIModel; -import net.minecraft.client.renderer.block.model.ModelRotation; -import net.minecraft.client.renderer.block.model.Variant; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.IModel; -import net.minecraftforge.client.model.ModelLoaderRegistry; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -/** - * Created by covers1624 on 16/12/2016. - */ -public class CCFinalMultiVariant extends Variant { - - private Variant baseVariant; - private BakedModelProperties baseProperties; - private List finalVariants = new LinkedList(); - private IModelState state; - - public CCFinalMultiVariant(CCVariant baseVariant, String textureDomain, Map subModels) { - super(baseVariant.model == null ? new ResourceLocation("builtin/missing") : baseVariant.model, baseVariant.state.get() instanceof ModelRotation ? ((ModelRotation) baseVariant.state.get()) : ModelRotation.X0_Y0, baseVariant.uvLock.or(false), baseVariant.weight.or(1)); - state = baseVariant.state.get(); - this.baseVariant = makeFinalVariant(baseVariant, textureDomain); - this.baseProperties = new BakedModelProperties(baseVariant.smooth.or(true), baseVariant.gui3d.or(true)); - for (CCVariant subModel : subModels.values()) { - finalVariants.add(makeFinalVariant(baseVariant.copy().with(subModel), textureDomain)); - } - } - - @Override - public IModel process(IModel base) { - boolean hasBase = base != ModelLoaderRegistry.getMissingModel(); - if (hasBase) { - base = baseVariant.process(base); - } - - List subModels = new LinkedList(); - for (Variant variant : finalVariants) { - if (!variant.getModelLocation().equals(new ResourceLocation("builtin/missing"))) { - IModel subModel = ModelLoaderRegistry.getModelOrLogError(variant.getModelLocation(), "Unable to load subModel's Model: " + variant.getModelLocation()); - subModels.add(variant.process(new StateOverrideIModel(subModel, variant.getState()))); - } - } - - return new CCMultiModel(hasBase ? base : null, baseProperties, subModels); - } - - @Override - public IModelState getState() { - return state; - } - - private static Variant makeFinalVariant(CCVariant variant, String textureDomain) { - boolean uvLock = variant.uvLock.or(false); - boolean smooth = variant.smooth.or(true); - boolean gui3d = variant.gui3d.or(true); - int weight = variant.weight.or(1); - if (variant.model != null && variant.textures.size() == 0 && variant.customData.size() == 0 && variant.state.orNull() instanceof ModelRotation) { - return new Variant(variant.model, ((ModelRotation) variant.state.get()), uvLock, weight); - } else { - return new CCFinalVariant(variant.model, variant.state.or(TRSRTransformation.identity()), uvLock, smooth, gui3d, weight, variant.textures, textureDomain, variant.customData); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/model/blockstate/CCFinalVariant.java b/dependencies/main/java/codechicken/lib/model/blockstate/CCFinalVariant.java deleted file mode 100644 index d97de65685..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockstate/CCFinalVariant.java +++ /dev/null @@ -1,72 +0,0 @@ -package codechicken.lib.model.blockstate; - -import com.google.common.collect.ImmutableMap; -import net.minecraft.client.renderer.block.model.ModelRotation; -import net.minecraft.client.renderer.block.model.Variant; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.IModel; -import net.minecraftforge.client.model.ModelLoaderRegistry; -import net.minecraftforge.client.model.ModelProcessingHelper; -import net.minecraftforge.common.model.IModelState; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -/** - * Created by covers1624 on 19/11/2016. - * Here because ForgeVariant is yet again private.. - * Credits to fry. - */ -public class CCFinalVariant extends Variant { - - private final IModelState state; - private final boolean smooth; - private final boolean gui3d; - private final ImmutableMap customData; - private final ImmutableMap textures; - - public CCFinalVariant(ResourceLocation model, IModelState state, boolean uvLock, boolean smooth, boolean gui3d, int weight, Map textures, String textureDomain, Map customData) { - super(model == null ? new ResourceLocation("builtin/missing") : model, state instanceof ModelRotation ? ((ModelRotation) state) : ModelRotation.X0_Y0, uvLock, weight); - this.state = state; - this.smooth = smooth; - this.gui3d = gui3d; - - Map newTextures = new HashMap(); - for (Entry entry : textures.entrySet()) { - String prefixedTexture = entry.getValue(); - if (!entry.getValue().contains(":")) { - prefixedTexture = textureDomain + ":" + prefixedTexture; - } - newTextures.put(entry.getKey(), prefixedTexture); - } - this.textures = ImmutableMap.copyOf(newTextures); - this.customData = ImmutableMap.copyOf(customData); - } - - public static IModel runModelHooks(IModel base, boolean smooth, boolean gui3d, boolean uvlock, ImmutableMap textureMap, ImmutableMap customData) { - base = ModelProcessingHelper.customData(base, customData); - base = ModelProcessingHelper.retexture(base, textureMap); - base = ModelProcessingHelper.smoothLighting(base, smooth); - base = ModelProcessingHelper.gui3d(base, gui3d); - base = ModelProcessingHelper.uvlock(base, uvlock); - return base; - } - - @Override - public IModel process(IModel base) { - - boolean hasBase = base != ModelLoaderRegistry.getMissingModel(); - - if (hasBase) { - base = runModelHooks(base, smooth, gui3d, isUvLock(), textures, customData); - } - - return base; - } - - @Override - public IModelState getState() { - return state; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/blockstate/CCVariant.java b/dependencies/main/java/codechicken/lib/model/blockstate/CCVariant.java deleted file mode 100644 index 205416a2f3..0000000000 --- a/dependencies/main/java/codechicken/lib/model/blockstate/CCVariant.java +++ /dev/null @@ -1,210 +0,0 @@ -package codechicken.lib.model.blockstate; - -import codechicken.lib.util.Copyable; -import codechicken.lib.util.TransformUtils; -import com.google.common.base.Objects; -import com.google.common.base.Objects.ToStringHelper; -import com.google.common.base.Optional; -import com.google.gson.*; -import net.minecraft.util.JsonUtils; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.common.model.IModelState; - -import java.lang.reflect.Type; -import java.util.*; -import java.util.Map.Entry; - -/** - * Created by covers1624 on 18/11/2016. - */ -public class CCVariant implements Copyable { - - protected ResourceLocation model; - protected Optional state = Optional.absent(); - protected Optional uvLock = Optional.absent(); - protected Optional smooth = Optional.absent(); - protected Optional gui3d = Optional.absent(); - protected Optional weight = Optional.absent(); - protected Map textures = new HashMap(); - protected Map customData = new HashMap(); - protected Map> subVariants = new LinkedHashMap>(); - - public CCVariant() { - } - - public CCVariant(CCVariant variant) { - this.model = variant.model; - this.state = variant.state; - this.uvLock = variant.uvLock; - this.smooth = variant.smooth; - this.gui3d = variant.gui3d; - this.weight = variant.weight; - this.textures = new HashMap(variant.textures); - this.customData = new HashMap(customData); - this.subVariants = new LinkedHashMap>(variant.subVariants); - } - - public CCVariant with(CCVariant other) { - if (this.model == null || other.model != null) { - this.model = other.model; - } - - if (other.state.isPresent()) { - this.state = other.state; - } - if (other.uvLock.isPresent()) { - this.uvLock = other.uvLock; - } - if (other.smooth.isPresent()) { - this.smooth = other.smooth; - } - if (other.gui3d.isPresent()) { - this.gui3d = other.gui3d; - } - if (other.weight.isPresent()) { - this.weight = other.weight; - } - HashMap newTextures = new HashMap(); - newTextures.putAll(textures); - newTextures.putAll(other.textures); - this.textures = new LinkedHashMap(newTextures); - HashMap newCustomData = new HashMap(); - newCustomData.putAll(customData); - newCustomData.putAll(other.customData); - this.customData = new LinkedHashMap(newCustomData); - return this; - } - - public List getPossibleVariantNames() { - List variantNames = new ArrayList(); - for (String variantName : subVariants.keySet()) { - variantNames.add(variantName); - for (CCVariant subVariant : subVariants.get(variantName).values()) { - variantNames.addAll(subVariant.getPossibleVariantNames()); - } - } - return variantNames; - } - - public List getPossibleVariantValues(String variant) { - List variantValues = new ArrayList(); - for (String variantName : subVariants.keySet()) { - if (variantName.equals(variant) && subVariants.containsKey(variant)) { - variantValues.addAll(subVariants.get(variant).keySet()); - } - - for (CCVariant subVariant : subVariants.get(variantName).values()) { - variantValues.addAll(subVariant.getPossibleVariantValues(variant)); - } - } - return variantValues; - } - - public CCVariant applySubOverrides(CCVariant parent, Map kvArray) { - CCVariant finalVariant = parent; - for (Entry entry : kvArray.entrySet()) { - for (Entry> variantsEntry : subVariants.entrySet()) { - if (entry.getKey().equals(variantsEntry.getKey())) { - Map variantMap = variantsEntry.getValue(); - if (variantMap.containsKey(entry.getValue())) { - finalVariant = finalVariant.with(variantMap.get(entry.getValue())); - } - } - } - } - - for (Entry entry : kvArray.entrySet()) { - for (Entry> variantsEntry : subVariants.entrySet()) { - if (entry.getKey().equals(variantsEntry.getKey())) { - Map variantMap = variantsEntry.getValue(); - if (variantMap.containsKey(entry.getValue())) { - finalVariant = variantMap.get(entry.getValue()).applySubOverrides(finalVariant, kvArray); - } - } - } - } - return finalVariant; - } - - @Override - public CCVariant copy() { - return new CCVariant(this); - } - - public static class Deserializer implements JsonDeserializer { - - public static ResourceLocation getBlockLocation(String location) { - ResourceLocation tmp = new ResourceLocation(location); - return new ResourceLocation(tmp.getResourceDomain(), "block/" + tmp.getResourcePath()); - } - - @Override - public CCVariant deserialize(JsonElement element, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { - CCVariant variant = new CCVariant(); - JsonObject json = element.getAsJsonObject(); - - if (json.has("model")) { - JsonElement modelElement = json.get("model"); - if (modelElement.isJsonNull()) { - variant.model = null; - } else { - variant.model = getBlockLocation(modelElement.getAsString()); - } - } - - if (json.has("textures")) { - for (Entry entry : json.get("textures").getAsJsonObject().entrySet()) { - if (entry.getValue().isJsonNull()) { - variant.textures.put(entry.getKey(), ""); - } else { - variant.textures.put(entry.getKey(), entry.getValue().getAsString()); - } - } - } - - variant.state = TransformUtils.parseFromJson(json); - - if (json.has("uvlock")) { - variant.uvLock = Optional.of(JsonUtils.getBoolean(json, "uvlock")); - } - - if (json.has("smooth_lighting")) { - variant.smooth = Optional.of(JsonUtils.getBoolean(json, "smooth_lighting")); - } - - if (json.has("gui3d")) { - variant.gui3d = Optional.of(JsonUtils.getBoolean(json, "gui3d")); - } - - if (json.has("weight")) { - variant.weight = Optional.of(JsonUtils.getInt(json, "weight")); - } - - if (json.has("variants")) { - variant.subVariants.putAll(CCBlockStateLoader.parseVariants(json.getAsJsonObject("variants"))); - } - - if (json.has("custom")) { - for (Entry e : json.get("custom").getAsJsonObject().entrySet()) { - if (e.getValue().isJsonNull()) { - variant.customData.put(e.getKey(), null); - } else { - variant.customData.put(e.getKey(), e.getValue().toString()); - } - } - } - - return variant; - } - } - - @Override - public String toString() { - ToStringHelper helper = Objects.toStringHelper("CCVariant"); - helper.add("Model", model); - helper.add("IModelState", state); - Gson gson = new GsonBuilder().setPrettyPrinting().create(); - helper.add("Textures:", gson.toJson(textures, Map.class)); - return helper.toString(); - } -} diff --git a/dependencies/main/java/codechicken/lib/model/cube/CCCubeLoader.java b/dependencies/main/java/codechicken/lib/model/cube/CCCubeLoader.java deleted file mode 100644 index e8456d2f59..0000000000 --- a/dependencies/main/java/codechicken/lib/model/cube/CCCubeLoader.java +++ /dev/null @@ -1,29 +0,0 @@ -package codechicken.lib.model.cube; - -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.ICustomModelLoader; -import net.minecraftforge.client.model.IModel; - -/** - * Created by covers1624 on 19/11/2016. - */ -public class CCCubeLoader implements ICustomModelLoader { - - public static final CCCubeLoader INSTANCE = new CCCubeLoader(); - - @Override - public void onResourceManagerReload(IResourceManager resourceManager) { - } - - @Override - public boolean accepts(ResourceLocation modelLocation) { - String path = modelLocation.getResourcePath(); - return modelLocation.getResourceDomain().equals("ccl") && (path.equals("cube") || path.equals("models/block/cube") || path.equals("models/item/cube")); - } - - @Override - public IModel loadModel(ResourceLocation modelLocation) throws Exception { - return CCModelCube.INSTANCE; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/cube/CCModelCube.java b/dependencies/main/java/codechicken/lib/model/cube/CCModelCube.java deleted file mode 100644 index 47802541dd..0000000000 --- a/dependencies/main/java/codechicken/lib/model/cube/CCModelCube.java +++ /dev/null @@ -1,158 +0,0 @@ -package codechicken.lib.model.cube; - -import codechicken.lib.model.BakedModelProperties; -import codechicken.lib.model.bakedmodels.PerspectiveAwareLayeredModelWrapper; -import codechicken.lib.texture.TextureUtils; -import com.google.common.base.Function; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.*; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; - -import java.util.*; -import java.util.Map.Entry; - -/** - * Created by covers1624 on 19/11/2016. - * TODO Document that this exists and what it does to jsons. - */ -public class CCModelCube implements IModel, IRetexturableModel, IModelSimpleProperties { - - public static String[] layerNames = { "solid", "cutout_mipped", "cutout", "translucent" }; - public static Map nameToLayer = new HashMap() { - { - put("solid", BlockRenderLayer.SOLID); - put("cutout_mipped", BlockRenderLayer.CUTOUT_MIPPED); - put("cutout", BlockRenderLayer.CUTOUT); - put("translucent", BlockRenderLayer.TRANSLUCENT); - } - }; - - public static CCModelCube INSTANCE = new CCModelCube(); - - private final ImmutableMap> layerFaceSpriteMap; - private boolean isAO; - private boolean gui3d; - - public CCModelCube() { - this(new HashMap>()); - } - - public CCModelCube(Map> layerFaceSpriteMap) { - this.layerFaceSpriteMap = ImmutableMap.copyOf(layerFaceSpriteMap); - } - - @Override - public Collection getDependencies() { - return Collections.singletonList(new ResourceLocation("minecraft:block/cube")); - } - - @Override - public Collection getTextures() { - List textures = new ArrayList(); - for (Entry> layerEnrty : layerFaceSpriteMap.entrySet()) { - for (Entry faceEntry : layerEnrty.getValue().entrySet()) { - textures.add(new ResourceLocation(faceEntry.getValue())); - } - } - return ImmutableList.copyOf(textures); - } - - @Override - public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { - - Map layerModelMap = new HashMap(); - TextureAtlasSprite particle = TextureUtils.getMissingSprite(); - for (Entry> layerEntry : layerFaceSpriteMap.entrySet()) { - Map kvTextures = new HashMap(); - for (Entry faceEntry : layerEntry.getValue().entrySet()) { - if (faceEntry.getKey() == null) { - kvTextures.put("particle", faceEntry.getValue()); - } else { - kvTextures.put(faceEntry.getKey().getName(), faceEntry.getValue()); - } - } - IModel vanillaModel = ModelLoaderRegistry.getModelOrLogError(new ResourceLocation("minecraft:block/cube"), "Unable to get vanilla model wrapper.."); - vanillaModel = ModelProcessingHelper.retexture(vanillaModel, ImmutableMap.copyOf(addMissing(kvTextures))); - IBakedModel model = vanillaModel.bake(state, format, bakedTextureGetter); - - if (layerEntry.getKey() == BlockRenderLayer.SOLID) { - particle = model.getParticleTexture(); - } - - layerModelMap.put(layerEntry.getKey(), model); - } - - return new PerspectiveAwareLayeredModelWrapper(layerModelMap, state, new BakedModelProperties(isAO, gui3d, particle)); - } - - private static Map addMissing(Map textures) { - Map newTextures = new HashMap(textures); - for (EnumFacing face : EnumFacing.VALUES) { - if (!textures.containsKey(face.getName())) { - newTextures.put("#" + face.getName(), ""); - } - } - return newTextures; - } - - @Override - public IModelState getDefaultState() { - return TRSRTransformation.identity(); - } - - @Override - public IModel retexture(ImmutableMap textures) { - Map> layerFaceSpriteMap = new HashMap>(); - - for (Entry entry : textures.entrySet()) { - EnumFacing face = getFaceForKey(entry.getKey()); - BlockRenderLayer layer = getLayerForTexKey(entry.getKey()); - Map faceMap = layerFaceSpriteMap.get(layer); - if (faceMap == null) { - faceMap = new HashMap(); - layerFaceSpriteMap.put(layer, faceMap); - } - faceMap.put(face, entry.getValue()); - } - - return new CCModelCube(layerFaceSpriteMap); - } - - private static BlockRenderLayer getLayerForTexKey(String key) { - String layerName = "solid"; - for (String l : layerNames) { - if (key.endsWith(l)) { - layerName = l; - } - } - return nameToLayer.get(layerName); - } - - public static EnumFacing getFaceForKey(String key) { - String faceName = key; - if (key.contains("_")) { - faceName = key.substring(0, key.indexOf("_")); - } - return EnumFacing.byName(faceName); - } - - @Override - public IModel smoothLighting(boolean value) { - this.isAO = value; - return this; - } - - @Override - public IModel gui3d(boolean value) { - this.gui3d = value; - return this; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/loader/CCBakedModelLoader.java b/dependencies/main/java/codechicken/lib/model/loader/CCBakedModelLoader.java deleted file mode 100644 index 525a0fa553..0000000000 --- a/dependencies/main/java/codechicken/lib/model/loader/CCBakedModelLoader.java +++ /dev/null @@ -1,215 +0,0 @@ -package codechicken.lib.model.loader; - -import codechicken.lib.model.loader.IBakedModelLoader.IModKeyProvider; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import codechicken.lib.thread.RestartableTask; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import com.google.common.collect.ImmutableList; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.IResourceManagerReloadListener; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.LoaderState; -import org.apache.logging.log4j.Level; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.Callable; -import java.util.concurrent.TimeUnit; - -/** - * Created by covers1624 on 7/25/2016. - * This is a flexible IBakedModel loader, It runs off IBakedModelLoaders and IModKeyProviders. - * When getModel(ItemStack) is called it will first try and obtain a IModKeyProvider, If no KeyProvider is found then it returns a null model. - * It then calls IModKeyProvider.createKey(ItemStack) if this returns null a null model is returned. - * It will then check the cache for a key -> IBakedModel reference, if the cache contains a model it is returned otherwise it bakes a model using IBakedModelLoader. - *

- * To use this call registerLoader(IBakedModelLoader) from PRE INIT! - * //TODO This system needs to be scrapped for the new BlockBakery system that was newly implemented. - */ -@Deprecated -public class CCBakedModelLoader implements IIconRegister, IResourceManagerReloadListener { - - public static final CCBakedModelLoader INSTANCE = new CCBakedModelLoader(); - - //TODO use cache factories. - private static final Cache modelCache = CacheBuilder.newBuilder().expireAfterAccess(30, TimeUnit.MINUTES).build(); - private static final Map modelBakeQue = new HashMap(); - - private static final ModelBakeTask bakingTask = new ModelBakeTask(); - - private static final Map modKeyProviders = new HashMap(); - private static final Map modelLoaders = new HashMap(); - - static { - TextureUtils.addIconRegister(INSTANCE); - TextureUtils.registerReloadListener(INSTANCE); - } - - /** - * Registers a IModKeyProvider and IBakedModelLoader. - * - * @param loader Registers a loader. - */ - public static void registerLoader(IBakedModelLoader loader) { - if (Loader.instance().hasReachedState(LoaderState.INITIALIZATION)) { - throw new RuntimeException("Unable to register IBakedModelLoader after Pre Initialization! Please register as the first thing you do in Pre Init!"); - } - if (modelLoaders.containsValue(loader)) { - throw new RuntimeException("Unable to register IBakedModelLoader as it has already been registered!"); - } - - IModKeyProvider provider = loader.createKeyProvider(); - FMLLog.log("CodeChicken Lib", Level.INFO, "Registered loader for mod: %s", provider.getMod()); - modelLoaders.put(provider, loader); - modKeyProviders.put(provider.getMod(), provider); - } - - @Override - public void registerIcons(TextureMap textureMap) { - for (ResourceLocation location : getTextures()) { - textureMap.registerSprite(location); - } - } - - @Override - public void onResourceManagerReload(IResourceManager resourceManager) { - modelCache.invalidateAll(); - } - - public static void clearCache() { - synchronized (modelCache) { - modelCache.invalidateAll(); - } - } - - private static Collection getTextures() { - ImmutableList.Builder builder = ImmutableList.builder(); - for (IBakedModelLoader loader : modelLoaders.values()) { - loader.addTextures(builder); - } - return builder.build(); - } - - public static synchronized IBakedModel getModel(IBlockState state) { - if (state.getBlock() == null || state.getBlock().getRegistryName() == null) { - return null; - } - ResourceLocation location = state.getBlock().getRegistryName(); - final IModKeyProvider provider = modKeyProviders.get(location.getResourceDomain()); - if (provider == null) { - FMLLog.bigWarning("Unable to find IModKeyProvider for domain %s!", location.getResourceDomain()); - return null; - } - final String key = provider.createKey(state); - if (key == null) { - return null; - } - String mapKey = location.toString() + "|" + key; - synchronized (modelCache) { - try { - return modelCache.get(mapKey, new Callable() { - @Override - public IBakedModel call() throws Exception { - return modelLoaders.get(provider).bakeModel(key); - } - }); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - } - - /** - * Call this from ItemOverrideList.handleItemState() - * - * @param stack The ItemStack to attempt to obtain a model for. - * @return The baked model if it can be found/generated, else null. - */ - public static synchronized IBakedModel getModel(ItemStack stack) { - if (stack.getItem() == null || stack.getItem().getRegistryName() == null) { - return null; - } - ResourceLocation location = stack.getItem().getRegistryName(); - IModKeyProvider provider = modKeyProviders.get(location.getResourceDomain()); - if (provider == null) { - FMLLog.bigWarning("Unable to find IModKeyProvider for domain %s!", location.getResourceDomain()); - return null; - } - String key = provider.createKey(stack); - if (key == null) { - return null; - } - String mapKey = location.toString() + "|" + key; - synchronized (modelCache) { - if (modelCache.getIfPresent(mapKey) == null) { - if (modelBakeQue.containsKey(mapKey)) { - return null; - } else { - bakingTask.stop(); - synchronized (modelBakeQue) { - modelBakeQue.put(mapKey, provider); - } - bakingTask.restart(); - } - } - return modelCache.getIfPresent(mapKey); - } - } - - public static class ModelBakeTask extends RestartableTask { - - public ModelBakeTask() { - super("CodeChicken Lib Dynamic model baking"); - } - - @Override - public void execute() { - Map localQue; - synchronized (modelBakeQue) { - localQue = new HashMap(modelBakeQue); - } - Iterator> queIterator = localQue.entrySet().iterator(); - while (queIterator.hasNext()) { - if (interrupted()) { - return; - } - Entry entry = queIterator.next(); - try { - IBakedModelLoader loader = modelLoaders.get(entry.getValue()); - String key = stripMapHeader(entry.getKey()); - IBakedModel model = loader.bakeModel(key); - queIterator.remove(); - - if (model != null) { - synchronized (modelCache) { - modelCache.put(entry.getKey(), model); - } - } - } catch (Exception e) { - FMLLog.log("CodeChickenLib Dyn Model baking", Level.FATAL, e, "A fatal exception has occurred whilst baking a model with key: %s", entry.getKey()); - } finally { - synchronized (modelBakeQue) { - modelBakeQue.remove(entry.getKey()); - } - } - } - } - - private static String stripMapHeader(String mapKey) { - int firstPipe = mapKey.indexOf('|'); - return mapKey.substring(firstPipe + 1); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/model/loader/IBakedModelLoader.java b/dependencies/main/java/codechicken/lib/model/loader/IBakedModelLoader.java deleted file mode 100644 index 4a6a3ebab7..0000000000 --- a/dependencies/main/java/codechicken/lib/model/loader/IBakedModelLoader.java +++ /dev/null @@ -1,77 +0,0 @@ -package codechicken.lib.model.loader; - -import com.google.common.collect.ImmutableList; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -/** - * Created by covers1624 on 7/25/2016. - *

- * This defines a sub bakery of CCBakedModelLoader - * See EnderStorage's EnderStorageBakedModelProvider for a "Default" implementation. - */ -@Deprecated -public interface IBakedModelLoader { - - /** - * This defines a Mod Key provider. - */ - @Deprecated - interface IModKeyProvider { - - /** - * Gets the mod to operate for. - * - * @return The mod id used in your Item.setRegistryName() CAPS SENSITIVE. - */ - String getMod(); - - /** - * Creates a unique key for your item that you can use to create models for. - * Return something like "key1=value1,key2=value2,key3=value3" but can realistically be what ever you want. - * - * @param stack Stack to create a key for. - * @return The key created, null if the item is not supported. - */ - String createKey(ItemStack stack); - - /** - * Creates a unique key for your BlockState that you can use to create models for. - * Return something like "key1=value1,key2=value2,key3=value3" but can realistically be what ever you want. - *

- * This should be used to create a key for the BlockState, handle the face culling in the model you return! - * - * @param state IBlockState to create a key for. - * @return The key created, null if IBlockState is not supported. - */ - String createKey(IBlockState state); - } - - /** - * Used to associate a IModKeyProvider with a IBakedModelLoader. - * - * @return Your key provider. - */ - IModKeyProvider createKeyProvider(); - - /** - * Any textures you want added to the texture map. - * - * @param builder The Builder to add textures to. - */ - void addTextures(ImmutableList.Builder builder); - - /** - * Uses the key provided from the IModKeyProvider to bake a model from your unique key. - * Form your key you should have some sort of indication of what exactly you are baking. - *

- * If it is a "In World" model then it can just be a simple wrapper as the override model just calls getQuads. - * - * @param key Your Unique key. - * @return The baked model created, null if it cannot for some reason. - */ - IBakedModel bakeModel(String key); - -} diff --git a/dependencies/main/java/codechicken/lib/model/modelbase/CCModelBase.java b/dependencies/main/java/codechicken/lib/model/modelbase/CCModelBase.java deleted file mode 100644 index 9417a8f710..0000000000 --- a/dependencies/main/java/codechicken/lib/model/modelbase/CCModelBase.java +++ /dev/null @@ -1,74 +0,0 @@ -package codechicken.lib.model.modelbase; - -import codechicken.lib.render.CCModel; -import codechicken.lib.vec.uv.UV; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import net.minecraft.client.renderer.VertexBuffer; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Random; - -/** - * Created by covers1624 on 8/24/2016. - * TODO, instead of just copying how vanillas works, create a wrapper that pulls data from existing ModelBases and allows some sort of Animation callback. - */ -public abstract class CCModelBase { - - public float swingProgress; - public boolean isRiding; - public boolean isChild = true; - public List boxList = Lists.newArrayList(); - private final Map modelTextureMap = Maps.newHashMap(); - public int textureWidth = 64; - public int textureHeight = 32; - - public CCModelRenderer getRandomModelBox(Random rand) { - return this.boxList.get(rand.nextInt(this.boxList.size())); - } - - protected void setTextureOffset(String partName, int x, int y) { - this.modelTextureMap.put(partName, new UV(x, y)); - } - - public UV getTextureOffset(String partName) { - return this.modelTextureMap.get(partName); - } - - public static void copyModelAngles(CCModelRenderer source, CCModelRenderer dest) { - dest.rotateAngleX = source.rotateAngleX; - dest.rotateAngleY = source.rotateAngleY; - dest.rotateAngleZ = source.rotateAngleZ; - dest.rotationPointX = source.rotationPointX; - dest.rotationPointY = source.rotationPointY; - dest.rotationPointZ = source.rotationPointZ; - } - - public void setModelAttributes(CCModelBase model) { - this.swingProgress = model.swingProgress; - this.isRiding = model.isRiding; - this.isChild = model.isChild; - } - - public static void renderModels(float scale, VertexBuffer buffer, TextureAtlasSprite sprite, CCModelRenderer... modelRenders) { - LinkedList models = new LinkedList(); - for (CCModelRenderer modelRenderer : modelRenders) { - models.add(modelRenderer.bake(scale)); - } - CCModel model = CCModel.combine(models); - - //TODO - //CCRenderState.bind(buffer); - //boolean startDrawing = !CCRenderState.isDrawing(); - //if (startDrawing) { - // CCRenderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); - //} - //model.render(); - //if (startDrawing) { - // CCRenderState.draw(); - //} - } -} diff --git a/dependencies/main/java/codechicken/lib/model/modelbase/CCModelBox.java b/dependencies/main/java/codechicken/lib/model/modelbase/CCModelBox.java deleted file mode 100644 index 5b0ffde5e1..0000000000 --- a/dependencies/main/java/codechicken/lib/model/modelbase/CCModelBox.java +++ /dev/null @@ -1,130 +0,0 @@ -package codechicken.lib.model.modelbase; - -import codechicken.lib.colour.Colour; -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.model.bakery.CCQuad; -import codechicken.lib.vec.Vertex5; - -/** - * Created by covers1624 on 8/24/2016. - * TODO CCModel. - */ -public class CCModelBox { - - private final CCQuad[] quads; - public final float posX1; - public final float posY1; - public final float posZ1; - public final float posX2; - public final float posY2; - public final float posZ2; - public String boxName; - - public CCModelBox(CCModelRenderer renderer, int textureX, int textureY, float xOffset, float yOffset, float zOffset, int width, int height, int depth, float scaleFactor) { - this(renderer, textureX, textureY, xOffset, yOffset, zOffset, width, height, depth, scaleFactor, renderer.mirror); - } - - public CCModelBox(CCModelRenderer renderer, int textureX, int textureY, float xOffset, float yOffset, float zOffset, int width, int height, int depth, float scaleFactor, boolean mirrored) { - - this.posX1 = xOffset; - this.posY1 = yOffset; - this.posZ1 = zOffset; - this.posX2 = xOffset + (float) width; - this.posY2 = yOffset + (float) height; - this.posZ2 = zOffset + (float) depth; - this.quads = new CCQuad[6]; - float f = xOffset + (float) width; - float f1 = yOffset + (float) height; - float f2 = zOffset + (float) depth; - xOffset = xOffset - scaleFactor; - yOffset = yOffset - scaleFactor; - zOffset = zOffset - scaleFactor; - f = f + scaleFactor; - f1 = f1 + scaleFactor; - f2 = f2 + scaleFactor; - - if (mirrored) { - float f3 = f; - f = xOffset; - xOffset = f3; - } - Vertex5[] verts = new Vertex5[8]; - verts[0] = new Vertex5(xOffset, yOffset, zOffset, 0.0F, 0.0F); - verts[1] = new Vertex5(f, yOffset, zOffset, 0.0F, 8.0F); - verts[2] = new Vertex5(f, f1, zOffset, 8.0F, 8.0F); - verts[3] = new Vertex5(xOffset, f1, zOffset, 8.0F, 0.0F); - verts[4] = new Vertex5(xOffset, yOffset, f2, 0.0F, 0.0F); - verts[5] = new Vertex5(f, yOffset, f2, 0.0F, 8.0F); - verts[6] = new Vertex5(f, f1, f2, 8.0F, 8.0F); - verts[7] = new Vertex5(xOffset, f1, f2, 8.0F, 0.0F); - quads[0] = setTextureCoords(new CCQuad(verts[5], verts[1], verts[2], verts[6]), textureX + depth + width, textureY + depth, textureX + depth + width + depth, textureY + depth + height, renderer.textureWidth, renderer.textureHeight); - quads[1] = setTextureCoords(new CCQuad(verts[0], verts[4], verts[7], verts[3]), textureX, textureY + depth, textureX + depth, textureY + depth + height, renderer.textureWidth, renderer.textureHeight); - quads[2] = setTextureCoords(new CCQuad(verts[5], verts[4], verts[0], verts[1]), textureX + depth, textureY, textureX + depth + width, textureY + depth, renderer.textureWidth, renderer.textureHeight); - quads[3] = setTextureCoords(new CCQuad(verts[2], verts[3], verts[7], verts[6]), textureX + depth + width, textureY + depth, textureX + depth + width + width, textureY, renderer.textureWidth, renderer.textureHeight); - quads[4] = setTextureCoords(new CCQuad(verts[1], verts[0], verts[3], verts[2]), textureX + depth, textureY + depth, textureX + depth + width, textureY + depth + height, renderer.textureWidth, renderer.textureHeight); - quads[5] = setTextureCoords(new CCQuad(verts[4], verts[5], verts[6], verts[7]), textureX + depth + width + depth, textureY + depth, textureX + depth + width + depth + width, textureY + depth + height, renderer.textureWidth, renderer.textureHeight); - for (CCQuad quad : quads) { - quad.computeNormals(); - fillQuadData(quad); - if (mirrored) { - flipQuad(quad); - } - } - } - - private CCQuad setTextureCoords(CCQuad quad, int texCoordU1, int texCoordV1, int texCoordU2, int texCoordV2, double textureWidth, double textureHeight) { - double f = 0.0D / textureWidth; - double f1 = 0.0D / textureHeight; - quad.vertices[0].uv.set(texCoordU2 / textureWidth - f, texCoordV1 / textureHeight + f1); - quad.vertices[1].uv.set(texCoordU1 / textureWidth + f, texCoordV1 / textureHeight + f1); - quad.vertices[2].uv.set(texCoordU1 / textureWidth + f, texCoordV2 / textureHeight - f1); - quad.vertices[2].uv.set(texCoordU2 / textureWidth - f, texCoordV2 / textureHeight - f1); - return quad; - } - - private CCQuad fillQuadData(CCQuad quad) { - Colour[] colours = new Colour[quad.colours.length]; - for (int i = 0; i < quad.colours.length; i++) { - Colour colour = quad.colours[i]; - if (colour == null) { - colour = new ColourRGBA(0xFFFFFFFF); - } - colours[i] = colour; - } - quad.colours = colours; - - Integer[] lightMaps = new Integer[quad.lightMaps.length]; - for (int i = 0; i < quad.lightMaps.length; i++) { - Integer lightMap = quad.lightMaps[i]; - if (lightMap == null) { - lightMap = 0; - } - lightMaps[i] = lightMap; - } - quad.lightMaps = lightMaps; - return quad; - } - - public CCQuad flipQuad(CCQuad quad) { - Vertex5[] verts = new Vertex5[4]; - verts[0] = quad.vertices[3]; - verts[1] = quad.vertices[2]; - verts[2] = quad.vertices[1]; - verts[3] = quad.vertices[0]; - quad.vertices = verts; - return quad; - } - - public CCQuad[] getQuads() { - CCQuad[] quads = new CCQuad[this.quads.length]; - for (int i = 0; i < quads.length; i++) { - quads[i] = this.quads[i].copy(); - } - return quads; - } - - public CCModelBox setBoxName(String name) { - this.boxName = name; - return this; - } -} diff --git a/dependencies/main/java/codechicken/lib/model/modelbase/CCModelRenderer.java b/dependencies/main/java/codechicken/lib/model/modelbase/CCModelRenderer.java deleted file mode 100644 index b2cdf5af7e..0000000000 --- a/dependencies/main/java/codechicken/lib/model/modelbase/CCModelRenderer.java +++ /dev/null @@ -1,279 +0,0 @@ -package codechicken.lib.model.modelbase; - -import codechicken.lib.model.bakery.CCQuad; -import codechicken.lib.render.CCModel; -import codechicken.lib.vec.*; -import codechicken.lib.vec.uv.UV; -import com.google.common.collect.Lists; -import net.minecraft.client.renderer.VertexBuffer; -import org.lwjgl.opengl.GL11; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -/** - * Created by covers1624 on 8/24/2016. - * A ModelRenderer that is compatible with FastTESR's. - * TODO See CCModelBase's comment, - */ -public class CCModelRenderer { - - public float textureWidth; - public float textureHeight; - private int textureOffsetX; - private int textureOffsetY; - public float rotationPointX; - public float rotationPointY; - public float rotationPointZ; - public float rotateAngleX; - public float rotateAngleY; - public float rotateAngleZ; - public boolean mirror; - public boolean showModel; - public boolean isHidden; - - private CCModel compiledModel; - public boolean compiled; - - public List cubeList; - public List childModels; - public final String boxName; - private final CCModelBase baseModel; - public float offsetX; - public float offsetY; - public float offsetZ; - - public CCModelRenderer(CCModelBase model, String boxNameIn) { - this.textureWidth = 64.0F; - this.textureHeight = 32.0F; - this.showModel = true; - this.cubeList = Lists.newArrayList(); - this.baseModel = model; - model.boxList.add(this); - this.boxName = boxNameIn; - this.setTextureSize(model.textureWidth, model.textureHeight); - } - - public CCModelRenderer(CCModelBase model) { - this(model, null); - } - - public CCModelRenderer(CCModelBase model, int texOffX, int texOffY) { - this(model); - this.setTextureOffset(texOffX, texOffY); - } - - public void addChild(CCModelRenderer renderer) { - if (this.childModels == null) { - this.childModels = Lists.newArrayList(); - } - - this.childModels.add(renderer); - } - - public CCModelRenderer setTextureOffset(int x, int y) { - this.textureOffsetX = x; - this.textureOffsetY = y; - return this; - } - - public CCModelRenderer addBox(String partName, float offX, float offY, float offZ, int width, int height, int depth) { - partName = this.boxName + "." + partName; - UV textureOffset = this.baseModel.getTextureOffset(partName); - this.setTextureOffset((int) textureOffset.u, (int) textureOffset.v); - this.cubeList.add((new CCModelBox(this, this.textureOffsetX, this.textureOffsetY, offX, offY, offZ, width, height, depth, 0.0F)).setBoxName(partName)); - return this; - } - - public CCModelRenderer addBox(float offX, float offY, float offZ, int width, int height, int depth) { - this.cubeList.add(new CCModelBox(this, this.textureOffsetX, this.textureOffsetY, offX, offY, offZ, width, height, depth, 0.0F)); - return this; - } - - public CCModelRenderer addBox(float offX, float offY, float offZ, int width, int height, int depth, boolean mirrored) { - this.cubeList.add(new CCModelBox(this, this.textureOffsetX, this.textureOffsetY, offX, offY, offZ, width, height, depth, 0.0F, mirrored)); - return this; - } - - public void addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) { - this.cubeList.add(new CCModelBox(this, this.textureOffsetX, this.textureOffsetY, offX, offY, offZ, width, height, depth, scaleFactor)); - } - - public void setRotationPoint(float rotationPointXIn, float rotationPointYIn, float rotationPointZIn) { - this.rotationPointX = rotationPointXIn; - this.rotationPointY = rotationPointYIn; - this.rotationPointZ = rotationPointZIn; - } - - public void render(float scale, VertexBuffer buffer) { - //TODO - //CCRenderState.bind(buffer); - //boolean startDrawing = !CCRenderState.isDrawing(); - //if (startDrawing) { - // CCRenderState.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); - //} - //bake(scale).render(); - //if (startDrawing) { - // CCRenderState.draw(); - //} - } - - public CCModel bake(float scale) { - if (!this.isHidden) { - if (this.showModel) { - if (!this.compiled) { - this.compileModel(scale); - } - LinkedList transforms = new LinkedList(); - LinkedList finalModelElements = new LinkedList(); - transforms.add(new Translation(offsetX, offsetY, offsetZ)); - //GlStateManager.translate(this.offsetX, this.offsetY, this.offsetZ); - - if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { - if (this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F) { - //GlStateManager.callList(this.displayList); - finalModelElements.add(compiledModel.copy()); - if (this.childModels != null) { - for (CCModelRenderer modelRenderer : childModels) { - finalModelElements.add(modelRenderer.bake(scale).copy()); - } - } - } else { - transforms.add(new Translation(rotationPointX * scale, rotationPointY * scale, rotationPointZ * scale)); - //GlStateManager.translate(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); - //GlStateManager.callList(this.displayList); - finalModelElements.add(compiledModel.copy()); - - if (this.childModels != null) { - for (CCModelRenderer modelRenderer : childModels) { - finalModelElements.add(modelRenderer.bake(scale).copy()); - } - } - - //GlStateManager.translate(-this.rotationPointX * scale, -this.rotationPointY * scale, -this.rotationPointZ * scale); - } - } else { - //GlStateManager.pushMatrix(); - //GlStateManager.translate(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); - transforms.add(new Translation(rotationPointX * scale, rotationPointY * scale, rotationPointZ * scale)); - - if (this.rotateAngleZ != 0.0F) { - transforms.add(new Rotation(rotateAngleZ, new Vector3(0, 0, 1).normalize())); - //GlStateManager.rotate(this.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F); - } - - if (this.rotateAngleY != 0.0F) { - transforms.add(new Rotation(rotateAngleY, new Vector3(0, 1, 0).normalize())); - //GlStateManager.rotate(this.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F); - } - - if (this.rotateAngleX != 0.0F) { - transforms.add(new Rotation(rotateAngleZ, new Vector3(1, 0, 0).normalize())); - //GlStateManager.rotate(this.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F); - } - finalModelElements.add(compiledModel.copy()); - //GlStateManager.callList(this.displayList); - - if (this.childModels != null) { - for (CCModelRenderer modelRenderer : childModels) { - finalModelElements.add(modelRenderer.bake(scale).copy()); - } - } - - //GlStateManager.popMatrix(); - } - - //GlStateManager.translate(-this.offsetX, -this.offsetY, -this.offsetZ); - return CCModel.combine(finalModelElements).apply(new TransformationList(transforms.toArray(new Transformation[transforms.size()]))); - } - } - return CCModel.newModel(GL11.GL_QUADS); - } - - /*public void renderWithRotation(float scale, VertexBuffer buffer) { - if (!this.isHidden) { - if (this.showModel) { - if (!this.compiled) { - this.compileModel(scale, buffer.getVertexFormat()); - } - - GlStateManager.pushMatrix(); - GlStateManager.translate(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); - - if (this.rotateAngleY != 0.0F) { - GlStateManager.rotate(this.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F); - } - - if (this.rotateAngleX != 0.0F) { - GlStateManager.rotate(this.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F); - } - - if (this.rotateAngleZ != 0.0F) { - GlStateManager.rotate(this.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F); - } - - GlStateManager.callList(this.displayList); - GlStateManager.popMatrix(); - } - } - }*/ - - //@SideOnly(Side.CLIENT) - /*public void postRender(float scale, VertexBuffer buffer) { - if (!this.isHidden) { - if (this.showModel) { - if (!this.compiled) { - this.compileModel(scale, buffer.getVertexFormat()); - } - - if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { - if (this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F) { - GlStateManager.translate(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); - } - } else { - GlStateManager.translate(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); - - if (this.rotateAngleZ != 0.0F) { - GlStateManager.rotate(this.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F); - } - - if (this.rotateAngleY != 0.0F) { - GlStateManager.rotate(this.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F); - } - - if (this.rotateAngleX != 0.0F) { - GlStateManager.rotate(this.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F); - } - } - } - } - }*/ - - private CCModel compileModel(float scale) { - if (compiled) { - return compiledModel; - } - - CCModel model = CCModel.newModel(GL11.GL_QUADS); - LinkedList vertices = new LinkedList(); - for (CCModelBox box : cubeList) { - for (CCQuad quad : box.getQuads()) { - Collections.addAll(vertices, quad.vertices); - } - } - model.verts = vertices.toArray(new Vertex5[vertices.size()]); - model.computeNormals(); - - compiledModel = model.copy().apply(new Scale(scale)); - - this.compiled = true; - return compiledModel; - } - - public CCModelRenderer setTextureSize(int textureWidthIn, int textureHeightIn) { - this.textureWidth = (float) textureWidthIn; - this.textureHeight = (float) textureHeightIn; - return this; - } -} diff --git a/dependencies/main/java/codechicken/lib/packet/ICustomPacketTile.java b/dependencies/main/java/codechicken/lib/packet/ICustomPacketTile.java deleted file mode 100644 index a760696f20..0000000000 --- a/dependencies/main/java/codechicken/lib/packet/ICustomPacketTile.java +++ /dev/null @@ -1,12 +0,0 @@ -package codechicken.lib.packet; - -import codechicken.lib.data.MCDataInput; -import codechicken.lib.data.MCDataOutput; - -public interface ICustomPacketTile { - - void writeToPacket(MCDataOutput packet); - - void readFromPacket(MCDataInput packet); - -} diff --git a/dependencies/main/java/codechicken/lib/packet/PacketCustom.java b/dependencies/main/java/codechicken/lib/packet/PacketCustom.java deleted file mode 100644 index 8301937e46..0000000000 --- a/dependencies/main/java/codechicken/lib/packet/PacketCustom.java +++ /dev/null @@ -1,583 +0,0 @@ -package codechicken.lib.packet; - -import codechicken.lib.data.MCDataHandler; -import codechicken.lib.data.MCDataIO; -import com.google.common.collect.Maps; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import io.netty.channel.ChannelHandler; -import io.netty.channel.ChannelHandlerContext; -import io.netty.channel.ChannelInboundHandlerAdapter; -import io.netty.channel.SimpleChannelInboundHandler; -import io.netty.handler.codec.EncoderException; -import io.netty.util.AttributeKey; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.INetHandler; -import net.minecraft.network.NetHandlerPlayServer; -import net.minecraft.network.Packet; -import net.minecraft.network.PacketBuffer; -import net.minecraft.network.play.INetHandlerPlayClient; -import net.minecraft.network.play.INetHandlerPlayServer; -import net.minecraft.network.play.server.SPacketUpdateTileEntity; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.management.PlayerChunkMapEntry; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraft.world.WorldServer; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.common.network.FMLEmbeddedChannel; -import net.minecraftforge.fml.common.network.FMLOutboundHandler; -import net.minecraftforge.fml.common.network.NetworkHandshakeEstablished; -import net.minecraftforge.fml.common.network.NetworkRegistry; -import net.minecraftforge.fml.common.network.handshake.NetworkDispatcher; -import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.io.IOException; -import java.util.EnumMap; -import java.util.zip.Deflater; -import java.util.zip.Inflater; - -public final class PacketCustom extends PacketBuffer implements MCDataHandler { - - public interface ICustomPacketHandler { - - } - - public interface IClientPacketHandler extends ICustomPacketHandler { - - void handlePacket(PacketCustom packetCustom, Minecraft mc, INetHandlerPlayClient handler); - } - - public interface IServerPacketHandler extends ICustomPacketHandler { - - void handlePacket(PacketCustom packetCustom, EntityPlayerMP sender, INetHandlerPlayServer handler); - } - - public static AttributeKey cclHandler = new AttributeKey("ccl:handler"); - - @ChannelHandler.Sharable - public static class CustomInboundHandler extends SimpleChannelInboundHandler { - - public EnumMap handlers = Maps.newEnumMap(Side.class); - - @Override - public void handlerAdded(ChannelHandlerContext ctx) throws Exception { - super.handlerAdded(ctx); - ctx.channel().attr(cclHandler).set(this); - } - - @Override - protected void channelRead0(ChannelHandlerContext ctx, FMLProxyPacket msg) throws Exception { - handlers.get(ctx.channel().attr(NetworkRegistry.CHANNEL_SOURCE).get()).handle(ctx.channel().attr(NetworkRegistry.NET_HANDLER).get(), ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get(), new PacketCustom(msg.payload())); - } - } - - private interface CustomHandler { - - void handle(INetHandler handler, String channel, PacketCustom packet); - } - - public static class ClientInboundHandler implements CustomHandler { - - private IClientPacketHandler handler; - - public ClientInboundHandler(ICustomPacketHandler handler) { - this.handler = (IClientPacketHandler) handler; - } - - @Override - public void handle(final INetHandler netHandler, final String channel, final PacketCustom packet) { - if (netHandler instanceof INetHandlerPlayClient) { - Minecraft mc = Minecraft.getMinecraft(); - if (!mc.isCallingFromMinecraftThread()) { - mc.addScheduledTask(new Runnable() { - public void run() { - handle(netHandler, channel, packet); - } - }); - } else { - handler.handlePacket(packet, mc, (INetHandlerPlayClient) netHandler); - } - } else { - System.err.println("Invalid INetHandler for PacketCustom on channel: " + channel); - } - } - } - - public static class ServerInboundHandler implements CustomHandler { - - private IServerPacketHandler handler; - - public ServerInboundHandler(ICustomPacketHandler handler) { - this.handler = (IServerPacketHandler) handler; - } - - @Override - public void handle(final INetHandler netHandler, final String channel, final PacketCustom packet) { - if (netHandler instanceof NetHandlerPlayServer) { - MinecraftServer mc = FMLCommonHandler.instance().getMinecraftServerInstance(); - if (!mc.isCallingFromMinecraftThread()) { - mc.addScheduledTask(new Runnable() { - public void run() { - handle(netHandler, channel, packet); - } - }); - } else { - handler.handlePacket(packet, ((NetHandlerPlayServer) netHandler).playerEntity, (INetHandlerPlayServer) netHandler); - } - } else { - System.err.println("Invalid INetHandler for PacketCustom on channel: " + channel); - } - } - } - - public interface IHandshakeHandler { - - void handshakeReceived(NetHandlerPlayServer netHandler); - } - - public static class HandshakeInboundHandler extends ChannelInboundHandlerAdapter { - - public IHandshakeHandler handler; - - public HandshakeInboundHandler(IHandshakeHandler handler) { - this.handler = handler; - } - - @Override - public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { - if (evt instanceof NetworkHandshakeEstablished) { - INetHandler netHandler = ((NetworkDispatcher) ctx.channel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).get()).getNetHandler(); - if (netHandler instanceof NetHandlerPlayServer) { - handler.handshakeReceived((NetHandlerPlayServer) netHandler); - } - } else { - ctx.fireUserEventTriggered(evt); - } - } - } - - public static String channelName(Object channelKey) { - if (channelKey instanceof String) { - return (String) channelKey; - } - if (channelKey instanceof ModContainer) { - String s = ((ModContainer) channelKey).getModId(); - if (s.length() > 20) { - throw new IllegalArgumentException("Mod ID (" + s + ") too long for use as channel (20 chars). Use a string identifier"); - } - return s; - } - - ModContainer mc = FMLCommonHandler.instance().findContainerFor(channelKey); - if (mc != null) { - return mc.getModId(); - } - - throw new IllegalArgumentException("Invalid channel: " + channelKey); - } - - public static FMLEmbeddedChannel getOrCreateChannel(String channelName, Side side) { - if (!NetworkRegistry.INSTANCE.hasChannel(channelName, side)) { - NetworkRegistry.INSTANCE.newChannel(channelName, new CustomInboundHandler()); - } - return NetworkRegistry.INSTANCE.getChannel(channelName, side); - } - - public static void assignHandler(Object channelKey, ICustomPacketHandler handler) { - String channelName = channelName(channelKey); - Side side = handler instanceof IServerPacketHandler ? Side.SERVER : Side.CLIENT; - FMLEmbeddedChannel channel = getOrCreateChannel(channelName, side); - channel.attr(cclHandler).get().handlers.put(side, side == Side.SERVER ? new ServerInboundHandler(handler) : new ClientInboundHandler(handler)); - } - - public static void assignHandshakeHandler(Object channelKey, IHandshakeHandler handler) { - FMLEmbeddedChannel channel = getOrCreateChannel(channelName(channelKey), Side.SERVER); - channel.pipeline().addLast(new HandshakeInboundHandler(handler)); - } - - private String channel; - private int type; - - public PacketCustom(ByteBuf payload) { - super(payload); - - type = readUnsignedByte(); - if (type > 0x80) { - decompress(); - } - type &= 0x7F; - } - - public PacketCustom(Object channelKey, int type) { - super(Unpooled.buffer()); - if (type <= 0 || type >= 0x80) { - throw new IllegalArgumentException("Packet type: " + type + " is not within required 0 < t < 0x80"); - } - - this.channel = channelName(channelKey); - this.type = type; - writeByte(type); - } - - /** - * Decompresses the remaining ByteBuf (after type has been read) using Snappy - */ - private void decompress() { - Inflater inflater = new Inflater(); - try { - int len = readVarInt(); - byte[] out = new byte[len]; - inflater.setInput(array(), readerIndex(), readableBytes()); - inflater.inflate(out); - clear(); - writeArray(out); - - } catch (Exception e) { - throw new EncoderException(e); - } finally { - inflater.end(); - } - } - - /** - * Compresses the payload ByteBuf after the type byte - */ - private void do_compress() { - Deflater deflater = new Deflater(); - try { - readerIndex(1); - int len = readableBytes(); - deflater.setInput(array(), readerIndex(), len); - deflater.finish(); - byte[] out = new byte[len]; - int clen = deflater.deflate(out); - if (clen >= len - 5 || !deflater.finished())//not worth compressing, gets larger - { - return; - } - clear(); - writeByte(type | 0x80); - writeVarInt(len); - writeArray(out); - } catch (Exception e) { - throw new EncoderException(e); - } finally { - readerIndex(0); - deflater.end(); - } - } - - public boolean incoming() { - return channel == null; - } - - public int getType() { - return type & 0x7F; - } - - public PacketCustom compress() { - if (incoming()) { - throw new IllegalStateException("Tried to compress an incoming packet"); - } - if ((type & 0x80) != 0) { - throw new IllegalStateException("Packet already compressed"); - } - type |= 0x80; - return this; - } - - @Override - public PacketCustom writeBoolean(boolean b) { - super.writeBoolean(b); - return this; - } - - @Override - public PacketCustom writeByte(int b) { - super.writeByte(b); - return this; - } - - @Override - public PacketCustom writeShort(int s) { - super.writeShort(s); - return this; - } - - @Override - public PacketCustom writeInt(int i) { - super.writeInt(i); - return this; - } - - @Override - public PacketCustom writeFloat(float f) { - super.writeFloat(f); - return this; - } - - @Override - public PacketCustom writeDouble(double d) { - super.writeDouble(d); - return this; - } - - @Override - public PacketCustom writeLong(long l) { - super.writeLong(l); - return this; - } - - @Override - public PacketCustom writeChar(char c) { - super.writeChar(c); - return this; - } - - @Override - - public PacketCustom writeVarInt(int i) { - writeVarIntToBuffer(i); - return this; - } - - @Override - public PacketCustom writeVarShort(int s) { - MCDataIO.writeVarShort(this, s); - return this; - } - - @Override - public PacketCustom writeArray(byte[] barray) { - writeBytes(barray); - return this; - } - - @Override - public PacketCustom writeString(String s) { - super.writeString(s); - return this; - } - - public PacketCustom writeLocation(ResourceLocation loc) { - writeString(loc.toString()); - return this; - } - - @Override - public PacketCustom writePos(BlockPos pos) { - writeInt(pos.getX()); - writeInt(pos.getY()); - writeInt(pos.getZ()); - return this; - } - - @Override - public PacketCustom writeBlockPos(BlockPos pos) { - return writePos(pos); - } - - @Override - public PacketCustom writeItemStack(ItemStack stack) { - MCDataIO.writeItemStack(this, stack); - return this; - } - - @Override - public PacketCustom writeNBTTagCompound(NBTTagCompound tag) { - writeNBTTagCompoundToBuffer(tag); - return this; - } - - @Override - public PacketCustom writeFluidStack(FluidStack fluid) { - MCDataIO.writeFluidStack(this, fluid); - return this; - } - - public short readUByte() { - return readUnsignedByte(); - } - - public int readUShort() { - return readUnsignedShort(); - } - - @Override - public int readVarShort() { - return MCDataIO.readVarShort(this); - } - - @Override - public int readVarInt() { - return readVarIntFromBuffer(); - } - - @Override - public BlockPos readPos() { - return new BlockPos(readInt(), readInt(), readInt()); - } - - @Override - public BlockPos readBlockPos() { - return readPos(); - } - - @Override - public byte[] readArray(int length) { - return readBytes(length).array(); - } - - @Override - public String readString() { - return readStringFromBuffer(32767); - } - - //TODO 1.11 pull to MC data in / out. - public ResourceLocation readLocation() { - return new ResourceLocation(readString()); - } - - @Override - public ItemStack readItemStack() { - return MCDataIO.readItemStack(this); - } - - @Override - public NBTTagCompound readNBTTagCompound() { - try { - return readNBTTagCompoundFromBuffer(); - } catch (IOException e) { - throw new EncoderException(e); - } - } - - @Override - public FluidStack readFluidStack() { - return MCDataIO.readFluidStack(this); - } - - public FMLProxyPacket toPacket() { - if (incoming()) { - throw new IllegalStateException("Tried to write an incoming packet"); - } - - if (readableBytes() > 32000 || (type & 0x80) != 0) { - do_compress(); - } - - return new FMLProxyPacket(new PacketBuffer(copy()), channel); - } - - public NBTTagCompound toNBTTag(NBTTagCompound tagCompound) { - tagCompound.setByteArray("CCL:data", array()); - return tagCompound; - } - - public NBTTagCompound toNBTTag() { - NBTTagCompound tagCompound = new NBTTagCompound(); - tagCompound.setByteArray("CCL:data", array()); - return tagCompound; - } - - public static PacketCustom fromNBTTag(NBTTagCompound tagCompound) { - return new PacketCustom(Unpooled.copiedBuffer(tagCompound.getByteArray("CCL:data"))); - } - - public SPacketUpdateTileEntity toTilePacket(BlockPos pos) { - return new SPacketUpdateTileEntity(pos, 0, toNBTTag()); - } - - @SideOnly (Side.CLIENT) - public static PacketCustom fromTilePacket(SPacketUpdateTileEntity tilePacket) { - return fromNBTTag(tilePacket.getNbtCompound()); - } - - public void sendToPlayer(EntityPlayer player) { - sendToPlayer(toPacket(), player); - } - - public static void sendToPlayer(Packet packet, EntityPlayer player) { - if (player == null) { - sendToClients(packet); - } else { - ((EntityPlayerMP) player).connection.sendPacket(packet); - } - } - - public void sendToClients() { - sendToClients(toPacket()); - } - - public static void sendToClients(Packet packet) { - FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().sendPacketToAllPlayers(packet); - } - - public void sendPacketToAllAround(BlockPos pos, double range, int dim) { - sendPacketToAllAround(pos.getX(), pos.getY(), pos.getZ(), range, dim); - } - - public void sendPacketToAllAround(double x, double y, double z, double range, int dim) { - sendToAllAround(toPacket(), x, y, z, range, dim); - } - - public static void sendToAllAround(Packet packet, double x, double y, double z, double range, int dim) { - FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().sendToAllNearExcept(null, x, y, z, range, dim, packet); - } - - public void sendToDimension(int dim) { - sendToDimension(toPacket(), dim); - } - - public static void sendToDimension(Packet packet, int dim) { - FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().sendPacketToAllPlayersInDimension(packet, dim); - } - - public void sendToChunk(TileEntity tile) { - sendToChunk(tile.getWorld(), tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4); - } - - public void sendToChunk(World world, int chunkX, int chunkZ) { - sendToChunk(toPacket(), world, chunkX, chunkZ); - } - - public static void sendToChunk(Packet packet, World world, int chunkX, int chunkZ) { - PlayerChunkMapEntry playerInstance = ((WorldServer) world).getPlayerChunkMap().getEntry(chunkX, chunkZ); - if (playerInstance != null) { - playerInstance.sendPacket(packet); - } - } - - public void sendToOps() { - sendToOps(toPacket()); - } - - public static void sendToOps(Packet packet) { - for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList()) { - if (FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().canSendCommands(player.getGameProfile())) { - sendToPlayer(packet, player); - } - } - } - - @SideOnly (Side.CLIENT) - public void sendToServer() { - sendToServer(toPacket()); - } - - @SideOnly (Side.CLIENT) - public static void sendToServer(Packet packet) { - Minecraft.getMinecraft().getConnection().sendPacket(packet); - } -} diff --git a/dependencies/main/java/codechicken/lib/raytracer/CuboidRayTraceResult.java b/dependencies/main/java/codechicken/lib/raytracer/CuboidRayTraceResult.java deleted file mode 100644 index 5261c0ff3e..0000000000 --- a/dependencies/main/java/codechicken/lib/raytracer/CuboidRayTraceResult.java +++ /dev/null @@ -1,54 +0,0 @@ -package codechicken.lib.raytracer; - -import codechicken.lib.vec.Vector3; -import net.minecraft.entity.Entity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; - -/** - * Created by covers1624 on 8/9/2016. - * This class is kind of special as if you return this in Block.collisionRayTrace, when the blocks HitBox is rendered it will cancel and use the cuboid provided here. - * This is to get around the fact that it is currently impossible to determine from Block.getSelectedBoundingBox what sub box to render as you have absolutely no player context to do a trace. - */ -public class CuboidRayTraceResult extends DistanceRayTraceResult { - - public IndexedCuboid6 cuboid6; - - /** - * Optional flag that disables auto rendering of this trace result. Useful when - * you wish to use this class to retain the Cuboid6 box but would like to render - * it yourself. - */ - public boolean disableAutoHitboxRender = false; - - public CuboidRayTraceResult(Entity entity, Vector3 hit, IndexedCuboid6 cuboid, double dist) { - super(entity, hit, cuboid.data, dist); - this.cuboid6 = cuboid; - } - - public CuboidRayTraceResult(Vector3 hit, BlockPos pos, EnumFacing side, IndexedCuboid6 cuboid, double dist) { - super(hit, pos, side, cuboid.data, dist); - this.cuboid6 = cuboid; - } - - public CuboidRayTraceResult(Vector3 hit, EnumFacing side, IndexedCuboid6 cuboid6, double dist) { - super(hit, side, cuboid6.data, dist); - this.cuboid6 = cuboid6; - } - - /** - * This will create a new instance of a DistanceRayTraceResult. - * You will not be able to TypeCast this back to a CuboidRayTraceResult. - * This can be used to avoid CCL's HitBox render taking over down the line. - * - * @return - */ - public DistanceRayTraceResult getAsTraceResult() { - return new DistanceRayTraceResult(new Vector3(hitVec), sideHit, hitInfo, dist); - } - - @Override - public String toString() { - return super.toString().replace("}", "") + ", cuboid=" + cuboid6.toString() + "}"; - } -} diff --git a/dependencies/main/java/codechicken/lib/raytracer/DistanceRayTraceResult.java b/dependencies/main/java/codechicken/lib/raytracer/DistanceRayTraceResult.java deleted file mode 100644 index d1d6113702..0000000000 --- a/dependencies/main/java/codechicken/lib/raytracer/DistanceRayTraceResult.java +++ /dev/null @@ -1,60 +0,0 @@ -package codechicken.lib.raytracer; - -import codechicken.lib.vec.Vector3; -import net.minecraft.entity.Entity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; - -//TODO Copyable. -public class DistanceRayTraceResult extends RayTraceResult implements Comparable { - - /** - * The square distance from the start of the raytrace. - */ - public double dist; - - public DistanceRayTraceResult(Entity entity, Vector3 hit, Object data, double dist) { - super(entity, hit.vec3()); - setData(data); - this.dist = dist; - } - - public DistanceRayTraceResult(Vector3 hit, EnumFacing side, Object data, double dist) { - super(hit.vec3(), side); - this.dist = dist; - setData(data); - } - - public DistanceRayTraceResult(Vector3 hit, BlockPos pos, EnumFacing side, Object data, double dist) { - super(hit.vec3(), side, pos); - setData(data); - this.dist = dist; - } - - public void setData(Object data) { - if (data instanceof Integer) { - subHit = (Integer) data; - } - hitInfo = data; - } - - @Deprecated//TODO Is this actually needed.. Can remove an AT line if not needed. - public void setPos(BlockPos pos) { - this.blockPos = pos; - } - - public void offsetHit(BlockPos pos) { - hitVec = hitVec.addVector(pos.getX(), pos.getY(), pos.getZ()); - } - - @Override - public int compareTo(DistanceRayTraceResult o) { - return dist == o.dist ? 0 : dist < o.dist ? -1 : 1; - } - - @Override - public String toString() { - return super.toString().replace("}", "") + ", subHit=" + subHit + ", sqDist: " + dist + "}"; - } -} diff --git a/dependencies/main/java/codechicken/lib/raytracer/ICuboidProvider.java b/dependencies/main/java/codechicken/lib/raytracer/ICuboidProvider.java deleted file mode 100644 index d62223ca0e..0000000000 --- a/dependencies/main/java/codechicken/lib/raytracer/ICuboidProvider.java +++ /dev/null @@ -1,19 +0,0 @@ -package codechicken.lib.raytracer; - -import java.util.List; - -/** - * Created by covers1624 on 8/10/2016. - * This is a completely random interface, mainly used to have a standard method to get cuboids from a tile. - * For a somewhat standard impl, use the first index in the array to indicate the blocks bounds, and anything else for other clickable's or boxes. - */ -public interface ICuboidProvider { - - /** - * Everything must return pure bounds not offset by the tiles position. - * - * @return A list of cuboids for a tile. - */ - List getIndexedCuboids(); - -} diff --git a/dependencies/main/java/codechicken/lib/raytracer/IndexedCuboid6.java b/dependencies/main/java/codechicken/lib/raytracer/IndexedCuboid6.java deleted file mode 100644 index 66738a9c29..0000000000 --- a/dependencies/main/java/codechicken/lib/raytracer/IndexedCuboid6.java +++ /dev/null @@ -1,94 +0,0 @@ -package codechicken.lib.raytracer; - -import codechicken.lib.math.MathHelper; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Vector3; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.AxisAlignedBB; - -public class IndexedCuboid6 extends Cuboid6 { - - public Object data; - - public IndexedCuboid6(Object data, Cuboid6 cuboid) { - super(cuboid); - this.data = data; - } - - public IndexedCuboid6(Object data, AxisAlignedBB box) { - super(box); - this.data = data; - } - - public CuboidRayTraceResult calculateIntercept(Vector3 start, Vector3 end) { - Vector3 hit = null; - EnumFacing sideHit = null; - double dist = Double.MAX_VALUE; - - for (EnumFacing face : EnumFacing.values()) { - Vector3 suspectHit = null; - switch (face) { - case DOWN: - suspectHit = start.copy().XZintercept(end, min.y); - break; - case UP: - suspectHit = start.copy().XZintercept(end, max.y); - break; - case NORTH: - suspectHit = start.copy().XYintercept(end, min.z); - break; - case SOUTH: - suspectHit = start.copy().XYintercept(end, max.z); - break; - case WEST: - suspectHit = start.copy().YZintercept(end, min.x); - break; - case EAST: - suspectHit = start.copy().YZintercept(end, max.x); - break; - } - - if (suspectHit == null) { - continue; - } - - switch (face) { - - case DOWN: - case UP: - if (!MathHelper.between(min.x, suspectHit.x, max.x) || !MathHelper.between(min.z, suspectHit.z, max.z)) { - continue; - } - break; - case NORTH: - case SOUTH: - if (!MathHelper.between(min.x, suspectHit.x, max.x) || !MathHelper.between(min.y, suspectHit.y, max.y)) { - continue; - } - break; - case WEST: - case EAST: - if (!MathHelper.between(min.y, suspectHit.y, max.y) || !MathHelper.between(min.z, suspectHit.z, max.z)) { - continue; - } - break; - } - double suspectDist = suspectHit.copy().subtract(start).magSquared(); - if (suspectDist < dist) { - sideHit = face; - dist = suspectDist; - hit = suspectHit; - } - } - - if (sideHit != null && hit != null) { - return new CuboidRayTraceResult(hit, sideHit, this, dist); - } - return null; - } - - @Override - public IndexedCuboid6 copy() { - return new IndexedCuboid6(data, this); - } -} diff --git a/dependencies/main/java/codechicken/lib/raytracer/RayTracer.java b/dependencies/main/java/codechicken/lib/raytracer/RayTracer.java deleted file mode 100644 index 864d8e1640..0000000000 --- a/dependencies/main/java/codechicken/lib/raytracer/RayTracer.java +++ /dev/null @@ -1,256 +0,0 @@ -package codechicken.lib.raytracer; - -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Vector3; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -public class RayTracer { - - /** - * @param start The vector to start RayTracing from. - * @param end The Vector to stop RayTracing at. - * @param cuboids The cuboids to check for a hit. - * @param pos The position offset for the start and end vector. - * @return The closest hit to the start vector. - * //TODO 1.11, Re arrange args to (start, end, pos, cuboids) - */ - public static CuboidRayTraceResult rayTraceCuboidsClosest(Vec3d start, Vec3d end, List cuboids, BlockPos pos) { - return rayTraceCuboidsClosest(new Vector3(start), new Vector3(end), cuboids, pos); - } - - /** - * @param start The vector to start RayTracing from. - * @param end The Vector to stop RayTracing at. - * @param cuboids The cuboids to check for a hit. - * @param pos The position offset for the start and end vector. - * @return The closest hit to the start vector. - * //TODO 1.11, Re arrange args to (start, end, pos, cuboids) - */ - public static CuboidRayTraceResult rayTraceCuboidsClosest(Vector3 start, Vector3 end, List cuboids, BlockPos pos) { - List results = new ArrayList(); - for (IndexedCuboid6 cuboid6 : cuboids) { - CuboidRayTraceResult hit = rayTrace(pos, start, end, cuboid6); - results.add(hit); - } - CuboidRayTraceResult closestHit = null; - double curClosest = Double.MAX_VALUE; - for (CuboidRayTraceResult hit : results) { - if (hit != null) { - if (curClosest > hit.dist) { - closestHit = hit; - curClosest = hit.dist; - } - } - } - return closestHit; - } - - /** - * This method goes by the assumption you don't care about IndexedCuboids and their extra data. - * Useful for adding hitboxes to blocks that don't actually do anything but visuals. - * - * @param start The vector to start RayTracing from. - * @param end The vector to stop RayTracing at. - * @param pos The position offset for the start and enc vector. - * @param boxes The cuboids to trace. - * @return The closest hit to the start vector. - */ - public static CuboidRayTraceResult rayTraceCuboidsClosest(Vector3 start, Vector3 end, BlockPos pos, AxisAlignedBB... boxes) { - List cuboidList = new LinkedList(); - if (boxes != null) { - for (AxisAlignedBB box : boxes) { - cuboidList.add(new IndexedCuboid6(0, box)); - } - } - return rayTraceCuboidsClosest(start, end, cuboidList, pos); - } - - /** - * This method goes by the assumption you don't care about IndexedCuboids and their extra data. - * Useful for adding hitboxes to blocks that don't actually do anything but visuals. - * - * @param start The vector to start RayTracing from. - * @param end The vector to stop RayTracing at. - * @param pos The position offset for the start and enc vector. - * @param boxes The cuboids to trace. - * @return The closest hit to the start vector. - */ - public static CuboidRayTraceResult rayTraceCuboidsClosest(Vec3d start, Vec3d end, BlockPos pos, AxisAlignedBB... boxes) { - List cuboidList = new LinkedList(); - if (boxes != null) { - for (AxisAlignedBB box : boxes) { - cuboidList.add(new IndexedCuboid6(0, box)); - } - } - return rayTraceCuboidsClosest(start, end, cuboidList, pos); - } - - /** - * This method goes by the assumption you don't care about IndexedCuboids and their extra data. - * Useful for adding hitboxes to blocks that don't actually do anything but visuals. - * - * @param start The vector to start RayTracing from. - * @param end The vector to stop RayTracing at. - * @param pos The position offset for the start and enc vector. - * @param cuboids The cuboids to trace. - * @return The closest hit to the start vector. - */ - public static CuboidRayTraceResult rayTraceCuboidsClosest(Vector3 start, Vector3 end, BlockPos pos, Cuboid6... cuboids) { - List cuboidList = new LinkedList(); - if (cuboids != null) { - for (Cuboid6 cuboid : cuboids) { - cuboidList.add(new IndexedCuboid6(0, cuboid)); - } - } - return rayTraceCuboidsClosest(start, end, cuboidList, pos); - } - - /** - * This method goes by the assumption you don't care about IndexedCuboids and their extra data. - * Useful for adding hitboxes to blocks that don't actually do anything but visuals. - * - * @param start The vector to start RayTracing from. - * @param end The vector to stop RayTracing at. - * @param pos The position offset for the start and enc vector. - * @param cuboids The cuboids to trace. - * @return The closest hit to the start vector. - */ - public static CuboidRayTraceResult rayTraceCuboidsClosest(Vec3d start, Vec3d end, BlockPos pos, Cuboid6... cuboids) { - List cuboidList = new LinkedList(); - if (cuboids != null) { - for (Cuboid6 cuboid : cuboids) { - cuboidList.add(new IndexedCuboid6(0, cuboid)); - } - } - return rayTraceCuboidsClosest(start, end, cuboidList, pos); - } - - /** - * @param start The vector to start RayTracing from. - * @param end The Vector to stop RayTracing at. - * @param pos The position offset for the start and end vector. - * @param cuboids The cuboids to check for a hit. - * @return The closest hit to the start vector. - */ - public static CuboidRayTraceResult rayTraceCuboidsClosest(Vector3 start, Vector3 end, BlockPos pos, IndexedCuboid6... cuboids) { - List cuboidList = new LinkedList(); - if (cuboids != null) { - Collections.addAll(cuboidList, cuboids); - } - return rayTraceCuboidsClosest(start, end, cuboidList, pos); - } - - /** - * @param start The vector to start RayTracing from. - * @param end The Vector to stop RayTracing at. - * @param pos The position offset for the start and end vector. - * @param cuboids The cuboids to check for a hit. - * @return The closest hit to the start vector. - */ - public static CuboidRayTraceResult rayTraceCuboidsClosest(Vec3d start, Vec3d end, BlockPos pos, IndexedCuboid6... cuboids) { - List cuboidList = new LinkedList(); - if (cuboids != null) { - Collections.addAll(cuboidList, cuboids); - } - return rayTraceCuboidsClosest(start, end, cuboidList, pos); - } - - /** - * Ray traces from start to end, if the ray intercepts the cuboid it returns a new CuboidRayTraceResult. - * - * @param pos The BlockPosition to subtract from the start and end vector. - * @param start The vector to start RayTracing from. - * @param end The vector to end RayTracing at. - * @param cuboid The cuboid to check for an intercept. - * @return A new CuboidRayTraceResult if successful, null if fail. - */ - public static CuboidRayTraceResult rayTrace(BlockPos pos, Vector3 start, Vector3 end, IndexedCuboid6 cuboid) { - Vector3 startRay = start.copy().subtract(pos); - Vector3 endRay = end.copy().subtract(pos); - RayTraceResult bbResult = cuboid.aabb().calculateIntercept(startRay.vec3(), endRay.vec3()); - - if (bbResult != null) { - Vector3 hitVec = new Vector3(bbResult.hitVec).add(pos); - EnumFacing sideHit = bbResult.sideHit; - double dist = hitVec.copy().subtract(start).magSquared(); - return new CuboidRayTraceResult(hitVec, pos, sideHit, cuboid, dist); - } - return null; - } - - public static RayTraceResult retraceBlock(World world, EntityPlayer player, BlockPos pos) { - Vec3d startVec = getStartVec(player); - Vec3d endVec = getEndVec(player); - return world.getBlockState(pos).collisionRayTrace(world, pos, startVec, endVec); - } - - private static double getBlockReachDistance_server(EntityPlayerMP player) { - return player.interactionManager.getBlockReachDistance(); - } - - @SideOnly (Side.CLIENT) - private static double getBlockReachDistance_client() { - return Minecraft.getMinecraft().playerController.getBlockReachDistance(); - } - - public static RayTraceResult retrace(EntityPlayer player) { - return retrace(player, getBlockReachDistance(player)); - } - - public static RayTraceResult retrace(EntityPlayer player, boolean stopOnFluid) { - Vec3d startVec = getStartVec(player); - Vec3d endVec = getEndVec(player); - return player.worldObj.rayTraceBlocks(startVec, endVec, stopOnFluid, false, true); - } - - public static RayTraceResult retrace(EntityPlayer player, double reach, boolean stopOnFluids) { - Vec3d startVec = getStartVec(player); - Vec3d endVec = getEndVec(player, reach); - return player.worldObj.rayTraceBlocks(startVec, endVec, stopOnFluids, false, true); - } - - public static RayTraceResult retrace(EntityPlayer player, double reach) { - return retrace(player, reach, true); - } - - public static Vec3d getCorrectedHeadVec(EntityPlayer player) { - Vector3 v = Vector3.fromEntity(player).add(0, player.getEyeHeight(), 0); - return v.vec3(); - } - - public static Vec3d getStartVec(EntityPlayer player) { - return getCorrectedHeadVec(player); - } - - public static double getBlockReachDistance(EntityPlayer player) { - return player.worldObj.isRemote ? getBlockReachDistance_client() : player instanceof EntityPlayerMP ? getBlockReachDistance_server((EntityPlayerMP) player) : 5D; - } - - public static Vec3d getEndVec(EntityPlayer player) { - Vec3d headVec = getCorrectedHeadVec(player); - Vec3d lookVec = player.getLook(1.0F); - double reach = getBlockReachDistance(player); - return headVec.addVector(lookVec.xCoord * reach, lookVec.yCoord * reach, lookVec.zCoord * reach); - } - - public static Vec3d getEndVec(EntityPlayer player, double reach) { - Vec3d headVec = getCorrectedHeadVec(player); - Vec3d lookVec = player.getLook(1.0F); - return headVec.addVector(lookVec.xCoord * reach, lookVec.yCoord * reach, lookVec.zCoord * reach); - } -} diff --git a/dependencies/main/java/codechicken/lib/render/BlockRenderer.java b/dependencies/main/java/codechicken/lib/render/BlockRenderer.java deleted file mode 100644 index ea5c7eba26..0000000000 --- a/dependencies/main/java/codechicken/lib/render/BlockRenderer.java +++ /dev/null @@ -1,207 +0,0 @@ -package codechicken.lib.render; - -import codechicken.lib.lighting.LC; -import codechicken.lib.render.pipeline.IVertexSource; -import codechicken.lib.render.pipeline.attribute.AttributeKey; -import codechicken.lib.render.pipeline.attribute.LightCoordAttribute; -import codechicken.lib.render.pipeline.attribute.SideAttribute; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Vertex5; - -//TODO Ability to use this without lighting. -public class BlockRenderer { - - public static class BlockFace implements IVertexSource { - - public Vertex5[] verts = new Vertex5[] { new Vertex5(), new Vertex5(), new Vertex5(), new Vertex5() }; - public LC[] lightCoords = new LC[] { new LC(), new LC(), new LC(), new LC() }; - public boolean lcComputed = false; - public int side; - - @Override - public Vertex5[] getVertices() { - return verts; - } - - @Override - public T getAttributes(AttributeKey attr) { - return LightCoordAttribute.attributeKey.equals(attr) && lcComputed ? (T) lightCoords : null; - } - - @Override - public boolean hasAttribute(AttributeKey attr) { - return SideAttribute.attributeKey.equals(attr) || LightCoordAttribute.attributeKey.equals(attr) && lcComputed; - } - - @Override - public void prepareVertex(CCRenderState state) { - state.side = side; - } - - public BlockFace computeLightCoords() { - if (!lcComputed) { - for (int i = 0; i < 4; i++) { - lightCoords[i].compute(verts[i].vec, side); - } - lcComputed = true; - } - return this; - } - - public BlockFace loadCuboidFace(Cuboid6 c, int side) { - double x1 = c.min.x; - double x2 = c.max.x; - double y1 = c.min.y; - double y2 = c.max.y; - double z1 = c.min.z; - double z2 = c.max.z; - double u1; - double u2; - double v1; - double v2; - this.side = side; - lcComputed = false; - - switch (side) { - case 0: - u1 = x1; - v1 = z1; - u2 = x2; - v2 = z2; - verts[0].set(x1, y1, z2, u1, v2, 0); - verts[1].set(x1, y1, z1, u1, v1, 0); - verts[2].set(x2, y1, z1, u2, v1, 0); - verts[3].set(x2, y1, z2, u2, v2, 0); - break; - case 1: - u1 = x1; - v1 = z1; - u2 = x2; - v2 = z2; - verts[0].set(x2, y2, z2, u2, v2, 1); - verts[1].set(x2, y2, z1, u2, v1, 1); - verts[2].set(x1, y2, z1, u1, v1, 1); - verts[3].set(x1, y2, z2, u1, v2, 1); - break; - case 2: - u1 = 1 - x1; - v1 = 1 - y2; - u2 = 1 - x2; - v2 = 1 - y1; - verts[0].set(x1, y1, z1, u1, v2, 2); - verts[1].set(x1, y2, z1, u1, v1, 2); - verts[2].set(x2, y2, z1, u2, v1, 2); - verts[3].set(x2, y1, z1, u2, v2, 2); - break; - case 3: - u1 = x1; - v1 = 1 - y2; - u2 = x2; - v2 = 1 - y1; - verts[0].set(x2, y1, z2, u2, v2, 3); - verts[1].set(x2, y2, z2, u2, v1, 3); - verts[2].set(x1, y2, z2, u1, v1, 3); - verts[3].set(x1, y1, z2, u1, v2, 3); - break; - case 4: - u1 = z1; - v1 = 1 - y2; - u2 = z2; - v2 = 1 - y1; - verts[0].set(x1, y1, z2, u2, v2, 4); - verts[1].set(x1, y2, z2, u2, v1, 4); - verts[2].set(x1, y2, z1, u1, v1, 4); - verts[3].set(x1, y1, z1, u1, v2, 4); - break; - case 5: - u1 = 1 - z1; - v1 = 1 - y2; - u2 = 1 - z2; - v2 = 1 - y1; - verts[0].set(x2, y1, z1, u1, v2, 5); - verts[1].set(x2, y2, z1, u1, v1, 5); - verts[2].set(x2, y2, z2, u2, v1, 5); - verts[3].set(x2, y1, z2, u2, v2, 5); - } - return this; - } - } - - public static class FullBlock implements IVertexSource { - - public Vertex5[] verts = CCModel.quadModel(24).generateBlock(0, Cuboid6.full).verts; - public LC[] lightCoords = new LC[24]; - - public FullBlock() { - for (int i = 0; i < 24; i++) { - lightCoords[i] = new LC().compute(verts[i].vec, i / 4); - } - } - - @Override - public Vertex5[] getVertices() { - return verts; - } - - @Override - public T getAttributes(AttributeKey attr) { - return LightCoordAttribute.attributeKey.equals(attr) ? (T) lightCoords : null; - } - - @Override - public boolean hasAttribute(AttributeKey attr) { - return SideAttribute.attributeKey.equals(attr) || LightCoordAttribute.attributeKey.equals(attr); - } - - @Override - public void prepareVertex(CCRenderState state) { - state.side = state.vertexIndex >> 2; - } - } - - public static FullBlock fullBlock = new FullBlock(); - - public static void renderFullBlock(CCRenderState state, int sideMask) { - state.setModel(fullBlock); - renderFaces(state, sideMask); - } - - /** - * Renders faces of a block-like model based on a sideMask. Eg for side 2, verts 8-11 will be rendered - * - * @param sideMask A mask of faces not to render - */ - public static void renderFaces(CCRenderState state, int sideMask) { - if (sideMask == 0x3F) { - return; - } - for (int s = 0; s < 6; s++) { - if ((sideMask & 1 << s) == 0) { - state.setVertexRange(s * 4, (s + 1) * 4); - state.render(); - } - } - } - - private static BlockFace face = new BlockFace(); - - /** - * Renders faces of a cuboid with texture coordinates mapped to match a standard minecraft block - * - * @param bounds The bounding cuboid to render - * @param sideMask A mask of faces not to render - */ - public static void renderCuboid(CCRenderState state, Cuboid6 bounds, int sideMask) { - if (sideMask == 0x3F) { - return; - } - - state.setModel(face); - for (int s = 0; s < 6; s++) { - if ((sideMask & 1 << s) == 0) { - face.loadCuboidFace(bounds, s); - state.render(); - } - } - } -} diff --git a/dependencies/main/java/codechicken/lib/render/CCIconRegister.java b/dependencies/main/java/codechicken/lib/render/CCIconRegister.java deleted file mode 100644 index fb67fa327f..0000000000 --- a/dependencies/main/java/codechicken/lib/render/CCIconRegister.java +++ /dev/null @@ -1,52 +0,0 @@ -package codechicken.lib.render; - -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.ResourceLocation; - -import java.util.ArrayList; - -/** - * Created by covers1624 on 5/22/2016. - */ -public class CCIconRegister implements IIconRegister { - - public static ArrayList locations = new ArrayList(); - - static { - TextureUtils.addIconRegister(new CCIconRegister()); - } - - @Override - public void registerIcons(TextureMap textureMap) { - for (ResourceLocation texture : locations) { - textureMap.registerSprite(texture); - } - } - - public static void registerTexture(String texture) { - registerTexture(new ResourceLocation(texture)); - } - - public static void registerTexture(ResourceLocation location) { - locations.add(location); - } - - public static void registerBlockTexture(String string) { - registerBlockTexture(new ResourceLocation(string)); - } - - public static void registerBlockTexture(ResourceLocation location) { - registerTexture(new ResourceLocation(location.getResourceDomain(), "blocks/" + location.getResourcePath())); - } - - public static void registerItemTexture(String string) { - registerItemTexture(new ResourceLocation(string)); - } - - public static void registerItemTexture(ResourceLocation location) { - registerTexture(new ResourceLocation(location.getResourceDomain(), "items/" + location.getResourcePath())); - } - -} diff --git a/dependencies/main/java/codechicken/lib/render/CCModel.java b/dependencies/main/java/codechicken/lib/render/CCModel.java deleted file mode 100644 index 13c4b5695e..0000000000 --- a/dependencies/main/java/codechicken/lib/render/CCModel.java +++ /dev/null @@ -1,901 +0,0 @@ -package codechicken.lib.render; - -import codechicken.lib.lighting.LC; -import codechicken.lib.lighting.LightModel; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.render.pipeline.IVertexSource; -import codechicken.lib.render.pipeline.VertexAttribute; -import codechicken.lib.render.pipeline.attribute.*; -import codechicken.lib.render.pipeline.attribute.AttributeKey.AttributeKeyRegistry; -import codechicken.lib.util.ArrayUtils; -import codechicken.lib.util.Copyable; -import codechicken.lib.util.VectorUtils; -import codechicken.lib.vec.*; -import codechicken.lib.vec.uv.UV; -import codechicken.lib.vec.uv.UVTransformation; -import codechicken.lib.vec.uv.UVTranslation; - -import java.util.*; - -import static codechicken.lib.vec.Rotation.sideRotations; - -public class CCModel implements IVertexSource, Copyable { - - private static class PositionNormalEntry { - - public Vector3 pos; - public LinkedList normals = new LinkedList(); - - public PositionNormalEntry(Vector3 position) { - pos = position; - } - - public boolean positionEqual(Vector3 v) { - return pos.x == v.x && pos.y == v.y && pos.z == v.z; - } - - public PositionNormalEntry addNormal(Vector3 normal) { - normals.add(normal); - return this; - } - } - - public final int vertexMode; - public final int vp; - public Vertex5[] verts; - public ArrayList attributes = new ArrayList(); - - protected CCModel(int vertexMode) { - if (vertexMode != 7 && vertexMode != 4) { - throw new IllegalArgumentException("Models must be GL_QUADS or GL_TRIANGLES"); - } - - this.vertexMode = vertexMode; - vp = vertexMode == 7 ? 4 : 3; - } - - public Vector3[] normals() { - return getAttributes(NormalAttribute.attributeKey); - } - - @Override - public Vertex5[] getVertices() { - return verts; - } - - @Override - public T getAttributes(AttributeKey attr) { - if (attr.attributeKeyIndex < attributes.size()) { - return (T) attributes.get(attr.attributeKeyIndex); - } - return null; - } - - @Override - public boolean hasAttribute(AttributeKey attr) { - return attr.attributeKeyIndex < attributes.size() && attributes.get(attr.attributeKeyIndex) != null; - } - - @Override - public void prepareVertex(CCRenderState state) { - } - - public T getOrAllocate(AttributeKey attr) { - T array = getAttributes(attr); - if (array == null) { - while (attributes.size() <= attr.attributeKeyIndex) { - attributes.add(null); - } - attributes.set(attr.attributeKeyIndex, array = attr.newArray(verts.length)); - } - return array; - } - - /** - * Each pixel corresponds to one unit of position when generating the model - * - * @param i Vertex index to start generating at - * @param x1 The minX bound of the box - * @param y1 The minY bound of the box - * @param z1 The minZ bound of the box - * @param w The width of the box - * @param h The height of the box - * @param d The depth of the box - * @param tx The distance of the top left corner of the texture map from the left in pixels - * @param ty The distance of the top left corner of the texture map from the top in pixels - * @param tw The width of the texture in pixels - * @param th The height of the texture in pixels - * @param f The scale of the model, pixels per block, normally 16 - * @return The generated model - */ - public CCModel generateBox(int i, double x1, double y1, double z1, double w, double h, double d, double tx, double ty, double tw, double th, double f) { - double u1, v1, u2, v2; - double x2 = x1 + w; - double y2 = y1 + h; - double z2 = z1 + d; - x1 /= f; - x2 /= f; - y1 /= f; - y2 /= f; - z1 /= f; - z2 /= f; - - //bottom face - u1 = (tx + d + w) / tw; - v1 = (ty + d) / th; - u2 = (tx + d * 2 + w) / tw; - v2 = ty / th; - verts[i++] = new Vertex5(x1, y1, z2, u1, v2); - verts[i++] = new Vertex5(x1, y1, z1, u1, v1); - verts[i++] = new Vertex5(x2, y1, z1, u2, v1); - verts[i++] = new Vertex5(x2, y1, z2, u2, v2); - - //top face - u1 = (tx + d) / tw; - v1 = (ty + d) / th; - u2 = (tx + d + w) / tw; - v2 = ty / th; - verts[i++] = new Vertex5(x2, y2, z2, u2, v2); - verts[i++] = new Vertex5(x2, y2, z1, u2, v1); - verts[i++] = new Vertex5(x1, y2, z1, u1, v1); - verts[i++] = new Vertex5(x1, y2, z2, u1, v2); - - //front face - u1 = (tx + d + w) / tw; - v1 = (ty + d) / th; - u2 = (tx + d) / tw; - v2 = (ty + d + h) / th; - verts[i++] = new Vertex5(x1, y2, z1, u2, v1); - verts[i++] = new Vertex5(x2, y2, z1, u1, v1); - verts[i++] = new Vertex5(x2, y1, z1, u1, v2); - verts[i++] = new Vertex5(x1, y1, z1, u2, v2); - - //back face - u1 = (tx + d * 2 + w * 2) / tw; - v1 = (ty + d) / th; - u2 = (tx + d * 2 + w) / tw; - v2 = (ty + d + h) / th; - verts[i++] = new Vertex5(x1, y2, z2, u1, v1); - verts[i++] = new Vertex5(x1, y1, z2, u1, v2); - verts[i++] = new Vertex5(x2, y1, z2, u2, v2); - verts[i++] = new Vertex5(x2, y2, z2, u2, v1); - - //left face - u1 = (tx + d) / tw; - v1 = (ty + d) / th; - u2 = (tx) / tw; - v2 = (ty + d + h) / th; - verts[i++] = new Vertex5(x1, y2, z2, u2, v1); - verts[i++] = new Vertex5(x1, y2, z1, u1, v1); - verts[i++] = new Vertex5(x1, y1, z1, u1, v2); - verts[i++] = new Vertex5(x1, y1, z2, u2, v2); - - //right face - u1 = (tx + d * 2 + w) / tw; - v1 = (ty + d) / th; - u2 = (tx + d + w) / tw; - v2 = (ty + d + h) / th; - verts[i++] = new Vertex5(x2, y1, z2, u1, v2); - verts[i++] = new Vertex5(x2, y1, z1, u2, v2); - verts[i++] = new Vertex5(x2, y2, z1, u2, v1); - verts[i++] = new Vertex5(x2, y2, z2, u1, v1); - - return this; - } - - /** - * Generates a box, uv mapped to be the same as a minecraft block with the same bounds - * - * @param i The vertex index to start generating at - * @param bounds The bounds of the block, 0 to 1 - * @return The generated model. When rendering an icon will need to be supplied for the UV transformation. - */ - public CCModel generateBlock(int i, Cuboid6 bounds) { - return generateBlock(i, bounds, 0); - } - - public CCModel generateBlock(int i, Cuboid6 bounds, int mask) { - return generateBlock(i, bounds.min.x, bounds.min.y, bounds.min.z, bounds.max.x, bounds.max.y, bounds.max.z, mask); - } - - public CCModel generateBlock(int i, double x1, double y1, double z1, double x2, double y2, double z2) { - return generateBlock(i, x1, y1, z1, x2, y2, z2, 0); - } - - /** - * Generates a box, uv mapped to be the same as a minecraft block with the same bounds - * - * @param i The vertex index to start generating at - * @param x1 minX - * @param y1 minY - * @param z1 minZ - * @param x2 maxX - * @param y2 maxY - * @param z2 maxZ - * @param mask A bitmask of sides NOT to generate. I high bit at index s means side s will not be generated - * @return The generated model. When rendering an icon will need to be supplied for the UV transformation. - */ - public CCModel generateBlock(int i, double x1, double y1, double z1, double x2, double y2, double z2, int mask) { - double u1, v1, u2, v2; - - if ((mask & 1) == 0) {//bottom face - u1 = x1; - v1 = z1; - u2 = x2; - v2 = z2; - verts[i++] = new Vertex5(x1, y1, z2, u1, v2, 0); - verts[i++] = new Vertex5(x1, y1, z1, u1, v1, 0); - verts[i++] = new Vertex5(x2, y1, z1, u2, v1, 0); - verts[i++] = new Vertex5(x2, y1, z2, u2, v2, 0); - } - - if ((mask & 2) == 0) {//top face - u1 = x1; - v1 = z1; - u2 = x2; - v2 = z2; - verts[i++] = new Vertex5(x2, y2, z2, u2, v2, 1); - verts[i++] = new Vertex5(x2, y2, z1, u2, v1, 1); - verts[i++] = new Vertex5(x1, y2, z1, u1, v1, 1); - verts[i++] = new Vertex5(x1, y2, z2, u1, v2, 1); - } - - if ((mask & 4) == 0) {//east face - u1 = 1 - x1; - v1 = 1 - y2; - u2 = 1 - x2; - v2 = 1 - y1; - verts[i++] = new Vertex5(x1, y1, z1, u1, v2, 2); - verts[i++] = new Vertex5(x1, y2, z1, u1, v1, 2); - verts[i++] = new Vertex5(x2, y2, z1, u2, v1, 2); - verts[i++] = new Vertex5(x2, y1, z1, u2, v2, 2); - } - - if ((mask & 8) == 0) {//west face - u1 = x1; - v1 = 1 - y2; - u2 = x2; - v2 = 1 - y1; - verts[i++] = new Vertex5(x2, y1, z2, u2, v2, 3); - verts[i++] = new Vertex5(x2, y2, z2, u2, v1, 3); - verts[i++] = new Vertex5(x1, y2, z2, u1, v1, 3); - verts[i++] = new Vertex5(x1, y1, z2, u1, v2, 3); - } - - if ((mask & 0x10) == 0) {//north face - u1 = z1; - v1 = 1 - y2; - u2 = z2; - v2 = 1 - y1; - verts[i++] = new Vertex5(x1, y1, z2, u2, v2, 4); - verts[i++] = new Vertex5(x1, y2, z2, u2, v1, 4); - verts[i++] = new Vertex5(x1, y2, z1, u1, v1, 4); - verts[i++] = new Vertex5(x1, y1, z1, u1, v2, 4); - } - - if ((mask & 0x20) == 0) {//south face - u1 = 1 - z1; - v1 = 1 - y2; - u2 = 1 - z2; - v2 = 1 - y1; - verts[i++] = new Vertex5(x2, y1, z1, u1, v2, 5); - verts[i++] = new Vertex5(x2, y2, z1, u1, v1, 5); - verts[i++] = new Vertex5(x2, y2, z2, u2, v1, 5); - verts[i++] = new Vertex5(x2, y1, z2, u2, v2, 5); - } - - return this; - } - - /** - * Generates a model using 2 Cuboids. - * c1 defines the size of the top face. - * c2 defines the size of the bottom face. - * the sides are generated on an angle between c1 and c2. - * - * @param i The vertex index to start generating at - * @param c1 The top face cuboid. - * @param c2 The bottom face cuboid. - * @return - */ - @Deprecated - public CCModel generateDualCuboidBlock(int i, Cuboid6 c1, Cuboid6 c2) { - double x11 = c1.min.x; - double y11 = c1.min.y; - double z11 = c1.min.z; - double x12 = c1.max.x; - double y12 = c1.max.y; - double z12 = c1.max.z; - - double x21 = c2.min.x; - double y21 = c2.min.y; - double z21 = c2.min.z; - double x22 = c2.max.x; - double y22 = c2.max.y; - double z22 = c2.max.z; - - double u11, v11, u12, v12; - double u21, v21, u22, v22; - - //bottom face - u11 = x11; - v11 = z11; - u12 = x12; - v12 = z12; - verts[i++] = new Vertex5(x11, y11, z12, u11, v12, 0); - verts[i++] = new Vertex5(x11, y11, z11, u11, v11, 0); - verts[i++] = new Vertex5(x12, y11, z11, u12, v11, 0); - verts[i++] = new Vertex5(x12, y11, z12, u12, v12, 0); - - //top face - u21 = x21; - v21 = z21; - u22 = x22; - v22 = z22; - verts[i++] = new Vertex5(x22, y22, z22, u22, v22, 1); - verts[i++] = new Vertex5(x22, y22, z21, u22, v21, 1); - verts[i++] = new Vertex5(x21, y22, z21, u21, v21, 1); - verts[i++] = new Vertex5(x21, y22, z22, u21, v22, 1); - - //east face - u11 = 1 - x11; - v11 = 1 - y12; - u12 = 1 - x12; - v12 = 1 - y11; - - u21 = 1 - x21; - v21 = 1 - y22; - u22 = 1 - x22; - v22 = 1 - y21; - - verts[i++] = new Vertex5(x11, y11, z11, u11, v12, 2); - verts[i++] = new Vertex5(x21, y22, z21, u21, v21, 2); - verts[i++] = new Vertex5(x22, y22, z21, u22, v21, 2); - verts[i++] = new Vertex5(x12, y11, z11, u12, v12, 2); - - //west face - u11 = x11; - v11 = 1 - y12; - u12 = x12; - v12 = 1 - y11; - - u21 = x21; - v21 = 1 - y22; - u22 = x22; - v22 = 1 - y21; - - verts[i++] = new Vertex5(x12, y11, z12, u12, v12, 3); - verts[i++] = new Vertex5(x22, y22, z22, u22, v21, 3); - verts[i++] = new Vertex5(x21, y22, z22, u21, v21, 3); - verts[i++] = new Vertex5(x11, y11, z12, u11, v12, 3); - - //north face - u11 = z11; - v11 = 1 - y12; - u12 = z12; - v12 = 1 - y11; - - u21 = z21; - v21 = 1 - y22; - u22 = z22; - v22 = 1 - y21; - - verts[i++] = new Vertex5(x11, y11, z12, u12, v12, 4); - verts[i++] = new Vertex5(x21, y22, z22, u22, v21, 4); - verts[i++] = new Vertex5(x21, y22, z21, u21, v21, 4); - verts[i++] = new Vertex5(x11, y11, z11, u11, v12, 4); - - //south face - u11 = 1 - z11; - v11 = 1 - y12; - u12 = 1 - z12; - v12 = 1 - y11; - - u21 = 1 - z21; - v21 = 1 - y22; - u22 = 1 - z22; - v22 = 1 - y21; - - verts[i++] = new Vertex5(x12, y11, z11, u11, v12, 5); - verts[i++] = new Vertex5(x22, y22, z21, u21, v21, 5); - verts[i++] = new Vertex5(x22, y22, z22, u22, v21, 5); - verts[i++] = new Vertex5(x12, y11, z12, u12, v12, 5); - - return this; - } - - public CCModel computeNormals() { - return computeNormals(0, verts.length); - } - - /** - * Computes the normals of all faces in the model. - * Uses the cross product of the vectors along 2 sides of the face - * - * @param start The first vertex to generate normals for - * @param length The number of vertices to generate normals for. Note this must be a multiple of 3 for triangles or 4 for quads - * @return The model - */ - public CCModel computeNormals(int start, int length) { - if (length % vp != 0 || start % vp != 0) { - throw new IllegalArgumentException("Cannot generate normals across polygons"); - } - - Vector3[] normals = getOrAllocate(NormalAttribute.attributeKey); - for (int k = 0; k < length; k += vp) { - int i = k + start; - Vector3 diff1 = verts[i + 1].vec.copy().subtract(verts[i].vec); - Vector3 diff2 = verts[i + vp - 1].vec.copy().subtract(verts[i].vec); - normals[i] = diff1.crossProduct(diff2).normalize(); - for (int d = 1; d < vp; d++) { - normals[i + d] = normals[i].copy(); - } - } - - return this; - } - - /** - * Computes lighting using the normals add a light model - * If the model is rotated, the lighting will no longer be valid - * - * @return The model - */ - public CCModel computeLighting(LightModel light) { - Vector3[] normals = normals(); - int[] colours = getAttributes(LightingAttribute.attributeKey); - if (colours == null) { - colours = getOrAllocate(LightingAttribute.attributeKey); - Arrays.fill(colours, -1); - } - for (int k = 0; k < verts.length; k++) { - colours[k] = light.apply(colours[k], normals[k]); - } - return this; - } - - public CCModel setColour(int c) { - int[] colours = getOrAllocate(ColourAttribute.attributeKey); - Arrays.fill(colours, c); - return this; - } - - /** - * Computes the minecraft lighting coordinates for use with a LightMatrix - * - * @return The model - */ - public CCModel computeLightCoords() { - LC[] lcs = getOrAllocate(LightCoordAttribute.attributeKey); - Vector3[] normals = normals(); - for (int i = 0; i < verts.length; i++) { - lcs[i] = new LC().compute(verts[i].vec, normals[i]); - } - return this; - } - - /** - * Averages all normals at the same position to produce a smooth lighting effect. - * - * @return The model - */ - public CCModel smoothNormals() { - ArrayList map = new ArrayList(); - Vector3[] normals = normals(); - nextvert: - for (int k = 0; k < verts.length; k++) { - Vector3 vec = verts[k].vec; - for (PositionNormalEntry e : map) { - if (e.positionEqual(vec)) { - e.addNormal(normals[k]); - continue nextvert; - } - } - - map.add(new PositionNormalEntry(vec).addNormal(normals[k])); - } - - for (PositionNormalEntry e : map) { - if (e.normals.size() <= 1) { - continue; - } - - Vector3 new_n = new Vector3(); - for (Vector3 n : e.normals) { - new_n.add(n); - } - - new_n.normalize(); - for (Vector3 n : e.normals) { - n.set(new_n); - } - } - - return this; - } - - public CCModel apply(Transformation t) { - for (int k = 0; k < verts.length; k++) { - verts[k].apply(t); - } - - Vector3[] normals = normals(); - if (normals != null) { - for (int k = 0; k < normals.length; k++) { - t.applyN(normals[k]); - } - } - - return this; - } - - public CCModel apply(UVTransformation uvt) { - for (int k = 0; k < verts.length; k++) { - verts[k].apply(uvt); - } - - return this; - } - - public CCModel expand(int extraVerts) { - int newLen = verts.length + extraVerts; - verts = Arrays.copyOf(verts, newLen); - for (int i = 0; i < attributes.size(); i++) { - if (attributes.get(i) != null) { - attributes.set(i, VertexAttribute.copyOf((AttributeKey) AttributeKeyRegistry.getAttributeKey(i), attributes.get(i), newLen)); - } - } - - return this; - } - - public void render(CCRenderState state, double x, double y, double z, double u, double v) { - render(state, new Vector3(x, y, z).translation(), new UVTranslation(u, v)); - } - - public void render(CCRenderState state, double x, double y, double z, UVTransformation u) { - render(state, new Vector3(x, y, z).translation(), u); - } - - public void render(CCRenderState state, Transformation t, double u, double v) { - render(state, t, new UVTranslation(u, v)); - } - - public void render(CCRenderState state, IVertexOperation... ops) { - render(state, 0, verts.length, ops); - } - - /** - * Renders vertices start through start+length-1 of the model - * - * @param start The first vertex index to render - * @param end The vertex index to render until - * @param ops Operations to apply - */ - public void render(CCRenderState state, int start, int end, IVertexOperation... ops) { - state.setPipeline(this, start, end, ops); - state.render(); - } - - public static CCModel quadModel(int numVerts) { - return newModel(7, numVerts); - } - - public static CCModel triModel(int numVerts) { - return newModel(4, numVerts); - } - - public static CCModel newModel(int vertexMode, int numVerts) { - CCModel model = newModel(vertexMode); - model.verts = new Vertex5[numVerts]; - return model; - } - - public static CCModel newModel(int vertexMode) { - return new CCModel(vertexMode); - } - - public static CCModel createModel(List verts, List uvs, List normals, int vertexMode, List polys) { - int vp = vertexMode == 7 ? 4 : 3; - if (polys.size() < vp || polys.size() % vp != 0) { - throw new IllegalArgumentException("Invalid number of vertices for model: " + polys.size()); - } - - boolean hasNormals = polys.get(0)[2] > 0; - CCModel model = CCModel.newModel(vertexMode, polys.size()); - if (hasNormals) { - model.getOrAllocate(NormalAttribute.attributeKey); - } - - for (int i = 0; i < polys.size(); i++) { - int[] ai = polys.get(i); - Vector3 vert = verts.get(ai[0] - 1).copy(); - Vector3 uv = ai[1] <= 0 ? new Vector3() : uvs.get(ai[1] - 1).copy(); - if (ai[2] > 0 != hasNormals) { - throw new IllegalArgumentException("Normals are an all or nothing deal here."); - } - - model.verts[i] = new Vertex5(vert, uv.x, uv.y); - if (hasNormals) { - model.normals()[i] = normals.get(ai[2] - 1).copy(); - } - } - - return model; - } - - /** - * Brings the UV coordinates of each face closer to the center UV by d. - * Useful for fixing texture seams - */ - public CCModel shrinkUVs(double d) { - for (int k = 0; k < verts.length; k += vp) { - UV uv = new UV(); - for (int i = 0; i < vp; i++) { - uv.add(verts[k + i].uv); - } - uv.multiply(1D / vp); - for (int i = 0; i < vp; i++) { - Vertex5 vert = verts[k + i]; - vert.uv.u += vert.uv.u < uv.u ? d : -d; - vert.uv.v += vert.uv.v < uv.v ? d : -d; - } - } - return this; - } - - /** - * @param side1 The side of this model - * @param side2 The side of the new model - * @param point The point to rotate around - * @return A copy of this model rotated to the appropriate side - */ - public CCModel sidedCopy(int side1, int side2, Vector3 point) { - return copy().apply(new TransformationList(sideRotations[side1].inverse(), sideRotations[side2]).at(point)); - } - - /** - * Copies length vertices and normals - */ - public static void copy(CCModel src, int srcpos, CCModel dst, int destpos, int length) { - for (int k = 0; k < length; k++) { - dst.verts[destpos + k] = src.verts[srcpos + k].copy(); - } - - for (int i = 0; i < src.attributes.size(); i++) { - if (src.attributes.get(i) != null) { - ArrayUtils.arrayCopy(src.attributes.get(i), srcpos, dst.getOrAllocate(AttributeKeyRegistry.getAttributeKey(i)), destpos, length); - } - } - } - - /** - * Generate models rotated to the other 5 sides of the block - * - * @param models An array of 6 models - * @param side The side of this model - * @param point The rotation point - */ - public static void generateSidedModels(CCModel[] models, int side, Vector3 point) { - for (int s = 0; s < 6; s++) { - if (s == side) { - continue; - } - - models[s] = models[side].sidedCopy(side, s, point); - } - } - - /** - * Generate models rotated to the other 3 horizontal of the block - * - * @param models An array of 4 models - * @param side The side of this model - * @param point The rotation point - */ - public static void generateSidedModelsH(CCModel[] models, int side, Vector3 point) { - for (int s = 2; s < 6; s++) { - if (s == side) { - continue; - } - - models[s] = models[side].sidedCopy(side, s, point); - } - } - - public CCModel backfacedCopy() { - return generateBackface(this, 0, copy(), 0, verts.length); - } - - /** - * Generates copies of faces with clockwise vertices - * - * @return The model - */ - public static CCModel generateBackface(CCModel src, int srcpos, CCModel dst, int destpos, int length) { - int vp = src.vp; - if (srcpos % vp != 0 || destpos % vp != 0 || length % vp != 0) { - throw new IllegalArgumentException("Vertices do not align with polygons"); - } - - int[][] o = new int[][] { { 0, 0 }, { 1, vp - 1 }, { 2, vp - 2 }, { 3, vp - 3 } }; - for (int i = 0; i < length; i++) { - int b = (i / vp) * vp; - int d = i % vp; - int di = destpos + b + o[d][1]; - int si = srcpos + b + o[d][0]; - dst.verts[di] = src.verts[si].copy(); - for (int a = 0; a < src.attributes.size(); a++) { - if (src.attributes.get(a) != null) { - ArrayUtils.arrayCopy(src.attributes.get(a), si, dst.getOrAllocate(AttributeKeyRegistry.getAttributeKey(a)), di, 1); - } - } - - if (dst.normals() != null && dst.normals()[di] != null) { - dst.normals()[di].negate(); - } - } - return dst; - } - - /** - * Generates sided copies of vertices into this model. - * Assumes that your model has been generated at vertex side*(numVerts/6) - */ - public CCModel generateSidedParts(int side, Vector3 point) { - if (verts.length % (6 * vp) != 0) { - throw new IllegalArgumentException("Invalid number of vertices for sided part generation"); - } - int length = verts.length / 6; - - for (int s = 0; s < 6; s++) { - if (s == side) { - continue; - } - - generateSidedPart(side, s, point, length * side, length * s, length); - } - - return this; - } - - /** - * Generates sided copies of vertices into this model. - * Assumes that your model has been generated at vertex side*(numVerts/4) - */ - public CCModel generateSidedPartsH(int side, Vector3 point) { - if (verts.length % (4 * vp) != 0) { - throw new IllegalArgumentException("Invalid number of vertices for sided part generation"); - } - int length = verts.length / 4; - - for (int s = 2; s < 6; s++) { - if (s == side) { - continue; - } - - generateSidedPart(side, s, point, length * (side - 2), length * (s - 2), length); - } - - return this; - } - - /** - * Generates a sided copy of verts into this model - */ - public CCModel generateSidedPart(int side1, int side2, Vector3 point, int srcpos, int destpos, int length) { - return apply(new TransformationList(sideRotations[side1].inverse(), sideRotations[side2]).at(point), srcpos, destpos, length); - } - - /** - * Generates a rotated copy of verts into this model - */ - public CCModel apply(Transformation t, int srcpos, int destpos, int length) { - for (int k = 0; k < length; k++) { - verts[destpos + k] = verts[srcpos + k].copy(); - verts[destpos + k].vec.apply(t); - } - - Vector3[] normals = normals(); - if (normals != null) { - for (int k = 0; k < length; k++) { - normals[destpos + k] = normals[srcpos + k].copy(); - t.applyN(normals[destpos + k]); - } - } - - return this; - } - - public static CCModel combine(Collection models) { - if (models.isEmpty()) { - return null; - } - - int numVerts = 0; - int vertexMode = -1; - for (CCModel model : models) { - if (vertexMode == -1) { - vertexMode = model.vertexMode; - } - if (vertexMode != model.vertexMode) { - throw new IllegalArgumentException("Cannot combine models with different vertex modes"); - } - - numVerts += model.verts.length; - } - - CCModel c_model = newModel(vertexMode, numVerts); - int i = 0; - for (CCModel model : models) { - copy(model, 0, c_model, i, model.verts.length); - i += model.verts.length; - } - - return c_model; - } - - public CCModel twoFacedCopy() { - CCModel model = newModel(vertexMode, verts.length * 2); - copy(this, 0, model, 0, verts.length); - return generateBackface(model, 0, model, verts.length, verts.length); - } - - public CCModel copy() { - CCModel model = newModel(vertexMode, verts.length); - copy(this, 0, model, 0, verts.length); - return model; - } - - /** - * @return The average of all vertices, for bones. - */ - public Vector3 collapse() { - Vector3 v = new Vector3(); - for (Vertex5 vert : verts) { - v.add(vert.vec); - } - v.multiply(1 / (double) verts.length); - return v; - } - - public CCModel zOffset(Cuboid6 offsets) { - for (int k = 0; k < verts.length; k++) { - Vertex5 vert = verts[k]; - Vector3 normal = normals()[k]; - switch (VectorUtils.findSide(normal)) { - case 0: - vert.vec.y += offsets.min.y; - break; - case 1: - vert.vec.y += offsets.max.y; - break; - case 2: - vert.vec.z += offsets.min.z; - break; - case 3: - vert.vec.z += offsets.max.z; - break; - case 4: - vert.vec.x += offsets.min.x; - break; - case 5: - vert.vec.x += offsets.max.x; - break; - } - } - return this; - } - - /** - * @return A Cuboid6 containing all the verts in this model - */ - public Cuboid6 bounds() { - Vector3 vec1 = verts[0].vec; - Cuboid6 c = new Cuboid6(vec1.copy(), vec1.copy()); - for (int i = 1; i < verts.length; i++) { - c.enclose(verts[i].vec); - } - return c; - } -} diff --git a/dependencies/main/java/codechicken/lib/render/CCModelLibrary.java b/dependencies/main/java/codechicken/lib/render/CCModelLibrary.java deleted file mode 100644 index 1a662055cc..0000000000 --- a/dependencies/main/java/codechicken/lib/render/CCModelLibrary.java +++ /dev/null @@ -1,83 +0,0 @@ -package codechicken.lib.render; - -import codechicken.lib.vec.Quat; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.Vertex5; - -import static codechicken.lib.math.MathHelper.phi; - -//TODO Maybe expand to some more platonic solids at some point. -public class CCModelLibrary { - - public static CCModel icosahedron4; - public static CCModel icosahedron7; - - private static int i; - - static { - generateIcosahedron(); - } - - private static void generateIcosahedron() { - Vector3[] verts = new Vector3[12]; - - verts[0] = new Vector3(-1, phi, 0); - verts[1] = new Vector3(1, phi, 0); - verts[2] = new Vector3(1, -phi, 0); - verts[3] = new Vector3(-1, -phi, 0); - - verts[4] = new Vector3(0, -1, phi); - verts[5] = new Vector3(0, 1, phi); - verts[6] = new Vector3(0, 1, -phi); - verts[7] = new Vector3(0, -1, -phi); - - verts[8] = new Vector3(phi, 0, -1); - verts[9] = new Vector3(phi, 0, 1); - verts[10] = new Vector3(-phi, 0, 1); - verts[11] = new Vector3(-phi, 0, -1); - - Quat quat = Quat.aroundAxis(0, 0, 1, Math.atan(1 / phi)); - for (Vector3 vec : verts) { - quat.rotate(vec); - } - - icosahedron4 = CCModel.newModel(4, 60); - icosahedron7 = CCModel.newModel(7, 80); - - i = 0; - //top - addIcosahedronTriangle(verts[1], 0.5, 0, verts[0], 0, 0.25, verts[5], 1, 0.25); - addIcosahedronTriangle(verts[1], 0.5, 0, verts[5], 0, 0.25, verts[9], 1, 0.25); - addIcosahedronTriangle(verts[1], 0.5, 0, verts[9], 0, 0.25, verts[8], 1, 0.25); - addIcosahedronTriangle(verts[1], 0.5, 0, verts[8], 0, 0.25, verts[6], 1, 0.25); - addIcosahedronTriangle(verts[1], 0.5, 0, verts[6], 0, 0.25, verts[0], 1, 0.25); - //centre 1vert top - addIcosahedronTriangle(verts[0], 0.5, 0.25, verts[11], 0, 0.75, verts[10], 1, 0.75); - addIcosahedronTriangle(verts[5], 0.5, 0.25, verts[10], 0, 0.75, verts[4], 1, 0.75); - addIcosahedronTriangle(verts[9], 0.5, 0.25, verts[4], 0, 0.75, verts[2], 1, 0.75); - addIcosahedronTriangle(verts[8], 0.5, 0.25, verts[2], 0, 0.75, verts[7], 1, 0.75); - addIcosahedronTriangle(verts[6], 0.5, 0.25, verts[7], 0, 0.75, verts[11], 1, 0.75); - //centre 1vert bottom - addIcosahedronTriangle(verts[2], 0.5, 0.75, verts[8], 0, 0.25, verts[9], 1, 0.25); - addIcosahedronTriangle(verts[7], 0.5, 0.75, verts[6], 0, 0.25, verts[8], 1, 0.25); - addIcosahedronTriangle(verts[11], 0.5, 0.75, verts[0], 0, 0.25, verts[6], 1, 0.25); - addIcosahedronTriangle(verts[10], 0.5, 0.75, verts[5], 0, 0.25, verts[0], 1, 0.25); - addIcosahedronTriangle(verts[4], 0.5, 0.75, verts[9], 0, 0.25, verts[5], 1, 0.25); - //bottom - addIcosahedronTriangle(verts[3], 0.5, 1, verts[2], 0, 0.75, verts[4], 1, 0.75); - addIcosahedronTriangle(verts[3], 0.5, 1, verts[7], 0, 0.75, verts[2], 1, 0.75); - addIcosahedronTriangle(verts[3], 0.5, 1, verts[11], 0, 0.75, verts[7], 1, 0.75); - addIcosahedronTriangle(verts[3], 0.5, 1, verts[10], 0, 0.75, verts[11], 1, 0.75); - addIcosahedronTriangle(verts[3], 0.5, 1, verts[4], 0, 0.75, verts[10], 1, 0.75); - - icosahedron4.computeNormals().smoothNormals(); - icosahedron7.computeNormals().smoothNormals(); - } - - private static void addIcosahedronTriangle(Vector3 vec1, double u1, double v1, Vector3 vec2, double u2, double v2, Vector3 vec3, double u3, double v3) { - icosahedron4.verts[i * 3] = icosahedron7.verts[i * 4] = new Vertex5(vec1, u1, v1); - icosahedron4.verts[i * 3 + 1] = icosahedron7.verts[i * 4 + 1] = new Vertex5(vec2, u2, v2); - icosahedron4.verts[i * 3 + 2] = icosahedron7.verts[i * 4 + 2] = icosahedron7.verts[i * 4 + 3] = new Vertex5(vec3, u3, v3); - i++; - } -} diff --git a/dependencies/main/java/codechicken/lib/render/CCModelState.java b/dependencies/main/java/codechicken/lib/render/CCModelState.java deleted file mode 100644 index a6352b8597..0000000000 --- a/dependencies/main/java/codechicken/lib/render/CCModelState.java +++ /dev/null @@ -1,79 +0,0 @@ -package codechicken.lib.render; - -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableMap; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.block.model.ItemTransformVec3f; -import net.minecraftforge.client.model.IPerspectiveAwareModel.MapWrapper; -import net.minecraftforge.common.model.IModelPart; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; - -/** - * Created by covers1624 on 5/16/2016. - * Same as a SimpleModelState except has a getter for the Transform map. - * TODO Fix toVanillaTransform. - */ -public class CCModelState implements IModelState { - - private final ImmutableMap map; - private final Optional defaultTransform; - - public CCModelState(ImmutableMap map) { - this(map, Optional.absent()); - } - - public CCModelState(ImmutableMap map, Optional defaultTransform) { - this.map = map; - this.defaultTransform = defaultTransform; - } - - public Optional apply(Optional part) { - if (!part.isPresent() || !(part.get() instanceof TransformType) || !map.containsKey(part.get())) { - return defaultTransform; - } - return Optional.fromNullable(map.get(part.get())); - } - - public ImmutableMap getTransforms() { - return MapWrapper.getTransforms(this); - } - - @SuppressWarnings ("deprecation")//TODO, This seems to create invalid transforms. - public ItemCameraTransforms toVanillaTransform() { - ItemTransformVec3f thirdPLeft = ItemTransformVec3f.DEFAULT; - ItemTransformVec3f thirdPRight = ItemTransformVec3f.DEFAULT; - ItemTransformVec3f firstPLeft = ItemTransformVec3f.DEFAULT; - ItemTransformVec3f firstPRight = ItemTransformVec3f.DEFAULT; - ItemTransformVec3f head = ItemTransformVec3f.DEFAULT; - ItemTransformVec3f gui = ItemTransformVec3f.DEFAULT; - ItemTransformVec3f ground = ItemTransformVec3f.DEFAULT; - ItemTransformVec3f fixed = ItemTransformVec3f.DEFAULT; - if (map.containsKey(TransformType.THIRD_PERSON_LEFT_HAND)) { - thirdPLeft = map.get(TransformType.THIRD_PERSON_LEFT_HAND).toItemTransform(); - } - if (map.containsKey(TransformType.THIRD_PERSON_RIGHT_HAND)) { - thirdPRight = map.get(TransformType.THIRD_PERSON_RIGHT_HAND).toItemTransform(); - } - if (map.containsKey(TransformType.FIRST_PERSON_LEFT_HAND)) { - firstPLeft = map.get(TransformType.FIRST_PERSON_LEFT_HAND).toItemTransform(); - } - if (map.containsKey(TransformType.FIRST_PERSON_RIGHT_HAND)) { - firstPRight = map.get(TransformType.FIRST_PERSON_RIGHT_HAND).toItemTransform(); - } - if (map.containsKey(TransformType.HEAD)) { - head = map.get(TransformType.HEAD).toItemTransform(); - } - if (map.containsKey(TransformType.GUI)) { - gui = map.get(TransformType.GUI).toItemTransform(); - } - if (map.containsKey(TransformType.GROUND)) { - ground = map.get(TransformType.GROUND).toItemTransform(); - } - if (map.containsKey(TransformType.FIXED)) { - fixed = map.get(TransformType.FIXED).toItemTransform(); - } - return new ItemCameraTransforms(thirdPLeft, thirdPRight, firstPLeft, firstPRight, head, gui, ground, fixed); - } -} diff --git a/dependencies/main/java/codechicken/lib/render/CCOBJParser.java b/dependencies/main/java/codechicken/lib/render/CCOBJParser.java deleted file mode 100644 index d987b0924b..0000000000 --- a/dependencies/main/java/codechicken/lib/render/CCOBJParser.java +++ /dev/null @@ -1,289 +0,0 @@ -package codechicken.lib.render; - -import codechicken.lib.vec.RedundantTransformation; -import codechicken.lib.vec.Transformation; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.uv.UV; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ResourceLocation; - -import java.io.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Created by covers1624 on 6/21/2016. - * TODO Support MatLib files. - * TODO Custom Mat file for loading LightModels, calculating normals and applying the lighting and rotations. - */ -public class CCOBJParser { - - private static final Pattern vertPattern = Pattern.compile("v(?: ([\\d\\.+-]+))+"); - private static final Pattern uvwPattern = Pattern.compile("vt(?: ([\\d\\.+-]+))+"); - private static final Pattern normalPattern = Pattern.compile("vn(?: ([\\d\\.+-]+))+"); - private static final Pattern polyPattern = Pattern.compile("f(?: ((?:\\d*)(?:/\\d*)?(?:/\\d*)?))+"); - public static final Matcher vertMatcher = vertPattern.matcher(""); - public static final Matcher uvwMatcher = uvwPattern.matcher(""); - public static final Matcher normalMatcher = normalPattern.matcher(""); - public static final Matcher polyMatcher = polyPattern.matcher(""); - - /** - * Parses vertices, texture coords, normals and polygons from a WaveFront Obj file - * - * @param res The resource for the obj file - * @return A map of group names to models - */ - public static Map parseObjModels(ResourceLocation res) { - return parseObjModels(res, null); - } - - /** - * Parses vertices, texture coords, normals and polygons from a WaveFront Obj file - * - * @param res The resource for the obj file - * @param coordSystem The cooridnate system transformation to apply - * @return A map of group names to models - */ - public static Map parseObjModels(ResourceLocation res, Transformation coordSystem) { - return parseObjModels(res, 4, coordSystem); - } - - /** - * Parses vertices, texture coords, normals and polygons from a WaveFront Obj file - * - * @param res The resource for the obj file - * @param vertexMode The vertex mode to create the model for (GL_TRIANGLES or GL_QUADS) - * @param coordSystem The cooridnate system transformation to apply - * @return A map of group names to models - */ - public static Map parseObjModels(ResourceLocation res, int vertexMode, Transformation coordSystem) { - try { - return parseObjModels(Minecraft.getMinecraft().getResourceManager().getResource(res).getInputStream(), vertexMode, coordSystem); - } catch (Exception e) { - throw new RuntimeException("failed to load model: " + res, e); - } - } - - /** - * Parses vertices, texture coords, normals and polygons from a WaveFront Obj file - * - * @param input An input stream to a obj file - * @param vertexMode The vertex mode to create the model for (GL_TRIANGLES or GL_QUADS) - * @param coordSystem The cooridnate system transformation to apply - * @return A map of group names to models - * @throws IOException - */ - public static Map parseObjModels(InputStream input, int vertexMode, Transformation coordSystem) throws IOException { - if (coordSystem == null) { - coordSystem = new RedundantTransformation(); - } - int vp = vertexMode == 7 ? 4 : 3; - - HashMap modelMap = new HashMap(); - ArrayList verts = new ArrayList(); - ArrayList uvs = new ArrayList(); - ArrayList normals = new ArrayList(); - ArrayList polys = new ArrayList(); - String modelName = "unnamed"; - - BufferedReader reader = new BufferedReader(new InputStreamReader(input)); - - String line; - while ((line = reader.readLine()) != null) { - line = line.replaceAll("\\s+", " ").trim(); - if (line.startsWith("#") || line.length() == 0) { - continue; - } - - if (line.startsWith("v ")) { - assertMatch(vertMatcher, line); - double[] values = parseDoubles(line.substring(2), " "); - illegalAssert(values.length >= 3, "Vertices must have x, y and z components"); - Vector3 vert = new Vector3(values[0], values[1], values[2]); - coordSystem.apply(vert); - verts.add(vert); - continue; - } - if (line.startsWith("vt ")) { - assertMatch(uvwMatcher, line); - double[] values = parseDoubles(line.substring(3), " "); - illegalAssert(values.length >= 2, "Tex Coords must have u, and v components"); - uvs.add(new Vector3(values[0], 1 - values[1], 0)); - continue; - } - if (line.startsWith("vn ")) { - assertMatch(normalMatcher, line); - double[] values = parseDoubles(line.substring(3), " "); - illegalAssert(values.length >= 3, "Normals must have x, y and z components"); - Vector3 norm = new Vector3(values[0], values[1], values[2]).normalize(); - coordSystem.applyN(norm); - normals.add(norm); - continue; - } - if (line.startsWith("f ")) { - assertMatch(polyMatcher, line); - String[] av = line.substring(2).split(" "); - illegalAssert(av.length >= 3, "Polygons must have at least 3 vertices"); - int[][] polyVerts = new int[av.length][3]; - for (int i = 0; i < av.length; i++) { - String[] as = av[i].split("/"); - for (int p = 0; p < as.length; p++) { - if (as[p].length() > 0) { - polyVerts[i][p] = Integer.parseInt(as[p]); - } - } - } - if (vp == 3) { - triangulate(polys, polyVerts); - } else { - quadulate(polys, polyVerts); - } - } - if (line.startsWith("g ")) { - if (!polys.isEmpty()) { - modelMap.put(modelName, CCModel.createModel(verts, uvs, normals, vertexMode, polys)); - polys.clear(); - } - modelName = line.substring(2); - } - } - - if (!polys.isEmpty()) { - modelMap.put(modelName, CCModel.createModel(verts, uvs, normals, vertexMode, polys)); - } - - return modelMap; - } - - /** - * Exports an Map of CCModels to a File. - * - * @param models Map of models to export. - * @param p PrintWriter to write the model to. - */ - public static void exportObj(Map models, PrintWriter p) { - List verts = new ArrayList(); - List uvs = new ArrayList(); - List normals = new ArrayList(); - List polys = new ArrayList(); - for (Map.Entry e : models.entrySet()) { - p.println("g " + e.getKey()); - CCModel m = e.getValue(); - - int vStart = verts.size(); - int uStart = uvs.size(); - int nStart = normals.size(); - boolean hasNormals = m.normals() != null; - polys.clear(); - - for (int i = 0; i < m.verts.length; i++) { - int[] ia = new int[hasNormals ? 3 : 2]; - ia[0] = addIndex(verts, m.verts[i].vec); - ia[1] = addIndex(uvs, m.verts[i].uv); - if (hasNormals) { - ia[2] = addIndex(normals, m.normals()[i]); - } - polys.add(ia); - } - - if (vStart < verts.size()) { - p.println(); - for (int i = vStart; i < verts.size(); i++) { - Vector3 v = verts.get(i); - p.format("v %s %s %s\n", clean(v.x), clean(v.y), clean(v.z)); - } - } - if (uStart < uvs.size()) { - p.println(); - for (int i = uStart; i < uvs.size(); i++) { - UV uv = uvs.get(i); - p.format("vt %s %s\n", clean(uv.u), clean(uv.v)); - } - } - if (nStart < normals.size()) { - p.println(); - for (int i = nStart; i < normals.size(); i++) { - Vector3 n = normals.get(i); - p.format("vn %s %s %s\n", clean(n.x), clean(n.y), clean(n.z)); - } - } - - p.println(); - for (int i = 0; i < polys.size(); i++) { - if (i % m.vp == 0) { - p.format("f"); - } - int[] ia = polys.get(i); - if (hasNormals) { - p.format(" %d/%d/%d", ia[0], ia[1], ia[2]); - } else { - p.format(" %d/%d", ia[0], ia[1]); - } - if (i % m.vp == m.vp - 1) { - p.println(); - } - } - } - } - - private static int addIndex(List list, T elem) { - int i = list.indexOf(elem) + 1; - if (i == 0) { - list.add(elem); - i = list.size(); - } - return i; - } - - private static String clean(double d) { - return d == (int) d ? Integer.toString((int) d) : Double.toString(d); - } - - private static void assertMatch(Matcher m, String s) { - m.reset(s); - illegalAssert(m.matches(), "Malformed line: " + s); - } - - private static void illegalAssert(boolean b, String err) { - if (!b) { - throw new IllegalArgumentException(err); - } - } - - private static double[] parseDoubles(String s, String token) { - String[] as = s.split(token); - double[] values = new double[as.length]; - for (int i = 0; i < as.length; i++) { - values[i] = Double.parseDouble(as[i]); - } - return values; - } - - private static void triangulate(List polys, int[][] polyVerts) { - for (int i = 2; i < polyVerts.length; i++) { - polys.add(polyVerts[0]); - polys.add(polyVerts[i]); - polys.add(polyVerts[i - 1]); - } - } - - private static void quadulate(List polys, int[][] polyVerts) { - if (polyVerts.length == 4) { - polys.add(polyVerts[0]); - polys.add(polyVerts[3]); - polys.add(polyVerts[2]); - polys.add(polyVerts[1]); - } else { - for (int i = 2; i < polyVerts.length; i++) { - polys.add(polyVerts[0]); - polys.add(polyVerts[i]); - polys.add(polyVerts[i - 1]); - polys.add(polyVerts[i - 1]); - } - } - } -} diff --git a/dependencies/main/java/codechicken/lib/render/CCRSConsumer.java b/dependencies/main/java/codechicken/lib/render/CCRSConsumer.java deleted file mode 100644 index 1459fee901..0000000000 --- a/dependencies/main/java/codechicken/lib/render/CCRSConsumer.java +++ /dev/null @@ -1,86 +0,0 @@ -package codechicken.lib.render; - -import codechicken.lib.colour.Colour; -import codechicken.lib.vec.Vector3; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.renderer.vertex.VertexFormatElement; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.client.model.pipeline.IVertexConsumer; - -/** - * Created by covers1624 on 15/01/2017. - * TODO, Maybe merge with CCRS?? - */ -public class CCRSConsumer implements IVertexConsumer { - - private final CCRenderState ccrs; - private Vector3 offset = Vector3.zero; - - public CCRSConsumer(CCRenderState ccrs) { - this.ccrs = ccrs; - } - - @Override - public VertexFormat getVertexFormat() { - return ccrs.getVertexFormat(); - } - - @Override - public void setTexture(TextureAtlasSprite texture) { - ccrs.sprite = texture; - } - - @Override - public void put(int e, float... data) { - VertexFormat format = getVertexFormat(); - - VertexFormatElement fmte = format.getElement(e); - switch (fmte.getUsage()) { - case POSITION: - ccrs.vert.vec.set(data).add(offset); - break; - case UV: - if (fmte.getIndex() == 0) { - ccrs.vert.uv.set(data[0], data[1]); - } else { - ccrs.brightness = (int) (data[1] * 65535 / 32) << 20 | (int) (data[0] * 65535 / 32) << 4; - } - break; - case COLOR: - ccrs.colour = Colour.packRGBA(data); - break; - case NORMAL: - ccrs.normal.set(data); - break; - case PADDING: - break; - default: - throw new UnsupportedOperationException("Generic vertex format element"); - } - if (e == format.getElementCount() - 1) { - ccrs.writeVert(); - } - } - - public void setOffset(Vector3 offset) { - this.offset = offset; - } - - public void setOffset(BlockPos offset) { - this.offset = Vector3.fromBlockPos(offset); - } - - @Override - public void setQuadTint(int tint) { - } - - @Override - public void setQuadOrientation(EnumFacing orientation) { - } - - @Override - public void setApplyDiffuseLighting(boolean diffuse) { - } -} diff --git a/dependencies/main/java/codechicken/lib/render/CCRenderEventHandler.java b/dependencies/main/java/codechicken/lib/render/CCRenderEventHandler.java deleted file mode 100644 index 0135f0ae99..0000000000 --- a/dependencies/main/java/codechicken/lib/render/CCRenderEventHandler.java +++ /dev/null @@ -1,56 +0,0 @@ -package codechicken.lib.render; - -import codechicken.lib.raytracer.CuboidRayTraceResult; -import codechicken.lib.vec.Vector3; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.RayTraceResult.Type; -import net.minecraftforge.client.event.DrawBlockHighlightEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public class CCRenderEventHandler { - - public static int renderTime; - public static float renderFrame; - - private static boolean hasInit = false; - - public static void init() { - if (!hasInit) { - MinecraftForge.EVENT_BUS.register(new CCRenderEventHandler()); - hasInit = true; - } - } - - @SubscribeEvent - public void clientTick(TickEvent.ClientTickEvent event) { - if (event.phase == Phase.END) { - renderTime++; - } - } - - @SubscribeEvent - public void renderTick(TickEvent.RenderTickEvent event) { - if (event.phase == Phase.START) { - renderFrame = event.renderTickTime; - } - } - - @SideOnly (Side.CLIENT) - @SubscribeEvent//TODO Change event priority. - public void onBlockHighlight(DrawBlockHighlightEvent event) { - BlockPos pos = event.getTarget().getBlockPos(); - - //We have found a CuboidRayTraceResult, Lets render it properly.. - RayTraceResult hit = event.getTarget(); - if (hit.typeOfHit == Type.BLOCK && hit instanceof CuboidRayTraceResult && !((CuboidRayTraceResult) hit).disableAutoHitboxRender) { - event.setCanceled(true); - RenderUtils.renderHitBox(event.getPlayer(), ((CuboidRayTraceResult) event.getTarget()).cuboid6.copy().add(new Vector3(pos)), event.getPartialTicks()); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/render/CCRenderState.java b/dependencies/main/java/codechicken/lib/render/CCRenderState.java deleted file mode 100644 index 5fefa35b2f..0000000000 --- a/dependencies/main/java/codechicken/lib/render/CCRenderState.java +++ /dev/null @@ -1,297 +0,0 @@ -package codechicken.lib.render; - -import codechicken.lib.colour.Colour; -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.lighting.LC; -import codechicken.lib.lighting.LightMatrix; -import codechicken.lib.render.buffer.BakingVertexBuffer; -import codechicken.lib.render.pipeline.CCRenderPipeline; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.render.pipeline.IVertexSource; -import codechicken.lib.render.pipeline.VertexAttribute; -import codechicken.lib.render.pipeline.attribute.*; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.Vertex5; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.VertexBuffer; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.renderer.vertex.VertexFormatElement; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import org.lwjgl.opengl.GL11; - -import java.util.List; - -/** - * The core of the CodeChickenLib render system. - * Where possible assign a local var of CCRenderState to avoid millions of calls to instance(); - * Uses a ThreadLocal system to assign each thread their own CCRenderState so we can use it in Multithreaded chunk batching. - * TODO, proper piping of BakedQuads and CCBakedQuads. - */ -public class CCRenderState { - - private static int nextOperationIndex; - - public static int registerOperation() { - return nextOperationIndex++; - } - - public static int operationCount() { - return nextOperationIndex; - } - - //Each attrib needs to be assigned in this order to have a valid operation index. - public final VertexAttribute normalAttrib = new NormalAttribute(); - public final VertexAttribute colourAttrib = new ColourAttribute(); - public final VertexAttribute lightingAttrib = new LightingAttribute(); - public final VertexAttribute sideAttrib = new SideAttribute(); - public final VertexAttribute lightCoordAttrib = new LightCoordAttribute(); - - private static final ThreadLocal instances = new ThreadLocal() { - @Override - protected CCRenderState initialValue() { - return new CCRenderState(); - } - }; - private static final CCRenderState bakingRenderState = new CCRenderState(); - - //pipeline state - public IVertexSource model; - public int firstVertexIndex; - public int lastVertexIndex; - public int vertexIndex; - public CCRenderPipeline pipeline; - @SideOnly (Side.CLIENT) - public VertexBuffer r; - @SideOnly (Side.CLIENT) - public VertexFormat fmt; - - //context - public int baseColour; - public int alphaOverride; - public boolean computeLighting; - public LightMatrix lightMatrix = new LightMatrix(); - - //vertex outputs - public final Vertex5 vert = new Vertex5(); - public final Vector3 normal = new Vector3(); - public int colour; - public int brightness; - - //attribute storage - public int side; - public LC lc = new LC(); - @SideOnly (Side.CLIENT) - public TextureAtlasSprite sprite; - - private CCRenderState() { - pipeline = new CCRenderPipeline(this); - - } - - public static CCRenderState instance() { - return instances.get(); - } - - public static CCRenderState getBakingRenderState() { - return bakingRenderState; - } - - public void reset() { - model = null; - pipeline.reset(); - computeLighting = true; - baseColour = alphaOverride = -1; - } - - public void preRenderWorld(IBlockAccess world, BlockPos pos) { - this.reset(); - this.colour = 0xFFFFFFFF; - this.setBrightness(world, pos); - } - - public void setPipeline(IVertexOperation... ops) { - pipeline.setPipeline(ops); - } - - public void setPipeline(IVertexSource model, int start, int end, IVertexOperation... ops) { - pipeline.reset(); - pipeline.forceFormatAttributes = false; - setModel(model, start, end); - pipeline.forceFormatAttributes = true; - pipeline.setPipeline(ops); - } - - public void bindModel(IVertexSource model) { - if (this.model != model) { - this.model = model; - pipeline.rebuild(); - } - } - - public void setModel(IVertexSource source) { - setModel(source, 0, source.getVertices().length); - } - - public void setModel(IVertexSource source, int start, int end) { - bindModel(source); - setVertexRange(start, end); - } - - public void setVertexRange(int start, int end) { - firstVertexIndex = start; - lastVertexIndex = end; - } - - public void renderQuads(List quads) { - VertexBuffer buffer = startDrawing(GL11.GL_QUADS, quads.get(0).getFormat()); - for (BakedQuad quad : quads) { - buffer.addVertexData(quad.getVertexData()); - } - draw(); - } - - public void render(IVertexOperation... ops) { - setPipeline(ops); - render(); - } - - public void render() { - Vertex5[] verts = model.getVertices(); - for (vertexIndex = firstVertexIndex; vertexIndex < lastVertexIndex; vertexIndex++) { - model.prepareVertex(this); - vert.set(verts[vertexIndex]); - runPipeline(); - writeVert(); - } - } - - public void runPipeline() { - pipeline.operate(); - } - - public void writeVert() { - if (r instanceof BakingVertexBuffer) { - ((BakingVertexBuffer) r).setSprite(sprite); - } - for (int e = 0; e < fmt.getElementCount(); e++) { - VertexFormatElement fmte = fmt.getElement(e); - switch (fmte.getUsage()) { - case POSITION: - r.pos(vert.vec.x, vert.vec.y, vert.vec.z); - break; - case UV: - if (fmte.getIndex() == 0) { - r.tex(vert.uv.u, vert.uv.v); - } else { - r.lightmap(brightness >> 16 & 65535, brightness & 65535); - } - break; - case COLOR: - if (r.isColorDisabled()) { - //-_- Fucking mojang.. - r.nextVertexFormatIndex(); - } else { - r.color(colour >>> 24, colour >> 16 & 0xFF, colour >> 8 & 0xFF, alphaOverride >= 0 ? alphaOverride : colour & 0xFF); - } - break; - case NORMAL: - r.normal((float) normal.x, (float) normal.y, (float) normal.z); - break; - case PADDING: - break; - default: - throw new UnsupportedOperationException("Generic vertex format element"); - } - } - r.endVertex(); - } - - public void pushColour() { - GlStateManager.color((colour >>> 24) / 255F, (colour >> 16 & 0xFF) / 255F, (colour >> 8 & 0xFF) / 255F, (alphaOverride >= 0 ? alphaOverride : colour & 0xFF) / 255F); - } - - public void setBrightness(IBlockAccess world, BlockPos pos) { - brightness = world.getBlockState(pos).getBlock().getPackedLightmapCoords(world.getBlockState(pos), world, pos); - } - - public void pullLightmap() { - brightness = (int) OpenGlHelper.lastBrightnessY << 16 | (int) OpenGlHelper.lastBrightnessX; - } - - public void pushLightmap() { - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightness & 0xFFFF, brightness >>> 16); - } - - public void setFluidColour(FluidStack fluidStack) { - setFluidColour(fluidStack, 0xFF); - } - - public void setFluidColour(FluidStack fluidStack, int alpha) { - this.colour = fluidStack.getFluid().getColor(fluidStack) << 8 | alpha; - } - - public void setColour(Colour colour) { - this.colour = colour.rgba(); - } - - public ColourRGBA getColour() { - return new ColourRGBA(colour); - } - - @SideOnly (Side.CLIENT) - public VertexBuffer startDrawing(int mode, VertexFormat format) { - VertexBuffer r = Tessellator.getInstance().getBuffer(); - r.begin(mode, format); - bind(r); - return r; - } - - @SideOnly (Side.CLIENT) - public VertexBuffer startDrawing(int mode, VertexFormat format, VertexBuffer buffer) { - buffer.begin(mode, format); - bind(buffer); - return buffer; - } - - @SideOnly (Side.CLIENT) - public void bind(VertexBuffer r) { - this.r = r; - fmt = r.getVertexFormat(); - } - - @SideOnly (Side.CLIENT) - public VertexBuffer getBuffer() { - return r; - } - - @SideOnly (Side.CLIENT) - public VertexFormat getVertexFormat() { - return fmt; - } - - public void draw() { - Tessellator.getInstance().draw(); - } - - /** - * Polls the currently bound VertexBuffer to see if it is drawing. - * If no buffer is bound it checks Tessellator.getInstance.getBuffer. - * - * @return If the buffer is drawing. - */ - public boolean isDrawing() { - if (r != null) { - return r.isDrawing; - } else { - return Tessellator.getInstance().getBuffer().isDrawing; - } - } -} diff --git a/dependencies/main/java/codechicken/lib/render/DigIconParticle.java b/dependencies/main/java/codechicken/lib/render/DigIconParticle.java deleted file mode 100644 index cc43d54bf3..0000000000 --- a/dependencies/main/java/codechicken/lib/render/DigIconParticle.java +++ /dev/null @@ -1,92 +0,0 @@ -package codechicken.lib.render; - -import codechicken.lib.render.particle.CustomParticleHandler; -import codechicken.lib.vec.Cuboid6; -import net.minecraft.client.particle.Particle; -import net.minecraft.client.particle.ParticleManager; -import net.minecraft.client.renderer.VertexBuffer; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.entity.Entity; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; - -public class DigIconParticle extends Particle { - - public DigIconParticle(World world, double x, double y, double z, double dx, double dy, double dz, TextureAtlasSprite icon) { - super(world, x, y, z, dx, dy, dz); - particleTexture = icon; - particleGravity = 1; - particleRed = particleGreen = particleBlue = 0.6F; - particleScale /= 2.0F; - } - - public static DigIconParticle newLandingParticle(World world, double x, double y, double z, double dx, double dy, double dz, TextureAtlasSprite icon) { - DigIconParticle particle = new DigIconParticle(world, x, y, z, dx, dy, dz, icon); - particle.motionX = dx; - particle.motionY = dy; - particle.motionZ = dz; - return particle; - } - - @Override - public int getFXLayer() { - return 1; - } - - public void setScale(float scale) { - particleScale = scale; - } - - public float getScale() { - return particleScale; - } - - public void setMaxAge(int age) { - particleMaxAge = age; - } - - public int getMaxAge() { - return particleMaxAge; - } - - /** - * copy pasted from ParticleBreaking - * //TODO Doc. - */ - @Override - public void renderParticle(VertexBuffer vertexBuffer, Entity entity, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { - float f = ((float) this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F; - float f1 = f + 0.015609375F; - float f2 = ((float) this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F; - float f3 = f2 + 0.015609375F; - float f4 = 0.1F * this.particleScale; - - if (this.particleTexture != null) { - f = this.particleTexture.getInterpolatedU((double) (this.particleTextureJitterX / 4.0F * 16.0F)); - f1 = this.particleTexture.getInterpolatedU((double) ((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F)); - f2 = this.particleTexture.getInterpolatedV((double) (this.particleTextureJitterY / 4.0F * 16.0F)); - f3 = this.particleTexture.getInterpolatedV((double) ((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F)); - } - - float f5 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) partialTicks - interpPosX); - float f6 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) partialTicks - interpPosY); - float f7 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTicks - interpPosZ); - int i = this.getBrightnessForRender(partialTicks); - int j = i >> 16 & 65535; - int k = i & 65535; - vertexBuffer.pos((double) (f5 - rotationX * f4 - rotationXY * f4), (double) (f6 - rotationZ * f4), (double) (f7 - rotationYZ * f4 - rotationXZ * f4)).tex((double) f, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); - vertexBuffer.pos((double) (f5 - rotationX * f4 + rotationXY * f4), (double) (f6 + rotationZ * f4), (double) (f7 - rotationYZ * f4 + rotationXZ * f4)).tex((double) f, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); - vertexBuffer.pos((double) (f5 + rotationX * f4 + rotationXY * f4), (double) (f6 + rotationZ * f4), (double) (f7 + rotationYZ * f4 + rotationXZ * f4)).tex((double) f1, (double) f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); - vertexBuffer.pos((double) (f5 + rotationX * f4 - rotationXY * f4), (double) (f6 - rotationZ * f4), (double) (f7 + rotationYZ * f4 - rotationXZ * f4)).tex((double) f1, (double) f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex(); - } - - @Deprecated//Use CustomParticleHandler.addBlockHitEffects This will be removed in 1.11 - public static void addBlockHitEffects(World world, Cuboid6 bounds, int side, TextureAtlasSprite icon, ParticleManager effectRenderer) { - CustomParticleHandler.addBlockHitEffects(world, bounds, EnumFacing.VALUES[side], icon, effectRenderer); - } - - @Deprecated//Use CustomParticleHandler.addBlockDestroyEffects This will be removed in 1.11 - public static void addBlockDestroyEffects(World world, Cuboid6 bounds, TextureAtlasSprite[] icons, ParticleManager effectRenderer) { - CustomParticleHandler.addBlockDestroyEffects(world, bounds, icons, effectRenderer); - } -} diff --git a/dependencies/main/java/codechicken/lib/render/QBImporter.java b/dependencies/main/java/codechicken/lib/render/QBImporter.java deleted file mode 100644 index 2990847591..0000000000 --- a/dependencies/main/java/codechicken/lib/render/QBImporter.java +++ /dev/null @@ -1,808 +0,0 @@ -package codechicken.lib.render; - -import codechicken.lib.texture.TextureDataHolder; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.vec.*; -import codechicken.lib.vec.uv.UV; -import codechicken.lib.vec.uv.UVScale; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.ResourceLocation; - -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.*; -import java.util.*; - -//TODO, Is this needed anymore? -public class QBImporter { - - private static class ImagePackNode { - - Rectangle4i rect; - ImagePackNode child1; - ImagePackNode child2; - QBImage packed; - - public ImagePackNode(int x, int y, int w, int h) { - rect = new Rectangle4i(x, y, w, h); - } - - public boolean pack(QBImage img) { - if (child1 != null) { - return child1.pack(img) || child2.pack(img); - } - - if (packed != null) { - return false; - } - - int fit = getFit(img.width(), img.height()); - if (fit == 0) { - return false; - } - - if ((fit & 2) != 0) {//exact fit - packed = img; - img.packSlot = rect; - img.packT = new ImageTransform((fit & 1) << 2); - return true; - } - - int w = (fit & 1) == 0 ? img.width() : img.height(); - int h = (fit & 1) == 0 ? img.height() : img.width(); - - if (rect.w - w > rect.h - h) {//create split with biggest leftover space - child1 = new ImagePackNode(rect.x, rect.y, w, rect.h); - child2 = new ImagePackNode(rect.x + w, rect.y, rect.w - w, rect.h); - } else { - child1 = new ImagePackNode(rect.x, rect.y, rect.w, h); - child2 = new ImagePackNode(rect.x, rect.y + h, rect.w, rect.h - h); - } - return child1.pack(img); - } - - private int getFit(int w, int h) { - if (w == rect.w && h == rect.h) { - return 2; - } - if (w == rect.h && h == rect.w) { - return 3; - } - if (rect.w >= w && rect.h >= h) { - return 4; - } - if (rect.w >= h && rect.h >= w) { - return 5; - } - - return 0; - } - - private static void nextSize(Rectangle4i rect, boolean square) { - if (square) { - rect.w <<= 1; - rect.h <<= 1; - } else { - if (rect.w == rect.h) { - rect.w *= 2; - } else { - rect.h *= 2; - } - } - } - - public static ImagePackNode pack(List images, boolean square) { - Collections.sort(images); - - int area = 0; - for (QBImage img : images) { - area += img.area(); - } - - ImagePackNode node = new ImagePackNode(0, 0, 2, 2); - while (node.rect.area() < area) { - nextSize(node.rect, square); - } - - while (true) { - boolean packed = true; - for (QBImage img : images) { - if (!node.pack(img)) { - packed = false; - break; - } - } - - if (packed) { - return node; - } - - node.child1 = node.child2 = null; - nextSize(node.rect, square); - } - } - - public BufferedImage toImage() { - BufferedImage img = new BufferedImage(rect.w, rect.h, BufferedImage.TYPE_INT_ARGB); - write(img); - return img; - } - - private void write(BufferedImage img) { - if (child1 != null) { - child1.write(img); - child2.write(img); - } else if (packed != null) { - ImageTransform t = packed.packT; - for (int u = 0; u < rect.w; u++) { - for (int v = 0; v < rect.h; v++) { - int rgba = t.access(packed, u, v); - img.setRGB(u + rect.x, v + rect.y, rgba >>> 8 | rgba << 24); - } - } - } - } - } - - private static class ImageTransform { - - int transform; - - public ImageTransform(int i) { - transform = i; - } - - public ImageTransform() { - this(0); - } - - public boolean transpose() { - return (transform & 4) != 0; - } - - public boolean flipU() { - return (transform & 1) != 0; - } - - public boolean flipV() { - return (transform & 2) != 0; - } - - public int access(QBImage img, int u, int v) { - if (transpose()) { - int tmp = u; - u = v; - v = tmp; - } - if (flipU()) { - u = img.width() - 1 - u; - } - if (flipV()) { - v = img.height() - 1 - v; - } - - return img.data[u][v]; - } - - public UV transform(UV uv) { - if (transpose()) { - double tmp = uv.u; - uv.u = uv.v; - uv.v = tmp; - } - if (flipU()) { - uv.u = 1 - uv.u; - } - if (flipV()) { - uv.v = 1 - uv.v; - } - - return uv; - } - } - - public static class QBImage implements Comparable { - - int[][] data; - ImageTransform packT; - Rectangle4i packSlot; - - public int width() { - return data.length; - } - - public int height() { - return data[0].length; - } - - public int area() { - return width() * height(); - } - - @Override - public int compareTo(QBImage o) { - int a = area(); - int b = o.area(); - return a > b ? -1 : a == b ? 0 : 1; - } - - public ImageTransform transformTo(QBImage img) { - if (width() == img.width() && height() == img.height()) { - for (int i = 0; i < 4; i++) { - ImageTransform t = new ImageTransform(i); - if (equals(img, t)) { - return t; - } - } - } - if (width() == img.height() && height() == img.width()) { - for (int i = 4; i < 8; i++) { - ImageTransform t = new ImageTransform(i); - if (equals(img, t)) { - return t; - } - } - } - return null; - } - - public boolean equals(QBImage img, ImageTransform t) { - for (int u = 0; u < img.width(); u++) { - for (int v = 0; v < img.height(); v++) { - if (t.access(this, u, v) != img.data[u][v]) { - return false; - } - } - } - - return true; - } - - public void transform(UV uv) { - packT.transform(uv); - uv.u *= packSlot.w; - uv.v *= packSlot.h; - uv.u += packSlot.x; - uv.v += packSlot.y; - } - } - - private static final int[][] vertOrder = new int[][] {//clockwise because MC is left handed - { 3, 0 }, { 1, 0 }, { 1, 2 }, { 3, 2 } }; - - public static class QBQuad { - - public Vertex5[] verts = new Vertex5[4]; - public QBImage image = new QBImage(); - public ImageTransform t = new ImageTransform(); - public int side; - - public QBQuad(int side) { - this.side = side; - } - - public void applyImageT() { - for (Vertex5 vert : verts) { - t.transform(vert.uv); - image.transform(vert.uv); - } - } - - public static QBQuad restore(Rectangle4i flat, int side, double d, QBImage img) { - QBQuad quad = new QBQuad(side); - quad.image = img; - - Transformation t = new Scale(-1, 1, -1).with(Rotation.sideOrientation(side, 0)).with(new Translation(new Vector3().setSide(side, d))); - quad.verts[0] = new Vertex5(flat.x, 0, flat.y, 0, 0); - quad.verts[1] = new Vertex5(flat.x + flat.w, 0, flat.y, 1, 0); - quad.verts[2] = new Vertex5(flat.x + flat.w, 0, flat.y + flat.h, 1, 1); - quad.verts[3] = new Vertex5(flat.x, 0, flat.y + flat.h, 0, 1); - for (Vertex5 vert : quad.verts) { - vert.apply(t); - } - - return quad; - } - - public Rectangle4i flatten() { - Transformation t = Rotation.sideOrientation(side, 0).inverse().with(new Scale(-1, 0, -1)); - Vector3 vmin = verts[0].vec.copy().apply(t); - Vector3 vmax = verts[2].vec.copy().apply(t); - return new Rectangle4i((int) vmin.x, (int) vmin.z, (int) (vmax.x - vmin.x), (int) (vmax.z - vmin.z)); - } - } - - public static class QBCuboid { - - public QBMatrix mat; - public CuboidCoord c; - public int sides; - - public QBCuboid(QBMatrix mat, CuboidCoord c) { - this.mat = mat; - this.c = c; - sides = 0; - } - - public static boolean intersects(QBCuboid a, QBCuboid b) { - CuboidCoord c = a.c; - CuboidCoord d = b.c; - return c.min.x <= d.max.x && d.min.x <= c.max.x && c.min.y <= d.max.y && d.min.y <= c.max.y && c.min.z <= d.max.z && d.min.z <= c.max.z; - } - - public static void clip(QBCuboid a, QBCuboid b) { - if (intersects(a, b)) { - a.clip(b); - b.clip(a); - } - } - - public void clip(QBCuboid o) { - CuboidCoord d = o.c; - for (int a = 0; a < 6; a += 2) { - int a1 = (a + 2) % 6; - int a2 = (a + 4) % 6; - if (c.getSide(a1 + 1) <= d.getSide(a1 + 1) && c.getSide(a1) >= d.getSide(a1) && c.getSide(a2 + 1) <= d.getSide(a2 + 1) && c.getSide(a2) >= d.getSide(a2)) { - - if (c.getSide(a) <= d.getSide(a + 1) && c.getSide(a) >= d.getSide(a)) { - c.setSide(a, d.getSide(a + 1) + 1); - sides |= 1 << a; - } - if (c.getSide(a + 1) >= d.getSide(a) && c.getSide(a + 1) <= d.getSide(a + 1)) { - c.setSide(a + 1, d.getSide(a) - 1); - sides |= 2 << a; - } - } - } - } - - public void extractQuads(List quads) { - Cuboid6 box = c.bounds(); - for (int s = 0; s < 6; s++) { - if ((sides & 1 << s) == 0) { - quads.add(extractQuad(s, box)); - } - } - } - - private QBQuad extractQuad(int side, Cuboid6 box) { - double[] da = new double[3]; - da[side >> 1] = box.getSide(side); - - QBQuad quad = new QBQuad(side); - for (int i = 0; i < 4; i++) { - int rU = vertOrder[i][0]; - int rV = vertOrder[i][1]; - int sideU = Rotation.rotateSide(side, rU); - int sideV = Rotation.rotateSide(side, rV); - da[sideU >> 1] = box.getSide(sideU); - da[sideV >> 1] = box.getSide(sideV); - quad.verts[i] = new Vertex5(Vector3.fromAxes(da), (3 - rU) / 2, rV / 2); - } - - int sideU = Rotation.rotateSide(side, 1); - int sideV = Rotation.rotateSide(side, 2); - quad.image.data = new int[c.size(sideU)][c.size(sideV)]; - QBImage image = quad.image; - - int[] ia = new int[3]; - ia[side >> 1] = c.getSide(side); - ia[sideU >> 1] = c.getSide(sideU ^ 1); - ia[sideV >> 1] = c.getSide(sideV ^ 1); - BlockCoord b = BlockCoord.fromAxes(ia); - BlockCoord bU = BlockCoord.sideOffsets[sideU]; - BlockCoord bV = BlockCoord.sideOffsets[sideV]; - for (int u = 0; u < image.width(); u++) { - for (int v = 0; v < image.height(); v++) { - image.data[u][v] = mat.matrix[b.x + bU.x * u + bV.x * v][b.y + bU.y * u + bV.y * v][b.z + bU.z * u + bV.z * v]; - } - } - - return quad; - } - } - - public static class QBMatrix { - - public String name; - public BlockCoord pos; - public BlockCoord size; - public int[][][] matrix; - - public void readMatrix(DataInputStream din, boolean compressed) throws IOException { - if (compressed) { - int z = 0; - while (z < size.z) { - int index = 0; - - while (true) { - int data = din.readInt(); - - if (data == NEXTSLICEFLAG) { - break; - } - - if (data == CODEFLAG) { - int count = readTni(din); - data = din.readInt(); - - for (int j = 0; j < count; j++, index++) { - matrix[index % size.x][index / size.x][z] = data; - } - } else { - matrix[index % size.x][index / size.x][z] = data; - index++; - } - } - z++; - } - } else { - for (int z = 0; z < size.z; z++) { - for (int y = 0; y < size.y; y++) { - for (int x = 0; x < size.x; x++) { - matrix[x][y][z] = din.readInt(); - } - } - } - } - } - - public void convertBGRAtoRGBA() { - for (int z = 0; z < size.z; z++) { - for (int y = 0; y < size.y; y++) { - for (int x = 0; x < size.x; x++) { - int i = matrix[x][y][z]; - matrix[x][y][z] = Integer.reverseBytes(i >>> 8) | i & 0xFF; - } - } - } - } - - private boolean voxelFull(boolean[][][] solid, CuboidCoord c) { - for (BlockCoord b : c) { - if (matrix[b.x][b.y][b.z] == 0) { - return false; - } - } - for (BlockCoord b : c) { - solid[b.x][b.y][b.z] = false; - } - return true; - } - - private QBCuboid expand(boolean[][][] solid, BlockCoord b) { - CuboidCoord c = new CuboidCoord(b); - solid[b.x][b.y][b.z] = false; - - for (int s = 0; s < 6; s++) { - CuboidCoord slice = c.copy(); - slice.expand(s ^ 1, -(slice.size(s) - 1)); - slice.expand(s, 1); - - while (slice.getSide(s) >= 0 && slice.getSide(s) < size.getSide(s)) { - if (!voxelFull(solid, slice)) { - break; - } - slice.expand(s ^ 1, -1); - slice.expand(s, 1); - c.expand(s, 1); - } - } - return new QBCuboid(this, c); - } - - public List rectangulate() { - List list = new ArrayList(); - boolean[][][] solid = new boolean[size.x][size.y][size.z]; - for (int z = 0; z < size.z; z++) { - for (int y = 0; y < size.y; y++) { - for (int x = 0; x < size.x; x++) { - solid[x][y][z] = matrix[x][y][z] != 0; - } - } - } - - for (int x = 0; x < size.x; x++) { - for (int z = 0; z < size.z; z++) { - for (int y = 0; y < size.y; y++) { - if (solid[x][y][z]) { - list.add(expand(solid, new BlockCoord(x, y, z))); - } - } - } - } - - for (int i = 0; i < list.size(); i++) { - for (int j = i + 1; j < list.size(); j++) { - QBCuboid.clip(list.get(i), list.get(j)); - } - } - - return list; - } - - public List extractQuads(boolean texturePlanes) { - List quads = new LinkedList(); - for (QBCuboid c : rectangulate()) { - c.extractQuads(quads); - } - - if (texturePlanes) { - optimisePlanes(quads); - } - - return quads; - } - - private void optimisePlanes(List quads) { - Multimap map = HashMultimap.create(); - for (QBQuad quad : quads) { - map.put(quad.side | ((int) quad.verts[0].vec.getSide(quad.side)) << 3, quad); - } - - quads.clear(); - for (Integer key : map.keySet()) { - Collection plane = map.get(key); - if (plane.size() == 1) { - quads.add(plane.iterator().next()); - continue; - } - - int side = key & 7; - Rectangle4i rect = null; - for (QBQuad q : plane) { - if (rect == null) { - rect = q.flatten(); - } else { - rect.include(q.flatten()); - } - } - - QBImage img = new QBImage(); - img.data = new int[rect.w][rect.h]; - for (QBQuad q : plane) { - QBImage from = q.image; - Rectangle4i r = q.flatten(); - int du = r.x - rect.x; - int dv = r.y - rect.y; - for (int u = 0; u < from.width(); u++) { - for (int v = 0; v < from.height(); v++) { - img.data[du + u][dv + v] = from.data[u][v]; - } - } - } - - quads.add(QBQuad.restore(rect, side, key >> 3, img)); - } - } - - public CCModel buildModel(List quads, BufferedImage img, boolean scaleMC) { - CCModel m = CCModel.quadModel(quads.size() * 4); - int i = 0; - for (QBQuad quad : quads) { - quad.applyImageT(); - m.verts[i++] = quad.verts[0]; - m.verts[i++] = quad.verts[1]; - m.verts[i++] = quad.verts[2]; - m.verts[i++] = quad.verts[3]; - } - m.apply(new UVScale(1D / img.getWidth(), 1D / img.getHeight())); - m.apply(new Translation(pos.x, pos.y, pos.z)); - if (scaleMC) { - m.apply(new Scale(1 / 16D)); - } - m.computeNormals(); - return m; - } - - private static void addImages(List quads, List images) { - for (QBQuad q : quads) { - QBImage img = q.image; - boolean matched = false; - for (QBImage img2 : images) { - ImageTransform t = img.transformTo(img2); - if (t != null) { - q.t = t; - q.image = img2; - matched = true; - break; - } - } - if (!matched) { - images.add(img); - } - } - } - } - - public static final int TEXTUREPLANES = 1; - public static final int SQUARETEXTURE = 2; - public static final int MERGETEXTURES = 4; - public static final int SCALEMC = 8; - - public static class QBModel { - - public QBMatrix[] matrices; - public boolean rightHanded; - - public RasterisedModel toRasterisedModel(int flags) { - List qbImages = new ArrayList(); - List> modelQuads = new ArrayList>(); - List images = new ArrayList(); - - boolean texturePlanes = (flags & TEXTUREPLANES) != 0; - boolean squareTextures = (flags & SQUARETEXTURE) != 0; - boolean mergeTextures = (flags & MERGETEXTURES) != 0; - boolean scaleMC = (flags & SCALEMC) != 0; - - for (QBMatrix mat : matrices) { - List quads = mat.extractQuads(texturePlanes); - modelQuads.add(quads); - QBMatrix.addImages(quads, qbImages); - if (!mergeTextures) { - images.add(ImagePackNode.pack(qbImages, squareTextures).toImage()); - qbImages.clear(); - } - } - - if (mergeTextures) { - images.add(ImagePackNode.pack(qbImages, squareTextures).toImage()); - } - - RasterisedModel m = new RasterisedModel(images); - for (int i = 0; i < matrices.length; i++) { - QBMatrix mat = matrices[i]; - BufferedImage img = images.get(mergeTextures ? 0 : i); - m.add(mat.name, mat.buildModel(modelQuads.get(i), img, scaleMC)); - } - return m; - } - } - - public static class RasterisedModel { - - private class Holder { - - CCModel m; - int img; - - public Holder(CCModel m, int img) { - this.m = m; - this.img = img; - } - } - - private Map map = new HashMap(); - private List images; - - public RasterisedModel(List images) { - this.images = images; - } - - public void add(String name, CCModel m) { - map.put(name, new Holder(m, Math.min(map.size(), images.size() - 1))); - } - - public CCModel getModel(String key) { - return map.get(key).m; - } - - public TextureAtlasSprite getIcon(String key, TextureMap textureMap) { - int img = map.get(key).img; - String iconName = "QBModel" + hashCode() + "_img"; - TextureAtlasSprite icon = textureMap.getTextureExtry(iconName); - if (icon != null) { - return icon; - } - - return TextureUtils.getTextureSpecial(textureMap, iconName).addTexture(new TextureDataHolder(images.get(img))); - } - - private void exportImg(BufferedImage img, File imgFile) throws IOException { - if (!imgFile.exists()) { - imgFile.createNewFile(); - } - ImageIO.write(img, "PNG", imgFile); - } - - public void export(File objFile, File imgDir) { - try { - if (!objFile.exists()) { - objFile.createNewFile(); - } - if (!imgDir.exists()) { - imgDir.mkdirs(); - } - - Map modelMap = new HashMap(); - for (Map.Entry e : map.entrySet()) { - modelMap.put(e.getKey(), e.getValue().m); - } - - PrintWriter p = new PrintWriter(objFile); - CCOBJParser.exportObj(modelMap, p); - p.close(); - - if (images.size() < map.size()) { - exportImg(images.get(0), new File(imgDir, objFile.getName().replaceAll("(.+)\\..+", "$1.png"))); - } else { - for (Map.Entry e : map.entrySet()) { - exportImg(images.get(e.getValue().img), new File(imgDir, e.getKey() + ".png")); - } - } - - } catch (IOException e) { - throw new RuntimeException(e); - } - } - } - - private static String readAsciiString(DataInputStream din) throws IOException { - byte[] bytes = new byte[din.readByte() & 0xFF]; - din.readFully(bytes); - return new String(bytes, "US-ASCII"); - } - - private static int readTni(DataInputStream din) throws IOException { - return Integer.reverseBytes(din.readInt()); - } - - private static final int CODEFLAG = Integer.reverseBytes(2); - private static final int NEXTSLICEFLAG = Integer.reverseBytes(6); - - public static QBModel loadQB(InputStream input) throws IOException { - DataInputStream din = new DataInputStream(input); - - QBModel m = new QBModel(); - int version = din.readInt(); - int colorFormat = din.readInt(); - m.rightHanded = din.readInt() != 0; - boolean compressed = din.readInt() != 0; - boolean visEncoded = din.readInt() != 0; - - if (visEncoded) { - throw new IllegalArgumentException("Encoded Visiblity States not supported"); - } - - m.matrices = new QBMatrix[readTni(din)]; - for (int i = 0; i < m.matrices.length; i++) { - QBMatrix mat = new QBMatrix(); - m.matrices[i] = mat; - mat.name = readAsciiString(din); - mat.size = new BlockCoord(readTni(din), readTni(din), readTni(din)); - mat.pos = new BlockCoord(readTni(din), readTni(din), readTni(din)); - mat.matrix = new int[mat.size.x][mat.size.y][mat.size.z]; - mat.readMatrix(din, compressed); - if (colorFormat == 1) { - mat.convertBGRAtoRGBA(); - } - } - - return m; - } - - public static QBModel loadQB(ResourceLocation res) { - try { - return loadQB(Minecraft.getMinecraft().getResourceManager().getResource(res).getInputStream()); - } catch (Exception e) { - throw new RuntimeException("failed to load model: " + res, e); - } - } - - public static QBModel loadQB(File file) { - try { - FileInputStream fin = new FileInputStream(file); - try { - return loadQB(fin); - } finally { - fin.close(); - } - } catch (Exception e) { - throw new RuntimeException("failed to load model: " + file.getPath(), e); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/render/RenderUtils.java b/dependencies/main/java/codechicken/lib/render/RenderUtils.java deleted file mode 100644 index 935c88f315..0000000000 --- a/dependencies/main/java/codechicken/lib/render/RenderUtils.java +++ /dev/null @@ -1,444 +0,0 @@ -package codechicken.lib.render; - -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.vec.*; -import codechicken.lib.vec.uv.IconTransformation; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderGlobal; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.VertexBuffer; -import net.minecraft.client.renderer.entity.RenderEntityItem; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.shader.Framebuffer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import org.lwjgl.opengl.GL11; - -//TODO Document and reorder things in here. -public class RenderUtils { - - private static Vector3[] vectors = new Vector3[8]; - private static RenderEntityItem uniformRenderItem; - private static boolean hasInitRenderItem; - - private static ThreadLocal iconTransformCache = new ThreadLocal() { - @Override - protected IconTransformation initialValue() { - return new IconTransformation(TextureUtils.getBlockTexture("stone")); - } - }; - - private static EntityItem entityItem; - - static { - for (int i = 0; i < vectors.length; i++) { - vectors[i] = new Vector3(); - } - - entityItem = new EntityItem(null); - entityItem.hoverStart = 0; - } - - private static void loadItemRenderer() { - if (!hasInitRenderItem) { - Minecraft minecraft = Minecraft.getMinecraft(); - uniformRenderItem = new RenderEntityItem(minecraft.getRenderManager(), minecraft.getRenderItem()); - hasInitRenderItem = true; - } - } - - public static void renderFluidQuad(Vector3 point1, Vector3 point2, Vector3 point3, Vector3 point4, TextureAtlasSprite icon, double res) { - renderFluidQuad(point2, vectors[0].set(point4).subtract(point1), vectors[1].set(point1).subtract(point2), icon, res); - } - - /** - * Draws a tessellated quadrilateral bottom to top, left to right - * - * @param base The bottom left corner of the quad - * @param wide The bottom of the quad - * @param high The left side of the quad - * @param res Units per icon - */ - public static void renderFluidQuad(Vector3 base, Vector3 wide, Vector3 high, TextureAtlasSprite icon, double res) { - VertexBuffer r = CCRenderState.instance().getBuffer(); - double u1 = icon.getMinU(); - double du = icon.getMaxU() - icon.getMinU(); - double v2 = icon.getMaxV(); - double dv = icon.getMaxV() - icon.getMinV(); - - double wlen = wide.mag(); - double hlen = high.mag(); - - double x = 0; - while (x < wlen) { - double rx = wlen - x; - if (rx > res) { - rx = res; - } - - double y = 0; - while (y < hlen) { - double ry = hlen - y; - if (ry > res) { - ry = res; - } - - Vector3 dx1 = vectors[2].set(wide).multiply(x / wlen); - Vector3 dx2 = vectors[3].set(wide).multiply((x + rx) / wlen); - Vector3 dy1 = vectors[4].set(high).multiply(y / hlen); - Vector3 dy2 = vectors[5].set(high).multiply((y + ry) / hlen); - - r.pos(base.x + dx1.x + dy2.x, base.y + dx1.y + dy2.y, base.z + dx1.z + dy2.z).tex(u1, v2 - ry / res * dv).endVertex(); - r.pos(base.x + dx1.x + dy1.x, base.y + dx1.y + dy1.y, base.z + dx1.z + dy1.z).tex(u1, v2).endVertex(); - r.pos(base.x + dx2.x + dy1.x, base.y + dx2.y + dy1.y, base.z + dx2.z + dy1.z).tex(u1 + rx / res * du, v2).endVertex(); - r.pos(base.x + dx2.x + dy2.x, base.y + dx2.y + dy2.y, base.z + dx2.z + dy2.z).tex(u1 + rx / res * du, v2 - ry / res * dv).endVertex(); - - y += ry; - } - - x += rx; - } - } - - public static void translateToWorldCoords(Entity entity, float frame) { - double interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * frame; - double interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * frame; - double interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * frame; - - GlStateManager.translate(-interpPosX, -interpPosY, -interpPosZ); - } - - public static void drawCuboidOutline(Cuboid6 c) { - CCRenderState state = CCRenderState.instance(); - VertexBuffer r = state.startDrawing(3, DefaultVertexFormats.POSITION); - r.pos(c.min.x, c.min.y, c.min.z).endVertex(); - r.pos(c.max.x, c.min.y, c.min.z).endVertex(); - r.pos(c.max.x, c.min.y, c.max.z).endVertex(); - r.pos(c.min.x, c.min.y, c.max.z).endVertex(); - r.pos(c.min.x, c.min.y, c.min.z).endVertex(); - state.draw(); - state.startDrawing(3, DefaultVertexFormats.POSITION); - r.pos(c.min.x, c.max.y, c.min.z).endVertex(); - r.pos(c.max.x, c.max.y, c.min.z).endVertex(); - r.pos(c.max.x, c.max.y, c.max.z).endVertex(); - r.pos(c.min.x, c.max.y, c.max.z).endVertex(); - r.pos(c.min.x, c.max.y, c.min.z).endVertex(); - state.draw(); - state.startDrawing(1, DefaultVertexFormats.POSITION); - r.pos(c.min.x, c.min.y, c.min.z).endVertex(); - r.pos(c.min.x, c.max.y, c.min.z).endVertex(); - r.pos(c.max.x, c.min.y, c.min.z).endVertex(); - r.pos(c.max.x, c.max.y, c.min.z).endVertex(); - r.pos(c.max.x, c.min.y, c.max.z).endVertex(); - r.pos(c.max.x, c.max.y, c.max.z).endVertex(); - r.pos(c.min.x, c.min.y, c.max.z).endVertex(); - r.pos(c.min.x, c.max.y, c.max.z).endVertex(); - state.draw(); - } - - public static void renderFluidCuboid(Cuboid6 bound, TextureAtlasSprite tex, double res) { - renderFluidQuad(//bottom - new Vector3(bound.min.x, bound.min.y, bound.min.z), new Vector3(bound.max.x, bound.min.y, bound.min.z), new Vector3(bound.max.x, bound.min.y, bound.max.z), new Vector3(bound.min.x, bound.min.y, bound.max.z), tex, res); - renderFluidQuad(//top - new Vector3(bound.min.x, bound.max.y, bound.min.z), new Vector3(bound.min.x, bound.max.y, bound.max.z), new Vector3(bound.max.x, bound.max.y, bound.max.z), new Vector3(bound.max.x, bound.max.y, bound.min.z), tex, res); - renderFluidQuad(//-x - new Vector3(bound.min.x, bound.max.y, bound.min.z), new Vector3(bound.min.x, bound.min.y, bound.min.z), new Vector3(bound.min.x, bound.min.y, bound.max.z), new Vector3(bound.min.x, bound.max.y, bound.max.z), tex, res); - renderFluidQuad(//+x - new Vector3(bound.max.x, bound.max.y, bound.max.z), new Vector3(bound.max.x, bound.min.y, bound.max.z), new Vector3(bound.max.x, bound.min.y, bound.min.z), new Vector3(bound.max.x, bound.max.y, bound.min.z), tex, res); - renderFluidQuad(//-z - new Vector3(bound.max.x, bound.max.y, bound.min.z), new Vector3(bound.max.x, bound.min.y, bound.min.z), new Vector3(bound.min.x, bound.min.y, bound.min.z), new Vector3(bound.min.x, bound.max.y, bound.min.z), tex, res); - renderFluidQuad(//+z - new Vector3(bound.min.x, bound.max.y, bound.max.z), new Vector3(bound.min.x, bound.min.y, bound.max.z), new Vector3(bound.max.x, bound.min.y, bound.max.z), new Vector3(bound.max.x, bound.max.y, bound.max.z), tex, res); - } - - public static void renderBlockOverlaySide(int x, int y, int z, int side, double tx1, double tx2, double ty1, double ty2) { - double[] points = new double[] { x - 0.009, x + 1.009, y - 0.009, y + 1.009, z - 0.009, z + 1.009 }; - - VertexBuffer r = Tessellator.getInstance().getBuffer(); - //TODO - switch (side) { - case 0: - r.pos(points[0], points[2], points[4]).tex(tx1, ty1).endVertex(); - r.pos(points[1], points[2], points[4]).tex(tx2, ty1).endVertex(); - r.pos(points[1], points[2], points[5]).tex(tx2, ty2).endVertex(); - r.pos(points[0], points[2], points[5]).tex(tx1, ty2).endVertex(); - break; - case 1: - r.pos(points[1], points[3], points[4]).tex(tx2, ty1).endVertex(); - r.pos(points[0], points[3], points[4]).tex(tx1, ty1).endVertex(); - r.pos(points[0], points[3], points[5]).tex(tx1, ty2).endVertex(); - r.pos(points[1], points[3], points[5]).tex(tx2, ty2).endVertex(); - break; - case 2: - r.pos(points[0], points[3], points[4]).tex(tx2, ty1).endVertex(); - r.pos(points[1], points[3], points[4]).tex(tx1, ty1).endVertex(); - r.pos(points[1], points[2], points[4]).tex(tx1, ty2).endVertex(); - r.pos(points[0], points[2], points[4]).tex(tx2, ty2).endVertex(); - break; - case 3: - r.pos(points[1], points[3], points[5]).tex(tx2, ty1).endVertex(); - r.pos(points[0], points[3], points[5]).tex(tx1, ty1).endVertex(); - r.pos(points[0], points[2], points[5]).tex(tx1, ty2).endVertex(); - r.pos(points[1], points[2], points[5]).tex(tx2, ty2).endVertex(); - break; - case 4: - r.pos(points[0], points[3], points[5]).tex(tx2, ty1).endVertex(); - r.pos(points[0], points[3], points[4]).tex(tx1, ty1).endVertex(); - r.pos(points[0], points[2], points[4]).tex(tx1, ty2).endVertex(); - r.pos(points[0], points[2], points[5]).tex(tx2, ty2).endVertex(); - break; - case 5: - r.pos(points[1], points[3], points[4]).tex(tx2, ty1).endVertex(); - r.pos(points[1], points[3], points[5]).tex(tx1, ty1).endVertex(); - r.pos(points[1], points[2], points[5]).tex(tx1, ty2).endVertex(); - r.pos(points[1], points[2], points[4]).tex(tx2, ty2).endVertex(); - break; - } - } - - public static void renderHitBox(EntityPlayer player, Cuboid6 cuboid, float partialTicks) { - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.glLineWidth(2.0F); - GlStateManager.disableTexture2D(); - GlStateManager.depthMask(false); - double xPos = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks; - double yPos = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks; - double zPos = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks; - RenderGlobal.drawSelectionBoundingBox(cuboid.aabb().expandXyz(0.0020000000949949026D).offset(-xPos, -yPos, -zPos), 0.0F, 0.0F, 0.0F, 0.4F); - GlStateManager.depthMask(true); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); - } - - public static void drawSelectionBoundingBox(AxisAlignedBB boundingBox) { - - Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer vertexbuffer = tessellator.getBuffer(); - vertexbuffer.begin(3, DefaultVertexFormats.POSITION); - vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); - vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); - vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex(); - vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex(); - vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); - tessellator.draw(); - vertexbuffer.begin(3, DefaultVertexFormats.POSITION); - vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); - vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex(); - vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex(); - vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex(); - vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); - tessellator.draw(); - vertexbuffer.begin(1, DefaultVertexFormats.POSITION); - vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); - vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); - vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); - vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex(); - vertexbuffer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex(); - vertexbuffer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex(); - vertexbuffer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex(); - vertexbuffer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex(); - tessellator.draw(); - } - - /** - * Checks to see if the FluidStack should be rendered. - * - * @param stack FluidStack to render. - * @return Weather to render or not. - */ - public static boolean shouldRenderFluid(FluidStack stack) { - return stack.amount > 0 && stack.getFluid() != null; - } - - /** - * Sets the colour of the fluid and returns the texture - * - * @param stack The fluid stack to render - * @return The icon of the fluid - */ - public static TextureAtlasSprite prepareFluidRender(FluidStack stack, int alpha) { - Fluid fluid = stack.getFluid(); - CCRenderState.instance().colour = fluid.getColor(stack) << 8 | alpha; - return TextureUtils.getTexture(fluid.getStill()); - } - - /** - * Disables lighting, enables blending and changes to the blocks texture - */ - public static void preFluidRender() { - GlStateManager.disableLighting(); - GlStateManager.enableBlend(); - GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - TextureUtils.bindBlockTexture(); - } - - /** - * Re-enables lighting and disables blending. - */ - public static void postFluidRender() { - GlStateManager.enableLighting(); - GlStateManager.disableBlend(); - } - - public static double fluidDensityToAlpha(double density) { - return Math.pow(density, 0.4); - } - - /** - * Renders a fluid within a bounding box. - * Assumes that CCRenderstate is already drawing with appropriate gl state. For a separate draw call see renderFluidCuboidGL - * If the fluid is a liquid it will render as a normal tank with height equal to density/bound.height. - * If the fluid is a gas, it will render the full box with an alpha equal to density. - * Warning, bound will be mutated if the fluid is a liquid - * - * @param stack The fluid to render. - * @param bound The box within which the fluid is contained. - * @param density The volume of fluid / the capacity of the tank. For gases this determines the alpha, for liquids this determines the height. - * @param res The resolution to render at. - */ - public static void renderFluidCuboid(FluidStack stack, Cuboid6 bound, double density, double res) { - if (!shouldRenderFluid(stack)) { - return; - } - - int alpha = 255; - if (stack.getFluid().isGaseous()) { - alpha = (int) (fluidDensityToAlpha(density) * 255); - } else { - bound.max.y = bound.min.y + (bound.max.y - bound.min.y) * density; - } - - renderFluidCuboid(bound, prepareFluidRender(stack, alpha), res); - } - - public static void renderFluidCuboidGL(FluidStack stack, Cuboid6 bound, double density, double res) { - if (!shouldRenderFluid(stack)) { - return; - } - - preFluidRender(); - CCRenderState state = CCRenderState.instance(); - state.startDrawing(7, DefaultVertexFormats.POSITION_TEX); - renderFluidCuboid(stack, bound, density, res); - state.pushColour(); - state.draw(); - postFluidRender(); - } - - /** - * Assumes that CCRenderstate is already drawing with appropriate gl state. For a separate draw call see renderFluidGaugeGL - */ - public static void renderFluidGauge(FluidStack stack, Rectangle4i rect, double density, double res) { - if (!shouldRenderFluid(stack)) { - return; - } - - int alpha = 255; - if (stack.getFluid().isGaseous()) { - alpha = (int) (fluidDensityToAlpha(density) * 255); - } else { - int height = (int) (rect.h * density); - rect.y += rect.h - height; - rect.h = height; - } - CCRenderState state = CCRenderState.instance(); - state.startDrawing(7, DefaultVertexFormats.POSITION_TEX); - renderFluidQuad(new Vector3(rect.x, rect.y + rect.h, 0), new Vector3(rect.w, 0, 0), new Vector3(0, -rect.h, 0), prepareFluidRender(stack, alpha), res); - state.draw(); - postFluidRender(); - } - - public static void renderFluidGaugeGL(FluidStack stack, Rectangle4i rect, double density, double res) { - if (!shouldRenderFluid(stack)) { - return; - } - - preFluidRender(); - CCRenderState state = CCRenderState.instance(); - state.startDrawing(7, DefaultVertexFormats.POSITION_TEX); - renderFluidGauge(stack, rect, density, res); - state.pushColour(); - state.draw(); - } - - public static Matrix4 getMatrix(Vector3 position, Rotation rotation, double scale) { - return new Matrix4().translate(position).apply(new Scale(scale)).apply(rotation); - } - - /** - * Renders items and blocks in the world at 0,0,0 with transformations that size them appropriately - */ - public static void renderItemUniform(ItemStack item) { - renderItemUniform(item, 0); - } - - /* - * Renders items and blocks in the world at 0,0,0 with transformations that size them appropriately - * - * @param spin The spin angle of the item around the y axis in degrees - */ - public static void renderItemUniform(ItemStack item, double spin) { - loadItemRenderer(); - //IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY); - //boolean is3D = customRenderer != null && customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D); - - //boolean larger = false; - //if (item.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item.getItem()).getRenderType())) { - // int renderType = Block.getBlockFromItem(item.getItem()).getRenderType(); - // larger = !(renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2); - //} else if (is3D) { - // larger = true; - //} - - //double d = 2; - //double d1 = 1 / d; - //if (larger) { - // GLStateManager.scale(d, d, d); - //} - - GlStateManager.color(1, 1, 1, 1); - - entityItem.setEntityItemStack(item); - uniformRenderItem.doRender(entityItem, 0, 0.06, 0, 0, (float) (spin * 9 / Math.PI)); - - //if (larger) { - // GLStateManager.scale(d1, d1, d1); - //}*/ - } - - /** - * Checks if stencil buffer is supported and attempts to enable it if so. - */ - public static boolean checkEnableStencil() { - Framebuffer fb = Minecraft.getMinecraft().getFramebuffer(); - return fb.isStencilEnabled() || fb.enableStencil(); - } - - public static float getPearlBob(double time) { - return (float) Math.sin(time / 25 * 3.141593) * 0.1F; - } - - public static int getTimeOffset(BlockPos pos) { - return getTimeOffset(pos.getX(), pos.getY(), pos.getZ()); - } - - public static int getTimeOffset(int x, int y, int z) { - return x * 3 + y * 5 + z * 9; - } - - public static IconTransformation getIconTransformation(TextureAtlasSprite sprite) { - IconTransformation transformation = iconTransformCache.get(); - transformation.icon = sprite; - return transformation; - } - -} diff --git a/dependencies/main/java/codechicken/lib/render/block/BlockRenderingRegistry.java b/dependencies/main/java/codechicken/lib/render/block/BlockRenderingRegistry.java deleted file mode 100644 index b0c64e131b..0000000000 --- a/dependencies/main/java/codechicken/lib/render/block/BlockRenderingRegistry.java +++ /dev/null @@ -1,110 +0,0 @@ -package codechicken.lib.render.block; - -import codechicken.lib.model.SimpleBakedBlockModel; -import codechicken.lib.render.buffer.BakingVertexBuffer; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.util.ReflectionManager; -import com.google.common.collect.ImmutableList; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BlockModelRenderer; -import net.minecraft.client.renderer.BlockRendererDispatcher; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.VertexBuffer; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.EnumBlockRenderType; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.common.util.EnumHelper; -import net.minecraftforge.fml.relauncher.ReflectionHelper; - -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; - -/** - * Created by covers1624 on 8/09/2016. - * TODO Start phase out of this system. - */ -public class BlockRenderingRegistry { - - private static final Map blockRendererList = new HashMap(); - private static final ImmutableList vanillaRenderTypes = ImmutableList.copyOf(EnumBlockRenderType.values()); - - private static boolean initialized = false; - - static { - init(); - } - - public static void init() { - if (!initialized) { - Minecraft mc = Minecraft.getMinecraft(); - BlockRendererDispatcher parentDispatcher = mc.getBlockRendererDispatcher(); - CCBlockRendererDispatcher newDispatcher = new CCBlockRendererDispatcher(parentDispatcher, mc.getBlockColors()); - - Field field = ReflectionHelper.findField(Minecraft.class, "blockRenderDispatcher", "field_175618_aM", "aR"); - ReflectionManager.set(field, mc, newDispatcher); - - TextureUtils.addIconRegister(newDispatcher); - - initialized = true; - } - } - - public static EnumBlockRenderType createRenderType(String name) { - return EnumHelper.addEnum(EnumBlockRenderType.class, name, new Class[0]); - } - - public static boolean canHandle(EnumBlockRenderType type) { - return blockRendererList.containsKey(type); - } - - public static void registerRenderer(EnumBlockRenderType type, ICCBlockRenderer renderer) { - if (vanillaRenderTypes.contains(type)) { - throw new IllegalArgumentException("Invalid EnumBlockRenderType! " + type.name()); - } - if (blockRendererList.containsKey(type)) { - throw new IllegalArgumentException("Unable to register duplicate render type!" + type.name()); - } - blockRendererList.put(type, renderer); - } - - static void renderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite) { - ICCBlockRenderer renderer = blockRendererList.get(state.getRenderType()); - if (renderer != null) { - state = state.getActualState(world, pos); - //TODO This needs to be optimized, probably not the most efficient thing in the world.. - VertexBuffer parent = Tessellator.getInstance().getBuffer(); - BakingVertexBuffer buffer = BakingVertexBuffer.create(); - buffer.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ()); - buffer.begin(7, parent.getVertexFormat()); - renderer.handleRenderBlockDamage(world, pos, state, sprite, buffer); - buffer.finishDrawing(); - BlockModelRenderer modelRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer(); - modelRenderer.renderModel(world, new SimpleBakedBlockModel(buffer.bake()), state, pos, parent, true); - } - } - - static boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, VertexBuffer buffer) { - ICCBlockRenderer renderer = blockRendererList.get(state.getRenderType()); - if (renderer != null) { - return renderer.renderBlock(world, pos, state, buffer); - } - return false; - } - - static void renderBlockBrightness(IBlockState state, float brightness) { - ICCBlockRenderer renderer = blockRendererList.get(state.getRenderType()); - if (renderer != null) { - renderer.renderBrightness(state, brightness); - } - } - - static void registerTextures(TextureMap map) { - for (ICCBlockRenderer renderer : blockRendererList.values()) { - renderer.registerTextures(map); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/render/block/CCBlockRendererDispatcher.java b/dependencies/main/java/codechicken/lib/render/block/CCBlockRendererDispatcher.java deleted file mode 100644 index 6a57fbeddd..0000000000 --- a/dependencies/main/java/codechicken/lib/render/block/CCBlockRendererDispatcher.java +++ /dev/null @@ -1,91 +0,0 @@ -package codechicken.lib.render.block; - -import codechicken.lib.texture.TextureUtils; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.BlockModelRenderer; -import net.minecraft.client.renderer.BlockModelShapes; -import net.minecraft.client.renderer.BlockRendererDispatcher; -import net.minecraft.client.renderer.VertexBuffer; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.color.BlockColors; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.crash.CrashReport; -import net.minecraft.crash.CrashReportCategory; -import net.minecraft.util.ReportedException; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.WorldType; - -/** - * Created by covers1624 on 8/09/2016. - * TODO Move back end of this to CCExtendedBlockRenderDispatcher - */ -public class CCBlockRendererDispatcher extends BlockRendererDispatcher implements TextureUtils.IIconRegister { - - public final BlockRendererDispatcher parentDispatcher; - - public CCBlockRendererDispatcher(BlockRendererDispatcher dispatcher, BlockColors blockColours) { - super(dispatcher.getBlockModelShapes(), blockColours); - parentDispatcher = dispatcher; - } - - @Override - public void renderBlockDamage(IBlockState state, BlockPos pos, TextureAtlasSprite texture, IBlockAccess blockAccess) { - if (BlockRenderingRegistry.canHandle(state.getRenderType())) { - BlockRenderingRegistry.renderBlockDamage(blockAccess, pos, state, texture); - } else { - parentDispatcher.renderBlockDamage(state, pos, texture, blockAccess); - } - } - - @Override - public boolean renderBlock(IBlockState state, BlockPos pos, IBlockAccess blockAccess, VertexBuffer worldRendererIn) { - try { - if (BlockRenderingRegistry.canHandle(state.getRenderType())) { - if (blockAccess.getWorldType() != WorldType.DEBUG_WORLD) { - try { - state = state.getActualState(blockAccess, pos); - } catch (Exception ignored) { - //Noise.. - } - } - return BlockRenderingRegistry.renderBlock(blockAccess, pos, state, worldRendererIn); - } - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tessellating CCL block in world"); - CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being tessellated"); - CrashReportCategory.addBlockInfo(crashreportcategory, pos, state.getBlock(), state.getBlock().getMetaFromState(state)); - throw new ReportedException(crashreport); - } - return parentDispatcher.renderBlock(state, pos, blockAccess, worldRendererIn); - } - - @Override - public void renderBlockBrightness(IBlockState state, float brightness) { - if (BlockRenderingRegistry.canHandle(state.getRenderType())) { - BlockRenderingRegistry.renderBlockBrightness(state, brightness); - } - super.renderBlockBrightness(state, brightness); - } - - @Override - public void registerIcons(TextureMap textureMap) { - BlockRenderingRegistry.registerTextures(textureMap); - } - - @Override - public BlockModelRenderer getBlockModelRenderer() { - return parentDispatcher.getBlockModelRenderer(); - } - - @Override - public IBakedModel getModelForState(IBlockState state) { - return parentDispatcher.getModelForState(state); - } - - @Override - public BlockModelShapes getBlockModelShapes() { - return parentDispatcher.getBlockModelShapes(); - } -} diff --git a/dependencies/main/java/codechicken/lib/render/block/CCExtendedBlockRendererDispatcher.java b/dependencies/main/java/codechicken/lib/render/block/CCExtendedBlockRendererDispatcher.java deleted file mode 100644 index eb718efbc9..0000000000 --- a/dependencies/main/java/codechicken/lib/render/block/CCExtendedBlockRendererDispatcher.java +++ /dev/null @@ -1,94 +0,0 @@ -package codechicken.lib.render.block; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BlockModelRenderer; -import net.minecraft.client.renderer.BlockModelShapes; -import net.minecraft.client.renderer.BlockRendererDispatcher; -import net.minecraft.client.renderer.VertexBuffer; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.color.BlockColors; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.crash.CrashReport; -import net.minecraft.crash.CrashReportCategory; -import net.minecraft.util.EnumBlockRenderType; -import net.minecraft.util.ReportedException; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.WorldType; - -/** - * Created by covers1624 on 26/10/2016. - * TODO remove IExtendedModel. - */ -public class CCExtendedBlockRendererDispatcher extends BlockRendererDispatcher { - - private final BlockRendererDispatcher parentDispatcher; - - private static boolean initialized = false; - - public CCExtendedBlockRendererDispatcher(BlockRendererDispatcher parentDispatcher, BlockColors blockColors) { - super(parentDispatcher.getBlockModelShapes(), blockColors); - this.parentDispatcher = parentDispatcher; - } - - public static void init() { - if (!initialized) { - Minecraft mc = Minecraft.getMinecraft(); - BlockRendererDispatcher parentDispatcher = mc.getBlockRendererDispatcher(); - CCExtendedBlockRendererDispatcher newDispatcher = new CCExtendedBlockRendererDispatcher(parentDispatcher, mc.getBlockColors()); - - mc.blockRenderDispatcher = newDispatcher; - initialized = true; - } - } - - @Override - public boolean renderBlock(IBlockState state, BlockPos pos, IBlockAccess blockAccess, VertexBuffer worldRendererIn) { - try { - EnumBlockRenderType enumblockrendertype = state.getRenderType(); - - if (enumblockrendertype == EnumBlockRenderType.MODEL && blockAccess.getWorldType() != WorldType.DEBUG_WORLD) { - IBakedModel model = this.getModelForState(state); - if (!(model instanceof IExtendedModel)) { - return parentDispatcher.renderBlock(state, pos, blockAccess, worldRendererIn); - } - state = state.getBlock().getExtendedState(state, blockAccess, pos); - model = ((IExtendedModel) model).handleExtendedModel(model, state); - return parentDispatcher.getBlockModelRenderer().renderModel(blockAccess, model, state, pos, worldRendererIn, true); - } else { - return parentDispatcher.renderBlock(state, pos, blockAccess, worldRendererIn); - } - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Tesselating block in world"); - CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being tesselated"); - CrashReportCategory.addBlockInfo(crashreportcategory, pos, state.getBlock(), state.getBlock().getMetaFromState(state)); - throw new ReportedException(crashreport); - } - } - - @Override - public void renderBlockDamage(IBlockState state, BlockPos pos, TextureAtlasSprite texture, IBlockAccess blockAccess) { - parentDispatcher.renderBlockDamage(state, pos, texture, blockAccess); - } - - @Override - public void renderBlockBrightness(IBlockState state, float brightness) { - parentDispatcher.renderBlockBrightness(state, brightness); - } - - @Override - public BlockModelRenderer getBlockModelRenderer() { - return parentDispatcher.getBlockModelRenderer(); - } - - @Override - public IBakedModel getModelForState(IBlockState state) { - return parentDispatcher.getModelForState(state); - } - - @Override - public BlockModelShapes getBlockModelShapes() { - return parentDispatcher.getBlockModelShapes(); - } -} diff --git a/dependencies/main/java/codechicken/lib/render/block/ICCBlockRenderer.java b/dependencies/main/java/codechicken/lib/render/block/ICCBlockRenderer.java deleted file mode 100644 index 46d54cf585..0000000000 --- a/dependencies/main/java/codechicken/lib/render/block/ICCBlockRenderer.java +++ /dev/null @@ -1,23 +0,0 @@ -package codechicken.lib.render.block; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.VertexBuffer; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; - -/** - * Created by covers1624 on 8/09/2016. - * TODO, Some sort of automatic block breaking texture stuff. - */ -public interface ICCBlockRenderer { - - void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, VertexBuffer buffer); - - boolean renderBlock(IBlockAccess world, BlockPos pos, IBlockState state, VertexBuffer buffer); - - void renderBrightness(IBlockState state, float brightness); - - void registerTextures(TextureMap map); -} diff --git a/dependencies/main/java/codechicken/lib/render/block/IExtendedModel.java b/dependencies/main/java/codechicken/lib/render/block/IExtendedModel.java deleted file mode 100644 index 6875887fcd..0000000000 --- a/dependencies/main/java/codechicken/lib/render/block/IExtendedModel.java +++ /dev/null @@ -1,26 +0,0 @@ -package codechicken.lib.render.block; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.IBakedModel; - -/** - * Created by covers1624 on 26/10/2016. - * Implementing this on a IBakedModel will allow you to have interaction similar to Block#getExtendedState. - * You can return an entirely different model for this or just set some flags. What ever you want. - * Useful for on-the-fly model baking, where you need to generate from an IExtendedBlockState. - */ -@Deprecated -public interface IExtendedModel extends IBakedModel { - - /** - * You can return what ever model you like. - * This is fired from BlockRendererDispatcher#renderBlock before blockModelRenderer#renderModel, - * but after getExtendedState. - * - * @param prevModel The model that was going to be rendered. - * @param state The IBlockState returned from getExtendedState. - * @return Another IBakedModel, can be different, same, whatever. - */ - IBakedModel handleExtendedModel(IBakedModel prevModel, IBlockState state); - -} diff --git a/dependencies/main/java/codechicken/lib/render/buffer/BakingVertexBuffer.java b/dependencies/main/java/codechicken/lib/render/buffer/BakingVertexBuffer.java deleted file mode 100644 index 2a780a0a16..0000000000 --- a/dependencies/main/java/codechicken/lib/render/buffer/BakingVertexBuffer.java +++ /dev/null @@ -1,176 +0,0 @@ -package codechicken.lib.render.buffer; - -import codechicken.lib.math.MathHelper; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.util.VectorUtils; -import codechicken.lib.util.VertexDataUtils; -import codechicken.lib.vec.Vector3; -import codechicken.lib.vec.uv.UV; -import com.google.common.collect.ImmutableList; -import net.minecraft.client.renderer.VertexBuffer; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.model.pipeline.LightUtil; -import net.minecraftforge.fml.common.FMLLog; -import org.apache.logging.log4j.Level; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; - -/** - * Created by covers1624 on 4/10/2016. - * Creates a List of BakedQuads from a VertexBuffer. That's it really.. - * //TODO, support triangles & quadulate. - */ -public class BakingVertexBuffer extends VertexBuffer { - - private HashMap spriteMap; - private boolean useSprites = true; - private boolean useDiffuseLighting = true; - - private static ThreadLocal threadBuffers = new ThreadLocal() { - @Override - protected BakingVertexBuffer initialValue() { - return new BakingVertexBuffer(0x200000); - } - }; - - public static BakingVertexBuffer create() { - return threadBuffers.get(); - } - - private BakingVertexBuffer(int bufferSizeIn) { - super(bufferSizeIn); - } - - @Override - public void begin(int glMode, VertexFormat format) { - if (glMode != 7) { - throw new IllegalArgumentException("Unable to bake GL Mode, only Quads supported! To bake triangles pipe through CCQuad then quadulate."); - } - super.begin(glMode, format); - } - - @Override - public void reset() { - spriteMap = new HashMap(); - useSprites = true; - useDiffuseLighting = true; - super.reset(); - } - - /** - * Sets the sprite for a specific vertex. - * - * @param sprite The sprite to set. - */ - public BakingVertexBuffer setSprite(TextureAtlasSprite sprite) { - spriteMap.put(MathHelper.floor(getVertexCount() / 4D), sprite); - return this; - } - - /** - * Sets the baker to ignore all sprite calculations and just use the missing icon. - * This should only be used in cases where you know the quads are not going to be transformed by another mod at any point. - */ - public BakingVertexBuffer ignoreSprites() { - useSprites = false; - return this; - } - - /** - * Sets the baker to use any set vertex range sprite, or calculate sprites for a given UV mapping. - * This is enabled by default. - */ - public BakingVertexBuffer useSprites() { - useSprites = true; - return this; - } - - /** - * Disables DiffuseLighting on quads. - */ - public BakingVertexBuffer dissableDiffuseLighting() { - useDiffuseLighting = false; - return this; - } - - /** - * Enables DiffuseLighting on quads. - * This is enabled by default. - */ - public BakingVertexBuffer enableDiffuseLighting() { - useDiffuseLighting = true; - return this; - } - - /** - * Bakes the data inside the VertexBuffer to a baked quad. - * - * @return The list of quads baked. - */ - public List bake() { - if (isDrawing) { - FMLLog.log("CodeChickenLib", Level.WARN, new IllegalStateException("Bake called before finishDrawing!"), "Someone is calling bake before finishDrawing!"); - finishDrawing(); - } - State state = getVertexState(); - VertexFormat format = state.getVertexFormat(); - if (!format.hasUvOffset(0)) { - throw new IllegalStateException("Unable to bake format that does not have UV mappings!"); - } - int[] rawBuffer = Arrays.copyOf(state.getRawBuffer(), state.getRawBuffer().length); - - List quads = new LinkedList(); - TextureAtlasSprite sprite = TextureUtils.getMissingSprite(); - - int curr = 0; - int next = format.getNextOffset(); - int i = 0; - while (rawBuffer.length >= next) { - int[] quadData = Arrays.copyOfRange(rawBuffer, curr, next); - Vector3 normal = new Vector3(); - if (format.hasNormal()) { - //Grab first normal. - float[] normalData = new float[4]; - LightUtil.unpack(quadData, normalData, format, 0, VertexDataUtils.getNormalElement(format)); - normal = Vector3.fromArray(normalData); - } else { - //No normal provided in format, so we calculate. - float[][] posData = new float[4][4]; - for (int v = 0; v < 4; v++) { - LightUtil.unpack(quadData, posData[v], format, v, VertexDataUtils.getPositionElement(format)); - } - normal.set(VectorUtils.calculateNormal(Vector3.fromArray(posData[0]), Vector3.fromArray(posData[1]), Vector3.fromArray(posData[3]))); - } - if (useSprites) { - //Attempt to get sprite for vertex. - if (spriteMap.containsKey(i)) { - //Use provided sprite for vertex. - sprite = spriteMap.get(i); - } else { - //Sprite not found for vertex, so we attempt to calculate the sprite. - float[] uvData = new float[4]; - LightUtil.unpack(quadData, uvData, format, 0, VertexDataUtils.getUVElement(format)); - UV uv = new UV(uvData[0], uvData[1]); - sprite = VertexDataUtils.getSpriteForUV(TextureUtils.getTextureMap(), uv); - } - } - //Use normal to calculate facing. - EnumFacing facing = VectorUtils.calcNormalSide(normal); - if (facing == null) { - facing = EnumFacing.UP; - } - BakedQuad quad = new BakedQuad(quadData, -1, facing, sprite, useDiffuseLighting, format); - quads.add(quad); - curr = next; - next += format.getNextOffset(); - i++; - } - return ImmutableList.copyOf(quads); - } -} diff --git a/dependencies/main/java/codechicken/lib/render/item/CCRenderItem.java b/dependencies/main/java/codechicken/lib/render/item/CCRenderItem.java deleted file mode 100644 index ffc7d72c41..0000000000 --- a/dependencies/main/java/codechicken/lib/render/item/CCRenderItem.java +++ /dev/null @@ -1,306 +0,0 @@ -package codechicken.lib.render.item; - -import codechicken.lib.asm.ObfMapping; -import codechicken.lib.render.state.GlStateManagerHelper; -import codechicken.lib.util.ReflectionManager; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.ItemModelMesher; -import net.minecraft.client.renderer.RenderItem; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.crash.CrashReport; -import net.minecraft.crash.CrashReportCategory; -import net.minecraft.crash.ICrashReportDetail; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ReportedException; -import net.minecraft.world.World; -import net.minecraftforge.client.ForgeHooksClient; -import net.minecraftforge.client.model.IPerspectiveAwareModel; -import org.apache.commons.lang3.tuple.Pair; - -import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; - -/** - * Created by covers1624 on 17/10/2016. - * TODO, Generify how this works. might be different from vanilla in the end but we should probably try and sniff off if the model is ours at an earlier date. - * TODO, Some sort of registry over IMC for mods to add their own hooks to this. - */ -public class CCRenderItem extends RenderItem { - - private final RenderItem parent; - private static CCRenderItem instance; - private static boolean hasInit; - - //Because forge has this private. - private static final Matrix4f flipX; - - static { - flipX = new Matrix4f(); - flipX.setIdentity(); - flipX.m00 = -1; - } - - public CCRenderItem(RenderItem renderItem) { - super(renderItem.textureManager, renderItem.itemModelMesher.getModelManager(), renderItem.itemColors); - ReflectionManager.setField(new ObfMapping("net/minecraft/client/renderer/RenderItem", "field_175059_m", ""), renderItem, renderItem.itemModelMesher); - this.parent = renderItem; - } - - public static void init() { - if (!hasInit) { - instance = new CCRenderItem(Minecraft.getMinecraft().getRenderItem()); - ObfMapping mapping = new ObfMapping("net/minecraft/client/Minecraft", "field_175621_X", ""); - ReflectionManager.setField(mapping, Minecraft.getMinecraft(), instance); - hasInit = true; - } - } - - public static CCRenderItem instance() { - init(); - return instance; - } - - @Override - public void renderItem(ItemStack stack, IBakedModel model) { - if (stack != null && model instanceof IItemRenderer) { - IItemRenderer renderer = (IItemRenderer) model; - boolean shouldHandleRender = true; - try {//Catch AME's from new method. - shouldHandleRender = true;//renderer.shouldHandleRender(stack); - } catch (AbstractMethodError ignored) { - } - if (shouldHandleRender) { - GlStateManager.pushMatrix(); - GlStateManager.translate(-0.5F, -0.5F, -0.5F); - - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.enableRescaleNormal(); - GlStateManagerHelper.pushState(); - renderer.renderItem(stack); - GlStateManagerHelper.popState(); - GlStateManager.popMatrix(); - return; - } - } - parent.renderItem(stack, model); - } - - private IBakedModel handleTransforms(ItemStack stack, IBakedModel model, TransformType transformType, boolean isLeftHand) { - if (model instanceof IMatrixTransform) { - ((IMatrixTransform) model).getTransform(transformType, isLeftHand).glApply(); - } else if (model instanceof IGLTransform) { - ((IGLTransform) model).applyTransforms(transformType, isLeftHand); - } else if (model instanceof IPerspectiveAwareModel) { - model = ForgeHooksClient.handleCameraTransforms(model, transformType, isLeftHand); - } else if (model instanceof IStackPerspectiveAwareModel) { - Pair pair = ((IStackPerspectiveAwareModel) model).handlePerspective(stack, transformType); - - if (pair.getRight() != null) { - Matrix4f matrix = new Matrix4f(pair.getRight()); - if (isLeftHand) { - matrix.mul(flipX, matrix); - matrix.mul(matrix, flipX); - } - ForgeHooksClient.multiplyCurrentGlMatrix(matrix); - } - return pair.getLeft(); - } - return model; - } - - private boolean isValidModel(IBakedModel model) { - return model instanceof IItemRenderer || model instanceof IGLTransform || model instanceof IMatrixTransform || model instanceof IStackPerspectiveAwareModel; - } - - @Override - public void renderItemModel(ItemStack stack, IBakedModel bakedModel, TransformType transform, boolean leftHanded) { - if (stack.getItem() != null) { - if (isValidModel(bakedModel)) { - this.textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - this.textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.enableRescaleNormal(); - GlStateManager.alphaFunc(516, 0.1F); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.pushMatrix(); - - bakedModel = handleTransforms(stack, bakedModel, transform, leftHanded); - - this.renderItem(stack, bakedModel); - GlStateManager.cullFace(GlStateManager.CullFace.BACK); - GlStateManager.popMatrix(); - GlStateManager.disableRescaleNormal(); - GlStateManager.disableBlend(); - this.textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - this.textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); - } else { - parent.zLevel = this.zLevel; - parent.renderItemModel(stack, bakedModel, transform, leftHanded); - } - } - } - - @Override - public void renderItemModelIntoGUI(ItemStack stack, int x, int y, IBakedModel bakedModel) { - if (isValidModel(bakedModel)) { - GlStateManager.pushMatrix(); - this.textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - this.textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false); - GlStateManager.enableRescaleNormal(); - GlStateManager.enableAlpha(); - GlStateManager.alphaFunc(516, 0.1F); - GlStateManager.enableBlend(); - GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - this.setupGuiTransform(x, y, bakedModel.isGui3d()); - - bakedModel = handleTransforms(stack, bakedModel, ItemCameraTransforms.TransformType.GUI, false); - - this.renderItem(stack, bakedModel); - GlStateManager.disableAlpha(); - GlStateManager.disableRescaleNormal(); - GlStateManager.disableLighting(); - GlStateManager.popMatrix(); - this.textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - this.textureManager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); - } else { - parent.zLevel = this.zLevel; - parent.renderItemModelIntoGUI(stack, x, y, bakedModel); - } - } - - // region Other Overrides - - @Override - public void renderItem(ItemStack stack, TransformType cameraTransformType) { - if (stack != null) { - IBakedModel bakedModel = this.getItemModelWithOverrides(stack, (World) null, (EntityLivingBase) null); - if (isValidModel(bakedModel)) { - this.renderItemModel(stack, bakedModel, cameraTransformType, false); - } - parent.zLevel = this.zLevel; - parent.renderItem(stack, cameraTransformType); - } - } - - @Override - public void renderItem(ItemStack stack, EntityLivingBase livingBase, TransformType transform, boolean leftHanded) { - if (stack != null && livingBase != null && stack.getItem() != null) { - IBakedModel bakedModel = this.getItemModelWithOverrides(stack, livingBase.worldObj, livingBase); - if (isValidModel(bakedModel)) { - this.renderItemModel(stack, bakedModel, transform, leftHanded); - } else { - parent.zLevel = this.zLevel; - parent.renderItem(stack, livingBase, transform, leftHanded); - } - } - } - - @Override - public void renderItemIntoGUI(ItemStack stack, int x, int y) { - IBakedModel bakedModel = this.getItemModelWithOverrides(stack, (World) null, (EntityLivingBase) null); - if (isValidModel(bakedModel)) { - this.renderItemModelIntoGUI(stack, x, y, bakedModel); - } else { - parent.zLevel = this.zLevel; - parent.renderItemIntoGUI(stack, x, y); - } - } - - @Override - public void renderItemAndEffectIntoGUI(ItemStack stack, int xPosition, int yPosition) { - this.renderItemAndEffectIntoGUI(Minecraft.getMinecraft().thePlayer, stack, xPosition, yPosition); - } - - @Override - public void renderItemAndEffectIntoGUI(@Nullable EntityLivingBase livingBase, final ItemStack stack, int x, int y) { - if (stack != null && stack.getItem() != null) { - try { - - IBakedModel model = this.getItemModelWithOverrides(stack, (World) null, livingBase); - if (isValidModel(model)) { - this.zLevel += 50.0F; - this.renderItemModelIntoGUI(stack, x, y, model); - this.zLevel -= 50.0F; - } else { - parent.zLevel = this.zLevel; - parent.renderItemAndEffectIntoGUI(livingBase, stack, x, y); - } - - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering item"); - CrashReportCategory crashreportcategory = crashreport.makeCategory("Item being rendered"); - crashreportcategory.setDetail("Item Type", new ICrashReportDetail() { - public String call() throws Exception { - return String.valueOf((Object) stack.getItem()); - } - }); - crashreportcategory.setDetail("Item Aux", new ICrashReportDetail() { - public String call() throws Exception { - return String.valueOf(stack.getMetadata()); - } - }); - crashreportcategory.setDetail("Item NBT", new ICrashReportDetail() { - public String call() throws Exception { - return String.valueOf((Object) stack.getTagCompound()); - } - }); - crashreportcategory.setDetail("Item Foil", new ICrashReportDetail() { - public String call() throws Exception { - return String.valueOf(stack.hasEffect()); - } - }); - throw new ReportedException(crashreport); - } - } - } - - // endregion - - // region parentOverrides - @Override - public void registerItems() { - //We don't want to register any more items as we are just a wrapper. - } - - @Override - public void registerItem(Item item, int subType, String identifier) { - //Pass this through because why not. - parent.registerItem(item, subType, identifier); - } - - @Override - public void isNotRenderingEffectsInGUI(boolean isNot) { - parent.isNotRenderingEffectsInGUI(isNot); - } - - @Override - public ItemModelMesher getItemModelMesher() { - return parent.getItemModelMesher(); - } - - @Override - public boolean shouldRenderItemIn3D(ItemStack stack) { - return parent.shouldRenderItemIn3D(stack); - } - - @Override - public IBakedModel getItemModelWithOverrides(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entitylivingbaseIn) { - return parent.getItemModelWithOverrides(stack, worldIn, entitylivingbaseIn); - } - - @Override - public void onResourceManagerReload(IResourceManager resourceManager) { - parent.onResourceManagerReload(resourceManager); - } - - //endregion -} diff --git a/dependencies/main/java/codechicken/lib/render/item/EntityRendererHooks.java b/dependencies/main/java/codechicken/lib/render/item/EntityRendererHooks.java deleted file mode 100644 index 073a4970d8..0000000000 --- a/dependencies/main/java/codechicken/lib/render/item/EntityRendererHooks.java +++ /dev/null @@ -1,129 +0,0 @@ -package codechicken.lib.render.item; - -import codechicken.lib.asm.ObfMapping; -import codechicken.lib.util.ReflectionManager; -import net.minecraft.client.renderer.RenderItem; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.entity.Entity; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; -import net.minecraftforge.client.event.GuiOpenEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.client.GuiModList; -import net.minecraftforge.fml.client.registry.IRenderFactory; -import net.minecraftforge.fml.client.registry.RenderingRegistry; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.Mod.EventHandler; -import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.lang.reflect.Field; -import java.util.ArrayList; - -/** - * Created by covers1624 on 31/10/2016. - */ -//Used to make sure all references to RenderItem are of CCL's overridden renderer. -@Mod (modid = "ccl-entityhook") -//TODO Find another way to do this, Maybe an ASM hook to load the CCRenderItem. -public class EntityRendererHooks { - - private static boolean hasSanitized; - - public static EntityRendererHooks instance; - - public EntityRendererHooks() { - instance = this; - } - - @EventHandler - @SideOnly (Side.CLIENT) - public void preInt(FMLPreInitializationEvent event) { - MinecraftForge.EVENT_BUS.register(instance); - RenderingRegistry.registerEntityRenderingHandler(DummyEntity.class, new IRenderFactory() { - @Override - public Render createRenderFor(RenderManager manager) { - sanitizeEntityRenderers(manager); - return new Render(manager) { - @Override - protected ResourceLocation getEntityTexture(DummyEntity entity) { - return null; - } - }; - } - }); - } - - @SuppressWarnings ("unchecked") - @SubscribeEvent - @SideOnly (Side.CLIENT) - public void onGuiInit(GuiOpenEvent event) { - try { - if (event.getGui() instanceof GuiModList) { - ModContainer container = FMLCommonHandler.instance().findContainerFor(instance); - Field field = ReflectionManager.getField(new ObfMapping("net/minecraftforge/fml/client/GuiModList", "mods", "")); - ArrayList mods = (ArrayList) field.get(event.getGui()); - if (mods.contains(container)) { - mods.remove(container); - } else { - FMLLog.warning("CCL's Dummy mod was not found inside the mod gui list!"); - } - - } - } catch (Exception e) { - throw new RuntimeException("Unable to hide CCL Dummy mod from the mods gui!.", e); - } - } - - @SideOnly (Side.CLIENT) - public static void sanitizeEntityRenderers(RenderManager renderManager) { - if (!hasSanitized) { - try { - for (Render render : renderManager.entityRenderMap.values()) { - if (render != null) { - for (Field field : render.getClass().getDeclaredFields()) { - if (field.getType().equals(RenderItem.class)) { - field.setAccessible(true); - field.set(render, CCRenderItem.instance()); - } - } - } - } - } catch (Exception e) { - throw new RuntimeException("Unable to reflect an EntityRenderer!", e); - } - hasSanitized = true; - } - } - - @SideOnly (Side.CLIENT) - public class DummyEntity extends Entity { - - public DummyEntity(World worldIn) { - super(worldIn); - } - - @Override - protected void entityInit() { - - } - - @Override - protected void readEntityFromNBT(NBTTagCompound compound) { - - } - - @Override - protected void writeEntityToNBT(NBTTagCompound compound) { - - } - } - -} diff --git a/dependencies/main/java/codechicken/lib/render/item/IGLTransform.java b/dependencies/main/java/codechicken/lib/render/item/IGLTransform.java deleted file mode 100644 index bdb4de5c0f..0000000000 --- a/dependencies/main/java/codechicken/lib/render/item/IGLTransform.java +++ /dev/null @@ -1,13 +0,0 @@ -package codechicken.lib.render.item; - -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; - -/** - * Created by covers1624 on 18/10/2016. - * Used to manually apply OpenGL transforms based on the TransformType. - */ -public interface IGLTransform extends IBakedModel { - - void applyTransforms(TransformType transformType, boolean isLeftHand); -} diff --git a/dependencies/main/java/codechicken/lib/render/item/IItemRenderer.java b/dependencies/main/java/codechicken/lib/render/item/IItemRenderer.java deleted file mode 100644 index 3748beb941..0000000000 --- a/dependencies/main/java/codechicken/lib/render/item/IItemRenderer.java +++ /dev/null @@ -1,20 +0,0 @@ -package codechicken.lib.render.item; - -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.item.ItemStack; - -/** - * Hooks to the location of RenderItem#renderItem(ItemStack, IBakedModel) - */ -//TODO, We need a perspective aware IItemRenderer -public interface IItemRenderer extends IBakedModel { - - /** - * Used as a CallBack to render a TileEntity / Item after Transforms have been applied. - * - * @param item Stack to render. - */ - void renderItem(ItemStack item); - - //boolean shouldHandleRender(ItemStack stack); -} diff --git a/dependencies/main/java/codechicken/lib/render/item/IMatrixTransform.java b/dependencies/main/java/codechicken/lib/render/item/IMatrixTransform.java deleted file mode 100644 index a9ccb759e6..0000000000 --- a/dependencies/main/java/codechicken/lib/render/item/IMatrixTransform.java +++ /dev/null @@ -1,14 +0,0 @@ -package codechicken.lib.render.item; - -import codechicken.lib.vec.Matrix4; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; - -/** - * Created by covers1624 on 18/10/2016. - * Used to define IITemRenderer to apply transforms using a Matrix4 - */ -public interface IMatrixTransform extends IBakedModel { - - Matrix4 getTransform(TransformType transformType, boolean isLeftHand); -} diff --git a/dependencies/main/java/codechicken/lib/render/item/IStackPerspectiveAwareModel.java b/dependencies/main/java/codechicken/lib/render/item/IStackPerspectiveAwareModel.java deleted file mode 100644 index b937a5eda9..0000000000 --- a/dependencies/main/java/codechicken/lib/render/item/IStackPerspectiveAwareModel.java +++ /dev/null @@ -1,17 +0,0 @@ -package codechicken.lib.render.item; - -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.item.ItemStack; -import org.apache.commons.lang3.tuple.Pair; - -import javax.vecmath.Matrix4f; - -/** - * Created by covers1624 on 5/11/2016. - * Basically the same as IPerspectiveAwareModel. Except you have reference to the ItemStack you are rendering for. - */ -public interface IStackPerspectiveAwareModel extends IBakedModel { - - Pair handlePerspective(ItemStack stack, TransformType cameraTransformType); -} diff --git a/dependencies/main/java/codechicken/lib/render/item/map/IMapRenderer.java b/dependencies/main/java/codechicken/lib/render/item/map/IMapRenderer.java deleted file mode 100644 index 2c419b2310..0000000000 --- a/dependencies/main/java/codechicken/lib/render/item/map/IMapRenderer.java +++ /dev/null @@ -1,34 +0,0 @@ -package codechicken.lib.render.item.map; - -import net.minecraft.item.ItemStack; -import net.minecraft.world.storage.MapData; - -import javax.annotation.Nullable; - -/** - * Created by covers1624 on 15/02/2017. - * Used to handle the rendering of map data for your custom maps. - */ -public interface IMapRenderer { - - /** - * If the IMapRenderer should handle rendering the data from this map. - * - * @param stack The ItemStack to render map data from. - * @param data The Map data contained inside this Map. - * @param inFrame If the ItemStack is inside an ItemFrame. - * @return Should this IMapRenderer handle with this context. - */ - boolean shouldHandle(ItemStack stack, @Nullable MapData data, boolean inFrame); - - /** - * If this is called you are expected to do something. - * This is ONLY called if shouldHandle returns true. - * - * @param stack The ItemStack to render the map data from. - * @param data The MapData contained in the ItemStack. - * @param inFrame If the ItemStack is inside an ItemFrame. - */ - void renderMap(ItemStack stack, @Nullable MapData data, boolean inFrame); - -} diff --git a/dependencies/main/java/codechicken/lib/render/item/map/MapRenderRegistry.java b/dependencies/main/java/codechicken/lib/render/item/map/MapRenderRegistry.java deleted file mode 100644 index a3f82db491..0000000000 --- a/dependencies/main/java/codechicken/lib/render/item/map/MapRenderRegistry.java +++ /dev/null @@ -1,50 +0,0 @@ -package codechicken.lib.render.item.map; - -import net.minecraft.client.Minecraft; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.world.storage.MapData; -import net.minecraftforge.client.event.RenderItemInFrameEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -import java.util.IdentityHashMap; - -/** - * Created by covers1624 on 15/02/2017. - * TODO PR for 1.11 to add this as an event. - */ -public class MapRenderRegistry { - - private static IdentityHashMap mapRenderers = new IdentityHashMap(); - - public static boolean shouldHandle(ItemStack stack, boolean inFrame) { - IMapRenderer mapRenderer = mapRenderers.get(stack.getItem()); - if (mapRenderer != null) { - MapData data = Items.FILLED_MAP.getMapData(stack, Minecraft.getMinecraft().theWorld); - return mapRenderer.shouldHandle(stack, data, inFrame); - } - return false; - } - - public static void handleRender(ItemStack stack, boolean inFrame) { - IMapRenderer mapRenderer = mapRenderers.get(stack.getItem()); - if (mapRenderer != null) { - MapData data = Items.FILLED_MAP.getMapData(stack, Minecraft.getMinecraft().theWorld); - mapRenderer.renderMap(stack, data, inFrame); - } - } - - public static void registerMapRenderer(Item item, IMapRenderer mapRenderer) { - mapRenderers.put(item, mapRenderer); - } - - @SubscribeEvent - public void onItemFrameRender(RenderItemInFrameEvent event) { - if (shouldHandle(event.getItem(), true)) { - event.setCanceled(true); - handleRender(event.getItem(), true); - } - } - -} diff --git a/dependencies/main/java/codechicken/lib/render/particle/CustomParticleHandler.java b/dependencies/main/java/codechicken/lib/render/particle/CustomParticleHandler.java deleted file mode 100644 index 6183ae0429..0000000000 --- a/dependencies/main/java/codechicken/lib/render/particle/CustomParticleHandler.java +++ /dev/null @@ -1,85 +0,0 @@ -package codechicken.lib.render.particle; - -import codechicken.lib.render.DigIconParticle; -import codechicken.lib.texture.IWorldBlockTextureProvider; -import codechicken.lib.vec.Cuboid6; -import codechicken.lib.vec.Vector3; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.particle.ParticleManager; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.world.World; - -/** - * Created by covers1624 on 21/11/2016. - * TODO, we need to support landing particles and Maybe some ASM to add this to all blocks that CCL supports. - */ -public class CustomParticleHandler { - - public static void addHitEffects(IBlockState state, World world, RayTraceResult trace, ParticleManager particleManager, IWorldBlockTextureProvider provider) { - TextureAtlasSprite sprite = provider.getTexture(trace.sideHit, state, BlockRenderLayer.SOLID, world, trace.getBlockPos()); - Cuboid6 cuboid = new Cuboid6(state.getBoundingBox(world, trace.getBlockPos())).add(trace.getBlockPos()); - addBlockHitEffects(world, cuboid, trace.sideHit, sprite, particleManager); - } - - public static void addDestroyEffects(World world, BlockPos pos, ParticleManager particleManager, IWorldBlockTextureProvider provider) { - TextureAtlasSprite[] sprites = new TextureAtlasSprite[6]; - IBlockState state = world.getBlockState(pos); - for (EnumFacing face : EnumFacing.VALUES) { - sprites[face.ordinal()] = provider.getTexture(face, state, BlockRenderLayer.SOLID, world, pos); - } - Cuboid6 cuboid = new Cuboid6(state.getBoundingBox(world, pos)).add(pos); - addBlockDestroyEffects(world, cuboid, sprites, particleManager); - } - - public static void addBlockHitEffects(World world, Cuboid6 bounds, EnumFacing side, TextureAtlasSprite icon, ParticleManager particleManager) { - float border = 0.1F; - Vector3 diff = bounds.max.copy().subtract(bounds.min).add(-2 * border); - diff.x *= world.rand.nextDouble(); - diff.y *= world.rand.nextDouble(); - diff.z *= world.rand.nextDouble(); - Vector3 pos = diff.add(bounds.min).add(border); - - if (side == EnumFacing.DOWN) { - diff.y = bounds.min.y - border; - } - if (side == EnumFacing.UP) { - diff.y = bounds.max.y + border; - } - if (side == EnumFacing.NORTH) { - diff.z = bounds.min.z - border; - } - if (side == EnumFacing.SOUTH) { - diff.z = bounds.max.z + border; - } - if (side == EnumFacing.WEST) { - diff.x = bounds.min.x - border; - } - if (side == EnumFacing.EAST) { - diff.x = bounds.max.x + border; - } - - particleManager.addEffect(new DigIconParticle(world, pos.x, pos.y, pos.z, 0, 0, 0, icon).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F)); - } - - public static void addBlockDestroyEffects(World world, Cuboid6 bounds, TextureAtlasSprite[] icons, ParticleManager particleManager) { - Vector3 diff = bounds.max.copy().subtract(bounds.min); - Vector3 center = bounds.min.copy().add(bounds.max).multiply(0.5); - Vector3 density = diff.copy().multiply(4).celi(); - - for (int i = 0; i < density.x; ++i) { - for (int j = 0; j < density.y; ++j) { - for (int k = 0; k < density.z; ++k) { - double x = bounds.min.x + (i + 0.5) * diff.x / density.x; - double y = bounds.min.y + (j + 0.5) * diff.y / density.y; - double z = bounds.min.z + (k + 0.5) * diff.z / density.z; - particleManager.addEffect(new DigIconParticle(world, x, y, z, x - center.x, y - center.y, z - center.z, icons[world.rand.nextInt(icons.length)])); - } - } - } - } - -} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/CCRenderPipeline.java b/dependencies/main/java/codechicken/lib/render/pipeline/CCRenderPipeline.java deleted file mode 100644 index 2e84dd8295..0000000000 --- a/dependencies/main/java/codechicken/lib/render/pipeline/CCRenderPipeline.java +++ /dev/null @@ -1,168 +0,0 @@ -package codechicken.lib.render.pipeline; - -import codechicken.lib.render.CCRenderState; - -import java.util.ArrayList; - -public class CCRenderPipeline { - - public class PipelineBuilder { - - CCRenderState renderState; - - public PipelineBuilder(CCRenderState renderState) { - this.renderState = renderState; - } - - public PipelineBuilder add(IVertexOperation op) { - ops.add(op); - return this; - } - - public PipelineBuilder add(IVertexOperation... ops) { - for (int i = 0; i < ops.length; i++) { - CCRenderPipeline.this.ops.add(ops[i]); - } - return this; - } - - public void build() { - rebuild(); - } - - public void render() { - rebuild(); - renderState.render(); - } - } - - private class PipelineNode { - - public ArrayList deps = new ArrayList(); - public IVertexOperation op; - - public void add() { - if (op == null) { - return; - } - - for (int i = 0; i < deps.size(); i++) { - deps.get(i).add(); - } - deps.clear(); - sorted.add(op); - op = null; - } - } - - private CCRenderState renderState; - - //By default we want to force format attributes. - public boolean forceFormatAttributes = true; - - private ArrayList attribs = new ArrayList(); - private ArrayList ops = new ArrayList(); - private ArrayList nodes = new ArrayList(); - private ArrayList sorted = new ArrayList(); - private PipelineNode loading; - private PipelineBuilder builder; - - public CCRenderPipeline(CCRenderState renderState) { - this.renderState = renderState; - builder = new PipelineBuilder(renderState); - } - - public void setPipeline(IVertexOperation... ops) { - this.ops.clear(); - for (int i = 0; i < ops.length; i++) { - this.ops.add(ops[i]); - } - rebuild(); - } - - public void reset() { - ops.clear(); - unbuild(); - } - - private void unbuild() { - for (int i = 0; i < attribs.size(); i++) { - attribs.get(i).active = false; - } - attribs.clear(); - sorted.clear(); - } - - public void rebuild() { - - if (forceFormatAttributes) { - if (renderState.fmt.hasNormal()) { - addAttribute(renderState.normalAttrib); - } - if (renderState.fmt.hasColor()) { - addAttribute(renderState.colourAttrib); - } - if (renderState.computeLighting) { - addAttribute(renderState.lightingAttrib); - } - } - - if (ops.isEmpty() || renderState.model == null) { - return; - } - - //ensure enough nodes for all ops - while (nodes.size() < CCRenderState.operationCount()) { - nodes.add(new PipelineNode()); - } - unbuild(); - - for (int i = 0; i < ops.size(); i++) { - IVertexOperation op = ops.get(i); - loading = nodes.get(op.operationID()); - boolean loaded = op.load(renderState); - if (loaded) { - loading.op = op; - } - - if (op instanceof VertexAttribute) { - if (loaded) { - attribs.add((VertexAttribute) op); - } else { - ((VertexAttribute) op).active = false; - } - } - } - - for (int i = 0; i < nodes.size(); i++) { - nodes.get(i).add(); - } - } - - public void addRequirement(int opRef) { - loading.deps.add(nodes.get(opRef)); - } - - public void addDependency(VertexAttribute attrib) { - loading.deps.add(nodes.get(attrib.operationID())); - addAttribute(attrib); - } - - public void addAttribute(VertexAttribute attrib) { - if (!attrib.active) { - ops.add(attrib); - attrib.active = true; - } - } - - public void operate() { - for (int i = 0; i < sorted.size(); i++) { - sorted.get(i).operate(renderState); - } - } - - public PipelineBuilder builder() { - ops.clear(); - return builder; - } -} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/ColourMultiplier.java b/dependencies/main/java/codechicken/lib/render/pipeline/ColourMultiplier.java deleted file mode 100644 index 2b7721ff55..0000000000 --- a/dependencies/main/java/codechicken/lib/render/pipeline/ColourMultiplier.java +++ /dev/null @@ -1,41 +0,0 @@ -package codechicken.lib.render.pipeline; - -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.render.CCRenderState; - -public class ColourMultiplier implements IVertexOperation { - - private static ColourMultiplier instance = new ColourMultiplier(-1); - - public static ColourMultiplier instance(int colour) { - instance.colour = colour; - return instance; - } - - public static final int operationIndex = CCRenderState.registerOperation(); - public int colour; - - public ColourMultiplier(int colour) { - this.colour = colour; - } - - @Override - public boolean load(CCRenderState state) { - if (colour == -1) { - return false; - } - - state.pipeline.addDependency(state.colourAttrib); - return true; - } - - @Override - public void operate(CCRenderState state) { - state.colour = ColourRGBA.multiply(state.colour, colour); - } - - @Override - public int operationID() { - return operationIndex; - } -} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/IVertexOperation.java b/dependencies/main/java/codechicken/lib/render/pipeline/IVertexOperation.java deleted file mode 100644 index 57a14ffdcc..0000000000 --- a/dependencies/main/java/codechicken/lib/render/pipeline/IVertexOperation.java +++ /dev/null @@ -1,26 +0,0 @@ -package codechicken.lib.render.pipeline; - -import codechicken.lib.render.CCRenderState; - -/** - * Represents an operation to be run for each vertex that operates on and modifies the current state - */ -public interface IVertexOperation { - - /** - * Load any required references and add dependencies to the pipeline based on the current model (may be null) - * Return false if this operation is redundant in the pipeline with the given model - */ - boolean load(CCRenderState state); - - /** - * Perform the operation on the current render state - */ - void operate(CCRenderState state); - - /** - * Get the unique id representing this type of operation. Duplicate operation IDs within the pipeline may have unexpected results. - * ID shoulld be obtained from CCRenderState.registerOperation() and stored in a static variable - */ - int operationID(); -} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/IVertexSource.java b/dependencies/main/java/codechicken/lib/render/pipeline/IVertexSource.java deleted file mode 100644 index e09aef18d8..0000000000 --- a/dependencies/main/java/codechicken/lib/render/pipeline/IVertexSource.java +++ /dev/null @@ -1,32 +0,0 @@ -package codechicken.lib.render.pipeline; - -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.attribute.AttributeKey; -import codechicken.lib.vec.Vertex5; - -/** - * Created by covers1624 on 10/10/2016. - */ -public interface IVertexSource { - - Vertex5[] getVertices(); - - /** - * Gets an array of vertex attributes - * - * @param attr The vertex attribute to get - * @param The attribute array type - * @return An array, or null if not computed - */ - T getAttributes(AttributeKey attr); - - /** - * @return True if the specified attribute is provided by this model, either by returning an array from getAttributes or by setting the state in prepareVertex - */ - boolean hasAttribute(AttributeKey attr); - - /** - * Callback to set CCRenderState for a vertex before the pipeline runs - */ - void prepareVertex(CCRenderState state); -} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/VertexAttribute.java b/dependencies/main/java/codechicken/lib/render/pipeline/VertexAttribute.java deleted file mode 100644 index a3225f425d..0000000000 --- a/dependencies/main/java/codechicken/lib/render/pipeline/VertexAttribute.java +++ /dev/null @@ -1,39 +0,0 @@ -package codechicken.lib.render.pipeline; - -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.attribute.AttributeKey; -import codechicken.lib.util.ArrayUtils; - -/** - * Management class for a vertex attribute such as colour, normal etc - * This class should handle the loading of the attribute from an array provided by IVertexSource.getAttributes or the computation of this attribute from others - * - * @param The array type for this attribute eg. int[], Vector3[] - */ -public abstract class VertexAttribute implements IVertexOperation { - - private final int operationIndex = CCRenderState.registerOperation(); - - /** - * Set to true when the attribute is part of the pipeline. Should only be managed by CCRenderState when constructing the pipeline - */ - public boolean active = false; - - /** - * Construct a new array for storage of vertex attributes in a model - */ - public abstract T newArray(int length); - - public abstract String getAttribName(); - - @Override - public int operationID() { - return operationIndex; - } - - public static R copyOf(AttributeKey attr, R src, int length) { - R dst = attr.newArray(length); - ArrayUtils.arrayCopy(src, 0, dst, 0, ((Object[]) src).length); - return dst; - } -} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/AttributeKey.java b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/AttributeKey.java deleted file mode 100644 index 743281a039..0000000000 --- a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/AttributeKey.java +++ /dev/null @@ -1,40 +0,0 @@ -package codechicken.lib.render.pipeline.attribute; - -import com.google.common.collect.ImmutableList; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by covers1624 on 10/10/2016. - * Used to lookup and create new arrays for an attribute without a hard dep on an attribute instance. - */ -public abstract class AttributeKey { - - public final int attributeKeyIndex; - - public AttributeKey() { - attributeKeyIndex = AttributeKeyRegistry.registerAttributeKey(this); - } - - public abstract T newArray(int length); - - public static class AttributeKeyRegistry { - - private static ArrayList> attributeKeys = new ArrayList>(); - - private static int registerAttributeKey(AttributeKey attr) { - attributeKeys.add(attr); - return attributeKeys.size() - 1; - } - - public static AttributeKey getAttributeKey(int index) { - return attributeKeys.get(index); - } - - public static List> getRegisteredAttributeKeys() { - return ImmutableList.copyOf(attributeKeys); - } - } - -} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/ColourAttribute.java b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/ColourAttribute.java deleted file mode 100644 index 9c02f2cdac..0000000000 --- a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/ColourAttribute.java +++ /dev/null @@ -1,45 +0,0 @@ -package codechicken.lib.render.pipeline.attribute; - -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.VertexAttribute; - -/** - * Sets colour in CCRS to the specified colour in the model. - */ -public class ColourAttribute extends VertexAttribute { - - public static final AttributeKey attributeKey = new AttributeKey() { - @Override - public int[] newArray(int length) { - return new int[length]; - } - }; - - private int[] colourRef; - - @Override - public int[] newArray(int length) { - return new int[length]; - } - - @Override - public String getAttribName() { - return "colourAttrib"; - } - - @Override - public boolean load(CCRenderState state) { - colourRef = state.model.getAttributes(ColourAttribute.attributeKey); - return colourRef != null || !state.model.hasAttribute(ColourAttribute.attributeKey); - } - - @Override - public void operate(CCRenderState state) { - if (colourRef != null) { - state.colour = ColourRGBA.multiply(state.baseColour, colourRef[state.vertexIndex]); - } else { - state.colour = state.baseColour; - } - } -} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightCoordAttribute.java b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightCoordAttribute.java deleted file mode 100644 index cd9f3edafe..0000000000 --- a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightCoordAttribute.java +++ /dev/null @@ -1,56 +0,0 @@ -package codechicken.lib.render.pipeline.attribute; - -import codechicken.lib.lighting.LC; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.VertexAttribute; -import codechicken.lib.vec.Transformation; -import codechicken.lib.vec.Vector3; - -/** - * Uses the position of the lightmatrix to compute LC if not provided - */ -public class LightCoordAttribute extends VertexAttribute { - - public static final AttributeKey attributeKey = new AttributeKey() { - @Override - public LC[] newArray(int length) { - return new LC[length]; - } - }; - - private LC[] lcRef; - private Vector3 vec = new Vector3();//for computation - private Vector3 pos = new Vector3(); - - @Override - public LC[] newArray(int length) { - return new LC[length]; - } - - @Override - public String getAttribName() { - return "lightCoordAttrib"; - } - - @Override - public boolean load(CCRenderState state) { - lcRef = state.model.getAttributes(LightCoordAttribute.attributeKey); - if (state.model.hasAttribute(LightCoordAttribute.attributeKey)) { - return lcRef != null; - } - - pos.set(new Vector3(state.lightMatrix.pos)); - state.pipeline.addDependency(state.sideAttrib); - state.pipeline.addRequirement(Transformation.operationIndex); - return true; - } - - @Override - public void operate(CCRenderState state) { - if (lcRef != null) { - state.lc.set(lcRef[state.vertexIndex]); - } else { - state.lc.compute(vec.set(state.vert.vec).subtract(pos), state.side); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightingAttribute.java b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightingAttribute.java deleted file mode 100644 index 9d1c4175d5..0000000000 --- a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/LightingAttribute.java +++ /dev/null @@ -1,49 +0,0 @@ -package codechicken.lib.render.pipeline.attribute; - -import codechicken.lib.colour.ColourRGBA; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.VertexAttribute; - -/** - * Created by covers1624 on 10/10/2016. - */ -public class LightingAttribute extends VertexAttribute { - - public static final AttributeKey attributeKey = new AttributeKey() { - @Override - public int[] newArray(int length) { - return new int[length]; - } - }; - - private int[] colourRef; - - @Override - public int[] newArray(int length) { - return new int[length]; - } - - @Override - public String getAttribName() { - return "lightingAttrib"; - } - - @Override - public boolean load(CCRenderState state) { - if (!state.computeLighting || !state.fmt.hasColor() || !state.model.hasAttribute(LightingAttribute.attributeKey)) { - return false; - } - - colourRef = state.model.getAttributes(LightingAttribute.attributeKey); - if (colourRef != null) { - state.pipeline.addDependency(state.colourAttrib); - return true; - } - return false; - } - - @Override - public void operate(CCRenderState state) { - state.colour = ColourRGBA.multiply(state.colour, colourRef[state.vertexIndex]); - } -} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/NormalAttribute.java b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/NormalAttribute.java deleted file mode 100644 index f8649e9afd..0000000000 --- a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/NormalAttribute.java +++ /dev/null @@ -1,54 +0,0 @@ -package codechicken.lib.render.pipeline.attribute; - -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.VertexAttribute; -import codechicken.lib.vec.Rotation; -import codechicken.lib.vec.Vector3; - -/** - * Apples normals to the render operation. If the model is a planar model it uses known normals. - */ -public class NormalAttribute extends VertexAttribute { - - public static final AttributeKey attributeKey = new AttributeKey() { - @Override - public Vector3[] newArray(int length) { - return new Vector3[length]; - } - }; - - private Vector3[] normalRef; - - @Override - public Vector3[] newArray(int length) { - return new Vector3[length]; - } - - @Override - public String getAttribName() { - return "normalAttrib"; - } - - @Override - public boolean load(CCRenderState state) { - normalRef = state.model.getAttributes(NormalAttribute.attributeKey); - if (state.model.hasAttribute(NormalAttribute.attributeKey)) { - return normalRef != null; - } - - if (state.model.hasAttribute(SideAttribute.attributeKey)) { - state.pipeline.addDependency(state.sideAttrib); - return true; - } - throw new IllegalStateException("Normals requested but neither normal or side attrutes are provided by the model"); - } - - @Override - public void operate(CCRenderState state) { - if (normalRef != null) { - state.normal.set(normalRef[state.vertexIndex]); - } else { - state.normal.set(Rotation.axes[state.side]); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/SideAttribute.java b/dependencies/main/java/codechicken/lib/render/pipeline/attribute/SideAttribute.java deleted file mode 100644 index 042cede201..0000000000 --- a/dependencies/main/java/codechicken/lib/render/pipeline/attribute/SideAttribute.java +++ /dev/null @@ -1,50 +0,0 @@ -package codechicken.lib.render.pipeline.attribute; - -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.VertexAttribute; -import codechicken.lib.util.VectorUtils; - -/** - * Sets the side state in CCRS based on the provided model. If the model does not have side data it requires normals. - */ -public class SideAttribute extends VertexAttribute { - - public static final AttributeKey attributeKey = new AttributeKey() { - @Override - public int[] newArray(int length) { - return new int[length]; - } - }; - - private int[] sideRef; - - @Override - public int[] newArray(int length) { - return new int[length]; - } - - @Override - public String getAttribName() { - return "sideAttrib"; - } - - @Override - public boolean load(CCRenderState state) { - sideRef = state.model.getAttributes(SideAttribute.attributeKey); - if (state.model.hasAttribute(SideAttribute.attributeKey)) { - return sideRef != null; - } - - state.pipeline.addDependency(state.normalAttrib); - return true; - } - - @Override - public void operate(CCRenderState state) { - if (sideRef != null) { - state.side = sideRef[state.vertexIndex]; - } else { - state.side = VectorUtils.findSide(state.normal); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/render/shader/ShaderProgram.java b/dependencies/main/java/codechicken/lib/render/shader/ShaderProgram.java deleted file mode 100644 index b5a480b4d7..0000000000 --- a/dependencies/main/java/codechicken/lib/render/shader/ShaderProgram.java +++ /dev/null @@ -1,173 +0,0 @@ -package codechicken.lib.render.shader; - -import codechicken.lib.render.shader.pipeline.CCShaderPipeline; -import codechicken.lib.render.shader.pipeline.attribute.IShaderOperation; -import org.lwjgl.opengl.ARBFragmentShader; -import org.lwjgl.opengl.ARBShaderObjects; -import org.lwjgl.opengl.ARBVertexShader; -import org.lwjgl.opengl.GL11; -import org.lwjgl.util.vector.Matrix4f; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; - -import static org.lwjgl.opengl.ARBShaderObjects.*; - -public class ShaderProgram { - - private int programID; - public CCShaderPipeline pipeline = new CCShaderPipeline(this); - private ArrayList ops = new ArrayList(); - - public ShaderProgram() { - programID = glCreateProgramObjectARB(); - if (programID == 0) { - throw new RuntimeException("Unable to allocate shader program object."); - } - } - - public void attachShaderOperation(IShaderOperation operation) { - ops.add(operation); - } - - public void bindShader() { - glUseProgramObjectARB(programID); - } - - /** - * Allows you to bind the shader for use outside an IShaderOperation. - * You can still pass variables to the shader using an IShaderOperation. - * - * Call this before you do your rendering. - * Then call ShaderProgram.unbindShader() when you have finished rendering. - */ - public void freeBindShader() { - pipeline.reset(); - pipeline.setPipeline(ops); - - glUseProgramObjectARB(programID); - pipeline.operate(); - } - - public static void unbindShader() { - glUseProgramObjectARB(0); - } - - public void runShader() { - pipeline.reset(); - pipeline.setPipeline(ops); - - bindShader(); - pipeline.operate(); - unbindShader(); - } - - public ShaderProgram attachVert(String resource) { - return attach(ARBVertexShader.GL_VERTEX_SHADER_ARB, resource); - } - - public ShaderProgram attachFrag(String resource) { - return attach(ARBFragmentShader.GL_FRAGMENT_SHADER_ARB, resource); - } - - public ShaderProgram attach(int shaderType, String resource) { - InputStream stream = ShaderProgram.class.getResourceAsStream(resource); - if (stream == null) { - throw new RuntimeException("Unable to locate resource: " + resource); - } - - return attach(shaderType, stream); - } - - public ShaderProgram attach(int shaderType, InputStream stream) { - if (stream == null) { - throw new RuntimeException("Invalid shader inputstream"); - } - - int shaderID = 0; - try { - shaderID = glCreateShaderObjectARB(shaderType); - if (shaderID == 0) { - throw new RuntimeException("Unable to allocate shader object."); - } - - try { - glShaderSourceARB(shaderID, asString(stream)); - } catch (IOException e) { - throw new RuntimeException("Error reading inputstream.", e); - } - - glCompileShaderARB(shaderID); - if (glGetObjectParameteriARB(shaderID, GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE) { - throw new RuntimeException("Error compiling shader: " + getInfoLog(shaderID)); - } - - glAttachObjectARB(programID, shaderID); - } catch (RuntimeException e) { - glDeleteObjectARB(shaderID); - throw e; - } - return this; - } - - /** - * Call this once you have bound your frag and vert shader. - */ - public ShaderProgram validate() { - glLinkProgramARB(programID); - if (glGetObjectParameteriARB(programID, GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) { - throw new RuntimeException("Error linking program: " + getInfoLog(programID)); - } - - glValidateProgramARB(programID); - if (glGetObjectParameteriARB(programID, GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) { - throw new RuntimeException("Error validating program: " + getInfoLog(programID)); - } - return this; - } - - public static String asString(InputStream stream) throws IOException { - StringBuilder sb = new StringBuilder(); - BufferedReader bin = new BufferedReader(new InputStreamReader(stream)); - String line; - while ((line = bin.readLine()) != null) { - sb.append(line).append('\n'); - } - stream.close(); - return sb.toString(); - } - - private static String getInfoLog(int shaderID) { - return glGetInfoLogARB(shaderID, glGetObjectParameteriARB(shaderID, GL_OBJECT_INFO_LOG_LENGTH_ARB)); - } - - public int getUniformLoc(String name) { - return ARBShaderObjects.glGetUniformLocationARB(programID, name); - } - - public int getAttribLoc(String name) { - return ARBVertexShader.glGetAttribLocationARB(programID, name); - } - - public void uniformTexture(String name, int textureIndex) { - ARBShaderObjects.glUniform1iARB(getUniformLoc(name), textureIndex); - } - - public void glVertexAttributeMat4(int loc, Matrix4f matrix) { - ARBVertexShader.glVertexAttrib4fARB(loc, matrix.m00, matrix.m01, matrix.m02, matrix.m03); - ARBVertexShader.glVertexAttrib4fARB(loc + 1, matrix.m10, matrix.m11, matrix.m12, matrix.m13); - ARBVertexShader.glVertexAttrib4fARB(loc + 2, matrix.m20, matrix.m21, matrix.m22, matrix.m23); - ARBVertexShader.glVertexAttrib4fARB(loc + 3, matrix.m30, matrix.m31, matrix.m32, matrix.m33); - } - - /** - * This method will completely remove the shader. - */ - public void cleanup() { - ops.clear(); - ARBShaderObjects.glDeleteObjectARB(programID); - } -} diff --git a/dependencies/main/java/codechicken/lib/render/shader/pipeline/CCShaderPipeline.java b/dependencies/main/java/codechicken/lib/render/shader/pipeline/CCShaderPipeline.java deleted file mode 100644 index b3b9152b86..0000000000 --- a/dependencies/main/java/codechicken/lib/render/shader/pipeline/CCShaderPipeline.java +++ /dev/null @@ -1,135 +0,0 @@ -package codechicken.lib.render.shader.pipeline; - -import codechicken.lib.render.shader.ShaderProgram; -import codechicken.lib.render.shader.pipeline.attribute.IShaderOperation; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * Created by covers1624 on 18/10/2016. - */ -public class CCShaderPipeline { - - private static int nextOperationIndex; - - public static int registerOperation() { - return nextOperationIndex++; - } - - public static int operationCount() { - return nextOperationIndex; - } - - public class PipelineBuilder { - - public CCShaderPipeline.PipelineBuilder add(IShaderOperation op) { - ops.add(op); - return this; - } - - public CCShaderPipeline.PipelineBuilder add(IShaderOperation... ops) { - for (int i = 0; i < ops.length; i++) { - CCShaderPipeline.this.ops.add(ops[i]); - } - return this; - } - - public void build() { - rebuild(); - } - } - - private class PipelineNode { - - public ArrayList deps = new ArrayList(); - public IShaderOperation op; - - public void add() { - if (op == null) { - return; - } - - for (int i = 0; i < deps.size(); i++) { - deps.get(i).add(); - } - deps.clear(); - sorted.add(op); - op = null; - } - } - - private ShaderProgram program; - - private ArrayList ops = new ArrayList(); - private ArrayList nodes = new ArrayList(); - private ArrayList sorted = new ArrayList(); - private CCShaderPipeline.PipelineNode loading; - private CCShaderPipeline.PipelineBuilder builder = new CCShaderPipeline.PipelineBuilder(); - - public CCShaderPipeline(ShaderProgram program) { - this.program = program; - } - - public void setPipeline(IShaderOperation... ops) { - this.ops.clear(); - Collections.addAll(this.ops, ops); - rebuild(); - } - - public void setPipeline(List ops) { - this.ops.clear(); - this.ops.addAll(ops); - rebuild(); - } - - public void reset() { - ops.clear(); - unbuild(); - } - - private void unbuild() { - sorted.clear(); - } - - public void rebuild() { - - if (ops.isEmpty()) { - return; - } - - //ensure enough nodes for all ops - while (nodes.size() < operationCount()) { - nodes.add(new CCShaderPipeline.PipelineNode()); - } - unbuild(); - - for (IShaderOperation op : ops) { - loading = nodes.get(op.operationID()); - boolean loaded = op.load(program); - if (loaded) { - loading.op = op; - } - } - - for (PipelineNode node : nodes) { - node.add(); - } - } - - public void addRequirement(int opRef) { - loading.deps.add(nodes.get(opRef)); - } - - public void operate() { - for (IShaderOperation op : sorted) { - op.operate(program); - } - } - - public CCShaderPipeline.PipelineBuilder builder() { - ops.clear(); - return builder; - } -} diff --git a/dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/IShaderOperation.java b/dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/IShaderOperation.java deleted file mode 100644 index b5dcf2a674..0000000000 --- a/dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/IShaderOperation.java +++ /dev/null @@ -1,15 +0,0 @@ -package codechicken.lib.render.shader.pipeline.attribute; - -import codechicken.lib.render.shader.ShaderProgram; - -/** - * Created by covers1624 on 18/10/2016. - */ -public interface IShaderOperation { - - boolean load(ShaderProgram program); - - void operate(ShaderProgram program); - - int operationID(); -} diff --git a/dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/ShaderRenderTimeOperation.java b/dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/ShaderRenderTimeOperation.java deleted file mode 100644 index 6239026375..0000000000 --- a/dependencies/main/java/codechicken/lib/render/shader/pipeline/attribute/ShaderRenderTimeOperation.java +++ /dev/null @@ -1,37 +0,0 @@ -package codechicken.lib.render.shader.pipeline.attribute; - -import codechicken.lib.render.shader.ShaderProgram; -import codechicken.lib.render.shader.pipeline.CCShaderPipeline; -import codechicken.lib.util.ClientUtils; -import org.lwjgl.opengl.ARBShaderObjects; - -import java.util.HashMap; - -/** - * Created by covers1624 on 18/10/2016. - */ -public class ShaderRenderTimeOperation implements IShaderOperation { - - public static final int operationID = CCShaderPipeline.registerOperation(); - private final HashMap shaderRenderTimeCache = new HashMap(); - - @Override - public boolean load(ShaderProgram program) { - return true; - } - - @Override - public void operate(ShaderProgram program) { - float renderTime = (float) ClientUtils.getRenderTime(); - if (renderTime != shaderRenderTimeCache.get(program)) { - int location = program.getAttribLoc("time"); - ARBShaderObjects.glUniform1fARB(location, renderTime); - shaderRenderTimeCache.put(program, renderTime); - } - } - - @Override - public int operationID() { - return operationID; - } -} diff --git a/dependencies/main/java/codechicken/lib/render/state/GlStateManagerHelper.java b/dependencies/main/java/codechicken/lib/render/state/GlStateManagerHelper.java deleted file mode 100644 index 650cc45a5a..0000000000 --- a/dependencies/main/java/codechicken/lib/render/state/GlStateManagerHelper.java +++ /dev/null @@ -1,356 +0,0 @@ -package codechicken.lib.render.state; - -import com.google.common.base.Objects; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.GlStateManager.*; - -import java.util.ArrayList; -import java.util.LinkedList; - -/** - * Created by covers1624 on 10/10/2016. - * Dumps specific GL states from GlStateManager - * Ability to push and pop most of the GL state. - * TODO Ability to auto compare between different saved states. So basically a GlLeak analyser. - * TODO Support both Raw GL and GLStateManager, would be useful for detecting GLLeaks that occur due to raw GL calls. - * TODO Support all the things. - */ -public class GlStateManagerHelper { - - public static enum State { - GL_ALPHA_TEST { - @Override - public String getState() { - AlphaState alphaState = GlStateManager.alphaState; - return Objects.toStringHelper(name()).add("Func", alphaState.func).add("Ref", alphaState.ref).add("Enabled", String.valueOf(alphaState.alphaTest.currentState).toUpperCase()).toString(); - } - - @Override - public void pushState(SavedState state) { - state.alphaTest = GlStateManager.alphaState.alphaTest.currentState; - state.alphaFunc = GlStateManager.alphaState.func; - state.alphaRef = GlStateManager.alphaState.ref; - } - - @Override - public void popState(SavedState pre, SavedState post) { - if (pre.alphaTest) { - GlStateManager.enableAlpha(); - } else { - GlStateManager.disableAlpha(); - } - GlStateManager.alphaFunc(pre.alphaFunc, pre.alphaRef); - } - }, - GL_LIGHTING { - @Override - public String getState() { - return Objects.toStringHelper(name()).add("Enabled", parseBoolState(GlStateManager.lightingState)).toString(); - } - - @Override - public void pushState(SavedState state) { - state.lighting = GlStateManager.lightingState.currentState; - } - - @Override - public void popState(SavedState pre, SavedState post) { - if (pre.lighting) { - GlStateManager.enableLighting(); - } else { - GlStateManager.disableLighting(); - } - } - }, - GL_BLEND { - @Override - public String getState() { - BlendState blendState = GlStateManager.blendState; - //@formatter:off - return Objects.toStringHelper(name()) - .add("SrcFactor", parseFactor(blendState.srcFactor)) .add("DstFactor", parseFactor(blendState.dstFactor)) - .add("SrcFactorAlpha", parseFactor(blendState.srcFactorAlpha)).add("DstFactorAlpha", parseFactor(blendState.dstFactorAlpha)) - .add("Enabled", parseBoolState(blendState.blend)).toString(); - //@formatter:on - } - - @Override - public void pushState(SavedState state) { - state.blend = GlStateManager.blendState.blend.currentState; - state.blendSrcFactor = GlStateManager.blendState.srcFactor; - state.blendDstFactor = GlStateManager.blendState.dstFactor; - state.blendSrcFactorAlpha = GlStateManager.blendState.srcFactorAlpha; - state.blendDstFactorAlpha = GlStateManager.blendState.dstFactorAlpha; - } - - @Override - public void popState(SavedState pre, SavedState post) { - if (pre.blend) { - GlStateManager.enableBlend(); - } else { - GlStateManager.disableBlend(); - } - if (pre.blendSrcFactorAlpha != post.blendSrcFactorAlpha || pre.blendDstFactorAlpha != post.blendDstFactorAlpha) { - GlStateManager.tryBlendFuncSeparate(pre.blendSrcFactor, pre.blendDstFactor, pre.blendSrcFactorAlpha, pre.blendDstFactorAlpha); - } else { - GlStateManager.blendFunc(pre.blendSrcFactor, post.blendDstFactor); - } - } - - private String parseFactor(int factor) { - switch (factor) { - case 32771: - return "CONSTANT_ALPHA"; - case 32769: - return "CONSTANT_COLOR"; - case 772: - return "DST_ALPHA"; - case 774: - return "DST_COLOR"; - case 1: - return "ONE"; - case 32772: - return "ONE_MINUS_CONSTANT_ALPHA"; - case 32770: - return "ONE_MINUS_CONSTANT_COLOR"; - case 773: - return "ONE_MINUS_DST_ALPHA"; - case 775: - return "ONE_MINUS_DST_COLOR"; - case 771: - return "ONE_MINUS_SRC_ALPHA"; - case 769: - return "ONE_MINUS_SRC_COLOR"; - case 770: - return "SRC_ALPHA"; - case 776: - return "SRC_ALPHA_SATURATE"; - case 768: - return "SRC_COLOR"; - case 0: - return "ZERO"; - default: - return "UNKNOWN:" + factor; - - } - } - - }, - GL_DEPTH_TEST { - @Override - public String getState() { - DepthState depthState = GlStateManager.depthState; - return Objects.toStringHelper(name()).add("Func", parseFunc(depthState.depthFunc)).add("Mask", String.valueOf(depthState.maskEnabled).toUpperCase()).add("Enabled", parseBoolState(depthState.depthTest)).toString(); - } - - @Override - public void pushState(SavedState state) { - state.depthTest = GlStateManager.depthState.depthTest.currentState; - state.depthMaskEnabled = GlStateManager.depthState.maskEnabled; - state.depthFunc = GlStateManager.depthState.depthFunc; - } - - @Override - public void popState(SavedState pre, SavedState post) { - if (pre.depthTest) { - GlStateManager.enableDepth(); - } else { - GlStateManager.disableDepth(); - } - GlStateManager.depthMask(pre.depthMaskEnabled); - GlStateManager.depthFunc(pre.depthFunc); - } - - private String parseFunc(int func) { - switch (func) { - case 0x200: - return "GL_NEVER"; - case 0x201: - return "GL_LESS"; - case 0x202: - return "GL_EQUAL"; - case 0x203: - return "GL_LEQUAL"; - case 0x204: - return "GL_GREATER"; - case 0x205: - return "GL_NOTEQUAL"; - case 0x206: - return "GL_GEQUAL"; - case 0x207: - return "GL_ALWAYS"; - default: - return "UNKNOWN:" + func; - - } - } - }, - GL_CULL_FACE { - @Override - public String getState() { - CullState cullState = GlStateManager.cullState; - return Objects.toStringHelper(name()).add("Mode", parseMode(cullState.mode)).add("Enabled", parseBoolState(cullState.cullFace)).toString(); - } - - @Override - public void pushState(SavedState state) { - state.cull = GlStateManager.cullState.cullFace.currentState; - state.cullMode = GlStateManager.cullState.mode; - } - - @Override - public void popState(SavedState pre, SavedState post) { - - if (pre.cull) { - GlStateManager.enableCull(); - } else { - GlStateManager.disableCull(); - } - GlStateManager.cullFace(pre.cullMode); - } - - private String parseMode(int mode) { - switch (mode) { - case 1028: - return "FRONT"; - case 1029: - return "BACK"; - case 1032: - return "FRONT_AND_BACK"; - default: - return "UNKNOWN:" + mode; - - } - } - - }, - GL_RESCALE_NORMAL { - @Override - public String getState() { - return Objects.toStringHelper(name()).add("Enabled", parseBoolState(GlStateManager.rescaleNormalState)).toString(); - } - - @Override - public void pushState(SavedState state) { - state.rescaleNormal = GlStateManager.rescaleNormalState.currentState; - } - - @Override - public void popState(SavedState pre, SavedState post) { - if (pre.rescaleNormal) { - GlStateManager.enableRescaleNormal(); - } else { - GlStateManager.disableRescaleNormal(); - } - } - - }; - - public abstract String getState(); - - public abstract void pushState(SavedState state); - - public abstract void popState(SavedState pre, SavedState post); - } - - public static class SavedState { - - private ArrayList savedStates = new ArrayList(); - - boolean alphaTest; - int alphaFunc; - float alphaRef; - - boolean lighting; - - boolean blend; - int blendSrcFactor; - int blendDstFactor; - int blendSrcFactorAlpha; - int blendDstFactorAlpha; - - boolean depthTest; - boolean depthMaskEnabled; - int depthFunc; - - boolean cull; - int cullMode; - - boolean rescaleNormal; - - private SavedState() { - } - - private static SavedState createSavedState(SavedState state) { - return createSavedState(state.savedStates.toArray(new State[state.savedStates.size()])); - } - - private static SavedState createSavedState(State... states) { - SavedState saveState = new SavedState(); - for (State state : states) { - state.pushState(saveState); - saveState.savedStates.add(state); - } - return saveState; - } - - private static void applyState(SavedState pre, SavedState post) { - for (State state : pre.savedStates) { - state.popState(pre, post); - } - } - - } - - private static final LinkedList savedStates = new LinkedList(); - - private static String parseBoolState(BooleanState boolState) { - return String.valueOf(boolState.currentState).toUpperCase(); - } - - public static String dumpGLState(State... states) { - StringBuilder builder = new StringBuilder(); - builder.append("GlStateManager { "); - for (int i = 0; i < states.length; i++) { - State state = states[i]; - builder.append(state.getState()); - if (i != states.length - 1) { - builder.append(", "); - } - } - - builder.append(" }"); - return builder.toString(); - } - - public static void pushState() { - SavedState state = SavedState.createSavedState(State.values()); - savedStates.addLast(state); - } - - public static void pushStates(State... states) { - if (states == null || states.length == 0) { - states = State.values(); - } - SavedState state = SavedState.createSavedState(states); - savedStates.addLast(state); - } - - public static void pushState(State[] states) { - if (states == null || states.length == 0) { - states = State.values(); - } - SavedState state = SavedState.createSavedState(states); - savedStates.addLast(state); - } - - public static void popState() { - if (savedStates.isEmpty()) { - throw new IllegalStateException("Unable to pop the GL state as there is no saved state!"); - } - SavedState pre = savedStates.removeLast(); - SavedState post = SavedState.createSavedState(pre); - SavedState.applyState(pre, post); - } - -} diff --git a/dependencies/main/java/codechicken/lib/texture/CustomIResource.java b/dependencies/main/java/codechicken/lib/texture/CustomIResource.java deleted file mode 100644 index fc715d0f7b..0000000000 --- a/dependencies/main/java/codechicken/lib/texture/CustomIResource.java +++ /dev/null @@ -1,69 +0,0 @@ -package codechicken.lib.texture; - -import net.minecraft.client.resources.IResource; -import net.minecraft.client.resources.data.IMetadataSection; -import net.minecraft.util.ResourceLocation; - -import javax.annotation.Nullable; -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - -/** - * Created by covers1624 on 2/11/2016. - * TODO Document. - */ -public class CustomIResource implements IResource { - - private ResourceLocation location; - private InputStream stream; - private IResource wrapped; - - public CustomIResource(ResourceLocation location, BufferedImage image, IResource wrapped) { - try { - this.location = location; - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ImageIO.write(image, "png", baos); - stream = new ByteArrayInputStream(baos.toByteArray()); - this.wrapped = wrapped; - - } catch (Exception e) { - throw new RuntimeException("Unable to create CustomIResource", e); - } - } - - @Override - public ResourceLocation getResourceLocation() { - return location; - } - - @Override - public InputStream getInputStream() { - return stream; - } - - @Override - public boolean hasMetadata() { - return wrapped.hasMetadata(); - } - - @Nullable - @Override - public T getMetadata(String sectionName) { - return wrapped.getMetadata(sectionName); - } - - @Override - public String getResourcePackName() { - return wrapped.getResourcePackName(); - } - - @Override - public void close() throws IOException { - wrapped.close(); - stream.close(); - } -} diff --git a/dependencies/main/java/codechicken/lib/texture/IItemBlockTextureProvider.java b/dependencies/main/java/codechicken/lib/texture/IItemBlockTextureProvider.java deleted file mode 100644 index 1cc0f075ab..0000000000 --- a/dependencies/main/java/codechicken/lib/texture/IItemBlockTextureProvider.java +++ /dev/null @@ -1,15 +0,0 @@ -package codechicken.lib.texture; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; - -/** - * Created by covers1624 on 30/10/2016. - * TODO Document. - */ -public interface IItemBlockTextureProvider { - - TextureAtlasSprite getTexture(EnumFacing side, ItemStack stack); - -} diff --git a/dependencies/main/java/codechicken/lib/texture/IWorldBlockTextureProvider.java b/dependencies/main/java/codechicken/lib/texture/IWorldBlockTextureProvider.java deleted file mode 100644 index 913b12141d..0000000000 --- a/dependencies/main/java/codechicken/lib/texture/IWorldBlockTextureProvider.java +++ /dev/null @@ -1,27 +0,0 @@ -package codechicken.lib.texture; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; - -/** - * Created by covers1624 on 25/11/2016. - */ -public interface IWorldBlockTextureProvider extends IItemBlockTextureProvider { - - /** - * Gets the texture for the given face of an in world block. - * - * @param side The side to get the texture for. - * @param state The state of the block. - * @param layer The layer needed. - * @param world The world the block is in. - * @param pos The position of the block. - * @return The texture, null if there is no texture for the arguments, {@link TextureUtils#getMissingSprite()} if the arguments are invalid. - */ - TextureAtlasSprite getTexture(EnumFacing side, IBlockState state, BlockRenderLayer layer, IBlockAccess world, BlockPos pos); - -} diff --git a/dependencies/main/java/codechicken/lib/texture/ManagedTextureFX.java b/dependencies/main/java/codechicken/lib/texture/ManagedTextureFX.java deleted file mode 100644 index 19ecc73440..0000000000 --- a/dependencies/main/java/codechicken/lib/texture/ManagedTextureFX.java +++ /dev/null @@ -1,27 +0,0 @@ -package codechicken.lib.texture; - -public class ManagedTextureFX extends TextureFX { - - public boolean changed; - - public ManagedTextureFX(int size, String name) { - super(size, name); - imageData = new int[size * size]; - } - - @Override - public void setup() { - } - - public void setData(int[] data) { - System.arraycopy(data, 0, imageData, 0, imageData.length); - changed = true; - } - - @Override - public boolean changed() { - boolean r = changed; - changed = false; - return r; - } -} diff --git a/dependencies/main/java/codechicken/lib/texture/PlaceholderTexture.java b/dependencies/main/java/codechicken/lib/texture/PlaceholderTexture.java deleted file mode 100644 index 84afd5ab75..0000000000 --- a/dependencies/main/java/codechicken/lib/texture/PlaceholderTexture.java +++ /dev/null @@ -1,22 +0,0 @@ -package codechicken.lib.texture; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.util.ResourceLocation; - -public class PlaceholderTexture extends TextureAtlasSprite { - - protected PlaceholderTexture(String par1) { - super(par1); - } - - @Override - public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location) { - return true; - } - - @Override - public boolean load(IResourceManager manager, ResourceLocation location) { - return true; - } -} diff --git a/dependencies/main/java/codechicken/lib/texture/SpriteSheetManager.java b/dependencies/main/java/codechicken/lib/texture/SpriteSheetManager.java deleted file mode 100644 index 49839fcd95..0000000000 --- a/dependencies/main/java/codechicken/lib/texture/SpriteSheetManager.java +++ /dev/null @@ -1,121 +0,0 @@ -package codechicken.lib.texture; - -import codechicken.lib.texture.TextureUtils.IIconRegister; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.util.ArrayList; -import java.util.HashMap; - -public class SpriteSheetManager { - - @SideOnly (Side.CLIENT) - public static class SpriteSheet implements IIconRegister { - - private int tilesX; - private int tilesY; - private ArrayList newSprites = new ArrayList(); - private TextureSpecial[] sprites; - private ResourceLocation resource; - private TextureDataHolder texture; - private int spriteWidth; - private int spriteHeight; - - public int atlasIndex; - - private SpriteSheet(int tilesX, int tilesY, ResourceLocation textureFile) { - this.tilesX = tilesX; - this.tilesY = tilesY; - this.resource = textureFile; - sprites = new TextureSpecial[tilesX * tilesY]; - } - - public void requestIndicies(int... indicies) { - for (int i : indicies) { - setupSprite(i); - } - } - - @Override - public void registerIcons(TextureMap textureMap) { - if (TextureUtils.refreshTexture(textureMap, resource.getResourcePath())) { - reloadTexture(); - for (TextureSpecial sprite : sprites) { - if (sprite != null) { - textureMap.setTextureEntry(sprite.getIconName(), sprite); - } - } - } else { - for (int i : newSprites) { - textureMap.setTextureEntry(sprites[i].getIconName(), sprites[i]); - } - } - newSprites.clear(); - } - - public TextureSpecial setupSprite(int i) { - if (sprites[i] == null) { - String name = resource + "_" + i; - sprites[i] = new TextureSpecial(name).baseFromSheet(this, i); - newSprites.add(i); - } - return sprites[i]; - } - - private void reloadTexture() { - texture = TextureUtils.loadTexture(resource); - spriteWidth = texture.width / tilesX; - spriteHeight = texture.height / tilesY; - } - - public TextureAtlasSprite getSprite(int index) { - TextureAtlasSprite i = sprites[index]; - if (i == null) { - throw new IllegalArgumentException("Sprite at index: " + index + " from texture file " + resource + " was not preloaded."); - } - return i; - } - - public TextureDataHolder createSprite(int spriteIndex) { - int sx = spriteIndex % tilesX; - int sy = spriteIndex / tilesX; - TextureDataHolder sprite = new TextureDataHolder(spriteWidth, spriteHeight); - TextureUtils.copySubImg(texture.data, texture.width, sx * spriteWidth, sy * spriteHeight, spriteWidth, spriteHeight, sprite.data, spriteWidth, 0, 0); - return sprite; - } - - public int spriteWidth() { - return spriteWidth; - } - - public int spriteHeight() { - return spriteHeight; - } - - public TextureSpecial bindTextureFX(int i, TextureFX textureFX) { - return setupSprite(i).addTextureFX(textureFX); - } - - public SpriteSheet selfRegister(int atlas) { - TextureUtils.addIconRegister(this); - return this; - } - } - - private static HashMap spriteSheets = new HashMap(); - - public static SpriteSheet getSheet(ResourceLocation resource) { - return getSheet(16, 16, resource); - } - - public static SpriteSheet getSheet(int tilesX, int tilesY, ResourceLocation resource) { - SpriteSheet sheet = spriteSheets.get(resource.toString()); - if (sheet == null) { - spriteSheets.put(resource.toString(), sheet = new SpriteSheet(tilesX, tilesY, resource)); - } - return sheet; - } -} diff --git a/dependencies/main/java/codechicken/lib/texture/TextureDataHolder.java b/dependencies/main/java/codechicken/lib/texture/TextureDataHolder.java deleted file mode 100644 index e411308440..0000000000 --- a/dependencies/main/java/codechicken/lib/texture/TextureDataHolder.java +++ /dev/null @@ -1,34 +0,0 @@ -package codechicken.lib.texture; - -import java.awt.image.BufferedImage; - -public class TextureDataHolder { - - public int width; - public int height; - public int[] data; - - public TextureDataHolder(int width, int height) { - this.width = width; - this.height = height; - data = new int[width * height]; - } - - public TextureDataHolder(int[] data, int width) { - this.data = data; - this.width = width; - height = data.length / width; - } - - public TextureDataHolder(BufferedImage img) { - this(img.getWidth(), img.getHeight()); - img.getRGB(0, 0, width, height, data, 0, width); - } - - public TextureDataHolder copyData() { - int[] copy = new int[data.length]; - System.arraycopy(data, 0, copy, 0, data.length); - data = copy; - return this; - } -} diff --git a/dependencies/main/java/codechicken/lib/texture/TextureFX.java b/dependencies/main/java/codechicken/lib/texture/TextureFX.java deleted file mode 100644 index 4ca8147509..0000000000 --- a/dependencies/main/java/codechicken/lib/texture/TextureFX.java +++ /dev/null @@ -1,60 +0,0 @@ -package codechicken.lib.texture; - -import codechicken.lib.texture.SpriteSheetManager.SpriteSheet; -import net.minecraft.client.Minecraft; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -@SideOnly (Side.CLIENT) -public class TextureFX { - - public int[] imageData; - public int tileSizeBase = 16; - public int tileSizeSquare = 256; - public int tileSizeMask = 15; - public int tileSizeSquareMask = 255; - - public boolean anaglyphEnabled; - public TextureSpecial texture; - - public TextureFX(int spriteIndex, SpriteSheet sheet) { - texture = sheet.bindTextureFX(spriteIndex, this); - } - - public TextureFX(int size, String name) { - texture = new TextureSpecial(name).blank(size).selfRegister().addTextureFX(this); - } - - public TextureFX setAtlas(int index) { - texture.atlasIndex = index; - return this; - } - - public void setup() { - imageData = new int[tileSizeSquare]; - } - - public void onTextureDimensionsUpdate(int width, int height) { - if (width != height) { - throw new IllegalArgumentException("Non-Square textureFX not supported (" + width + ":" + height + ")"); - } - - tileSizeBase = width; - tileSizeSquare = tileSizeBase * tileSizeBase; - tileSizeMask = tileSizeBase - 1; - tileSizeSquareMask = tileSizeSquare - 1; - setup(); - } - - public void update() { - anaglyphEnabled = Minecraft.getMinecraft().gameSettings.anaglyph; - onTick(); - } - - public void onTick() { - } - - public boolean changed() { - return true; - } -} diff --git a/dependencies/main/java/codechicken/lib/texture/TextureSpecial.java b/dependencies/main/java/codechicken/lib/texture/TextureSpecial.java deleted file mode 100644 index c0b8781209..0000000000 --- a/dependencies/main/java/codechicken/lib/texture/TextureSpecial.java +++ /dev/null @@ -1,170 +0,0 @@ -package codechicken.lib.texture; - -import codechicken.lib.texture.SpriteSheetManager.SpriteSheet; -import codechicken.lib.texture.TextureUtils.IIconRegister; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.PngSizeInfo; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.renderer.texture.TextureUtil; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.util.ArrayList; - -@SideOnly (Side.CLIENT) -public class TextureSpecial extends TextureAtlasSprite implements IIconRegister { - - //sprite sheet fields - private int spriteIndex; - private SpriteSheet spriteSheet; - - //textureFX fields - private TextureFX textureFX; - private int mipmapLevels; - private int rawWidth; - private int rawHeight; - - private int blankSize = -1; - private ArrayList baseTextures; - - private boolean selfRegister; - public int atlasIndex; - - protected TextureSpecial(String par1) { - super(par1); - } - - public TextureSpecial addTexture(TextureDataHolder t) { - if (baseTextures == null) { - baseTextures = new ArrayList(); - } - baseTextures.add(t); - return this; - } - - public TextureSpecial baseFromSheet(SpriteSheet spriteSheet, int spriteIndex) { - this.spriteSheet = spriteSheet; - this.spriteIndex = spriteIndex; - return this; - } - - public TextureSpecial addTextureFX(TextureFX fx) { - textureFX = fx; - return this; - } - - @Override - public void initSprite(int sheetWidth, int sheetHeight, int originX, int originY, boolean rotated) { - super.initSprite(sheetWidth, sheetHeight, originX, originY, rotated); - if (textureFX != null) { - textureFX.onTextureDimensionsUpdate(width, height); - } - } - - @Override - public void updateAnimation() { - if (textureFX != null) { - textureFX.update(); - if (textureFX.changed()) { - int[][] mipmaps = new int[mipmapLevels + 1][]; - mipmaps[0] = textureFX.imageData; - mipmaps = TextureUtil.generateMipmapData(mipmapLevels, width, mipmaps); - TextureUtil.uploadTextureMipmap(mipmaps, width, height, originX, originY, false, false); - } - } - } - - @Override - public void loadSprite(PngSizeInfo sizeInfo, boolean animationMeta) { - rawWidth = sizeInfo.pngWidth; - rawHeight = sizeInfo.pngHeight; - try { - super.loadSprite(sizeInfo, false); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - @Override - public void generateMipmaps(int p_147963_1_) { - super.generateMipmaps(p_147963_1_); - mipmapLevels = p_147963_1_; - } - - @Override - public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location) { - return true; - } - - public void addFrame(int[] data, int width, int height) { - GameSettings settings = Minecraft.getMinecraft().gameSettings; - BufferedImage[] images = new BufferedImage[settings.mipmapLevels + 1]; - images[0] = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); - images[0].setRGB(0, 0, width, height, data, 0, width); - - //Workaround for mojang's change to TextureAtlasSprite loading. - resetSprite(); - this.width = images[0].getWidth(); - this.height = images[0].getHeight(); - int[][] aInt = new int[settings.mipmapLevels + 1][]; - aInt[0] = new int[images[0].getWidth() * images[0].getHeight()]; - images[0].getRGB(0, 0, images[0].getWidth(), images[0].getHeight(), aInt[0], 0, images[0].getWidth()); - framesTextureData.add(aInt); - } - - @Override - public boolean load(IResourceManager manager, ResourceLocation location) { - if (baseTextures != null) { - for (TextureDataHolder tex : baseTextures) { - addFrame(tex.data, tex.width, tex.height); - } - } else if (spriteSheet != null) { - TextureDataHolder tex = spriteSheet.createSprite(spriteIndex); - addFrame(tex.data, tex.width, tex.height); - } else if (blankSize > 0) { - addFrame(new int[blankSize * blankSize], blankSize, blankSize); - } - - if (framesTextureData.isEmpty()) { - throw new RuntimeException("No base frame for texture: " + getIconName()); - } - - return false; - } - - @Override - public boolean hasAnimationMetadata() { - return textureFX != null || super.hasAnimationMetadata(); - } - - @Override - public int getFrameCount() { - if (textureFX != null) { - return 1; - } - - return super.getFrameCount(); - } - - public TextureSpecial blank(int size) { - blankSize = size; - return this; - } - - public TextureSpecial selfRegister() { - selfRegister = true; - TextureUtils.addIconRegister(this); - return this; - } - - @Override - public void registerIcons(TextureMap textureMap) { - textureMap.setTextureEntry(getIconName(), this); - } -} diff --git a/dependencies/main/java/codechicken/lib/texture/TextureUtils.java b/dependencies/main/java/codechicken/lib/texture/TextureUtils.java deleted file mode 100644 index ac62db079a..0000000000 --- a/dependencies/main/java/codechicken/lib/texture/TextureUtils.java +++ /dev/null @@ -1,311 +0,0 @@ -package codechicken.lib.texture; - -import codechicken.lib.colour.Colour; -import codechicken.lib.colour.ColourARGB; -import com.google.common.base.Function; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.resources.IReloadableResourceManager; -import net.minecraft.client.resources.IResource; -import net.minecraft.client.resources.IResourceManagerReloadListener; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.event.TextureStitchEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -public class TextureUtils { - - //TODO, Move this somewhere else. - public interface IIconRegister { - - @SideOnly (Side.CLIENT) - void registerIcons(TextureMap textureMap); - } - - static { - MinecraftForge.EVENT_BUS.register(new TextureUtils()); - } - - private static ArrayList iconRegisters = new ArrayList(); - - public static Function bakedTextureGetter = new Function() { - @Override - public TextureAtlasSprite apply(ResourceLocation input) { - return getTexture(input); - } - }; - - //TODO Rename this. - public static void addIconRegister(IIconRegister registrar) { - iconRegisters.add(registrar); - } - - public static void registerReloadListener(IResourceManagerReloadListener reloadListener) { - //If this crashes people need to stop using reflection.. - getResourceManager().registerReloadListener(reloadListener); - } - - @SubscribeEvent - public void textureLoad(TextureStitchEvent.Pre event) { - for (IIconRegister reg : iconRegisters) { - reg.registerIcons(event.getMap()); - } - } - - /** - * @return an array of ARGB pixel data - */ - public static int[] loadTextureData(ResourceLocation resource) { - return loadTexture(resource).data; - } - - public static Colour[] loadTextureColours(ResourceLocation resource) { - int[] idata = loadTextureData(resource); - Colour[] data = new Colour[idata.length]; - for (int i = 0; i < data.length; i++) { - data[i] = new ColourARGB(idata[i]); - } - return data; - } - - //TODO Move to some sort of IO Utils. - public static InputStream getTextureResource(ResourceLocation textureFile) throws IOException { - return Minecraft.getMinecraft().getResourceManager().getResource(textureFile).getInputStream(); - } - - public static BufferedImage loadBufferedImage(ResourceLocation textureFile) { - try { - return loadBufferedImage(getTextureResource(textureFile)); - } catch (Exception e) { - System.err.println("Failed to load texture file: " + textureFile); - e.printStackTrace(); - } - return null; - } - - public static BufferedImage loadBufferedImage(InputStream in) throws IOException { - BufferedImage img = ImageIO.read(in); - in.close(); - return img; - } - - public static void copySubImg(int[] fromTex, int fromWidth, int fromX, int fromY, int width, int height, int[] toTex, int toWidth, int toX, int toY) { - for (int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) { - int fp = (y + fromY) * fromWidth + x + fromX; - int tp = (y + toX) * toWidth + x + toX; - - toTex[tp] = fromTex[fp]; - } - } - } - - public static TextureAtlasSprite getBlankIcon(int size, TextureMap textureMap) { - String s = "blank_" + size; - TextureAtlasSprite icon = textureMap.getTextureExtry(s); - if (icon == null) { - textureMap.setTextureEntry(s, icon = new TextureSpecial(s).blank(size)); - } - - return icon; - } - - public static TextureSpecial getTextureSpecial(TextureMap textureMap, String name) { - if (textureMap.getTextureExtry(name) != null) { - throw new IllegalStateException("Texture: " + name + " is already registered"); - } - - TextureSpecial icon = new TextureSpecial(name); - textureMap.setTextureEntry(name, icon); - return icon; - } - - public static void prepareTexture(int target, int texture, int min_mag_filter, int wrap) { - GlStateManager.glTexParameteri(target, GL11.GL_TEXTURE_MIN_FILTER, min_mag_filter); - GlStateManager.glTexParameteri(target, GL11.GL_TEXTURE_MAG_FILTER, min_mag_filter); - if (target == GL11.GL_TEXTURE_2D) { - GlStateManager.bindTexture(target); - } else { - GL11.glBindTexture(target, texture); - } - - switch (target) { - case GL12.GL_TEXTURE_3D: - GlStateManager.glTexParameteri(target, GL12.GL_TEXTURE_WRAP_R, wrap); - case GL11.GL_TEXTURE_2D: - GlStateManager.glTexParameteri(target, GL11.GL_TEXTURE_WRAP_T, wrap); - case GL11.GL_TEXTURE_1D: - GlStateManager.glTexParameteri(target, GL11.GL_TEXTURE_WRAP_S, wrap); - } - } - - public static TextureDataHolder loadTexture(ResourceLocation resource) { - BufferedImage img = loadBufferedImage(resource); - if (img == null) { - throw new RuntimeException("Texture not found: " + resource); - } - return new TextureDataHolder(img); - } - - /** - * Uses an empty placeholder texture to tell if the map has been reloaded since the last call to refresh texture and the texture with name needs to be reacquired to be valid - */ - public static boolean refreshTexture(TextureMap map, String name) { - if (map.getTextureExtry(name) == null) { - map.setTextureEntry(name, new PlaceholderTexture(name)); - return true; - } - return false; - } - - /*public static IIcon safeIcon(IIcon icon) { - if (icon == null) - icon = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno"); - - return icon; - }*/ - - public static TextureManager getTextureManager() { - return Minecraft.getMinecraft().renderEngine; - } - - public static TextureMap getTextureMap() { - return Minecraft.getMinecraft().getTextureMapBlocks(); - } - - public static IReloadableResourceManager getResourceManager() { - return (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager(); - } - - public static TextureAtlasSprite getMissingSprite() { - return getTextureMap().getMissingSprite(); - } - - public static TextureAtlasSprite getTexture(String location) { - return getTextureMap().getAtlasSprite(location); - } - - public static TextureAtlasSprite getTexture(ResourceLocation location) { - return getTexture(location.toString()); - } - - public static TextureAtlasSprite getBlockTexture(String string) { - return getBlockTexture(new ResourceLocation(string)); - } - - public static TextureAtlasSprite getBlockTexture(ResourceLocation location) { - return getTexture(new ResourceLocation(location.getResourceDomain(), "blocks/" + location.getResourcePath())); - } - - public static TextureAtlasSprite getItemTexture(String string) { - return getItemTexture(new ResourceLocation(string)); - } - - public static TextureAtlasSprite getItemTexture(ResourceLocation location) { - return getTexture(new ResourceLocation(location.getResourceDomain(), "items/" + location.getResourcePath())); - } - - public static IResource getResource(String location) throws IOException { - return getResource(new ResourceLocation(location)); - } - - public static IResource getResource(ResourceLocation location) throws IOException { - return getResourceManager().getResource(location); - } - - public static void changeTexture(String texture) { - changeTexture(new ResourceLocation(texture)); - } - - public static void changeTexture(ResourceLocation texture) { - getTextureManager().bindTexture(texture); - } - - public static void disableMipmap(String texture) { - disableMipmap(new ResourceLocation(texture)); - } - - public static void disableMipmap(ResourceLocation texture) { - getTextureManager().getTexture(texture).setBlurMipmap(false, false); - } - - public static void restoreLastMipmap(String texture) { - restoreLastMipmap(new ResourceLocation(texture)); - } - - public static void restoreLastMipmap(ResourceLocation location) { - getTextureManager().getTexture(location).restoreLastBlurMipmap(); - } - - public static void bindBlockTexture() { - changeTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - } - - public static void dissableBlockMipmap() { - disableMipmap(TextureMap.LOCATION_BLOCKS_TEXTURE); - } - - public static void restoreBlockMipmap() { - restoreLastMipmap(TextureMap.LOCATION_BLOCKS_TEXTURE); - } - - public static TextureAtlasSprite[] getSideIconsForBlock(IBlockState state) { - TextureAtlasSprite[] sideSprites = new TextureAtlasSprite[6]; - TextureAtlasSprite missingSprite = getMissingSprite(); - for (int i = 0; i < 6; i++) { - TextureAtlasSprite[] sprites = getIconsForBlock(state, i); - TextureAtlasSprite sideSprite = missingSprite; - if (sprites.length != 0) { - sideSprite = sprites[0]; - } - sideSprites[i] = sideSprite; - } - return sideSprites; - } - - public static TextureAtlasSprite[] getIconsForBlock(IBlockState state, int side) { - return getIconsForBlock(state, EnumFacing.values()[side]); - } - - public static TextureAtlasSprite[] getIconsForBlock(IBlockState state, EnumFacing side) { - IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state); - if (model != null) { - List quads = model.getQuads(state, side, 0); - if (quads != null && quads.size() > 0) { - TextureAtlasSprite[] sprites = new TextureAtlasSprite[quads.size()]; - for (int i = 0; i < quads.size(); i++) { - sprites[i] = quads.get(i).getSprite(); - } - return sprites; - } - } - return new TextureAtlasSprite[0]; - } - - public static TextureAtlasSprite getParticleIconForBlock(IBlockState state) { - IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state); - if (model != null) { - return model.getParticleTexture(); - } - return null; - } - -} diff --git a/dependencies/main/java/codechicken/lib/thread/ProfileTimer.java b/dependencies/main/java/codechicken/lib/thread/ProfileTimer.java deleted file mode 100644 index 50990198df..0000000000 --- a/dependencies/main/java/codechicken/lib/thread/ProfileTimer.java +++ /dev/null @@ -1,40 +0,0 @@ -package codechicken.lib.thread; - -public class ProfileTimer { - - public double decay; - public long startTime; - public long nanoTime; - public int scanCount; - public int logScans; - public String logName; - - public ProfileTimer() { - this(0.98); - } - - public ProfileTimer(double decay) { - this.decay = decay; - } - - public ProfileTimer log(String logName, int scans) { - this.logScans = scans; - this.logName = logName; - return this; - } - - public void start() { - startTime = System.nanoTime(); - } - - public void end() { - long t = System.nanoTime() - startTime; - nanoTime = (long) (nanoTime * decay + t * (1 - decay)); - - scanCount++; - if (logScans > 0 && scanCount % logScans == 0) { - System.out.println("Profiled " + logName + " " + nanoTime + "ns"); - } - - } -} diff --git a/dependencies/main/java/codechicken/lib/thread/ReentrantCheck.java b/dependencies/main/java/codechicken/lib/thread/ReentrantCheck.java deleted file mode 100644 index d23e4cd0b2..0000000000 --- a/dependencies/main/java/codechicken/lib/thread/ReentrantCheck.java +++ /dev/null @@ -1,31 +0,0 @@ -package codechicken.lib.thread; - -public class ReentrantCheck { - - private boolean entered; - - public ReentrantCheck() { - entered = false; - } - - public boolean entered() { - return entered; - } - - public void enter() { - entered = true; - } - - public void exit() { - entered = false; - } - - public static ThreadLocal threadLocal() { - return new ThreadLocal() { - @Override - protected ReentrantCheck initialValue() { - return new ReentrantCheck(); - } - }; - } -} diff --git a/dependencies/main/java/codechicken/lib/thread/RestartableTask.java b/dependencies/main/java/codechicken/lib/thread/RestartableTask.java deleted file mode 100644 index 54562b890a..0000000000 --- a/dependencies/main/java/codechicken/lib/thread/RestartableTask.java +++ /dev/null @@ -1,103 +0,0 @@ -package codechicken.lib.thread; - -/** - * Provides an abstract way to have a task run and restart if needed whilst still operating. - * It is recommended to implement - */ -public abstract class RestartableTask { - - public final String name; - private Thread thread; - private volatile boolean restart; - private volatile boolean stopped; - - private ThreadOperationTimer timer; - - public RestartableTask(String name) { - this.name = name; - } - - private void start() { - thread = new Thread(name) { - @Override - public void run() { - do { - while (stopped) { - try { - Thread.sleep(1); - } catch (InterruptedException ignored) { - } - } - if (!restart) { - execute(); - } - } while (!finish()); - } - }; - thread.start(); - } - - private synchronized boolean finish() { - if (restart) { - restart = false; - return false; - } else { - clearTasks(); - return true; - } - } - - /** - * Clears the current task. - * Not recommended to be called directly. - */ - public void clearTasks() { - thread = null; - timer = null; - } - - /** - * Marks the Task to be restarted. - * You may call this to start the process too. - */ - public synchronized void restart() { - if (thread != null) { - stopped = false; - restart = true; - } else { - start(); - } - } - - /** - * Stops execution until restart is called. If a thread is running, the restart flag will be set, and the thread will be paused once the execute method exits. - */ - public synchronized void stop() { - if (thread != null) { - stopped = true; - restart = true; - } - } - - /** - * This must be implemented in your execute method, if this returns true it means you need to get your operation in to a restartable state and prepare for a restart. - * - * @return True if the process should end. - */ - public boolean interrupted() { - return restart; - } - - public synchronized ThreadOperationTimer getTimer(int timeout) { - if (timer == null) { - timer = ThreadOperationTimer.start(thread, timeout); - } - return timer; - } - - /** - * Main call point for the RestartableTask, this is where you will put your logic to be called. - * Make sure you implement some sort of bail out system if interrupted() is true. - */ - public abstract void execute(); -} diff --git a/dependencies/main/java/codechicken/lib/thread/TaskProfiler.java b/dependencies/main/java/codechicken/lib/thread/TaskProfiler.java deleted file mode 100644 index 42522e826f..0000000000 --- a/dependencies/main/java/codechicken/lib/thread/TaskProfiler.java +++ /dev/null @@ -1,78 +0,0 @@ -package codechicken.lib.thread; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map.Entry; - -public class TaskProfiler { - - public static class ProfilerResult { - - public final String name; - public final long time; - public final double fraction; - - public ProfilerResult(String name, long time, long totalTime) { - this.name = name; - this.time = time; - fraction = time / (double) totalTime; - } - } - - public HashMap times = new HashMap(); - - public String currentSection; - private long startTime; - private long totalTime; - - private long startTimeOnce; - private String currentOnceSection; - - public void start(String section) { - if (currentSection != null) { - end(); - } - - currentSection = section; - startTime = System.nanoTime(); - } - - public void end() { - long time = System.nanoTime() - startTime; - totalTime += time; - - Long prev = times.get(currentSection); - if (prev == null) { - prev = 0L; - } - times.put(currentSection, prev + time); - currentSection = null; - } - - public void startOnce(String name) { - currentOnceSection = name; - startTimeOnce = System.nanoTime(); - } - - public ProfilerResult endOnce() { - long end = System.nanoTime() - startTimeOnce; - return new ProfilerResult(currentOnceSection, end, end); - } - - public List getResults() { - ArrayList results = new ArrayList(times.size()); - for (Entry e : times.entrySet()) { - results.add(new ProfilerResult(e.getKey(), e.getValue(), totalTime)); - } - return results; - } - - public void clear() { - if (currentSection != null) { - end(); - } - times.clear(); - totalTime = 0; - } -} diff --git a/dependencies/main/java/codechicken/lib/thread/ThreadOperationTimer.java b/dependencies/main/java/codechicken/lib/thread/ThreadOperationTimer.java deleted file mode 100644 index 92a710fe7f..0000000000 --- a/dependencies/main/java/codechicken/lib/thread/ThreadOperationTimer.java +++ /dev/null @@ -1,78 +0,0 @@ -package codechicken.lib.thread; - -import codechicken.lib.asm.ObfMapping; -import com.google.common.base.Objects; - -/** - * Used to control how long a thread can run for before a TimeoutException is thrown. - */ -public class ThreadOperationTimer extends Thread { - - @SuppressWarnings ("serial") - public static class TimeoutException extends RuntimeException { - - public final Object operation; - - public TimeoutException(String msg, Object op) { - super(msg); - operation = op; - } - } - - private Thread thread; - private Object operation; - private long opTime; - private long limit; - - private ThreadOperationTimer(Thread thread, int limit) { - super(thread.getName() + " Operation Timer"); - this.thread = thread; - this.limit = limit; - } - - public synchronized void setLimit(int limit) { - this.limit = limit; - } - - public void reset() { - reset(null); - } - - public synchronized void reset(Object op) { - operation = op; - opTime = System.currentTimeMillis(); - } - - public synchronized void update(Object op) { - if (!Objects.equal(operation, op)) { - operation = op; - opTime = System.currentTimeMillis(); - } - } - - @SuppressWarnings ("deprecation") - @Override - public void run() { - if (ObfMapping.obfuscated) { - return;//don't run this thread in a source environment - } - - while (thread.isAlive()) { - synchronized (this) { - if (operation != null && System.currentTimeMillis() - opTime > limit) { - thread.stop(new TimeoutException("Operation took too long", operation)); - } - } - try { - Thread.sleep(50); - } catch (InterruptedException ie) { - } - } - } - - public static ThreadOperationTimer start(Thread thread, int limit) { - ThreadOperationTimer t = new ThreadOperationTimer(thread, limit); - t.start(); - return t; - } -} diff --git a/dependencies/main/java/codechicken/lib/tile/IActiveTile.java b/dependencies/main/java/codechicken/lib/tile/IActiveTile.java deleted file mode 100644 index 1a054c9584..0000000000 --- a/dependencies/main/java/codechicken/lib/tile/IActiveTile.java +++ /dev/null @@ -1,12 +0,0 @@ -package codechicken.lib.tile; - -/** - * Created by covers1624 on 3/28/2016. - */ -public interface IActiveTile { - - boolean isActive(); - - void setActive(boolean active); - -} diff --git a/dependencies/main/java/codechicken/lib/tile/IDisplayTickTile.java b/dependencies/main/java/codechicken/lib/tile/IDisplayTickTile.java deleted file mode 100644 index 2f2af84b09..0000000000 --- a/dependencies/main/java/codechicken/lib/tile/IDisplayTickTile.java +++ /dev/null @@ -1,19 +0,0 @@ -package codechicken.lib.tile; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.util.Random; - -/** - * Created by covers1624 on 3/28/2016. - */ -public interface IDisplayTickTile { - - @SideOnly (Side.CLIENT) - void randomDisplayTick(World world, BlockPos position, IBlockState state, Random random); - -} diff --git a/dependencies/main/java/codechicken/lib/tile/IGuiTile.java b/dependencies/main/java/codechicken/lib/tile/IGuiTile.java deleted file mode 100644 index 705d92de1b..0000000000 --- a/dependencies/main/java/codechicken/lib/tile/IGuiTile.java +++ /dev/null @@ -1,13 +0,0 @@ -package codechicken.lib.tile; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -/** - * Created by covers1624 on 3/28/2016. - */ -public interface IGuiTile { - - void openGui(World world, BlockPos pos, EntityPlayer player); -} diff --git a/dependencies/main/java/codechicken/lib/tile/IHarvestTile.java b/dependencies/main/java/codechicken/lib/tile/IHarvestTile.java deleted file mode 100644 index 1fe7119f00..0000000000 --- a/dependencies/main/java/codechicken/lib/tile/IHarvestTile.java +++ /dev/null @@ -1,13 +0,0 @@ -package codechicken.lib.tile; - -import net.minecraft.item.ItemStack; - -import java.util.List; - -/** - * Created by covers1624 on 3/28/2016. - */ -public interface IHarvestTile { - - List getHarvestItems(); -} diff --git a/dependencies/main/java/codechicken/lib/tile/IPlacingTypeTile.java b/dependencies/main/java/codechicken/lib/tile/IPlacingTypeTile.java deleted file mode 100644 index d14ad15d01..0000000000 --- a/dependencies/main/java/codechicken/lib/tile/IPlacingTypeTile.java +++ /dev/null @@ -1,13 +0,0 @@ -package codechicken.lib.tile; - -/** - * Created by covers1624 on 3/28/2016. - */ -//TODO Enum. -public interface IPlacingTypeTile { - - boolean getPlacing(); - - void setPlacing(boolean placing); - -} diff --git a/dependencies/main/java/codechicken/lib/tile/IRedstoneActiveTile.java b/dependencies/main/java/codechicken/lib/tile/IRedstoneActiveTile.java deleted file mode 100644 index cc3fb0865c..0000000000 --- a/dependencies/main/java/codechicken/lib/tile/IRedstoneActiveTile.java +++ /dev/null @@ -1,12 +0,0 @@ -package codechicken.lib.tile; - -/** - * Created by covers1624 on 7/3/2016. - */ -public interface IRedstoneActiveTile { - - void setTileActive(); - - void setTileInactive(); - -} diff --git a/dependencies/main/java/codechicken/lib/tile/IRotatableTile.java b/dependencies/main/java/codechicken/lib/tile/IRotatableTile.java deleted file mode 100644 index 016c0ff4f8..0000000000 --- a/dependencies/main/java/codechicken/lib/tile/IRotatableTile.java +++ /dev/null @@ -1,13 +0,0 @@ -package codechicken.lib.tile; - -import net.minecraft.util.EnumFacing; - -public interface IRotatableTile extends IPlacingTypeTile { - - void doRotation(boolean shift); - - EnumFacing getRotation(); - - void setRotation(EnumFacing facing); - -} diff --git a/dependencies/main/java/codechicken/lib/tool/LibDownloader.java b/dependencies/main/java/codechicken/lib/tool/LibDownloader.java deleted file mode 100644 index 0de10de9d3..0000000000 --- a/dependencies/main/java/codechicken/lib/tool/LibDownloader.java +++ /dev/null @@ -1,111 +0,0 @@ -package codechicken.lib.tool; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.lang.reflect.Method; -import java.net.URL; -import java.net.URLClassLoader; -import java.net.URLConnection; -import java.nio.ByteBuffer; -import java.util.LinkedList; -import java.util.List; - -public class LibDownloader { - - private static String[] libs = new String[] { "org/ow2/asm/asm-debug-all/5.0.3/asm-debug-all-5.0.3.jar", "com/google/guava/guava/14.0/guava-14.0.jar", "net/sf/jopt-simple/jopt-simple/4.5/jopt-simple-4.5.jar", "org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar", "org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar" }; - private static File libDir = new File("lib"); - - private static ByteBuffer downloadBuffer = ByteBuffer.allocateDirect(1 << 23); - - public static void load() { - if (!libDir.exists()) { - libDir.mkdir(); - } - if (!libDir.isDirectory()) { - throw new RuntimeException("/lib is not a directory"); - } - - List missing = checkExists(); - for (String lib : missing) { - download(lib); - } - addPaths(libs); - } - - private static void addPaths(String[] libs) { - try { - URLClassLoader cl = (URLClassLoader) ClassLoader.getSystemClassLoader(); - Method m_addURL = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); - m_addURL.setAccessible(true); - for (String lib : libs) { - m_addURL.invoke(cl, new File(libDir, fileName(lib)).toURI().toURL()); - } - } catch (Exception e) { - throw new RuntimeException("Failed to add libraries to classpath", e); - } - } - - private static void download(String lib) { - File libFile = new File(libDir, fileName(lib)); - try { - URL libDownload = new URL("http://repo1.maven.org/maven2/" + lib); - URLConnection connection = libDownload.openConnection(); - connection.setConnectTimeout(5000); - connection.setReadTimeout(5000); - connection.setRequestProperty("User-Agent", "CodeChickenLib Downloader"); - int sizeGuess = connection.getContentLength(); - download(connection.getInputStream(), sizeGuess, libFile); - } catch (Exception e) { - libFile.delete(); - throw new RuntimeException("A download error occured", e); - } - } - - private static void download(InputStream is, int sizeGuess, File target) throws Exception { - String name = target.getName(); - if (sizeGuess > downloadBuffer.capacity()) { - throw new Exception(String.format("The file %s is too large to be downloaded", name)); - } - - downloadBuffer.clear(); - - int bytesRead, fullLength = 0; - - System.out.format("Downloading lib %s", name); - byte[] smallBuffer = new byte[1024]; - while ((bytesRead = is.read(smallBuffer)) >= 0) { - downloadBuffer.put(smallBuffer, 0, bytesRead); - fullLength += bytesRead; - System.out.format("\rDownloading lib %s %d%%", name, fullLength * 100 / sizeGuess); - } - System.out.format("\rDownloaded lib %s \n", name); - is.close(); - downloadBuffer.limit(fullLength); - - if (!target.exists()) { - target.createNewFile(); - } - - downloadBuffer.position(0); - FileOutputStream fos = new FileOutputStream(target); - fos.getChannel().write(downloadBuffer); - fos.close(); - } - - private static String fileName(String lib) { - return lib.replaceAll(".+/", ""); - } - - private static List checkExists() { - LinkedList list = new LinkedList(); - for (String lib : libs) { - File file = new File(libDir, fileName(lib)); - if (!file.exists()) { - list.add(lib); - } - } - return list; - } - -} diff --git a/dependencies/main/java/codechicken/lib/tool/MCStripTransformer.java b/dependencies/main/java/codechicken/lib/tool/MCStripTransformer.java deleted file mode 100644 index d9ad82dfa0..0000000000 --- a/dependencies/main/java/codechicken/lib/tool/MCStripTransformer.java +++ /dev/null @@ -1,49 +0,0 @@ -package codechicken.lib.tool; - -import codechicken.lib.asm.ASMHelper; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.commons.Remapper; -import org.objectweb.asm.commons.RemappingMethodAdapter; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.MethodNode; - -import java.util.Iterator; - -public class MCStripTransformer { - - public static class ReferenceDetector extends Remapper { - - boolean found = false; - - @Override - public String map(String typeName) { - if (typeName.startsWith("net/minecraft") || !typeName.contains("/")) { - found = true; - } - return typeName; - } - } - - public static byte[] transform(byte[] bytes) { - ClassNode cnode = ASMHelper.createClassNode(bytes, ClassReader.EXPAND_FRAMES); - - boolean changed = false; - Iterator it = cnode.methods.iterator(); - while (it.hasNext()) { - MethodNode mnode = it.next(); - ReferenceDetector r = new ReferenceDetector(); - mnode.accept(new RemappingMethodAdapter(mnode.access, mnode.desc, new MethodVisitor(Opcodes.ASM4) { - }, r)); - if (r.found) { - it.remove(); - changed = true; - } - } - if (changed) { - bytes = ASMHelper.createBytes(cnode, 0); - } - return bytes; - } -} diff --git a/dependencies/main/java/codechicken/lib/tool/Main.java b/dependencies/main/java/codechicken/lib/tool/Main.java deleted file mode 100644 index 039121ca0a..0000000000 --- a/dependencies/main/java/codechicken/lib/tool/Main.java +++ /dev/null @@ -1,14 +0,0 @@ -package codechicken.lib.tool; - -public class Main { - - public static void main(String[] args) { - LibDownloader.load(); - try { - Class c_toolMain = new StripClassLoader().loadClass("codechicken.lib.tool.ToolMain"); - c_toolMain.getDeclaredMethod("main", String[].class).invoke(null, new Object[] { args }); - } catch (Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/tool/StripClassLoader.java b/dependencies/main/java/codechicken/lib/tool/StripClassLoader.java deleted file mode 100644 index 1a2f86db3c..0000000000 --- a/dependencies/main/java/codechicken/lib/tool/StripClassLoader.java +++ /dev/null @@ -1,53 +0,0 @@ -package codechicken.lib.tool; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.URLClassLoader; - -public class StripClassLoader extends URLClassLoader { - - public StripClassLoader() { - super(new URL[0], StripClassLoader.class.getClassLoader()); - } - - @Override - public Class loadClass(String name) throws ClassNotFoundException { - if (!name.startsWith("codechicken.lib")) { - return super.loadClass(name); - } - - try { - String resName = name.replace('.', '/') + ".class"; - InputStream res = getResourceAsStream(resName); - if (res == null) { - throw new ClassNotFoundException("Could not find resource: " + resName); - } - byte[] bytes = readFully(res); - bytes = transform(bytes); - return defineClass(name, bytes, 0, bytes.length); - - } catch (IOException e) { - throw new ClassNotFoundException(name, e); - } - } - - public static byte[] readFully(InputStream is) throws IOException { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - - int read; - byte[] data = new byte[16384]; - while ((read = is.read(data, 0, data.length)) > 0) { - buffer.write(data, 0, read); - } - - return buffer.toByteArray(); - } - - private byte[] transform(byte[] bytes) { - - bytes = MCStripTransformer.transform(bytes); - return bytes; - } -} diff --git a/dependencies/main/java/codechicken/lib/tool/ToolMain.java b/dependencies/main/java/codechicken/lib/tool/ToolMain.java deleted file mode 100644 index 46dd0353f3..0000000000 --- a/dependencies/main/java/codechicken/lib/tool/ToolMain.java +++ /dev/null @@ -1,48 +0,0 @@ -package codechicken.lib.tool; - -import codechicken.lib.tool.module.ModuleQBConverter; - -public class ToolMain { - - public interface Module { - - void main(String[] args); - - String name(); - - void printHelp(); - } - - public static Module[] modules = new Module[] { new ModuleQBConverter() }; - - private static void printHelp() { - System.out.println("Usage: [module] [args]"); - System.out.println(" Modules: "); - for (Module m : modules) { - System.out.println(" - " + m.name()); - } - System.out.println("-h [module] for module help"); - } - - public static void main(String[] args) { - if (args.length > 0) { - for (Module m : modules) { - if (args[0].equals(m.name())) { - String[] args2 = new String[args.length - 1]; - System.arraycopy(args, 1, args2, 0, args2.length); - m.main(args2); - return; - } - } - if (args[0].equals("-h") && args.length >= 2) { - for (Module m : modules) { - if (args[1].equals(m.name())) { - m.printHelp(); - return; - } - } - } - } - printHelp(); - } -} diff --git a/dependencies/main/java/codechicken/lib/tool/module/JOptModule.java b/dependencies/main/java/codechicken/lib/tool/module/JOptModule.java deleted file mode 100644 index 5493399578..0000000000 --- a/dependencies/main/java/codechicken/lib/tool/module/JOptModule.java +++ /dev/null @@ -1,42 +0,0 @@ -package codechicken.lib.tool.module; - -import codechicken.lib.tool.ToolMain; -import joptsimple.OptionException; -import joptsimple.OptionParser; -import joptsimple.OptionSet; - -import java.io.IOException; - -public abstract class JOptModule implements ToolMain.Module { - - OptionParser parser = new OptionParser(); - - @Override - public void main(String[] args) { - OptionSet options; - try { - options = parser.parse(args); - } catch (OptionException ex) { - System.err.println(ex.getLocalizedMessage()); - System.exit(-1); - return; - } - - try { - main(parser, options); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - protected abstract void main(OptionParser parser, OptionSet options); - - @Override - public void printHelp() { - try { - parser.printHelpOn(System.out); - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/tool/module/ModuleQBConverter.java b/dependencies/main/java/codechicken/lib/tool/module/ModuleQBConverter.java deleted file mode 100644 index 1110edcede..0000000000 --- a/dependencies/main/java/codechicken/lib/tool/module/ModuleQBConverter.java +++ /dev/null @@ -1,82 +0,0 @@ -package codechicken.lib.tool.module; - -import codechicken.lib.render.QBImporter; -import joptsimple.OptionParser; -import joptsimple.OptionSet; - -import java.io.File; - -import static java.util.Arrays.asList; - -public class ModuleQBConverter extends JOptModule { - - public ModuleQBConverter() { - parser.acceptsAll(asList("?", "h", "help"), "Show the help"); - parser.acceptsAll(asList("i", "input"), "comma separated list of paths to models (.qb or directories)").withRequiredArg().ofType(File.class).withValuesSeparatedBy(',').required(); - parser.acceptsAll(asList("o", "out"), "Output Directory").withRequiredArg().ofType(File.class); - parser.acceptsAll(asList("o2", "textureplanes"), "2nd level optimisation. Merges coplanar polygons. Increases texture size"); - parser.acceptsAll(asList("s", "squaretextures"), "Produce square textures"); - parser.acceptsAll(asList("t", "mergetextures"), "Use the same texture for all models"); - parser.acceptsAll(asList("r", "scalemc"), "Resize model to mc standard (shrink by factor of 16)"); - } - - protected void main(OptionParser parser, OptionSet options) { - int flags = 0; - if (options.has("o2")) { - flags |= QBImporter.TEXTUREPLANES; - } - if (options.has("s")) { - flags |= QBImporter.SQUARETEXTURE; - } - if (options.has("t")) { - flags |= QBImporter.MERGETEXTURES; - } - if (options.has("r")) { - flags |= QBImporter.SCALEMC; - } - - File[] input = options.valuesOf("input").toArray(new File[0]); - File[] outDir = new File[input.length]; - if (options.has("out")) { - File output = (File) options.valueOf("out"); - if (output.isFile()) { - throw new RuntimeException("Output Path is not a directory"); - } - if (!output.exists()) { - output.mkdirs(); - } - - for (int i = 0; i < input.length; i++) { - outDir[i] = output; - } - } else { - for (int i = 0; i < input.length; i++) { - outDir[i] = input[i].isDirectory() ? input[i] : input[i].getParentFile(); - } - } - - for (int i = 0; i < input.length; i++) { - File file = input[i]; - if (file.isDirectory()) { - for (File file2 : file.listFiles()) { - if (file2.getName().endsWith(".qb")) { - convert(file2, outDir[i], flags); - } - } - } else { - convert(file, outDir[i], flags); - } - } - } - - private void convert(File in, File outDir, int flags) { - System.out.println("Converting: " + in.getName()); - QBImporter.RasterisedModel m = QBImporter.loadQB(in).toRasterisedModel(flags); - m.export(new File(outDir, in.getName().replace(".qb", ".obj")), outDir); - } - - @Override - public String name() { - return "QBConverter"; - } -} diff --git a/dependencies/main/java/codechicken/lib/util/ArrayUtils.java b/dependencies/main/java/codechicken/lib/util/ArrayUtils.java deleted file mode 100644 index 30507cce7c..0000000000 --- a/dependencies/main/java/codechicken/lib/util/ArrayUtils.java +++ /dev/null @@ -1,234 +0,0 @@ -package codechicken.lib.util; - -import com.google.common.base.Function; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by covers1624 on 3/27/2016. - */ -public class ArrayUtils { - - /** - * Converts an String array to lowercase. - * - * @param array Array to convert. - * @return Converted array. - */ - public static String[] arrayToLowercase(String[] array) { - String[] copy = new String[array.length]; - for (int i = 0; i < array.length; i++) { - copy[i] = array[i].toLowerCase(); - } - return copy; - } - - /** - * Converts and array of "key=value" to a map. - * - * @param array Array to convert. - * @return Map of values. - */ - public static Map convertKeyValueArrayToMap(String[] array) { - HashMap map = new HashMap(); - for (String entry : array) { - String[] split = entry.split("="); - map.put(split[0], split[1]); - } - return map; - } - - /** - * Prefixes a string array with the desired value. - * - * @param prefix The prefix to apply. - * @param list The list to apply the prefix to. - * @return The list with the prefix applied. - */ - public static List prefixStringList(String prefix, List list) { - List finalList = new ArrayList(); - for (String string : list) { - finalList.add(prefix + string); - } - return finalList; - } - - /** - * Checks if a map contains all keys passed in. - * - * @param map Map to check. - * @param keys Keys that must exist. - * @param The type of data in the map key. - * @return False if fail. - */ - public static boolean containsKeys(Map map, T... keys) { - for (T object : keys) { - if (!map.containsKey(object)) { - return false; - } - } - return true; - } - - /** - * Adds the value at the first null index in the array. - * - * @param array Array to add to. - * @param value Value to add. - * @param Type of value. - */ - public static void addToArrayFirstNull(T[] array, T value) { - int nullIndex = -1; - for (int i = 0; i < array.length; i++) { - T v = array[i]; - if (v == null) { - nullIndex = i; - break; - } - } - if (nullIndex == -1) {//We aren't able to expand it as we are using generics. - throw new RuntimeException("Unable to add to array as it is full! Expand it before adding to it!"); - } - array[nullIndex] = value; - } - - /** - * Adds all elements from the array that are not null to the list. - * - * @param array Array to grab from. - * @param list List to add to. - * @param What we are dealing with. - * @return The modified list. - */ - public static List addAllNoNull(T[] array, List list) { - for (T value : array) { - if (value != null) { - list.add(value); - } - } - return list; - } - - /** - * Checks if the array is all null. - * - * @param array The array to check. - * @param What we are dealing with. - * @return True if the array only contains nulls. - */ - public static boolean isEmpty(T[] array) { - for (T value : array) { - if (value != null) { - return false; - } - } - return true; - } - - /** - * Counts the elements in the array that are not null. - * - * @param array The array to check. - * @param What we are dealing with. - * @return The count of non-null objects in the array. - */ - public static int countNoNull(T[] array) { - int counter = 0; - for (T value : array) { - if (value != null) { - counter++; - } - } - return counter; - } - - /** - * Fills the array with the specified value. - * If the value is an instance of Copyable it will call copy. - * - * @param array Array to fill. - * @param value Value to fill with. - * @param What we are dealing with. - */ - @SuppressWarnings ("unchecked") - public static void fillArray(T[] array, T value) { - for (int i = 0; i < array.length; i++) { - T newValue = value; - if (value instanceof Copyable) { - newValue = ((Copyable) value).copy(); - } - array[i] = newValue; - } - } - - /** - * Apples the Specified function to the entire array and returns a new List of the result. - * The input to the function may be null. - * - * @param function The function to apply. - * @param array The array to apply the function to. - * @param The Input generic. - * @param The Output generic. - * @return A list of the output of the specified function. - */ - public static List applyArray(Function function, I... array) { - List finalList = new ArrayList(); - for (I i : array) { - finalList.add(function.apply(i)); - } - - return finalList; - } - - /** - * Basically a wrapper for System.arraycopy with support for CCL Copyable's - * - * @param src The source array. - * @param srcPos Starting position in the source array. - * @param dst The destination array. - * @param destPos Starting position in the destination array. - * @param length The number of elements to copy. - */ - public static void arrayCopy(Object src, int srcPos, Object dst, int destPos, int length) { - System.arraycopy(src, srcPos, dst, destPos, length); - if (dst instanceof Copyable[]) { - Object[] oa = (Object[]) dst; - Copyable[] c = (Copyable[]) dst; - for (int i = destPos; i < destPos + length; i++) { - if (c[i] != null) { - oa[i] = c[i].copy(); - } - } - } - } - - /** - * Returns the index of the first occurrence of the specified element in the array. - * Will return -1 if the element is non existent in the array. - * - * @param array The array to search. - * @param object Element to find. - * @param What we are dealing with. - * @return The index in the array of the object. - */ - public static int indexOf(T[] array, T object) { - if (object == null) { - for (int i = 0; i < array.length; i++) { - if (array[i] == null) { - return i; - } - } - } else { - for (int i = 0; i < array.length; i++) { - if (object.equals(array[i])) { - return i; - } - } - } - return -1; - } - -} diff --git a/dependencies/main/java/codechicken/lib/util/BlockStateUtils.java b/dependencies/main/java/codechicken/lib/util/BlockStateUtils.java deleted file mode 100644 index e553ea9063..0000000000 --- a/dependencies/main/java/codechicken/lib/util/BlockStateUtils.java +++ /dev/null @@ -1,41 +0,0 @@ -package codechicken.lib.util; - -import com.google.common.base.Objects; -import com.google.common.base.Optional; -import net.minecraft.block.state.IBlockState; -import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.common.property.IUnlistedProperty; - -import java.util.LinkedList; -import java.util.List; -import java.util.Map.Entry; - -/** - * Created by covers1624 on 13/01/2017. - */ -public class BlockStateUtils { - - public static int hashBlockState(IBlockState state) { - if (state instanceof IExtendedBlockState) { - return hashBlockState((IExtendedBlockState) state); - } - return hashBlockState_(state); - } - - public static int hashBlockState_(IBlockState state) { - return Objects.hashCode(state.toString()); - } - - @SuppressWarnings ("unchecked") - private static int hashBlockState(IExtendedBlockState state) { - List toHash = new LinkedList(); - toHash.add(state.toString()); - toHash.add("meta=" + state.getBlock().getMetaFromState(state)); - for (Entry, Optional> entry : state.getUnlistedProperties().entrySet()) { - IUnlistedProperty property = entry.getKey(); - toHash.add(property.getName() + "=" + property.valueToString(state.getValue(property))); - } - return Objects.hashCode(toHash.toArray()); - } - -} diff --git a/dependencies/main/java/codechicken/lib/util/BlockUtils.java b/dependencies/main/java/codechicken/lib/util/BlockUtils.java deleted file mode 100644 index 3b718b5bd9..0000000000 --- a/dependencies/main/java/codechicken/lib/util/BlockUtils.java +++ /dev/null @@ -1,81 +0,0 @@ -package codechicken.lib.util; - -import codechicken.lib.vec.Vector3; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.Entity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import java.util.LinkedList; -import java.util.List; - -/** - * Created by covers1624 on 6/30/2016. - * TODO Nuke things in here that aren't needed anymore. - */ -public class BlockUtils { - - /** - * Generates a bounding box. - * - * @param pos Position of block. - * @param dir Direction to create Box. - * @param vector3 Size of the box. - */ - public static AxisAlignedBB getBox(BlockPos pos, EnumFacing dir, Vector3 vector3) { - return new AxisAlignedBB(pos, pos.add(vector3.x, vector3.y, vector3.z)); - } - - /** - * Checks if an entity is in range of the position passed in. - * - * @param pos Position of block. - * @param entity Entity to check. - * @param range Range to check. - * @return True if entity in range. - */ - public static boolean isEntityInRange(BlockPos pos, Entity entity, int range) { - return entity.getDistanceSq(pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D) <= range; - } - - /** - * Simply fires a lighting update for a block. - * - * @param world World for the update. - * @param position Pos to update. - */ - public static void fireLightUpdate(World world, BlockPos position) { - world.notifyLightSet(position); - } - - /** - * Fires a block update. - * Assumes the BlockState has not changed but a update is still needed. - * - * @param world - * @param pos - *///TODO fireBlockUpdate(TileEntity). - public static void fireBlockUpdate(World world, BlockPos pos) { - IBlockState state = world.getBlockState(pos); - world.notifyBlockUpdate(pos, state, state, 3); - } - - /** - * Gets the adjacent blocks for a position. - * - * @param pos Main position. - * @param includeVertical Weather to include vertical facings. - * @return List of adjacent blocks. - */ - public static List getAdjacent(BlockPos pos, boolean includeVertical) { - LinkedList adjacentPositions = new LinkedList(); - for (EnumFacing step : (includeVertical ? EnumFacing.VALUES : EnumFacing.HORIZONTALS)) { - adjacentPositions.add(pos.offset(step)); - } - - return adjacentPositions; - } - -} diff --git a/dependencies/main/java/codechicken/lib/util/CCDirection.java b/dependencies/main/java/codechicken/lib/util/CCDirection.java deleted file mode 100644 index 17b771e007..0000000000 --- a/dependencies/main/java/codechicken/lib/util/CCDirection.java +++ /dev/null @@ -1,103 +0,0 @@ -package codechicken.lib.util; - -import net.minecraft.util.EnumFacing; -import net.minecraft.util.IStringSerializable; - -/** - * Created by covers1624 on 5/17/2016. - */ -@Deprecated//Brandon this isn't needed anymore, use null and special case it instead of UNKNOWN -public enum CCDirection implements IStringSerializable { - - /** - * -Y - */ - DOWN(0, -1, 0), - - /** - * +Y - */ - UP(0, 1, 0), - - /** - * -Z - */ - NORTH(0, 0, -1), - - /** - * +Z - */ - SOUTH(0, 0, 1), - - /** - * -X - */ - WEST(-1, 0, 0), - - /** - * +X - */ - EAST(1, 0, 0), - - /** - * Used only by getOrientation, for invalid inputs - */ - UNKNOWN(0, 0, 0); - - public final int offsetX; - public final int offsetY; - public final int offsetZ; - public final int flag; - public static final CCDirection[] VALID_DIRECTIONS = { DOWN, UP, NORTH, SOUTH, WEST, EAST }; - public static final int[] OPPOSITES = { 1, 0, 3, 2, 5, 4, 6 }; - // Left hand rule rotation matrix for all possible axes of rotation - public static final int[][] ROTATION_MATRIX = {// - { 0, 1, 4, 5, 3, 2, 6 },// - { 0, 1, 5, 4, 2, 3, 6 },// - { 5, 4, 2, 3, 0, 1, 6 },// - { 4, 5, 2, 3, 1, 0, 6 },// - { 2, 3, 1, 0, 4, 5, 6 },// - { 3, 2, 0, 1, 4, 5, 6 },// - { 0, 1, 2, 3, 4, 5, 6 },// - }; - - CCDirection(int x, int y, int z) { - offsetX = x; - offsetY = y; - offsetZ = z; - flag = 1 << ordinal(); - } - - public static CCDirection getOrientation(int id) { - if (id >= 0 && id < VALID_DIRECTIONS.length) { - return VALID_DIRECTIONS[id]; - } - return UNKNOWN; - } - - public CCDirection getOpposite() { - return getOrientation(OPPOSITES[ordinal()]); - } - - public CCDirection getRotation(CCDirection axis) { - return getOrientation(ROTATION_MATRIX[axis.ordinal()][ordinal()]); - } - - public EnumFacing getFacing(CCDirection direction) { - if (direction != UNKNOWN) { - return EnumFacing.getFront(direction.ordinal()); - } else { - return null; - } - } - - public CCDirection getDirection(EnumFacing facing) { - return facing == null ? UNKNOWN : VALID_DIRECTIONS[facing.getIndex()]; - } - - @Override - public String getName() { - return name().toLowerCase(); - } - -} diff --git a/dependencies/main/java/codechicken/lib/util/ClientUtils.java b/dependencies/main/java/codechicken/lib/util/ClientUtils.java deleted file mode 100644 index 50e19608b9..0000000000 --- a/dependencies/main/java/codechicken/lib/util/ClientUtils.java +++ /dev/null @@ -1,58 +0,0 @@ -package codechicken.lib.util; - -import codechicken.lib.render.CCRenderEventHandler; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.network.NetworkManager; -import net.minecraft.world.World; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public class ClientUtils extends CommonUtils { - - private static Minecraft mc() { - return Minecraft.getMinecraft(); - } - - public static World getWorld() { - return mc().theWorld; - } - - public static boolean inWorld() { - return mc().getConnection() != null; - } - - public static void openSMPGui(int windowId, GuiScreen gui) { - mc().displayGuiScreen(gui); - if (windowId != 0) { - mc().thePlayer.openContainer.windowId = windowId; - } - } - - public static float getRenderFrame() { - return CCRenderEventHandler.renderFrame; - } - - public static double getRenderTime() { - return CCRenderEventHandler.renderTime + getRenderFrame(); - } - - public static String getServerIP() { - try { - NetworkManager networkManager = mc().getConnection().getNetworkManager(); - String s = networkManager.getRemoteAddress().toString(); - s = s.substring(s.indexOf("/") + 1); - return s; - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - @SideOnly (Side.CLIENT) - public static String getWorldSaveName() { - return mc().isSingleplayer() ? FMLCommonHandler.instance().getMinecraftServerInstance().getFolderName() : null; - } -} diff --git a/dependencies/main/java/codechicken/lib/util/CommonUtils.java b/dependencies/main/java/codechicken/lib/util/CommonUtils.java deleted file mode 100644 index 913e93a207..0000000000 --- a/dependencies/main/java/codechicken/lib/util/CommonUtils.java +++ /dev/null @@ -1,59 +0,0 @@ -package codechicken.lib.util; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityList; -import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.relauncher.FMLInjectionData; - -import java.io.File; - -public class CommonUtils { - - public static boolean isClientWorld(World world) { - return world.isRemote; - } - - public static boolean isServerWorld(World world) { - return !world.isRemote; - } - - public static boolean isClient() { - return FMLCommonHandler.instance().getSide().isClient(); - } - - public static File getSaveLocation(World world) { - File base = DimensionManager.getCurrentSaveRootDirectory(); - return world.provider.getDimension() == 0 ? base : new File(base, world.provider.getSaveFolder()); - } - - public static File getSaveLocation(int dim) { - return getSaveLocation(DimensionManager.getWorld(dim)); - } - - public static String getWorldName(World world) { - return world.getWorldInfo().getWorldName(); - } - - public static int getDimension(World world) { - return world.provider.getDimension(); - } - - public static File getMinecraftDir() { - return (File) FMLInjectionData.data()[6]; - } - - public static String getRelativePath(File parent, File child) { - if (parent.isFile() || !child.getPath().startsWith(parent.getPath())) { - return null; - } - return child.getPath().substring(parent.getPath().length() + 1); - } - - @Deprecated - public static void registerHandledEntity(Class entityClass, String identifier) { - EntityList.CLASS_TO_NAME.put(entityClass, identifier); - EntityList.NAME_TO_CLASS.put(identifier, entityClass); - } -} diff --git a/dependencies/main/java/codechicken/lib/util/ContainerUtils.java b/dependencies/main/java/codechicken/lib/util/ContainerUtils.java deleted file mode 100644 index 3ea10f77d0..0000000000 --- a/dependencies/main/java/codechicken/lib/util/ContainerUtils.java +++ /dev/null @@ -1,37 +0,0 @@ -package codechicken.lib.util; - -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; - -/** - * Created by covers1624 on 30/08/2016. - */ -@Deprecated -public class ContainerUtils { - - public static void bindPlayerInventory(Container container, InventoryPlayer inventoryPlayer, int xStart, int yStart) { - // Main inventory - for (int i = 0; i < 3; i++) {// Rows, 3 Rows - for (int j = 0; j < 9; j++) {// Columns, 9 Slots per row - int slot = j + i * 9 + 9; - int x = xStart + j * 18; - int y = yStart + i * 18; - addSlotToContainer(container, new Slot(inventoryPlayer, slot, x, y)); - } - } - - // Hotbar - for (int i = 0; i < 9; i++) { - addSlotToContainer(container, new Slot(inventoryPlayer, i, xStart + i * 18, yStart + 58)); - } - } - - public static Slot addSlotToContainer(Container container, Slot slot) { - slot.slotNumber = container.inventorySlots.size(); - //Covers1624Lib.logger.info(slot.slotNumber); - container.inventorySlots.add(slot); - container.inventoryItemStacks.add(null); - return slot; - } -} diff --git a/dependencies/main/java/codechicken/lib/util/Copyable.java b/dependencies/main/java/codechicken/lib/util/Copyable.java deleted file mode 100644 index fff6f32e5e..0000000000 --- a/dependencies/main/java/codechicken/lib/util/Copyable.java +++ /dev/null @@ -1,6 +0,0 @@ -package codechicken.lib.util; - -public interface Copyable { - - T copy(); -} diff --git a/dependencies/main/java/codechicken/lib/util/EntityUtils.java b/dependencies/main/java/codechicken/lib/util/EntityUtils.java deleted file mode 100644 index ec581bc7a4..0000000000 --- a/dependencies/main/java/codechicken/lib/util/EntityUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package codechicken.lib.util; - -import codechicken.lib.vec.Vector3; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.init.SoundEvents; -import net.minecraft.util.SoundCategory; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.living.EnderTeleportEvent; - -/** - * Created by covers1624 on 17/10/2016. - */ -//TODO Nuke. -public class EntityUtils { - - public static int entityId = 0; - - public static int nextEntityId() { - return entityId++; - } - - public static boolean teleportEntityTo(EntityLivingBase entity, Vector3 location) { - EnderTeleportEvent event = new EnderTeleportEvent(entity, location.x, location.y, location.z, 0); - if (MinecraftForge.EVENT_BUS.post(event)) { - return false; - } - entity.setPositionAndUpdate(event.getTargetX(), event.getTargetY(), event.getTargetZ()); - SoundUtils.playSoundAt(entity, SoundCategory.BLOCKS, SoundEvents.ENTITY_ENDERMEN_TELEPORT); - return true; - } - -} diff --git a/dependencies/main/java/codechicken/lib/util/FontUtils.java b/dependencies/main/java/codechicken/lib/util/FontUtils.java deleted file mode 100644 index 7e4a18f75a..0000000000 --- a/dependencies/main/java/codechicken/lib/util/FontUtils.java +++ /dev/null @@ -1,67 +0,0 @@ -package codechicken.lib.util; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.item.ItemStack; - -public class FontUtils { - - public static FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; - - public static void drawCenteredString(String s, int xCenter, int y, int colour) { - fontRenderer.drawString(s, xCenter - fontRenderer.getStringWidth(s) / 2, y, colour); - } - - public static void drawRightString(String s, int xRight, int y, int colour) { - fontRenderer.drawString(s, xRight - fontRenderer.getStringWidth(s), y, colour); - } - - public static final String[] prefixes = new String[] { "K", "M", "G" }; - - public static void drawItemQuantity(int x, int y, ItemStack item, String quantity, int mode) { - if (item == null || (quantity == null && item.stackSize <= 1)) { - return; - } - - if (quantity == null) { - switch (mode) { - case 2: - int q = item.stackSize; - String postfix = ""; - for (int p = 0; p < 3 && q > 1000; p++) { - q /= 1000; - postfix = prefixes[p]; - } - quantity = Integer.toString(q) + postfix; - break; - case 1: - quantity = ""; - if (item.stackSize / 64 > 0) { - quantity += item.stackSize / 64 + "s"; - } - if (item.stackSize % 64 > 0) { - quantity += item.stackSize % 64; - } - break; - default: - quantity = Integer.toString(item.stackSize); - break; - } - } - - double scale = quantity.length() > 2 ? 0.5 : 1; - double sheight = 8 * scale; - double swidth = fontRenderer.getStringWidth(quantity) * scale; - - GlStateManager.disableLighting(); - GlStateManager.disableDepth(); - GlStateManager.pushMatrix(); - GlStateManager.translate(x + 16 - swidth, y + 16 - sheight, 0); - GlStateManager.scale(scale, scale, 1); - fontRenderer.drawStringWithShadow(quantity, 0, 0, 0xFFFFFF); - GlStateManager.popMatrix(); - GlStateManager.enableLighting(); - GlStateManager.enableDepth(); - } -} diff --git a/dependencies/main/java/codechicken/lib/util/FuelUtils.java b/dependencies/main/java/codechicken/lib/util/FuelUtils.java deleted file mode 100644 index 254715f8f7..0000000000 --- a/dependencies/main/java/codechicken/lib/util/FuelUtils.java +++ /dev/null @@ -1,37 +0,0 @@ -package codechicken.lib.util; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.IFuelHandler; - -import java.util.HashMap; - -/** - * Created by covers1624 on 17/10/2016. - */ -public class FuelUtils implements IFuelHandler { - - private static HashMap fuelBurnMap = new HashMap(); - - @Override - public int getBurnTime(ItemStack fuel) { - - if (fuelBurnMap.containsKey(fuel)) { - return fuelBurnMap.get(fuel); - } - return -1; - } - - public static void registerFuel(ItemStack stack, int burn) { - fuelBurnMap.put(stack, burn); - } - - public static void registerFuel(Block block, int burn) { - registerFuel(new ItemStack(block), burn); - } - - public static void registerFuel(Item item, int burn) { - registerFuel(new ItemStack(item), burn); - } -} diff --git a/dependencies/main/java/codechicken/lib/util/ItemNBTUtils.java b/dependencies/main/java/codechicken/lib/util/ItemNBTUtils.java deleted file mode 100644 index 4d2d3217f5..0000000000 --- a/dependencies/main/java/codechicken/lib/util/ItemNBTUtils.java +++ /dev/null @@ -1,389 +0,0 @@ -package codechicken.lib.util; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; - -import java.util.UUID; - -/** - * Created by covers1624 on 6/30/2016. - */ -public class ItemNBTUtils { - - /** - * Checks if an ItemStack has an NBTTag. - * - * @param stack Stack to check. - * @return If tag is in existence. - */ - public static boolean hasTag(ItemStack stack) { - return stack.hasTagCompound(); - } - - /** - * Sets the tag on an ItemStack. - * - * @param stack Stack to set tag on. - * @param tagCompound Tag to set on item. - */ - public static void setTag(ItemStack stack, NBTTagCompound tagCompound) { - stack.setTagCompound(tagCompound); - } - - /** - * Gets the NBTTag associated with an ItemStack. - * - * @param stack Stack to get tag from. - * @return Tag from the ItemStack. - */ - public static NBTTagCompound getTag(ItemStack stack) { - return stack.getTagCompound(); - } - - /** - * Checks if an NBTTag exists on an item and if not it will create a new one. - * - * @param stack Stack to check. - * @return The Tag on the item. - */ - public static NBTTagCompound validateTagExists(ItemStack stack) { - if (!hasTag(stack)) { - setTag(stack, new NBTTagCompound()); - } - return getTag(stack); - } - - /** - * Checks if an ItemStack has an NBTTag on an ItemStack with the specified Key and Value. - * - * @param stack Stack to check. - * @param key Key to check for. - * @return False if key does not exist or if the tag does not exist. - */ - public static boolean hasKey(ItemStack stack, String key) { - return hasTag(stack) && getTag(stack).hasKey(key); - } - - /** - * Checks if an ItemStack has an NBTTag of a specific type and name. - * - * @param stack Stack to check. - * @param key Key to check for. - * @param nbtType Primitive NBT Type. - * @return False if key does not exist or if the tag does not exist. - */ - public static boolean hasKey(ItemStack stack, String key, int nbtType) { - return hasTag(stack) && getTag(stack).hasKey(key, nbtType); - } - - /** - * Removes a key from the ItemStacks NBTTag. - * - * @param stack Stack to edit. - * @param key Key to remove. - */ - public static void removeTag(ItemStack stack, String key) { - if (hasTag(stack)) { - getTag(stack).removeTag(key); - } - } - - //region Setters - - /** - * Sets a byte on an ItemStack with the specified Key and Value. - * - * @param stack Stack to set. - * @param key Key. - * @param b Value. - */ - public static void setByte(ItemStack stack, String key, byte b) { - validateTagExists(stack); - getTag(stack).setByte(key, b); - } - - /** - * Sets a short on an ItemStack with the specified Key and Value. - * - * @param stack Stack to set. - * @param key Key. - * @param s Value. - */ - public static void setShort(ItemStack stack, String key, short s) { - validateTagExists(stack); - getTag(stack).setShort(key, s); - } - - /** - * Sets a int on an ItemStack with the specified Key and Value. - * - * @param stack Stack to set. - * @param key Key. - * @param i Value. - */ - public static void setInteger(ItemStack stack, String key, int i) { - validateTagExists(stack); - getTag(stack).setInteger(key, i); - } - - /** - * Sets a long on an ItemStack with the specified Key and Value. - * - * @param stack Stack to set. - * @param key Key. - * @param l Value. - */ - public static void setLong(ItemStack stack, String key, long l) { - validateTagExists(stack); - getTag(stack).setLong(key, l); - } - - /** - * Sets a UUID on an ItemStack with the specified Key and Value. - * - * @param stack Stack to set. - * @param key Key. - * @param uuid Value. - */ - public static void setUUID(ItemStack stack, String key, UUID uuid) { - validateTagExists(stack); - getTag(stack).setUniqueId(key, uuid); - } - - /** - * Sets a float on an ItemStack with the specified Key and Value. - * - * @param stack Stack to set. - * @param key Key. - * @param f Value. - */ - public static void setFloat(ItemStack stack, String key, float f) { - validateTagExists(stack); - getTag(stack).setFloat(key, f); - } - - /** - * Sets a double on an ItemStack with the specified Key and Value. - * - * @param stack Stack to set. - * @param key Key. - * @param d Value. - */ - public static void setDouble(ItemStack stack, String key, double d) { - validateTagExists(stack); - getTag(stack).setDouble(key, d); - } - - /** - * Sets a String on an ItemStack with the specified Key and Value. - * - * @param stack Stack to set. - * @param key Key. - * @param s Value. - */ - public static void setString(ItemStack stack, String key, String s) { - validateTagExists(stack); - getTag(stack).setString(key, s); - } - - /** - * Sets a byte array on an ItemStack with the specified Key and Value. - * - * @param stack Stack to set. - * @param key Key. - * @param b Value. - */ - public static void setByteArray(ItemStack stack, String key, byte[] b) { - validateTagExists(stack); - getTag(stack).setByteArray(key, b); - } - - /** - * Sets a int array on an ItemStack with the specified Key and Value. - * - * @param stack Stack to set. - * @param key Key. - * @param i Value. - */ - public static void setIntArray(ItemStack stack, String key, int[] i) { - validateTagExists(stack); - getTag(stack).setIntArray(key, i); - } - - /** - * Sets a boolean on an ItemStack with the specified Key and Value. - * - * @param stack Stack to set. - * @param key Key. - * @param b Value. - */ - public static void setBoolean(ItemStack stack, String key, boolean b) { - validateTagExists(stack); - getTag(stack).setBoolean(key, b); - } - - //endregion - - //region Getters - - /** - * Gets a byte from an ItemStacks NBTTag. - * - * @param stack Stack key exists on. - * @param key Key for the value. - * @return Value. - */ - public static byte getByte(ItemStack stack, String key) { - validateTagExists(stack); - return getTag(stack).getByte(key); - } - - /** - * Gets a short from an ItemStacks NBTTag. - * - * @param stack Stack key exists on. - * @param key Key for the value. - * @return Value. - */ - public static short getShort(ItemStack stack, String key) { - validateTagExists(stack); - return getTag(stack).getShort(key); - } - - /** - * Gets a int from an ItemStacks NBTTag. - * - * @param stack Stack key exists on. - * @param key Key for the value. - * @return Value. - */ - public static int getInteger(ItemStack stack, String key) { - validateTagExists(stack); - return getTag(stack).getInteger(key); - } - - /** - * Gets a long from an ItemStacks NBTTag. - * - * @param stack Stack key exists on. - * @param key Key for the value. - * @return Value. - */ - public static long getLong(ItemStack stack, String key) { - validateTagExists(stack); - return getTag(stack).getLong(key); - } - - /** - * Gets a UUID from an ItemStacks NBTTag. - * - * @param stack Stack key exists on. - * @param key Key for the value. - * @return Value. - */ - public static UUID getUUID(ItemStack stack, String key) { - validateTagExists(stack); - return getTag(stack).getUniqueId(key); - } - - /** - * Gets a float from an ItemStacks NBTTag. - * - * @param stack Stack key exists on. - * @param key Key for the value. - * @return Value. - */ - public static float getFloat(ItemStack stack, String key) { - validateTagExists(stack); - return getTag(stack).getFloat(key); - } - - /** - * Gets a double from an ItemStacks NBTTag. - * - * @param stack Stack key exists on. - * @param key Key for the value. - * @return Value. - */ - public static double getDouble(ItemStack stack, String key) { - validateTagExists(stack); - return getTag(stack).getDouble(key); - } - - /** - * Gets a String from an ItemStacks NBTTag. - * - * @param stack Stack key exists on. - * @param key Key for the value. - * @return Value. - */ - public static String getString(ItemStack stack, String key) { - validateTagExists(stack); - return getTag(stack).getString(key); - } - - /** - * Gets a byte array from an ItemStacks NBTTag. - * - * @param stack Stack key exists on. - * @param key Key for the value. - * @return Value. - */ - public static byte[] getByteArray(ItemStack stack, String key) { - validateTagExists(stack); - return getTag(stack).getByteArray(key); - } - - /** - * Gets a int array from an ItemStacks NBTTag. - * - * @param stack Stack key exists on. - * @param key Key for the value. - * @return Value. - */ - public static int[] getIntArray(ItemStack stack, String key) { - validateTagExists(stack); - return getTag(stack).getIntArray(key); - } - - /** - * Gets a boolean from an ItemStacks NBTTag. - * - * @param stack Stack key exists on. - * @param key Key for the value. - * @return Value. - */ - public static boolean getBoolean(ItemStack stack, String key) { - validateTagExists(stack); - return getTag(stack).getBoolean(key); - } - - /** - * Gets a NBTTagCompound from an ItemStacks NBTTag. - * - * @param stack Stack key exists on. - * @param key Key for the value. - * @return Value. - */ - public static NBTTagCompound getCompoundTag(ItemStack stack, String key) { - validateTagExists(stack); - return getTag(stack).getCompoundTag(key); - } - - /** - * Gets a NBTTagList from an ItemStacks NBTTag. - * - * @param stack Stack key exists on. - * @param key Key for the value. - * @param type Primitive NBT Type the List should be made up of. - * @return Value. - */ - public static NBTTagList getTagList(ItemStack stack, String key, int type) { - validateTagExists(stack); - return getTag(stack).getTagList(key, type); - } - - //endregion - -} diff --git a/dependencies/main/java/codechicken/lib/util/ItemUtils.java b/dependencies/main/java/codechicken/lib/util/ItemUtils.java deleted file mode 100644 index fc819ef753..0000000000 --- a/dependencies/main/java/codechicken/lib/util/ItemUtils.java +++ /dev/null @@ -1,188 +0,0 @@ -package codechicken.lib.util; - -import codechicken.lib.inventory.InventoryUtils; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntityFurnace; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.List; - -/** - * Created by covers1624 on 6/30/2016. - * TODO, InventoryUtils needs to have things merged to here and such. - */ -public class ItemUtils { - - public static boolean isPlayerHoldingSomething(EntityPlayer player) { - return player.getHeldItemMainhand() != null || player.getHeldItemOffhand() != null; - } - - public static ItemStack getHeldStack(EntityPlayer player) { - ItemStack stack = player.getHeldItemMainhand(); - if (stack == null) { - stack = player.getHeldItemOffhand(); - } - return stack; - } - - /** - * Drops an item in the world at the given BlockPos - * - * @param world World to drop the item. - * @param pos Location to drop item. - * @param stack ItemStack to drop. - * @param velocity The velocity to add. - */ - public static void dropItem(World world, BlockPos pos, ItemStack stack, double velocity) { - double xVelocity = world.rand.nextFloat() * velocity + (1.0D - velocity) * 0.5D; - double yVelocity = world.rand.nextFloat() * velocity + (1.0D - velocity) * 0.5D; - double zVelocity = world.rand.nextFloat() * velocity + (1.0D - velocity) * 0.5D; - EntityItem entityItem = new EntityItem(world, pos.getX() + xVelocity, pos.getY() + yVelocity, pos.getZ() + zVelocity, stack); - entityItem.setPickupDelay(10); - world.spawnEntity(entityItem); - } - - /** - * Drops an item in the world at the given BlockPos - * - * @param world World to drop the item. - * @param pos Location to drop item. - * @param stack ItemStack to drop. - */ - public static void dropItem(World world, BlockPos pos, ItemStack stack) { - dropItem(world, pos, stack, 0.7D); - } - - /** - * Drops all the items in an IInventory on the ground. - * - * @param world World to drop the item. - * @param pos Position to drop item. - * @param inventory IInventory to drop. - */ - public static void dropInventory(World world, BlockPos pos, IInventory inventory) { - for (int i = 0; i < inventory.getSizeInventory(); i++) { - ItemStack stack = inventory.getStackInSlot(i); - if (stack != null && stack.stackSize > 0) { - dropItem(world, pos, stack); - } - } - } - - /** - * Copy's an ItemStack. - * - * @param stack Stack to copy. - * @param stackSize Size of the new stack. - * @return The new stack. - */ - public static ItemStack copyStack(ItemStack stack, int stackSize) { - return InventoryUtils.copyStack(stack, stackSize); - } - - /** - * Ejects an item with .3 velocity in the given direction. - * - * @param world World to spawn the item. - * @param pos Location for item to spawn. - * @param stack Stack to spawn. - * @param dir Direction to shoot. - */ - public static void ejectItem(World world, BlockPos pos, ItemStack stack, EnumFacing dir) { - pos.offset(dir); - EntityItem entity = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, stack); - entity.motionX = 0.0; - entity.motionY = 0.0; - entity.motionZ = 0.0; - - switch (dir) { - case DOWN: - entity.motionY = -0.3; - break; - case UP: - entity.motionY = 0.3; - break; - case NORTH: - entity.motionZ = -0.3; - break; - case SOUTH: - entity.motionZ = 0.3; - break; - case WEST: - entity.motionX = -0.3; - break; - case EAST: - entity.motionX = 0.3; - break; - default: - } - - entity.setPickupDelay(10); - world.spawnEntity(entity); - } - - /** - * Ejects an list of items with .3 velocity in the given direction. - * - * @param world World to spawn the item. - * @param pos Location for item to spawn. - * @param stacks Stack to spawn. - * @param dir Direction to shoot. - */ - public static void ejectItems(World world, BlockPos pos, List stacks, EnumFacing dir) { - for (ItemStack stack : stacks) { - ejectItem(world, pos, stack, dir); - } - } - - /** - * Gets the burn time for a given ItemStack. - * Will return 0 if there is no burn time on the item. - * - * @param itemStack Stack to get Burn time on. - * @return Burn time for the Stack. - */ - public static int getBurnTime(ItemStack itemStack) { - return TileEntityFurnace.getItemBurnTime(itemStack); - } - - /** - * Compares an ItemStack, Useful for comparators. - * - * @param stack1 First Stack. - * @param stack2 Second Stack. - * @return Returns the difference. - */ - public static int compareItemStack(ItemStack stack1, ItemStack stack2) { - int itemStack1ID = Item.getIdFromItem(stack1.getItem()); - int itemStack2ID = Item.getIdFromItem(stack1.getItem()); - return itemStack1ID != itemStack2ID ? itemStack1ID - itemStack2ID : (stack1.getItemDamage() == stack2.getItemDamage() ? 0 : (stack1.getItem().getHasSubtypes() ? stack1.getItemDamage() - stack2.getItemDamage() : 0)); - } - - /** - * @param stack1 The {@link ItemStack} being compared. - * @param stack2 The {@link ItemStack} to compare to. - * @return whether the two items are the same in terms of damage and itemID. - */ - public static boolean areStacksSameType(ItemStack stack1, ItemStack stack2) { - return stack1 != null && stack2 != null && (stack1.getItem() == stack2.getItem() && (!stack2.getHasSubtypes() || stack2.getItemDamage() == stack1.getItemDamage()) && ItemStack.areItemStackTagsEqual(stack2, stack1)); - } - - /** - * {@link ItemStack}s with damage 32767 are wildcards allowing all damages. Eg all colours of wool are allowed to create Beds. - * - * @param stack1 The {@link ItemStack} being compared. - * @param stack2 The {@link ItemStack} to compare to. - * @return whether the two items are the same from the perspective of a crafting inventory. - */ - public static boolean areStacksSameTypeCrafting(ItemStack stack1, ItemStack stack2) { - return stack1 != null && stack2 != null && stack1.getItem() == stack2.getItem() && (stack1.getItemDamage() == stack2.getItemDamage() || stack1.getItemDamage() == OreDictionary.WILDCARD_VALUE || stack2.getItemDamage() == OreDictionary.WILDCARD_VALUE || stack1.getItem().isDamageable()); - } -} diff --git a/dependencies/main/java/codechicken/lib/util/LangProxy.java b/dependencies/main/java/codechicken/lib/util/LangProxy.java deleted file mode 100644 index d930e05fde..0000000000 --- a/dependencies/main/java/codechicken/lib/util/LangProxy.java +++ /dev/null @@ -1,20 +0,0 @@ -package codechicken.lib.util; - -import net.minecraft.util.text.translation.I18n; - -public class LangProxy { - - public final String namespace; - - public LangProxy(String namespace) { - this.namespace = namespace + "."; - } - - public String translate(String key) { - return I18n.translateToLocal(namespace + key); - } - - public String format(String key, Object... params) { - return I18n.translateToLocalFormatted(namespace + key, params); - } -} diff --git a/dependencies/main/java/codechicken/lib/util/ReflectionManager.java b/dependencies/main/java/codechicken/lib/util/ReflectionManager.java deleted file mode 100644 index 66a3725954..0000000000 --- a/dependencies/main/java/codechicken/lib/util/ReflectionManager.java +++ /dev/null @@ -1,336 +0,0 @@ -package codechicken.lib.util; - -import codechicken.lib.asm.ObfMapping; -import org.objectweb.asm.Type; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.HashMap; - -//TODO Clean cruft and move basically everything to OBFMapping. -public class ReflectionManager { - - public static HashMap, Class> primitiveWrappers = new HashMap, Class>(); - - static { - primitiveWrappers.put(Integer.TYPE, Integer.class); - primitiveWrappers.put(Short.TYPE, Short.class); - primitiveWrappers.put(Byte.TYPE, Byte.class); - primitiveWrappers.put(Long.TYPE, Long.class); - primitiveWrappers.put(Double.TYPE, Double.class); - primitiveWrappers.put(Float.TYPE, Float.class); - primitiveWrappers.put(Boolean.TYPE, Boolean.class); - primitiveWrappers.put(Character.TYPE, Character.class); - } - - public static boolean isInstance(Class class1, Object obj) { - Class primitive = primitiveWrappers.get(class1); - if (primitive != null) { - if (primitive == Long.class && Long.class.isInstance(obj)) { - return true; - } - if ((primitive == Long.class || primitive == Integer.class) && Integer.class.isInstance(obj)) { - return true; - } - if ((primitive == Long.class || primitive == Integer.class || primitive == Short.class) && Short.class.isInstance(obj)) { - return true; - } - if ((primitive == Long.class || primitive == Integer.class || primitive == Short.class || primitive == Byte.class) && Integer.class.isInstance(obj)) { - return true; - } - - if (primitive == Double.class && Double.class.isInstance(obj)) { - return true; - } - if ((primitive == Double.class || primitive == Float.class) && Float.class.isInstance(obj)) { - return true; - } - - return primitive.isInstance(obj); - } - return class1.isInstance(obj); - } - - public static Class findClass(String name) { - return findClass(name, true); - } - - public static boolean classExists(String name) { - return findClass(name, false) != null; - } - - public static Class findClass(ObfMapping mapping) { - return findClass(mapping, true); - } - - public static Class findClass(ObfMapping mapping, boolean init) { - try { - return Class.forName(mapping.javaClass(), init, ReflectionManager.class.getClassLoader()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public static Class findClass(String name, boolean init) { - try { - return Class.forName(name, init, ReflectionManager.class.getClassLoader()); - } catch (ClassNotFoundException cnfe) { - try { - return Class.forName("net.minecraft.src." + name, init, ReflectionManager.class.getClassLoader()); - } catch (ClassNotFoundException cnfe2) { - return null; - } - } - } - - public static void setField(ObfMapping mapping, Object instance, Object value) { - try { - Field field = getField(mapping); - field.setAccessible(true); - field.set(instance, value); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public static void setField(Class class1, Object instance, String name, Object value) throws IllegalArgumentException, IllegalAccessException { - setField(class1, instance, new String[] { name }, value); - } - - public static void setField(Class class1, Object instance, String[] names, Object value) throws IllegalArgumentException, IllegalAccessException { - for (Field field : class1.getDeclaredFields()) { - boolean match = false; - for (String name : names) { - if (field.getName().equals(name)) { - match = true; - break; - } - } - if (!match) { - continue; - } - - field.setAccessible(true); - field.set(instance, value); - return; - } - } - - public static void setField(Class class1, Object instance, int fieldindex, Object value) throws IllegalArgumentException, IllegalAccessException { - Field field = class1.getDeclaredFields()[fieldindex]; - field.setAccessible(true); - field.set(instance, value); - } - - /** - * Static function - * void return type - * single name - */ - @Deprecated - public static void callMethod(Class class1, String name, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { - callMethod(class1, null, new String[] { name }, params); - } - - /** - * Static function - * void return type - * single name - */ - @Deprecated - public static void callMethod(Class class1, String[] names, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { - callMethod(class1, null, names, params); - } - - /** - * void return type - * single name - */ - @Deprecated - public static void callMethod(Class class1, Object instance, String name, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { - callMethod(class1, null, instance, new String[] { name }, params); - } - - /** - * void return type - */ - @Deprecated - public static void callMethod(Class class1, Object instance, String[] names, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { - callMethod(class1, null, instance, names, params); - } - - /** - * Static method - * single name - */ - @Deprecated - public static R callMethod(Class class1, Class returntype, String name, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { - return callMethod(class1, returntype, null, new String[] { name }, params); - } - - /** - * Static method - */ - @Deprecated - public static R callMethod(Class class1, Class returntype, String[] names, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { - return callMethod(class1, returntype, null, names, params); - } - - /** - * sinlge name - */ - @Deprecated - public static R callMethod(Class class1, Class returntype, Object instance, String name, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { - return callMethod(class1, returntype, instance, new String[] { name }, params); - } - - @Deprecated - public static R callMethod(Class class1, Class returntype, Object instance, String[] names, Object... params) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { - nextMethod: - for (Method method : class1.getDeclaredMethods()) { - boolean match = false; - for (String name : names) { - if (method.getName().equals(name)) { - match = true; - break; - } - } - if (!match) { - continue; - } - - Class[] paramtypes = method.getParameterTypes(); - if (paramtypes.length != params.length) { - continue; - } - - for (int i = 0; i < params.length; i++) { - if (!isInstance(paramtypes[i], params[i])) { - continue nextMethod; - } - } - - method.setAccessible(true); - return (R) method.invoke(instance, params); - } - return null; - } - - public static R callMethod(ObfMapping mapping, Class returnType, Object instance, Object... params) { - try { - return callMethod_Unsafe(mapping, returnType, instance, params); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public static R callMethod_Unsafe(ObfMapping mapping, Class returnType, Object instance, Object... params) throws InvocationTargetException, IllegalAccessException { - mapping.toRuntime(); - Class clazz = findClass(mapping); - Method method = null; - for (Method m : clazz.getDeclaredMethods()) { - if (m.getName().equals(mapping.s_name) && Type.getMethodDescriptor(m).equals(mapping.s_desc)) { - method = m; - break; - } - } - if (method != null) { - method.setAccessible(true); - return (R) method.invoke(instance, params); - } - return null; - } - - public static T getField(Class class1, Class fieldType, Object instance, int fieldIndex) throws IllegalArgumentException, IllegalAccessException { - Field field = class1.getDeclaredFields()[fieldIndex]; - field.setAccessible(true); - return (T) field.get(instance); - } - - public static T getField(Class class1, Class fieldType, Object instance, String fieldName) { - try { - Field field = class1.getDeclaredField(fieldName); - field.setAccessible(true); - return (T) field.get(instance); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public static T newInstance(Class class1, Object... params) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { - nextMethod: - for (Constructor constructor : class1.getDeclaredConstructors()) { - Class[] paramtypes = constructor.getParameterTypes(); - if (paramtypes.length != params.length) { - continue; - } - - for (int i = 0; i < params.length; i++) { - if (!isInstance(paramtypes[i], params[i])) { - continue nextMethod; - } - } - - constructor.setAccessible(true); - return (T) constructor.newInstance(params); - } - return null; - } - - public static boolean hasField(Class class1, String fieldName) { - try { - class1.getDeclaredField(fieldName); - return true; - } catch (NoSuchFieldException nfe) { - return false; - } - } - - public static T get(Field field, Class class1) { - return get(field, class1, null); - } - - public static T get(Field field, Class class1, Object instance) { - try { - return (T) field.get(instance); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public static void set(Field field, Object value) { - set(field, null, value); - } - - public static void set(Field field, Object instance, Object value) { - try { - field.set(instance, value); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public static V getField(ObfMapping mapping, Object instance, Class clazz) { - try { - Field field = getField(mapping); - return (V) field.get(instance); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public static Field getField(ObfMapping mapping) { - mapping.toRuntime(); - - try { - Class clazz = ReflectionManager.class.getClassLoader().loadClass(mapping.javaClass()); - Field field = clazz.getDeclaredField(mapping.s_name); - field.setAccessible(true); - return field; - } catch (Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/dependencies/main/java/codechicken/lib/util/RotationUtils.java b/dependencies/main/java/codechicken/lib/util/RotationUtils.java deleted file mode 100644 index e9836c240f..0000000000 --- a/dependencies/main/java/codechicken/lib/util/RotationUtils.java +++ /dev/null @@ -1,177 +0,0 @@ -package codechicken.lib.util; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; - -/** - * Contains a bunch of stuff to do with rotation. - * Created by covers1624 on 6/30/2016. - */ -public class RotationUtils { - - /** - * Gets the rotation for placing a block only on the horizon. - * - * @param entity Entity placing block. - * @return Direction placed. - */ - public static EnumFacing getPlacedRotationHorizontal(EntityLivingBase entity) { - int facing = MathHelper.floor_double((entity.rotationYaw * 4F) / 360F + 0.5D) & 3; - return entityRotationToSide(facing).getOpposite(); - } - - /** - * Gets rotation for placing a block, Will use Up and Down. - * - * @param pos Pos placement is happening. - * @param entity Entity placing block. - * @return Direction placed. - */ - public static EnumFacing getPlacedRotation(BlockPos pos, EntityLivingBase entity) { - int entityRotation = (int) Math.floor(entity.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - if (Math.abs(entity.posX - pos.getX()) < 2.0D && Math.abs(entity.posZ - pos.getZ()) < 2.0D) { - - double eyeDistance = entity.posY + 1.82D - pos.getY(); - - if (eyeDistance > 2.0D) { - return EnumFacing.DOWN; - } - - if (eyeDistance < 0.0D) { - return EnumFacing.UP; - } - } - - return entityRotationToSide(entityRotation); - } - - /** - * Short hand for getPlacedRotationHorizontal and getPlacedRotation. - * - * @param pos Pos placement is happening. - * @param entity Entity placing block. - * @param onlyHorizon True if should only obey the horizon. - * @return Direction placed. - */ - public static EnumFacing getPlacedRotation(BlockPos pos, EntityLivingBase entity, boolean onlyHorizon) { - if (onlyHorizon) { - return getPlacedRotationHorizontal(entity); - } - return getPlacedRotation(pos, entity); - } - - /** - * Rotate this Facing around the Y axis counter-clockwise (NORTH => WEST => SOUTH => EAST => NORTH) - * - * @param facing Current facing. - * @return Next facing. - */ - public static EnumFacing rotateCounterClockwise(EnumFacing facing) { - switch (facing) { - case NORTH: - return EnumFacing.WEST; - case EAST: - return EnumFacing.NORTH; - case SOUTH: - return EnumFacing.EAST; - case WEST: - return EnumFacing.SOUTH; - default: - throw new IllegalStateException("Unable to get CCW facing of " + facing); - } - } - - /** - * Rotate this Facing around the Y axis counter-clockwise (NORTH => EAST => SOUTH => WEST => NORTH) - * - * @param facing Current facing. - * @return Next facing. - */ - public static EnumFacing rotateClockwise(EnumFacing facing) { - switch (facing) { - case NORTH: - return EnumFacing.EAST; - case EAST: - return EnumFacing.SOUTH; - case SOUTH: - return EnumFacing.WEST; - case WEST: - return EnumFacing.NORTH; - default: - throw new IllegalStateException("Unable to get CW facing of " + facing); - } - } - - /** - * Rotate this Facing around all axises counter-clockwise (NORTH => SOUTH => EAST => WEST => UP => DOWN => NORTH) - * - * @param facing Current facing. - * @return Next facing. - */ - public static EnumFacing rotateForward(EnumFacing facing) { - switch (facing) { - case NORTH: - return EnumFacing.DOWN; - case DOWN: - return EnumFacing.UP; - case UP: - return EnumFacing.WEST; - case WEST: - return EnumFacing.EAST; - case EAST: - return EnumFacing.SOUTH; - case SOUTH: - return EnumFacing.NORTH; - } - return EnumFacing.NORTH; - } - - /** - * Rotate this Facing around all axises counter-clockwise (NORTH => DOWN => UP => WEST => EAST => SOUTH => NORTH) - * - * @param facing Current facing. - * @return Next facing. - */ - public static EnumFacing rotateBackwards(EnumFacing facing) { - switch (facing) { - case NORTH: - return EnumFacing.SOUTH; - case SOUTH: - return EnumFacing.EAST; - case EAST: - return EnumFacing.WEST; - case WEST: - return EnumFacing.UP; - case UP: - return EnumFacing.DOWN; - case DOWN: - return EnumFacing.NORTH; - } - return EnumFacing.NORTH; - } - - /** - * Turns Entity rotation in to EnumFacing. - * - * @param rotation The entity rotation, Generally MathHelper.floor_double((entity.rotationYaw * 4F) / 360F + 0.5D) & 3; - * @return The rotation in EnumFacing. - */ - public static EnumFacing entityRotationToSide(int rotation) { - switch (rotation) { - case 0: - return EnumFacing.SOUTH; - - case 1: - return EnumFacing.WEST; - - case 2: - return EnumFacing.NORTH; - - default: - return EnumFacing.EAST; - } - } - -} diff --git a/dependencies/main/java/codechicken/lib/util/ServerUtils.java b/dependencies/main/java/codechicken/lib/util/ServerUtils.java deleted file mode 100644 index 4b5a2fcf97..0000000000 --- a/dependencies/main/java/codechicken/lib/util/ServerUtils.java +++ /dev/null @@ -1,90 +0,0 @@ -package codechicken.lib.util; - -import codechicken.lib.gui.IGuiPacketSender; -import com.mojang.authlib.GameProfile; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.inventory.Container; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.management.PlayerProfileCache.ProfileEntry; -import net.minecraft.util.math.ChunkPos; -import net.minecraft.util.text.ITextComponent; -import net.minecraftforge.fml.common.FMLCommonHandler; - -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - -/** - * Created by covers1624 on 22/10/2016. - */ -public class ServerUtils { - - public static MinecraftServer mc() { - return FMLCommonHandler.instance().getMinecraftServerInstance(); - } - - public static EntityPlayerMP getPlayer(String playername) { - return mc().getPlayerList().getPlayerByUsername(playername); - } - - public static List getPlayers() { - return mc().getPlayerList().getPlayerList(); - } - - public static ArrayList getPlayersInDimension(int dimension) { - ArrayList players = new ArrayList(); - for (EntityPlayer p : getPlayers()) { - if (p.dimension == dimension) { - players.add(p); - } - } - - return players; - } - - public static boolean isPlayerLoadingChunk(EntityPlayerMP player, ChunkPos chunk) { - return player.getServerWorld().getPlayerChunkMap().contains(chunk.chunkXPos, chunk.chunkZPos); - } - - public static GameProfile getGameProfile(String username) { - EntityPlayer player = getPlayer(username); - if (player != null) { - return player.getGameProfile(); - } - - //try and access it in the cache without forcing a save - username = username.toLowerCase(Locale.ROOT); - ProfileEntry cachedEntry = mc().getPlayerProfileCache().usernameToProfileEntryMap.get(username); - if (cachedEntry != null) { - return cachedEntry.getGameProfile(); - } - - //load it from the cache - return mc().getPlayerProfileCache().getGameProfileForUsername(username); - } - - public static boolean isPlayerOP(String username) { - GameProfile prof = getGameProfile(username); - return prof != null && mc().getPlayerList().canSendCommands(prof); - } - - public static boolean isPlayerOwner(String username) { - return mc().isSinglePlayer() && mc().getServerOwner().equalsIgnoreCase(username); - } - - public static void sendChatToAll(ITextComponent msg) { - for (EntityPlayer p : getPlayers()) { - p.addChatComponentMessage(msg); - } - } - - public static void openSMPContainer(EntityPlayerMP player, Container container, IGuiPacketSender packetSender) { - player.getNextWindowId(); - player.closeContainer(); - packetSender.sendPacket(player, player.currentWindowId); - player.openContainer = container; - player.openContainer.windowId = player.currentWindowId; - player.openContainer.addListener(player); - } -} diff --git a/dependencies/main/java/codechicken/lib/util/SoundUtils.java b/dependencies/main/java/codechicken/lib/util/SoundUtils.java deleted file mode 100644 index a4b385a099..0000000000 --- a/dependencies/main/java/codechicken/lib/util/SoundUtils.java +++ /dev/null @@ -1,42 +0,0 @@ -package codechicken.lib.util; - -import codechicken.lib.vec.Vector3; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.SoundCategory; -import net.minecraft.util.SoundEvent; -import net.minecraft.world.World; - -/** - * Created by covers1624 on 17/10/2016. - */ -public class SoundUtils { - - public static void playSoundAt(Entity entity, SoundCategory category, SoundEvent sound, float volume, float pitch, boolean distanceDelay) { - entity.worldObj.playSound(entity.posX, entity.posY, entity.posZ, sound, category, volume, pitch, distanceDelay); - } - - public static void playSoundAt(Entity entity, SoundCategory category, SoundEvent sound, float volume, float pitch) { - EntityPlayer player = null; - - //only assigning player on client as if triggered on server the player passed here would be omitted from hearing the sound - if (entity.worldObj.isRemote && entity instanceof EntityPlayer) { - player = (EntityPlayer) entity; - } - - entity.worldObj.playSound(player, entity.posX, entity.posY, entity.posZ, sound, category, volume, pitch); - } - - public static void playSoundAt(Entity entity, SoundCategory category, SoundEvent sound) { - playSoundAt(entity, category, sound, 1.0F, 1.0F); - } - - public static void playSoundAt(Vector3 pos, World world, SoundCategory category, SoundEvent sound, float volume, float pitch, boolean distanceDelay) { - world.playSound(pos.x, pos.y, pos.z, sound, category, volume, pitch, distanceDelay); - } - - public static void playSoundAt(Vector3 pos, World world, SoundCategory category, SoundEvent sound, float volume, float pitch) { - world.playSound(pos.x, pos.y, pos.z, sound, category, volume, pitch, false); - } - -} diff --git a/dependencies/main/java/codechicken/lib/util/TileEntityUtils.java b/dependencies/main/java/codechicken/lib/util/TileEntityUtils.java deleted file mode 100644 index d729ef2be2..0000000000 --- a/dependencies/main/java/codechicken/lib/util/TileEntityUtils.java +++ /dev/null @@ -1,62 +0,0 @@ -package codechicken.lib.util; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryLargeChest; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.items.CapabilityItemHandler; -import net.minecraftforge.items.IItemHandler; - -/** - * Created by covers1624 on 6/30/2016. - */ -public class TileEntityUtils { - - /** - * Retrieves an IInventory at the given location, Useful for receiving the entire inventory of a double chest. - */ - public static IInventory getInventory(World world, BlockPos pos) { - TileEntity tileEntity = world.getTileEntity(pos); - if (tileEntity instanceof IInventory) { - IInventory inventory = (IInventory) tileEntity; - if (inventory instanceof TileEntityChest) { - TileEntityChest first = (TileEntityChest) tileEntity; - TileEntityChest second = null; - for (BlockPos adjacentPos : BlockUtils.getAdjacent(pos, false)) { - TileEntity suspect = world.getTileEntity(adjacentPos); - if (suspect instanceof TileEntityChest) { - second = (TileEntityChest) suspect; - break; - } - } - if (second != null) { - return new InventoryLargeChest("large chest", first, second); - } - } - return inventory; - } - return null; - } - - /** - * Gets an IItemHandler at the given position. If the capability doesn't exist it returns null. - * - * @param world World the tile is in. - * @param pos Position the tile is at. - * @param facing The face of the tile to get the capability for. - * @return The IItemHandler existing on the tile. - */ - public static IItemHandler getIItemHandler(World world, BlockPos pos, EnumFacing facing) { - TileEntity tileEntity = world.getTileEntity(pos); - if (tileEntity != null) { - if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing)) { - return tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing); - } - } - return null; - } - -} diff --git a/dependencies/main/java/codechicken/lib/util/TransformUtils.java b/dependencies/main/java/codechicken/lib/util/TransformUtils.java deleted file mode 100644 index 8b729ea762..0000000000 --- a/dependencies/main/java/codechicken/lib/util/TransformUtils.java +++ /dev/null @@ -1,229 +0,0 @@ -package codechicken.lib.util; - -import codechicken.lib.render.CCModelState; -import codechicken.lib.vec.Matrix4; -import com.google.common.base.Optional; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; -import com.google.gson.*; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.block.model.ModelRotation; -import net.minecraft.util.JsonUtils; -import net.minecraftforge.client.model.ForgeBlockStateV1.TRSRDeserializer; -import net.minecraftforge.common.model.IModelState; -import net.minecraftforge.common.model.TRSRTransformation; - -import javax.vecmath.Vector3f; -import java.util.EnumMap; - -/** - * Created by covers1624 on 5/16/2016. - * This is mostly just extracted from the ForgeBlockStateV1. - * Credits to Rain Warrior. - *

- * If you have an idea for another transform just make a pull request. - */ -public class TransformUtils { - - private static final TRSRTransformation flipX = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null); - - public static final Gson GSON = new GsonBuilder().registerTypeAdapter(TRSRTransformation.class, TRSRDeserializer.INSTANCE).create(); - - public static final CCModelState DEFAULT_BLOCK; - public static final CCModelState DEFAULT_ITEM; - public static final CCModelState DEFAULT_TOOL; - public static final CCModelState DEFAULT_BOW; - public static final CCModelState DEFAULT_HANDHELD_ROD; - - static { - TRSRTransformation thirdPerson = get(0, 2.5f, 0, 75, 45, 0, 0.375f); - TRSRTransformation firstPerson; - - ImmutableMap.Builder defaultBlockBuilder = ImmutableMap.builder(); - defaultBlockBuilder.put(TransformType.GUI, get(0, 0, 0, 30, 225, 0, 0.625f)); - defaultBlockBuilder.put(TransformType.GROUND, get(0, 3, 0, 0, 0, 0, 0.25f)); - defaultBlockBuilder.put(TransformType.FIXED, get(0, 0, 0, 0, 0, 0, 0.5f)); - defaultBlockBuilder.put(TransformType.THIRD_PERSON_RIGHT_HAND, thirdPerson); - defaultBlockBuilder.put(TransformType.THIRD_PERSON_LEFT_HAND, leftify(thirdPerson)); - defaultBlockBuilder.put(TransformType.FIRST_PERSON_RIGHT_HAND, get(0, 0, 0, 0, 45, 0, 0.4f)); - defaultBlockBuilder.put(TransformType.FIRST_PERSON_LEFT_HAND, get(0, 0, 0, 0, 225, 0, 0.4f)); - DEFAULT_BLOCK = new CCModelState(defaultBlockBuilder.build()); - - thirdPerson = get(0, 3, 1, 0, 0, 0, 0.55f); - firstPerson = get(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f); - ImmutableMap.Builder defaultItemBuilder = ImmutableMap.builder(); - defaultItemBuilder.put(TransformType.GROUND, get(0, 2, 0, 0, 0, 0, 0.5f)); - defaultItemBuilder.put(TransformType.HEAD, get(0, 13, 7, 0, 180, 0, 1)); - defaultItemBuilder.put(TransformType.THIRD_PERSON_RIGHT_HAND, thirdPerson); - defaultItemBuilder.put(TransformType.THIRD_PERSON_LEFT_HAND, leftify(thirdPerson)); - defaultItemBuilder.put(TransformType.FIRST_PERSON_RIGHT_HAND, firstPerson); - defaultItemBuilder.put(TransformType.FIRST_PERSON_LEFT_HAND, leftify(firstPerson)); - DEFAULT_ITEM = new CCModelState(defaultItemBuilder.build()); - - ImmutableMap.Builder defaultToolBuilder = ImmutableMap.builder(); - defaultToolBuilder.put(TransformType.GROUND, get(0, 2, 0, 0, 0, 0, 0.5f)); - defaultToolBuilder.put(TransformType.THIRD_PERSON_RIGHT_HAND, get(0, 4, 0.5F, 0, -90, 55, 0.85F)); - defaultToolBuilder.put(TransformType.THIRD_PERSON_LEFT_HAND, get(0, 4, 0.5f, 0, 90, -55, 0.85f)); - defaultToolBuilder.put(TransformType.FIRST_PERSON_RIGHT_HAND, get(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f)); - defaultToolBuilder.put(TransformType.FIRST_PERSON_LEFT_HAND, get(1.13f, 3.2f, 1.13f, 0, 90, -25, 0.68f)); - DEFAULT_TOOL = new CCModelState(defaultToolBuilder.build()); - - ImmutableMap.Builder defaultBowBuilder = ImmutableMap.builder(); - defaultBowBuilder.put(TransformType.GROUND, get(0, 2, 0, 0, 0, 0, 0.5f)); - defaultBowBuilder.put(TransformType.THIRD_PERSON_RIGHT_HAND, get(-1F, -2F, 2.5F, -80, 260, -40, 0.9F)); - defaultBowBuilder.put(TransformType.THIRD_PERSON_LEFT_HAND, get(-1F, -2F, 2.5F, -80, -280, 40, 0.9f)); - defaultBowBuilder.put(TransformType.FIRST_PERSON_RIGHT_HAND, get(1.13F, 3.2F, 1.13F, 0, -90, 25, 0.68f)); - defaultBowBuilder.put(TransformType.FIRST_PERSON_LEFT_HAND, get(1.13f, 3.2f, 1.13f, 0, 90, -25, 0.68f)); - DEFAULT_BOW = new CCModelState(defaultBowBuilder.build()); - - ImmutableMap.Builder defaultRodBuilder = ImmutableMap.builder(); - defaultRodBuilder.put(TransformType.GROUND, get(0, 2, 0, 0, 0, 0, 0.5f)); - defaultRodBuilder.put(TransformType.THIRD_PERSON_RIGHT_HAND, get(0F, 4F, 2.5F, 0, 90, 55, 0.85F)); - defaultRodBuilder.put(TransformType.THIRD_PERSON_LEFT_HAND, get(0F, 4F, 2.5F, 0, -90, -55, 0.85f)); - defaultRodBuilder.put(TransformType.FIRST_PERSON_RIGHT_HAND, get(0F, 1.6F, 0.8F, 0, 90, 25, 0.68f)); - defaultRodBuilder.put(TransformType.FIRST_PERSON_LEFT_HAND, get(0F, 1.6F, 0.8F, 0, -90, -25, 0.68f)); - DEFAULT_HANDHELD_ROD = new CCModelState(defaultRodBuilder.build()); - } - - public static TRSRTransformation get(float tx, float ty, float tz, float rx, float ry, float rz, float s) { - return TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(tx / 16, ty / 16, tz / 16), TRSRTransformation.quatFromXYZDegrees(new Vector3f(rx, ry, rz)), new Vector3f(s, s, s), null)); - } - - public static TRSRTransformation leftify(TRSRTransformation transform) { - return TRSRTransformation.blockCenterToCorner(flipX.compose(TRSRTransformation.blockCornerToCenter(transform)).compose(flipX)); - } - - /** - * Reimplementation from ForgeBlockStateV1's variant Deserializer. - * - * @param json The Json that contains either ModelRotation x,y,TRSRTransforms or CCL defaults. - * @return A IModelState. - */ - public static Optional parseFromJson(JsonObject json) { - Optional ret = Optional.absent(); - if (json.has("x") || json.has("y")) { - int x = JsonUtils.getInt(json, "x", 0); - int y = JsonUtils.getInt(json, "y", 0); - ModelRotation rot = ModelRotation.getModelRotation(x, y); - ret = Optional.of(new TRSRTransformation(rot)); - if (!ret.isPresent()) { - throw new JsonParseException("Invalid BlockModelRotation x: " + x + " y: " + y); - } - } - if (json.has("transform")) { - JsonElement transformElement = json.get("transform"); - if (transformElement.isJsonPrimitive() && transformElement.getAsJsonPrimitive().isString()) { - String transform = transformElement.getAsString(); - if (transform.equals("identity")) { - ret = Optional.of(TRSRTransformation.identity()); - } else if (transform.equals("ccl:default-block")) { - ret = Optional.of(DEFAULT_BLOCK); - } else if (transform.equals("ccl:default-item")) { - ret = Optional.of(DEFAULT_ITEM); - } else if (transform.equals("ccl:default-tool")) { - ret = Optional.of(DEFAULT_TOOL); - } else if (transform.equals("ccl:default-bow")) { - ret = Optional.of(DEFAULT_BOW); - } else if (transform.equals("ccl:default-handheld-rod")) { - ret = Optional.of(DEFAULT_HANDHELD_ROD); - } - } else if (!transformElement.isJsonObject()) { - try { - TRSRTransformation base = GSON.fromJson(transformElement, TRSRTransformation.class); - ret = Optional.of(TRSRTransformation.blockCenterToCorner(base)); - } catch (JsonParseException e) { - throw new JsonParseException("transform: expected a string, object or valid base transformation, got: " + transformElement); - } - } else { - JsonObject transform = transformElement.getAsJsonObject(); - EnumMap transforms = Maps.newEnumMap(TransformType.class); - if (transform.has("thirdperson")) { - TRSRTransformation t = GSON.fromJson(transform.get("thirdperson"), TRSRTransformation.class); - transform.remove("thirdperson"); - transforms.put(TransformType.THIRD_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); - } - if (transform.has("thirdperson_righthand")) { - TRSRTransformation t = GSON.fromJson(transform.get("thirdperson_righthand"), TRSRTransformation.class); - transform.remove("thirdperson_righthand"); - transforms.put(TransformType.THIRD_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); - } - if (transform.has("thirdperson_lefthand")) { - TRSRTransformation t = GSON.fromJson(transform.get("thirdperson_lefthand"), TRSRTransformation.class); - transform.remove("thirdperson_lefthand"); - transforms.put(TransformType.THIRD_PERSON_LEFT_HAND, TRSRTransformation.blockCenterToCorner(t)); - } - if (transform.has("firstperson")) { - TRSRTransformation t = GSON.fromJson(transform.get("firstperson"), TRSRTransformation.class); - transform.remove("firstperson"); - transforms.put(TransformType.FIRST_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); - } - if (transform.has("firstperson_righthand")) { - TRSRTransformation t = GSON.fromJson(transform.get("firstperson_righthand"), TRSRTransformation.class); - transform.remove("firstperson_righthand"); - transforms.put(TransformType.FIRST_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); - } - if (transform.has("firstperson_lefthand")) { - TRSRTransformation t = GSON.fromJson(transform.get("firstperson_lefthand"), TRSRTransformation.class); - transform.remove("firstperson_lefthand"); - transforms.put(TransformType.FIRST_PERSON_LEFT_HAND, TRSRTransformation.blockCenterToCorner(t)); - } - if (transform.has("head")) { - TRSRTransformation t = GSON.fromJson(transform.get("head"), TRSRTransformation.class); - transform.remove("head"); - transforms.put(TransformType.HEAD, TRSRTransformation.blockCenterToCorner(t)); - } - if (transform.has("gui")) { - TRSRTransformation t = GSON.fromJson(transform.get("gui"), TRSRTransformation.class); - transform.remove("gui"); - transforms.put(TransformType.GUI, TRSRTransformation.blockCenterToCorner(t)); - } - if (transform.has("ground")) { - TRSRTransformation t = GSON.fromJson(transform.get("ground"), TRSRTransformation.class); - transform.remove("ground"); - transforms.put(TransformType.GROUND, TRSRTransformation.blockCenterToCorner(t)); - } - if (transform.has("fixed")) { - TRSRTransformation t = GSON.fromJson(transform.get("fixed"), TRSRTransformation.class); - transform.remove("fixed"); - transforms.put(TransformType.FIXED, TRSRTransformation.blockCenterToCorner(t)); - } - int k = transform.entrySet().size(); - if (transform.has("matrix")) { - k--; - } - if (transform.has("translation")) { - k--; - } - if (transform.has("rotation")) { - k--; - } - if (transform.has("scale")) { - k--; - } - if (transform.has("post-rotation")) { - k--; - } - if (k > 0) { - throw new JsonParseException("transform: allowed keys: 'thirdperson', 'firstperson', 'gui', 'head', 'matrix', 'translation', 'rotation', 'scale', 'post-rotation'"); - } - TRSRTransformation base = TRSRTransformation.identity(); - if (!transform.entrySet().isEmpty()) { - base = GSON.fromJson(transform, TRSRTransformation.class); - base = TRSRTransformation.blockCenterToCorner(base); - } - IModelState state; - if (transforms.isEmpty()) { - state = base; - } else { - state = new CCModelState(Maps.immutableEnumMap(transforms), Optional.of(base)); - } - ret = Optional.of(state); - } - } - return ret; - } - - public static TRSRTransformation fromMatrix4(Matrix4 matrix4) { - return new TRSRTransformation(matrix4.toMatrix4f()); - } -} diff --git a/dependencies/main/java/codechicken/lib/util/TripleABC.java b/dependencies/main/java/codechicken/lib/util/TripleABC.java deleted file mode 100644 index 4f07f45fb5..0000000000 --- a/dependencies/main/java/codechicken/lib/util/TripleABC.java +++ /dev/null @@ -1,30 +0,0 @@ -package codechicken.lib.util; - -/** - * Created by covers1624 on 8/29/2016. - * TODO Copyable. - */ -public class TripleABC { - - private final A a; - private final B b; - private final C c; - - public TripleABC(A a, B b, C c) { - this.a = a; - this.b = b; - this.c = c; - } - - public A getA() { - return a; - } - - public B getB() { - return b; - } - - public C getC() { - return c; - } -} diff --git a/dependencies/main/java/codechicken/lib/util/VectorUtils.java b/dependencies/main/java/codechicken/lib/util/VectorUtils.java deleted file mode 100644 index 787c0f47cf..0000000000 --- a/dependencies/main/java/codechicken/lib/util/VectorUtils.java +++ /dev/null @@ -1,78 +0,0 @@ -package codechicken.lib.util; - -import codechicken.lib.vec.Vector3; -import net.minecraft.util.EnumFacing; - -/** - * Created by covers1624 on 4/10/2016. - */ -public class VectorUtils { - - /** - * Calculates a normal for the given vertices. - * - * @param vertices The vertices to calculate a normal for, Expected to be a length of 3. - * @return The normal. - */ - public static Vector3 calculateNormal(Vector3... vertices) { - Vector3 diff1 = vertices[1].copy().subtract(vertices[0]); - Vector3 diff2 = vertices[2].copy().subtract(vertices[0]); - return diff1.crossProduct(diff2).normalize().copy(); - } - - /** - * Calculates the int direction a normal is facing. - * - * @param normal The normal to calculate from. - * @return The direction the normal is facing. - */ - public static int findSide(Vector3 normal) { - if (normal.y <= -0.99) { - return 0; - } - if (normal.y >= 0.99) { - return 1; - } - if (normal.z <= -0.99) { - return 2; - } - if (normal.z >= 0.99) { - return 3; - } - if (normal.x <= -0.99) { - return 4; - } - if (normal.x >= 0.99) { - return 5; - } - return -1; - } - - /** - * Calculates the EnumFacing for a given normal. - * - * @param normal The normal to calculate from. - * @return The direction the normal is facing. - */ - public static EnumFacing calcNormalSide(Vector3 normal) { - if (normal.y <= -0.99) { - return EnumFacing.DOWN; - } - if (normal.y >= 0.99) { - return EnumFacing.UP; - } - if (normal.z <= -0.99) { - return EnumFacing.NORTH; - } - if (normal.z >= 0.99) { - return EnumFacing.SOUTH; - } - if (normal.x <= -0.99) { - return EnumFacing.WEST; - } - if (normal.x >= 0.99) { - return EnumFacing.EAST; - } - return null; - } -} diff --git a/dependencies/main/java/codechicken/lib/util/VertexDataUtils.java b/dependencies/main/java/codechicken/lib/util/VertexDataUtils.java deleted file mode 100644 index d37e43c106..0000000000 --- a/dependencies/main/java/codechicken/lib/util/VertexDataUtils.java +++ /dev/null @@ -1,145 +0,0 @@ -package codechicken.lib.util; - -import codechicken.lib.math.MathHelper; -import codechicken.lib.vec.uv.UV; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.renderer.vertex.VertexFormatElement; -import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.client.model.pipeline.LightUtil; -import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by covers1624 on 4/10/2016. - * Utilities for anything to do with raw vertex data access. - */ -public class VertexDataUtils { - - /** - * Gets the position for the element 'position' in the elements list for use in LightUtil.pack/unpack for a given format. - * - * @param format The format. - * @return The element position, -1 if it does not exist. - */ - public static int getPositionElement(VertexFormat format) { - for (int e = 0; e < format.getElementCount(); e++) { - if (format.getElement(e).isPositionElement()) { - return e; - } - } - return -1; - } - - /** - * Gets the position for the element 'normal' in the elements list for use in LightUtil.pack/unpack for a given format. - * - * @param format The format. - * @return The element position, -1 if it does not exist. - */ - public static int getNormalElement(VertexFormat format) { - for (int e = 0; e < format.getElementCount(); e++) { - if (format.getElement(e).getUsage() == EnumUsage.NORMAL) { - return e; - } - } - return -1; - } - - /** - * Gets the position for the element 'uv' in the elements list for use in LightUtil.pack/unpack for a given format. - * - * @param format The format. - * @return The element position, -1 if it does not exist. - */ - public static int getUVElement(VertexFormat format) { - for (int e = 0; e < format.getElementCount(); e++) { - if (format.getElement(e).getUsage() == EnumUsage.UV && format.getElement(e).getIndex() == 0) { - return e; - } - } - return -1; - } - - /** - * Gets the position for the element provided in the elements list for use in LightUtil.pack/unpack for a given format. - * - * @param format The format. - * @param element THe element to get. - * @return The element position, -1 if it does not exist. - */ - public static int getElement(VertexFormat format, VertexFormatElement element) { - for (int e = 0; e < format.getElementCount(); e++) { - if (format.getElement(e).equals(element)) { - return e; - } - } - return -1; - } - - /** - * Attempts to get the TextureAtlasSprite for a given UV mapping. - * This is not threaded and will search EVERY sprite loaded in the texture map. - * This is meant to be a last resort, where possible always try to avoid using this or have this be fired. - * TODO Improve searching by caching value ranges somehow. - * - * @param textureMap The TextureMap to search. - * @param uv The UV mapping to find. - * @return The TextureAtlasSprite found, returns missing icon if it hasn't been found. - */ - public static TextureAtlasSprite getSpriteForUV(TextureMap textureMap, UV uv) { - for (TextureAtlasSprite sprite : textureMap.mapUploadedSprites.values()) { - if (MathHelper.between(sprite.getMinU(), uv.u, sprite.getMaxU()) && MathHelper.between(sprite.getMinV(), uv.v, sprite.getMaxV())) { - return sprite; - } - } - return textureMap.getMissingSprite(); - } - - /** - * Copies the data from a UnpackedBakedQuad to a normal baked quad to save space in ram. - * - * @param quad The UnpackedBakedQuad to copy from. - * @return The copied BakedQuad. - */ - public static BakedQuad copyQuad(UnpackedBakedQuad quad) { - return new BakedQuad(quad.getVertexData(), quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad.getFormat()); - } - - public static Map> sortFaceData(List quads) { - Map> faceQuadMap = new HashMap>(); - for (BakedQuad quad : quads) { - List faceQuads = faceQuadMap.get(quad.getFace()); - if (faceQuads == null) { - faceQuads = new ArrayList(); - faceQuadMap.put(quad.getFace(), faceQuads); - } - faceQuads.add(quad); - } - return faceQuadMap; - } - - public static void fullyPackQuads(int[] packedData, float[][][] unpackedData, VertexFormat format) { - for (int e = 0; e < format.getElementCount(); e++) { - for (int v = 0; v < 4; v++) { - LightUtil.pack(unpackedData[v][e], packedData, format, v, e); - } - } - } - - public static void fullyUnPackQuads(int[] packedData, float[][][] unpackedData, VertexFormat format) { - for (int e = 0; e < format.getElementCount(); e++) { - for (int v = 0; v < 4; v++) { - LightUtil.unpack(packedData, unpackedData[v][e], format, v, e); - } - } - } - -} diff --git a/dependencies/main/java/codechicken/lib/vec/AxisCycle.java b/dependencies/main/java/codechicken/lib/vec/AxisCycle.java deleted file mode 100644 index 66636a57d3..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/AxisCycle.java +++ /dev/null @@ -1,36 +0,0 @@ -package codechicken.lib.vec; - -public class AxisCycle { - - public static Transformation[] cycles = new Transformation[] { new RedundantTransformation(), new VariableTransformation(new Matrix4(0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1)) { - @Override - public void apply(Vector3 vec) { - double d0 = vec.x; - double d1 = vec.y; - double d2 = vec.z; - vec.x = d2; - vec.y = d0; - vec.z = d1; - } - - @Override - public Transformation inverse() { - return cycles[2]; - } - }, new VariableTransformation(new Matrix4(0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1)) { - @Override - public void apply(Vector3 vec) { - double d0 = vec.x; - double d1 = vec.y; - double d2 = vec.z; - vec.x = d1; - vec.y = d2; - vec.z = d0; - } - - @Override - public Transformation inverse() { - return cycles[1]; - } - } }; -} diff --git a/dependencies/main/java/codechicken/lib/vec/BlockCoord.java b/dependencies/main/java/codechicken/lib/vec/BlockCoord.java deleted file mode 100644 index f822696ec2..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/BlockCoord.java +++ /dev/null @@ -1,261 +0,0 @@ -package codechicken.lib.vec; - -import codechicken.lib.math.MathHelper; -import codechicken.lib.util.Copyable; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; - -//TODO Find viability of keeping this, BlockPos is a thing now.. -//TODO, Maybe we should keep this and extend BlockPos.. -@Deprecated -public class BlockCoord implements Comparable, Copyable { - - public static final BlockCoord[] sideOffsets = new BlockCoord[] { new BlockCoord(0, -1, 0), new BlockCoord(0, 1, 0), new BlockCoord(0, 0, -1), new BlockCoord(0, 0, 1), new BlockCoord(-1, 0, 0), new BlockCoord(1, 0, 0) }; - - public int x; - public int y; - public int z; - - private BlockPos posCache; - - public BlockCoord(int x, int y, int z) { - this.x = x; - this.y = y; - this.z = z; - } - - public BlockCoord(BlockPos pos) { - this(pos.getX(), pos.getY(), pos.getZ()); - } - - public BlockCoord(Vector3 v) { - this(MathHelper.floor(v.x), MathHelper.floor(v.y), MathHelper.floor(v.z)); - } - - public BlockCoord(TileEntity tile) { - this(tile.getPos()); - } - - public BlockCoord(int[] ia) { - this(ia[0], ia[1], ia[2]); - } - - public BlockCoord() { - } - - /** - * @param ia int[]{y, z, x} - */ - public static BlockCoord fromAxes(int[] ia) { - return new BlockCoord(ia[2], ia[0], ia[1]); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof BlockCoord)) { - return false; - } - BlockCoord o2 = (BlockCoord) obj; - return x == o2.x && y == o2.y && z == o2.z; - } - - @Override - public int hashCode() { - return (x ^ z) * 31 + y; - } - - public int compareTo(BlockCoord o) { - if (x != o.x) { - return x < o.x ? 1 : -1; - } - if (y != o.y) { - return y < o.y ? 1 : -1; - } - if (z != o.z) { - return z < o.z ? 1 : -1; - } - return 0; - } - - public Vector3 toVector3Centered() { - return new Vector3(x + 0.5, y + 0.5, z + 0.5); - } - - public BlockCoord multiply(int i) { - x *= i; - y *= i; - z *= i; - return this; - } - - public double mag() { - return Math.sqrt(x * x + y * y + z * z); - } - - public int mag2() { - return x * x + y * y + z * z; - } - - public boolean isZero() { - return x == 0 && y == 0 && z == 0; - } - - public boolean isAxial() { - return x == 0 ? (y == 0 || z == 0) : (y == 0 && z == 0); - } - - public BlockCoord add(BlockCoord coord2) { - x += coord2.x; - y += coord2.y; - z += coord2.z; - return this; - } - - public BlockCoord add(int i, int j, int k) { - x += i; - y += j; - z += k; - return this; - } - - public BlockCoord sub(BlockCoord coord2) { - x -= coord2.x; - y -= coord2.y; - z -= coord2.z; - return this; - } - - public BlockCoord sub(int i, int j, int k) { - x -= i; - y -= j; - z -= k; - return this; - } - - public BlockCoord offset(int side) { - return offset(side, 1); - } - - public BlockCoord offset(int side, int amount) { - BlockCoord offset = sideOffsets[side]; - x += offset.x * amount; - y += offset.y * amount; - z += offset.z * amount; - return this; - } - - public BlockCoord inset(int side) { - return inset(side, 1); - } - - public BlockCoord inset(int side, int amount) { - return offset(side, -amount); - } - - public int getSide(int side) { - switch (side) { - case 0: - case 1: - return y; - case 2: - case 3: - return z; - case 4: - case 5: - return x; - } - throw new IndexOutOfBoundsException("Switch Falloff"); - } - - public BlockCoord setSide(int s, int v) { - switch (s) { - case 0: - case 1: - y = v; - break; - case 2: - case 3: - z = v; - break; - case 4: - case 5: - x = v; - break; - default: - throw new IndexOutOfBoundsException("Switch Falloff"); - } - return this; - } - - public int[] intArray() { - return new int[] { x, y, z }; - } - - public BlockPos pos() { - if (posCache == null || x != posCache.getX() || y != posCache.getY() || z != posCache.getZ()) { - posCache = new BlockPos(x, y, z); - } - return posCache; - } - - public BlockCoord copy() { - return new BlockCoord(x, y, z); - } - - public BlockCoord set(int i, int j, int k) { - x = i; - y = j; - z = k; - return this; - } - - public BlockCoord set(BlockCoord coord) { - return set(coord.x, coord.y, coord.z); - } - - public BlockCoord set(BlockPos pos) { - return set(pos.getX(), pos.getY(), pos.getZ()); - } - - public BlockCoord set(int[] ia) { - return set(ia[0], ia[1], ia[2]); - } - - public BlockCoord set(TileEntity tile) { - return set(tile.getPos()); - } - - public int toSide() { - if (!isAxial()) { - return -1; - } - if (y < 0) { - return 0; - } - if (y > 0) { - return 1; - } - if (z < 0) { - return 2; - } - if (z > 0) { - return 3; - } - if (x < 0) { - return 4; - } - if (x > 0) { - return 5; - } - - return -1; - } - - public int absSum() { - return (x < 0 ? -x : x) + (y < 0 ? -y : y) + (z < 0 ? -z : z); - } - - public String toString() { - return "(" + x + ", " + y + ", " + z + ")"; - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/Cuboid6.java b/dependencies/main/java/codechicken/lib/vec/Cuboid6.java deleted file mode 100644 index 23e7fdbdcd..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/Cuboid6.java +++ /dev/null @@ -1,258 +0,0 @@ -package codechicken.lib.vec; - -import codechicken.lib.util.Copyable; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; - -public class Cuboid6 implements Copyable { - - public static Cuboid6 full = new Cuboid6(0, 0, 0, 1, 1, 1); - - public Vector3 min; - public Vector3 max; - - public Cuboid6() { - this(new Vector3(), new Vector3()); - } - - public Cuboid6(Vector3 min, Vector3 max) { - this.min = min; - this.max = max; - } - - public Cuboid6(AxisAlignedBB aabb) { - min = new Vector3(aabb.minX, aabb.minY, aabb.minZ); - max = new Vector3(aabb.maxX, aabb.maxY, aabb.maxZ); - } - - public Cuboid6(Cuboid6 cuboid) { - min = cuboid.min.copy(); - max = cuboid.max.copy(); - } - - public Cuboid6(double minx, double miny, double minz, double maxx, double maxy, double maxz) { - min = new Vector3(minx, miny, minz); - max = new Vector3(maxx, maxy, maxz); - } - - public AxisAlignedBB aabb() { - return new AxisAlignedBB(min.x, min.y, min.z, max.x, max.y, max.z); - } - - public Cuboid6 set(double minx, double miny, double minz, double maxx, double maxy, double maxz) { - min.set(minx, miny, minz); - max.set(maxx, maxy, maxz); - return this; - } - - public Cuboid6 set(Vector3 min, Vector3 max) { - return set(min.x, min.y, min.z, max.x, max.y, max.z); - } - - public Cuboid6 set(Cuboid6 c) { - return set(c.min.x, c.min.y, c.min.z, c.max.x, c.max.y, c.max.z); - } - - public Cuboid6 add(double dx, double dy, double dz) { - min.add(dx, dy, dz); - max.add(dx, dy, dz); - return this; - } - - public Cuboid6 add(double d) { - return add(d, d, d); - } - - public Cuboid6 add(Vector3 vec) { - return add(vec.x, vec.y, vec.z); - } - - public Cuboid6 add(BlockPos pos) { - return add(pos.getX(), pos.getY(), pos.getZ()); - } - - public Cuboid6 subtract(double dx, double dy, double dz) { - min.subtract(dx, dy, dz); - max.subtract(dx, dy, dz); - return this; - } - - public Cuboid6 subtract(double d) { - return subtract(d, d, d); - } - - public Cuboid6 subtract(Vector3 vec) { - return subtract(vec.x, vec.y, vec.z); - } - - public Cuboid6 subtract(BlockPos pos) { - return subtract(pos.getX(), pos.getY(), pos.getZ()); - } - - @Deprecated //Use subtract - public Cuboid6 sub(Vector3 vec) { - return subtract(vec); - } - - public Cuboid6 expand(double dx, double dy, double dz) { - min.subtract(dx, dy, dz); - max.add(dx, dy, dz); - return this; - } - - public Cuboid6 expand(double d) { - return expand(d, d, d); - } - - public Cuboid6 expand(Vector3 vec) { - return expand(vec.x, vec.y, vec.z); - } - - public Cuboid6 offset(Cuboid6 o) { - min.add(o.min); - max.add(o.max); - return this; - } - - public Cuboid6 enclose(double minx, double miny, double minz, double maxx, double maxy, double maxz) { - if (min.x > minx) { - min.x = minx; - } - if (min.y > miny) { - min.y = miny; - } - if (min.z > minz) { - min.z = minz; - } - if (max.x < maxx) { - max.x = maxx; - } - if (max.y < maxy) { - max.y = maxy; - } - if (max.z < maxz) { - max.z = maxz; - } - return this; - } - - public Cuboid6 enclose(double x, double y, double z) { - return enclose(x, y, z, x, y, z); - } - - public Cuboid6 enclose(Vector3 vec) { - return enclose(vec.x, vec.y, vec.z, vec.x, vec.y, vec.z); - } - - public Cuboid6 enclose(Cuboid6 c) { - return enclose(c.min.x, c.min.y, c.min.z, c.max.x, c.max.y, c.max.z); - } - - public boolean contains(double x, double y, double z) { - return min.x - 1E-5 <= x && min.y - 1E-5 <= y && min.z - 1E-5 <= z && max.x + 1E-5 >= x && max.y + 1E-5 >= y && max.z + 1E-5 >= z; - } - - public boolean contains(Vector3 vec) { - return contains(vec.x, vec.y, vec.z); - } - - public boolean intersects(Cuboid6 b) { - return max.x - 1E-5 > b.min.x && max.y - 1E-5 > b.min.y && max.z - 1E-5 > b.min.z && b.max.x - 1E-5 > min.x && b.max.y - 1E-5 > min.y && b.max.z - 1E-5 > min.z; - } - - public Vector3 center() { - return min.copy().add(max).multiply(0.5); - } - - public double getSide(int s) { - switch (s) { - case 0: - return min.y; - case 1: - return max.y; - case 2: - return min.z; - case 3: - return max.z; - case 4: - return min.x; - case 5: - return max.x; - } - throw new IndexOutOfBoundsException("Switch Falloff"); - } - - public Cuboid6 setSide(int s, double d) { - switch (s) { - case 0: - min.y = d; - break; - case 1: - max.y = d; - break; - case 2: - min.z = d; - break; - case 3: - max.z = d; - break; - case 4: - min.x = d; - break; - case 5: - max.x = d; - break; - default: - throw new IndexOutOfBoundsException("Switch Falloff"); - } - return this; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof Cuboid6)) { - return false; - } - Cuboid6 c = (Cuboid6) obj; - return min.equals(c.min) && max.equals(c.max); - } - - public boolean equalsT(Cuboid6 c) { - return min.equalsT(c.min) && max.equalsT(c.max); - } - - public Cuboid6 copy() { - return new Cuboid6(this); - } - - public String toString() { - MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "Cuboid: (" + new BigDecimal(min.x, cont) + ", " + new BigDecimal(min.y, cont) + ", " + new BigDecimal(min.z, cont) + ") -> (" + new BigDecimal(max.x, cont) + ", " + new BigDecimal(max.y, cont) + ", " + new BigDecimal(max.z, cont) + ")"; - } - - public Cuboid6 apply(Transformation t) { - t.apply(min); - t.apply(max); - double temp; - if (min.x > max.x) { - temp = min.x; - min.x = max.x; - max.x = temp; - } - if (min.y > max.y) { - temp = min.y; - min.y = max.y; - max.y = temp; - } - if (min.z > max.z) { - temp = min.z; - min.z = max.z; - max.z = temp; - } - return this; - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/CuboidCoord.java b/dependencies/main/java/codechicken/lib/vec/CuboidCoord.java deleted file mode 100644 index e4882bf6e3..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/CuboidCoord.java +++ /dev/null @@ -1,242 +0,0 @@ -package codechicken.lib.vec; - -import codechicken.lib.util.Copyable; -import net.minecraft.util.math.AxisAlignedBB; - -import java.util.Iterator; - -public class CuboidCoord implements Iterable, Copyable { - - public BlockCoord min; - public BlockCoord max; - - public CuboidCoord() { - min = new BlockCoord(); - max = new BlockCoord(); - } - - public CuboidCoord(BlockCoord min, BlockCoord max) { - this.min = min; - this.max = max; - } - - public CuboidCoord(BlockCoord coord) { - this(coord, coord.copy()); - } - - public CuboidCoord(int[] ia) { - this(ia[0], ia[1], ia[2], ia[3], ia[4], ia[5]); - } - - public CuboidCoord(int x1, int y1, int z1, int x2, int y2, int z2) { - this(new BlockCoord(x1, y1, z1), new BlockCoord(x2, y2, z2)); - } - - public AxisAlignedBB toAABB() { - return bounds().aabb(); - } - - public int[] intArray() { - return new int[] { min.x, min.y, min.z, max.x, max.y, max.z }; - } - - public Cuboid6 bounds() { - return new Cuboid6(min.x, min.y, min.z, max.x + 1, max.y + 1, max.z + 1); - } - - public CuboidCoord set(int x1, int y1, int z1, int x2, int y2, int z2) { - min.set(x1, y1, z1); - max.set(x2, y2, z2); - return this; - } - - public CuboidCoord set(BlockCoord min, BlockCoord max) { - return set(min.x, min.y, min.z, max.x, max.y, max.z); - } - - public CuboidCoord set(BlockCoord coord) { - return set(coord.x, coord.y, coord.z, coord.x, coord.y, coord.z); - } - - public CuboidCoord set(int[] ia) { - return set(ia[0], ia[1], ia[2], ia[3], ia[4], ia[5]); - } - - public CuboidCoord expand(int dx, int dy, int dz) { - max.add(dx, dy, dz); - min.sub(dx, dy, dz); - return this; - } - - public CuboidCoord expand(int d) { - return expand(d, d, d); - } - - public CuboidCoord expand(int side, int amount) { - if (side % 2 == 0) { //negative side - min = min.offset(side, amount); - } else { - max = max.offset(side, amount); - } - return this; - } - - public CuboidCoord include(int x, int y, int z) { - if (x < min.x) { - min.x = x; - } else if (x > max.x) { - max.x = x; - } - if (y < min.y) { - min.y = y; - } else if (y > max.y) { - max.y = y; - } - if (z < min.z) { - min.z = z; - } else if (z > max.z) { - max.z = z; - } - return this; - } - - public CuboidCoord include(BlockCoord coord) { - return include(coord.x, coord.y, coord.z); - } - - public boolean contains(int x, int y, int z) { - return x >= min.x && x <= max.x && y >= min.y && y <= max.y && z >= min.z && z <= max.z; - } - - public boolean contains(BlockCoord coord) { - return contains(coord.x, coord.y, coord.z); - } - - public boolean intersects(CuboidCoord c) { - return max.x >= c.min.x && max.y >= c.min.y && max.z >= c.min.z && min.x <= c.max.x && min.y <= c.max.y && min.z <= c.max.z; - } - - public int volume() { - return (max.x - min.x + 1) * (max.y - min.y + 1) * (max.z - min.z + 1); - } - - public Vector3 centerVec() { - return new Vector3(min.x + (max.x - min.x + 1) / 2D, min.y + (max.y - min.y + 1) / 2D, min.z + (max.z - min.z + 1) / 2D); - } - - public BlockCoord center() { - return new BlockCoord(min.x + (max.x - min.x) / 2, min.y + (max.y - min.y) / 2, min.z + (max.z - min.z) / 2); - } - - //TODO: Remove this? Does not conform... - public BlockCoord getCenter(BlockCoord store) { - store.set(min.x + (max.x - min.x) / 2, min.y + (max.y - min.y) / 2, min.z + (max.z - min.z) / 2); - return store; - } - - public int size(int s) { - switch (s) { - case 0: - case 1: - return max.y - min.y + 1; - case 2: - case 3: - return max.z - min.z + 1; - case 4: - case 5: - return max.x - min.x + 1; - default: - return 0; - } - } - - public int getSide(int s) { - switch (s) { - case 0: - return min.y; - case 1: - return max.y; - case 2: - return min.z; - case 3: - return max.z; - case 4: - return min.x; - case 5: - return max.x; - } - throw new IndexOutOfBoundsException("Switch Falloff"); - } - - public CuboidCoord setSide(int s, int v) { - switch (s) { - case 0: - min.y = v; - break; - case 1: - max.y = v; - break; - case 2: - min.z = v; - break; - case 3: - max.z = v; - break; - case 4: - min.x = v; - break; - case 5: - max.x = v; - break; - default: - throw new IndexOutOfBoundsException("Switch Falloff"); - } - return this; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof CuboidCoord)) { - return false; - } - CuboidCoord c = (CuboidCoord) obj; - return min.equals(c.min) && max.equals(c.max); - } - - public CuboidCoord copy() { - return new CuboidCoord(min.copy(), max.copy()); - } - - public Iterator iterator() { - return new Iterator() { - BlockCoord b = null; - - public boolean hasNext() { - return b == null || !b.equals(max); - } - - public BlockCoord next() { - if (b == null) { - b = min.copy(); - } else { - if (b.z != max.z) { - b.z++; - } else { - b.z = min.z; - if (b.y != max.y) { - b.y++; - } else { - b.y = min.y; - b.x++; - } - } - } - return b.copy(); - } - - public void remove() { - throw new UnsupportedOperationException(); - } - }; - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/ITransformation.java b/dependencies/main/java/codechicken/lib/vec/ITransformation.java deleted file mode 100644 index 1df3c3b736..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/ITransformation.java +++ /dev/null @@ -1,50 +0,0 @@ -package codechicken.lib.vec; - -/** - * Abstract supertype for any VectorN transformation - * - * @param The vector type - * @param The transformation type - */ -public abstract class ITransformation { - - /** - * Applies this transformation to vec - */ - public abstract void apply(Vector vec); - - /** - * @param point The point to apply this transformation around - * @return Wraps this transformation in a translation to point and then back from point - */ - public abstract Transformation at(Vector point); - - /** - * Creates a TransformationList composed of this transformation followed by t - * If this is a TransformationList, the transformation will be appended and this returned - */ - public abstract Transformation with(Transformation t); - - /** - * Returns a simplified transformation that performs this, followed by next. If such a transformation does not exist, returns null - */ - public Transformation merge(Transformation next) { - return null; - } - - /** - * Returns true if this transformation is redundant, eg. Scale(1, 1, 1), Translation(0, 0, 0) or Rotation(0, a, b, c) - */ - public boolean isRedundant() { - return false; - } - - public abstract Transformation inverse(); - - /** - * Scala ++ operator - */ - public Transformation $plus$plus(Transformation t) { - return with(t); - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/IrreversibleTransformationException.java b/dependencies/main/java/codechicken/lib/vec/IrreversibleTransformationException.java deleted file mode 100644 index 94dbcfea1a..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/IrreversibleTransformationException.java +++ /dev/null @@ -1,16 +0,0 @@ -package codechicken.lib.vec; - -@SuppressWarnings ("serial") -public class IrreversibleTransformationException extends RuntimeException { - - public ITransformation t; - - public IrreversibleTransformationException(ITransformation t) { - this.t = t; - } - - @Override - public String getMessage() { - return "The following transformation is irreversible:\n" + t; - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/Line3.java b/dependencies/main/java/codechicken/lib/vec/Line3.java deleted file mode 100644 index 93589975e9..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/Line3.java +++ /dev/null @@ -1,40 +0,0 @@ -package codechicken.lib.vec; - -public class Line3 { - - public static final double tol = 0.0001D; - - public Vector3 pt1; - public Vector3 pt2; - - public Line3(Vector3 pt1, Vector3 pt2) { - this.pt1 = pt1; - this.pt2 = pt2; - } - - public Line3() { - this(new Vector3(), new Vector3()); - } - - public static boolean intersection2D(Line3 line1, Line3 line2, Vector3 store) { - // calculate differences - double xD1 = line1.pt2.x - line1.pt1.x; - double zD1 = line1.pt2.z - line1.pt1.z; - double xD2 = line2.pt2.x - line2.pt1.x; - double zD2 = line2.pt2.z - line2.pt1.z; - - double xD3 = line1.pt1.x - line2.pt1.x; - double zD3 = line1.pt1.z - line2.pt1.z; - - double div = zD2 * xD1 - xD2 * zD1; - if (div == 0)//lines are parallel - { - return false; - } - double ua = (xD2 * zD3 - zD2 * xD3) / div; - store.set(line1.pt1.x + ua * xD1, 0, line1.pt1.z + ua * zD1); - - return store.x >= Math.min(line1.pt1.x, line1.pt2.x) - tol && store.x >= Math.min(line2.pt1.x, line2.pt2.x) - tol && store.z >= Math.min(line1.pt1.z, line1.pt2.z) - tol && store.z >= Math.min(line2.pt1.z, line2.pt2.z) - tol && store.x <= Math.max(line1.pt1.x, line1.pt2.x) + tol && store.x <= Math.max(line2.pt1.x, line2.pt2.x) + tol && store.z <= Math.max(line1.pt1.z, line1.pt2.z) + tol && store.z <= Math.max(line2.pt1.z, line2.pt2.z) + tol; - - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/Matrix4.java b/dependencies/main/java/codechicken/lib/vec/Matrix4.java deleted file mode 100644 index 02f41a2d4a..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/Matrix4.java +++ /dev/null @@ -1,368 +0,0 @@ -package codechicken.lib.vec; - -import codechicken.lib.util.Copyable; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import javax.vecmath.Matrix4d; -import javax.vecmath.Matrix4f; -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.FloatBuffer; - -//TODO Decompose to individual transforms. -public class Matrix4 extends Transformation implements Copyable { - - private static FloatBuffer glBuf = ByteBuffer.allocateDirect(16 * 8).order(ByteOrder.nativeOrder()).asFloatBuffer(); - - //m - public double m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33; - - public Matrix4() { - m00 = m11 = m22 = m33 = 1; - } - - public Matrix4(double d00, double d01, double d02, double d03, double d10, double d11, double d12, double d13, double d20, double d21, double d22, double d23, double d30, double d31, double d32, double d33) { - m00 = d00; - m01 = d01; - m02 = d02; - m03 = d03; - m10 = d10; - m11 = d11; - m12 = d12; - m13 = d13; - m20 = d20; - m21 = d21; - m22 = d22; - m23 = d23; - m30 = d30; - m31 = d31; - m32 = d32; - m33 = d33; - } - - public Matrix4(Matrix4 mat) { - set(mat); - } - - public Matrix4 setIdentity() { - m00 = m11 = m22 = m33 = 1; - m01 = m02 = m03 = m10 = m12 = m13 = m20 = m21 = m23 = m30 = m31 = m32 = 0; - - return this; - } - - public Matrix4 translate(Vector3 vec) { - m03 += m00 * vec.x + m01 * vec.y + m02 * vec.z; - m13 += m10 * vec.x + m11 * vec.y + m12 * vec.z; - m23 += m20 * vec.x + m21 * vec.y + m22 * vec.z; - m33 += m30 * vec.x + m31 * vec.y + m32 * vec.z; - - return this; - } - - public Matrix4 scale(Vector3 vec) { - m00 *= vec.x; - m10 *= vec.x; - m20 *= vec.x; - m30 *= vec.x; - m01 *= vec.y; - m11 *= vec.y; - m21 *= vec.y; - m31 *= vec.y; - m02 *= vec.z; - m12 *= vec.z; - m22 *= vec.z; - m32 *= vec.z; - - return this; - } - - public Matrix4 rotate(double angle, Vector3 axis) { - double c = Math.cos(angle); - double s = Math.sin(angle); - double mc = 1.0f - c; - double xy = axis.x * axis.y; - double yz = axis.y * axis.z; - double xz = axis.x * axis.z; - double xs = axis.x * s; - double ys = axis.y * s; - double zs = axis.z * s; - - double f00 = axis.x * axis.x * mc + c; - double f10 = xy * mc + zs; - double f20 = xz * mc - ys; - - double f01 = xy * mc - zs; - double f11 = axis.y * axis.y * mc + c; - double f21 = yz * mc + xs; - - double f02 = xz * mc + ys; - double f12 = yz * mc - xs; - double f22 = axis.z * axis.z * mc + c; - - double t00 = m00 * f00 + m01 * f10 + m02 * f20; - double t10 = m10 * f00 + m11 * f10 + m12 * f20; - double t20 = m20 * f00 + m21 * f10 + m22 * f20; - double t30 = m30 * f00 + m31 * f10 + m32 * f20; - double t01 = m00 * f01 + m01 * f11 + m02 * f21; - double t11 = m10 * f01 + m11 * f11 + m12 * f21; - double t21 = m20 * f01 + m21 * f11 + m22 * f21; - double t31 = m30 * f01 + m31 * f11 + m32 * f21; - m02 = m00 * f02 + m01 * f12 + m02 * f22; - m12 = m10 * f02 + m11 * f12 + m12 * f22; - m22 = m20 * f02 + m21 * f12 + m22 * f22; - m32 = m30 * f02 + m31 * f12 + m32 * f22; - m00 = t00; - m10 = t10; - m20 = t20; - m30 = t30; - m01 = t01; - m11 = t11; - m21 = t21; - m31 = t31; - - return this; - } - - public Matrix4 rotate(Rotation rotation) { - rotation.apply(this); - return this; - } - - public Matrix4 leftMultiply(Matrix4 mat) { - double n00 = m00 * mat.m00 + m10 * mat.m01 + m20 * mat.m02 + m30 * mat.m03; - double n01 = m01 * mat.m00 + m11 * mat.m01 + m21 * mat.m02 + m31 * mat.m03; - double n02 = m02 * mat.m00 + m12 * mat.m01 + m22 * mat.m02 + m32 * mat.m03; - double n03 = m03 * mat.m00 + m13 * mat.m01 + m23 * mat.m02 + m33 * mat.m03; - double n10 = m00 * mat.m10 + m10 * mat.m11 + m20 * mat.m12 + m30 * mat.m13; - double n11 = m01 * mat.m10 + m11 * mat.m11 + m21 * mat.m12 + m31 * mat.m13; - double n12 = m02 * mat.m10 + m12 * mat.m11 + m22 * mat.m12 + m32 * mat.m13; - double n13 = m03 * mat.m10 + m13 * mat.m11 + m23 * mat.m12 + m33 * mat.m13; - double n20 = m00 * mat.m20 + m10 * mat.m21 + m20 * mat.m22 + m30 * mat.m23; - double n21 = m01 * mat.m20 + m11 * mat.m21 + m21 * mat.m22 + m31 * mat.m23; - double n22 = m02 * mat.m20 + m12 * mat.m21 + m22 * mat.m22 + m32 * mat.m23; - double n23 = m03 * mat.m20 + m13 * mat.m21 + m23 * mat.m22 + m33 * mat.m23; - double n30 = m00 * mat.m30 + m10 * mat.m31 + m20 * mat.m32 + m30 * mat.m33; - double n31 = m01 * mat.m30 + m11 * mat.m31 + m21 * mat.m32 + m31 * mat.m33; - double n32 = m02 * mat.m30 + m12 * mat.m31 + m22 * mat.m32 + m32 * mat.m33; - double n33 = m03 * mat.m30 + m13 * mat.m31 + m23 * mat.m32 + m33 * mat.m33; - - m00 = n00; - m01 = n01; - m02 = n02; - m03 = n03; - m10 = n10; - m11 = n11; - m12 = n12; - m13 = n13; - m20 = n20; - m21 = n21; - m22 = n22; - m23 = n23; - m30 = n30; - m31 = n31; - m32 = n32; - m33 = n33; - - return this; - } - - public Matrix4 multiply(Matrix4 mat) { - double n00 = m00 * mat.m00 + m01 * mat.m10 + m02 * mat.m20 + m03 * mat.m30; - double n01 = m00 * mat.m01 + m01 * mat.m11 + m02 * mat.m21 + m03 * mat.m31; - double n02 = m00 * mat.m02 + m01 * mat.m12 + m02 * mat.m22 + m03 * mat.m32; - double n03 = m00 * mat.m03 + m01 * mat.m13 + m02 * mat.m23 + m03 * mat.m33; - double n10 = m10 * mat.m00 + m11 * mat.m10 + m12 * mat.m20 + m13 * mat.m30; - double n11 = m10 * mat.m01 + m11 * mat.m11 + m12 * mat.m21 + m13 * mat.m31; - double n12 = m10 * mat.m02 + m11 * mat.m12 + m12 * mat.m22 + m13 * mat.m32; - double n13 = m10 * mat.m03 + m11 * mat.m13 + m12 * mat.m23 + m13 * mat.m33; - double n20 = m20 * mat.m00 + m21 * mat.m10 + m22 * mat.m20 + m23 * mat.m30; - double n21 = m20 * mat.m01 + m21 * mat.m11 + m22 * mat.m21 + m23 * mat.m31; - double n22 = m20 * mat.m02 + m21 * mat.m12 + m22 * mat.m22 + m23 * mat.m32; - double n23 = m20 * mat.m03 + m21 * mat.m13 + m22 * mat.m23 + m23 * mat.m33; - double n30 = m30 * mat.m00 + m31 * mat.m10 + m32 * mat.m20 + m33 * mat.m30; - double n31 = m30 * mat.m01 + m31 * mat.m11 + m32 * mat.m21 + m33 * mat.m31; - double n32 = m30 * mat.m02 + m31 * mat.m12 + m32 * mat.m22 + m33 * mat.m32; - double n33 = m30 * mat.m03 + m31 * mat.m13 + m32 * mat.m23 + m33 * mat.m33; - - m00 = n00; - m01 = n01; - m02 = n02; - m03 = n03; - m10 = n10; - m11 = n11; - m12 = n12; - m13 = n13; - m20 = n20; - m21 = n21; - m22 = n22; - m23 = n23; - m30 = n30; - m31 = n31; - m32 = n32; - m33 = n33; - - return this; - } - - public Matrix4 transpose() { - double n00 = m00; - double n10 = m01; - double n20 = m02; - double n30 = m03; - double n01 = m10; - double n11 = m11; - double n21 = m12; - double n31 = m13; - double n02 = m20; - double n12 = m21; - double n22 = m22; - double n32 = m23; - double n03 = m30; - double n13 = m31; - double n23 = m32; - double n33 = m33; - - m00 = n00; - m01 = n01; - m02 = n02; - m03 = n03; - m10 = n10; - m11 = n11; - m12 = n12; - m13 = n13; - m20 = n20; - m21 = n21; - m22 = n22; - m23 = n23; - m30 = n30; - m31 = n31; - m32 = n32; - m33 = n33; - - return this; - } - - public Matrix4 copy() { - return new Matrix4(this); - } - - public Matrix4 set(Matrix4 mat) { - m00 = mat.m00; - m01 = mat.m01; - m02 = mat.m02; - m03 = mat.m03; - m10 = mat.m10; - m11 = mat.m11; - m12 = mat.m12; - m13 = mat.m13; - m20 = mat.m20; - m21 = mat.m21; - m22 = mat.m22; - m23 = mat.m23; - m30 = mat.m30; - m31 = mat.m31; - m32 = mat.m32; - m33 = mat.m33; - - return this; - } - - public Matrix4d toMatrix4d() { - double[] matrix = new double[16]; - matrix[0] = m00; - matrix[1] = m01; - matrix[2] = m02; - matrix[3] = m03; - matrix[4] = m10; - matrix[5] = m11; - matrix[6] = m12; - matrix[7] = m13; - matrix[8] = m20; - matrix[9] = m21; - matrix[10] = m22; - matrix[11] = m23; - matrix[12] = m30; - matrix[13] = m31; - matrix[14] = m32; - matrix[15] = m33; - return new Matrix4d(matrix); - } - - public Matrix4f toMatrix4f() { - float[] matrix = new float[16]; - matrix[0] = (float) m00; - matrix[1] = (float) m01; - matrix[2] = (float) m02; - matrix[3] = (float) m03; - matrix[4] = (float) m10; - matrix[5] = (float) m11; - matrix[6] = (float) m12; - matrix[7] = (float) m13; - matrix[8] = (float) m20; - matrix[9] = (float) m21; - matrix[10] = (float) m22; - matrix[11] = (float) m23; - matrix[12] = (float) m30; - matrix[13] = (float) m31; - matrix[14] = (float) m32; - matrix[15] = (float) m33; - return new Matrix4f(matrix); - } - - @Override - public void apply(Matrix4 mat) { - mat.multiply(this); - } - - private void mult3x3(Vector3 vec) { - double x = m00 * vec.x + m01 * vec.y + m02 * vec.z; - double y = m10 * vec.x + m11 * vec.y + m12 * vec.z; - double z = m20 * vec.x + m21 * vec.y + m22 * vec.z; - - vec.x = x; - vec.y = y; - vec.z = z; - } - - @Override - public void apply(Vector3 vec) { - mult3x3(vec); - vec.add(m03, m13, m23); - } - - @Override - public void applyN(Vector3 vec) { - mult3x3(vec); - vec.normalize(); - } - - @Override - public String toString() { - MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "[" + new BigDecimal(m00, cont) + "," + new BigDecimal(m01, cont) + "," + new BigDecimal(m02, cont) + "," + new BigDecimal(m03, cont) + "]\n" + "[" + new BigDecimal(m10, cont) + "," + new BigDecimal(m11, cont) + "," + new BigDecimal(m12, cont) + "," + new BigDecimal(m13, cont) + "]\n" + "[" + new BigDecimal(m20, cont) + "," + new BigDecimal(m21, cont) + "," + new BigDecimal(m22, cont) + "," + new BigDecimal(m23, cont) + "]\n" + "[" + new BigDecimal(m30, cont) + "," + new BigDecimal(m31, cont) + "," + new BigDecimal(m32, cont) + "," + new BigDecimal(m33, cont) + "]"; - } - - public Matrix4 apply(Transformation t) { - t.apply(this); - return this; - } - - @Override - @SideOnly (Side.CLIENT) - public void glApply() { - glBuf.put((float) m00).put((float) m10).put((float) m20).put((float) m30).put((float) m01).put((float) m11).put((float) m21).put((float) m31).put((float) m02).put((float) m12).put((float) m22).put((float) m32).put((float) m03).put((float) m13).put((float) m23).put((float) m33); - glBuf.flip(); - GlStateManager.multMatrix(glBuf); - } - - @Override - public Transformation inverse() { - throw new IrreversibleTransformationException(this);//Don't waste your cpu with matrix inverses - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/Quat.java b/dependencies/main/java/codechicken/lib/vec/Quat.java deleted file mode 100644 index ae91c230d3..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/Quat.java +++ /dev/null @@ -1,139 +0,0 @@ -package codechicken.lib.vec; - -import codechicken.lib.math.MathHelper; -import codechicken.lib.util.Copyable; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; - -public class Quat implements Copyable { - - public double x; - public double y; - public double z; - public double s; - - public Quat() { - s = 1; - x = 0; - y = 0; - z = 0; - } - - public Quat(Quat quat) { - x = quat.x; - y = quat.y; - z = quat.z; - s = quat.s; - } - - public Quat(double d, double d1, double d2, double d3) { - x = d1; - y = d2; - z = d3; - s = d; - } - - public Quat set(Quat quat) { - x = quat.x; - y = quat.y; - z = quat.z; - s = quat.s; - - return this; - } - - public Quat set(double d, double d1, double d2, double d3) { - x = d1; - y = d2; - z = d3; - s = d; - - return this; - } - - public static Quat aroundAxis(double ax, double ay, double az, double angle) { - return new Quat().setAroundAxis(ax, ay, az, angle); - } - - public static Quat aroundAxis(Vector3 axis, double angle) { - return aroundAxis(axis.x, axis.y, axis.z, angle); - } - - public Quat setAroundAxis(double ax, double ay, double az, double angle) { - angle *= 0.5; - double d4 = MathHelper.sin(angle); - return set(MathHelper.cos(angle), ax * d4, ay * d4, az * d4); - } - - public Quat setAroundAxis(Vector3 axis, double angle) { - return setAroundAxis(axis.x, axis.y, axis.z, angle); - } - - public Quat multiply(Quat quat) { - double d = s * quat.s - x * quat.x - y * quat.y - z * quat.z; - double d1 = s * quat.x + x * quat.s - y * quat.z + z * quat.y; - double d2 = s * quat.y + x * quat.z + y * quat.s - z * quat.x; - double d3 = s * quat.z - x * quat.y + y * quat.x + z * quat.s; - s = d; - x = d1; - y = d2; - z = d3; - - return this; - } - - public Quat rightMultiply(Quat quat) { - double d = s * quat.s - x * quat.x - y * quat.y - z * quat.z; - double d1 = s * quat.x + x * quat.s + y * quat.z - z * quat.y; - double d2 = s * quat.y - x * quat.z + y * quat.s + z * quat.x; - double d3 = s * quat.z + x * quat.y - y * quat.x + z * quat.s; - s = d; - x = d1; - y = d2; - z = d3; - - return this; - } - - public double mag() { - return Math.sqrt(x * x + y * y + z * z + s * s); - } - - public Quat normalize() { - double d = mag(); - if (d != 0) { - d = 1 / d; - x *= d; - y *= d; - z *= d; - s *= d; - } - - return this; - } - - public Quat copy() { - return new Quat(this); - } - - public void rotate(Vector3 vec) { - double d = -x * vec.x - y * vec.y - z * vec.z; - double d1 = s * vec.x + y * vec.z - z * vec.y; - double d2 = s * vec.y - x * vec.z + z * vec.x; - double d3 = s * vec.z + x * vec.y - y * vec.x; - vec.x = d1 * s - d * x - d2 * z + d3 * y; - vec.y = d2 * s - d * y + d1 * z - d3 * x; - vec.z = d3 * s - d * z - d1 * y + d2 * x; - } - - public String toString() { - MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "Quat(" + new BigDecimal(s, cont) + ", " + new BigDecimal(x, cont) + ", " + new BigDecimal(y, cont) + ", " + new BigDecimal(z, cont) + ")"; - } - - public Rotation rotation() { - return new Rotation(this); - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/Rectangle4i.java b/dependencies/main/java/codechicken/lib/vec/Rectangle4i.java deleted file mode 100644 index 866cb7855c..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/Rectangle4i.java +++ /dev/null @@ -1,97 +0,0 @@ -package codechicken.lib.vec; - -public class Rectangle4i { - - public int x; - public int y; - public int w; - public int h; - - public Rectangle4i() { - } - - public Rectangle4i(int x, int y, int w, int h) { - this.x = x; - this.y = y; - this.w = w; - this.h = h; - } - - public int x1() { - return x; - } - - public int y1() { - return y; - } - - public int x2() { - return x + w - 1; - } - - public int y2() { - return y + h - 1; - } - - public void set(int x, int y, int w, int h) { - this.x = x; - this.y = y; - this.w = w; - this.h = h; - } - - public Rectangle4i offset(int dx, int dy) { - x += dx; - y += dy; - return this; - } - - public Rectangle4i include(int px, int py) { - if (px < x) { - expand(px - x, 0); - } - if (px >= x + w) { - expand(px - x - w + 1, 0); - } - if (py < y) { - expand(0, py - y); - } - if (py >= y + h) { - expand(0, py - y - h + 1); - } - return this; - } - - public Rectangle4i include(Rectangle4i r) { - include(r.x, r.y); - return include(r.x2(), r.y2()); - } - - public Rectangle4i expand(int px, int py) { - if (px > 0) { - w += px; - } else { - x += px; - w -= px; - } - if (py > 0) { - h += py; - } else { - y += py; - h -= py; - } - return this; - } - - public boolean contains(int px, int py) { - return x <= px && px < x + w && y <= py && py < y + h; - } - - public boolean intersects(Rectangle4i r) { - return r.x + r.w > x && r.x < x + w && r.y + r.h > y && r.y < y + h; - } - - public int area() { - return w * h; - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/RedundantTransformation.java b/dependencies/main/java/codechicken/lib/vec/RedundantTransformation.java deleted file mode 100644 index e314a21518..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/RedundantTransformation.java +++ /dev/null @@ -1,49 +0,0 @@ -package codechicken.lib.vec; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public class RedundantTransformation extends Transformation { - - @Override - public void apply(Vector3 vec) { - } - - @Override - public void apply(Matrix4 mat) { - } - - @Override - public void applyN(Vector3 normal) { - } - - @Override - public Transformation at(Vector3 point) { - return this; - } - - @Override - @SideOnly (Side.CLIENT) - public void glApply() { - } - - @Override - public Transformation inverse() { - return this; - } - - @Override - public Transformation merge(Transformation next) { - return next; - } - - @Override - public boolean isRedundant() { - return true; - } - - @Override - public String toString() { - return "Nothing()"; - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/Rotation.java b/dependencies/main/java/codechicken/lib/vec/Rotation.java deleted file mode 100644 index c4956392db..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/Rotation.java +++ /dev/null @@ -1,280 +0,0 @@ -package codechicken.lib.vec; - -import codechicken.lib.math.MathHelper; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; - -public class Rotation extends Transformation { - - /** - * Clockwise pi/2 about y looking down - */ - public static Transformation[] quarterRotations = new Transformation[] { new RedundantTransformation(), new VariableTransformation(new Matrix4(0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1)) { - @Override - public void apply(Vector3 vec) { - double d1 = vec.x; - double d2 = vec.z; - vec.x = -d2; - vec.z = d1; - } - - @Override - public Transformation inverse() { - return quarterRotations[3]; - } - }, new VariableTransformation(new Matrix4(-1, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1)) { - @Override - public void apply(Vector3 vec) { - vec.x = -vec.x; - vec.z = -vec.z; - } - - @Override - public Transformation inverse() { - return this; - } - }, new VariableTransformation(new Matrix4(0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 0, 1)) { - @Override - public void apply(Vector3 vec) { - double d1 = vec.x; - double d2 = vec.z; - vec.x = d2; - vec.z = -d1; - } - - @Override - public Transformation inverse() { - return quarterRotations[1]; - } - } }; - - public static Transformation[] sideRotations = new Transformation[] { new RedundantTransformation(), new VariableTransformation(new Matrix4(1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1)) { - @Override - public void apply(Vector3 vec) { - vec.y = -vec.y; - vec.z = -vec.z; - } - - @Override - public Transformation inverse() { - return this; - } - }, new VariableTransformation(new Matrix4(1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1)) { - @Override - public void apply(Vector3 vec) { - double d1 = vec.y; - double d2 = vec.z; - vec.y = -d2; - vec.z = d1; - } - - @Override - public Transformation inverse() { - return sideRotations[3]; - } - }, new VariableTransformation(new Matrix4(1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1)) { - @Override - public void apply(Vector3 vec) { - double d1 = vec.y; - double d2 = vec.z; - vec.y = d2; - vec.z = -d1; - } - - @Override - public Transformation inverse() { - return sideRotations[2]; - } - }, new VariableTransformation(new Matrix4(0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)) { - @Override - public void apply(Vector3 vec) { - double d0 = vec.x; - double d1 = vec.y; - vec.x = d1; - vec.y = -d0; - } - - @Override - public Transformation inverse() { - return sideRotations[5]; - } - }, new VariableTransformation(new Matrix4(0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)) { - @Override - public void apply(Vector3 vec) { - double d0 = vec.x; - double d1 = vec.y; - vec.x = -d1; - vec.y = d0; - } - - @Override - public Transformation inverse() { - return sideRotations[4]; - } - } }; - - public static Vector3[] axes = new Vector3[] { new Vector3(0, -1, 0), new Vector3(0, 1, 0), new Vector3(0, 0, -1), new Vector3(0, 0, 1), new Vector3(-1, 0, 0), new Vector3(1, 0, 0) }; - - public static int[] sideRotMap = new int[] { 3, 4, 2, 5, 3, 5, 2, 4, 1, 5, 0, 4, 1, 4, 0, 5, 1, 2, 0, 3, 1, 3, 0, 2 }; - - public static int[] rotSideMap = new int[] { -1, -1, 2, 0, 1, 3, -1, -1, 2, 0, 3, 1, 2, 0, -1, -1, 3, 1, 2, 0, -1, -1, 1, 3, 2, 0, 1, 3, -1, -1, 2, 0, 3, 1, -1, -1 }; - - /** - * Rotate pi/2 * this offset for [side] about y axis before rotating to the side for the rotation indicies to line up - */ - public static int[] sideRotOffsets = new int[] { 0, 2, 2, 0, 1, 3 }; - - public static int rotateSide(int s, int r) { - return sideRotMap[s << 2 | r]; - } - - /** - * Reverse of rotateSide - */ - public static int rotationTo(int s1, int s2) { - if ((s1 & 6) == (s2 & 6)) { - throw new IllegalArgumentException("Faces " + s1 + " and " + s2 + " are opposites"); - } - return rotSideMap[s1 * 6 + s2]; - } - - /** - * @param player The placing player, used for obtaining the look vector - * @param side The side of the block being placed on - * @return The rotation for the face == side^1 - */ - public static int getSidedRotation(EntityPlayer player, int side) { - Vector3 look = new Vector3(player.getLook(1)); - double max = 0; - int maxr = 0; - for (int r = 0; r < 4; r++) { - Vector3 axis = Rotation.axes[rotateSide(side ^ 1, r)]; - double d = look.scalarProject(axis); - if (d > max) { - max = d; - maxr = r; - } - } - return maxr; - } - - /** - * @return The rotation quat for side 0 and rotation 0 to side s with rotation r - */ - public static Transformation sideOrientation(int s, int r) { - return quarterRotations[(r + sideRotOffsets[s]) % 4].with(sideRotations[s]); - } - - /** - * @param entity The placing entity, used for obtaining the look vector - * @return The side towards which the entity is most directly looking. - */ - public static int getSideFromLookAngle(EntityLivingBase entity) { - Vector3 look = new Vector3(entity.getLook(1)); - double max = 0; - int maxs = 0; - for (int s = 0; s < 6; s++) { - double d = look.scalarProject(axes[s]); - if (d > max) { - max = d; - maxs = s; - } - } - return maxs; - } - - public double angle; - public Vector3 axis; - - private Quat quat; - - public Rotation(double angle, Vector3 axis) { - this.angle = angle; - this.axis = axis; - } - - public Rotation(double angle, double x, double y, double z) { - this(angle, new Vector3(x, y, z)); - } - - public Rotation(Quat quat) { - this.quat = quat; - - angle = Math.acos(quat.s) * 2; - if (angle == 0) { - axis = new Vector3(0, 1, 0); - } else { - double sa = Math.sin(angle * 0.5); - axis = new Vector3(quat.x / sa, quat.y / sa, quat.z / sa); - } - } - - @Override - public void apply(Vector3 vec) { - if (quat == null) { - quat = Quat.aroundAxis(axis, angle); - } - - vec.rotate(quat); - } - - @Override - public void applyN(Vector3 normal) { - apply(normal); - } - - @Override - public void apply(Matrix4 mat) { - mat.rotate(angle, axis); - } - - public Quat toQuat() { - if (quat == null) { - quat = Quat.aroundAxis(axis, angle); - } - return quat; - } - - @Override - @SideOnly (Side.CLIENT) - public void glApply() { - GlStateManager.rotate((float) (angle * MathHelper.todeg), (float) axis.x, (float) axis.y, (float) axis.z); - } - - @Override - public Transformation inverse() { - return new Rotation(-angle, axis); - } - - @Override - public Transformation merge(Transformation next) { - if (next instanceof Rotation) { - Rotation r = (Rotation) next; - if (r.axis.equalsT(axis)) { - return new Rotation(angle + r.angle, axis); - } - - return new Rotation(toQuat().copy().multiply(r.toQuat())); - } - - return null; - } - - @Override - public boolean isRedundant() { - return MathHelper.between(-1E-5, angle, 1E-5); - } - - @Override - public String toString() { - MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "Rotation(" + new BigDecimal(angle, cont) + ", " + new BigDecimal(axis.x, cont) + ", " + new BigDecimal(axis.y, cont) + ", " + new BigDecimal(axis.z, cont) + ")"; - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/Scale.java b/dependencies/main/java/codechicken/lib/vec/Scale.java deleted file mode 100644 index 76f4df4d46..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/Scale.java +++ /dev/null @@ -1,71 +0,0 @@ -package codechicken.lib.vec; - -import net.minecraft.client.renderer.GlStateManager; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; - -public class Scale extends Transformation { - - public Vector3 factor; - - public Scale(Vector3 factor) { - this.factor = factor; - } - - public Scale(double factor) { - this(new Vector3(factor, factor, factor)); - } - - public Scale(double x, double y, double z) { - this(new Vector3(x, y, z)); - } - - @Override - public void apply(Vector3 vec) { - vec.multiply(factor); - } - - @Override - public void applyN(Vector3 normal) { - } - - @Override - public void apply(Matrix4 mat) { - mat.scale(factor); - } - - @Override - @SideOnly (Side.CLIENT) - public void glApply() { - GlStateManager.scale(factor.x, factor.y, factor.z); - } - - @Override - public Transformation inverse() { - return new Scale(1 / factor.x, 1 / factor.y, 1 / factor.z); - } - - @Override - public Transformation merge(Transformation next) { - if (next instanceof Scale) { - return new Scale(factor.copy().multiply(((Scale) next).factor)); - } - - return null; - } - - @Override - public boolean isRedundant() { - return factor.equalsT(Vector3.one); - } - - @Override - public String toString() { - MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "Scale(" + new BigDecimal(factor.x, cont) + ", " + new BigDecimal(factor.y, cont) + ", " + new BigDecimal(factor.z, cont) + ")"; - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/SwapYZ.java b/dependencies/main/java/codechicken/lib/vec/SwapYZ.java deleted file mode 100644 index ad256dd681..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/SwapYZ.java +++ /dev/null @@ -1,20 +0,0 @@ -package codechicken.lib.vec; - -public class SwapYZ extends VariableTransformation { - - public SwapYZ() { - super(new Matrix4(1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1)); - } - - @Override - public void apply(Vector3 vec) { - double vz = vec.z; - vec.z = vec.y; - vec.y = vz; - } - - @Override - public Transformation inverse() { - return this; - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/Transformation.java b/dependencies/main/java/codechicken/lib/vec/Transformation.java deleted file mode 100644 index 3f9119d6cc..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/Transformation.java +++ /dev/null @@ -1,58 +0,0 @@ -package codechicken.lib.vec; - -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -/** - * Abstract supertype for any 3D vector transformation - */ -public abstract class Transformation extends ITransformation implements IVertexOperation { - - public static final int operationIndex = CCRenderState.registerOperation(); - - /** - * Applies this transformation to a normal (doesn't translate) - * - * @param normal The normal to transform - */ - public abstract void applyN(Vector3 normal); - - /** - * Applies this transformation to a matrix as a multiplication on the right hand side. - * - * @param mat The matrix to combine this transformation with - */ - public abstract void apply(Matrix4 mat); - - public Transformation at(Vector3 point) { - return new TransformationList(new Translation(-point.x, -point.y, -point.z), this, point.translation()); - } - - public TransformationList with(Transformation t) { - return new TransformationList(this, t); - } - - @SideOnly (Side.CLIENT) - public abstract void glApply(); - - @Override - public boolean load(CCRenderState state) { - state.pipeline.addRequirement(state.normalAttrib.operationID()); - return !isRedundant(); - } - - @Override - public void operate(CCRenderState state) { - apply(state.vert.vec); - if (state.normalAttrib.active) { - applyN(state.normal); - } - } - - @Override - public int operationID() { - return operationIndex; - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/TransformationList.java b/dependencies/main/java/codechicken/lib/vec/TransformationList.java deleted file mode 100644 index aba6449c64..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/TransformationList.java +++ /dev/null @@ -1,175 +0,0 @@ -package codechicken.lib.vec; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.util.ArrayList; -import java.util.Iterator; - -public class TransformationList extends Transformation { - - private ArrayList transformations = new ArrayList(); - private Matrix4 mat; - - public TransformationList(Transformation... transforms) { - for (Transformation t : transforms) { - if (t instanceof TransformationList) { - transformations.addAll(((TransformationList) t).transformations); - } else { - transformations.add(t); - } - } - - compact(); - } - - public Matrix4 compile() { - if (mat == null) { - mat = new Matrix4(); - for (int i = transformations.size() - 1; i >= 0; i--) { - transformations.get(i).apply(mat); - } - } - return mat; - } - - /** - * Returns a global space matrix as opposed to an object space matrix (reverse application order) - * - * @return - */ - public Matrix4 reverseCompile() { - Matrix4 mat = new Matrix4(); - for (Transformation t : transformations) { - t.apply(mat); - } - return mat; - } - - @Override - public void apply(Vector3 vec) { - if (mat != null) { - mat.apply(vec); - } else { - for (int i = 0; i < transformations.size(); i++) { - transformations.get(i).apply(vec); - } - } - } - - @Override - public void applyN(Vector3 normal) { - if (mat != null) { - mat.applyN(normal); - } else { - for (int i = 0; i < transformations.size(); i++) { - transformations.get(i).applyN(normal); - } - } - } - - @Override - public void apply(Matrix4 mat) { - mat.multiply(compile()); - } - - @Override - public TransformationList with(Transformation t) { - if (t.isRedundant()) { - return this; - } - - mat = null;//matrix invalid - if (t instanceof TransformationList) { - transformations.addAll(((TransformationList) t).transformations); - } else { - transformations.add(t); - } - - compact(); - return this; - } - - public TransformationList prepend(Transformation t) { - if (t.isRedundant()) { - return this; - } - - mat = null;//matrix invalid - if (t instanceof TransformationList) { - transformations.addAll(0, ((TransformationList) t).transformations); - } else { - transformations.add(0, t); - } - - compact(); - return this; - } - - private void compact() { - ArrayList newList = new ArrayList(transformations.size()); - Iterator iterator = transformations.iterator(); - Transformation prev = null; - while (iterator.hasNext()) { - Transformation t = iterator.next(); - if (t.isRedundant()) { - continue; - } - - if (prev != null) { - Transformation m = prev.merge(t); - if (m == null) { - newList.add(prev); - } else if (m.isRedundant()) { - t = null; - } else { - t = m; - } - } - prev = t; - } - if (prev != null) { - newList.add(prev); - } - - if (newList.size() < transformations.size()) { - transformations = newList; - mat = null; - } - - if (transformations.size() > 3 && mat == null) { - compile(); - } - } - - @Override - public boolean isRedundant() { - return transformations.size() == 0; - } - - @Override - @SideOnly (Side.CLIENT) - public void glApply() { - for (int i = transformations.size() - 1; i >= 0; i--) { - transformations.get(i).glApply(); - } - } - - @Override - public Transformation inverse() { - TransformationList rev = new TransformationList(); - for (int i = transformations.size() - 1; i >= 0; i--) { - rev.with(transformations.get(i).inverse()); - } - return rev; - } - - @Override - public String toString() { - String s = ""; - for (Transformation t : transformations) { - s += "\n" + t.toString(); - } - return s.trim(); - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/Translation.java b/dependencies/main/java/codechicken/lib/vec/Translation.java deleted file mode 100644 index 46378bc2b8..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/Translation.java +++ /dev/null @@ -1,73 +0,0 @@ -package codechicken.lib.vec; - -import net.minecraft.client.renderer.GlStateManager; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; - -//TODO Constructor for BlockPos. -public class Translation extends Transformation { - - public Vector3 vec; - - public Translation(Vector3 vec) { - this.vec = vec; - } - - public Translation(double x, double y, double z) { - this(new Vector3(x, y, z)); - } - - @Override - public void apply(Vector3 vec) { - vec.add(this.vec); - } - - @Override - public void applyN(Vector3 normal) { - } - - @Override - public void apply(Matrix4 mat) { - mat.translate(vec); - } - - @Override - public Transformation at(Vector3 point) { - return this; - } - - @Override - @SideOnly (Side.CLIENT) - public void glApply() { - GlStateManager.translate(vec.x, vec.y, vec.z); - } - - @Override - public Transformation inverse() { - return new Translation(-vec.x, -vec.y, -vec.z); - } - - @Override - public Transformation merge(Transformation next) { - if (next instanceof Translation) { - return new Translation(vec.copy().add(((Translation) next).vec)); - } - - return null; - } - - @Override - public boolean isRedundant() { - return vec.equalsT(Vector3.zero); - } - - @Override - public String toString() { - MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "Translation(" + new BigDecimal(vec.x, cont) + ", " + new BigDecimal(vec.y, cont) + ", " + new BigDecimal(vec.z, cont) + ")"; - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/VariableTransformation.java b/dependencies/main/java/codechicken/lib/vec/VariableTransformation.java deleted file mode 100644 index 6f968d7b90..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/VariableTransformation.java +++ /dev/null @@ -1,29 +0,0 @@ -package codechicken.lib.vec; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -public abstract class VariableTransformation extends Transformation { - - public Matrix4 mat; - - public VariableTransformation(Matrix4 mat) { - this.mat = mat; - } - - @Override - public void applyN(Vector3 normal) { - apply(normal); - } - - @Override - public void apply(Matrix4 mat) { - mat.multiply(this.mat); - } - - @Override - @SideOnly (Side.CLIENT) - public void glApply() { - mat.glApply(); - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/Vector3.java b/dependencies/main/java/codechicken/lib/vec/Vector3.java deleted file mode 100644 index 1635942b19..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/Vector3.java +++ /dev/null @@ -1,541 +0,0 @@ -package codechicken.lib.vec; - -import codechicken.lib.math.MathHelper; -import codechicken.lib.util.Copyable; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.Entity; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import org.lwjgl.util.vector.Vector3f; -import org.lwjgl.util.vector.Vector4f; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; - -public class Vector3 implements Copyable { - - public static Vector3 zero = new Vector3(); - public static Vector3 one = new Vector3(1, 1, 1); - public static Vector3 center = new Vector3(0.5, 0.5, 0.5); - - public double x; - public double y; - public double z; - - public Vector3() { - } - - public Vector3(double d, double d1, double d2) { - x = d; - y = d1; - z = d2; - } - - public Vector3(Vector3 vec) { - x = vec.x; - y = vec.y; - z = vec.z; - } - - public Vector3(double[] da) { - this(da[0], da[1], da[2]); - } - - public Vector3(float[] fa) { - this(fa[0], fa[1], fa[2]); - } - - public Vector3(Vec3d vec) { - x = vec.xCoord; - y = vec.yCoord; - z = vec.zCoord; - } - - @Deprecated // use Vector3.fromBlockPos //TODO, 1.11 move this to Vec3i - public Vector3(BlockPos pos) { - x = pos.getX(); - y = pos.getY(); - z = pos.getZ(); - } - - public static Vector3 fromBlockPos(BlockPos pos) { - return new Vector3(pos.getX(), pos.getY(), pos.getZ()); - } - - public static Vector3 fromBlockPosCenter(BlockPos pos) { - return fromBlockPos(pos).add(0.5); - } - - public static Vector3 fromEntity(Entity e) { - return new Vector3(e.posX, e.posY, e.posZ); - } - - public static Vector3 fromEntityCenter(Entity e) { - return new Vector3(e.posX, e.posY - e.getYOffset() + e.height / 2, e.posZ); - } - - public static Vector3 fromTile(TileEntity tile) { - return fromBlockPos(tile.getPos()); - } - - public static Vector3 fromTileCenter(TileEntity tile) { - return fromTile(tile).add(0.5); - } - - public static Vector3 fromAxes(double[] da) { - return new Vector3(da[2], da[0], da[1]); - } - - public static Vector3 fromAxes(float[] fa) { - return new Vector3(fa[2], fa[0], fa[1]); - } - - public static Vector3 fromArray(double[] da) { - return new Vector3(da[0], da[1], da[2]); - } - - public static Vector3 fromArray(float[] fa) { - return new Vector3(fa[0], fa[1], fa[2]); - } - - public Vec3d vec3() { - return new Vec3d(x, y, z); - } - - public BlockPos pos() { - return new BlockPos(x, y, z); - } - - @SideOnly (Side.CLIENT) - public Vector3f vector3f() { - return new Vector3f((float) x, (float) y, (float) z); - } - - @SideOnly (Side.CLIENT) - public Vector4f vector4f() { - return new Vector4f((float) x, (float) y, (float) z, 1); - } - - @SideOnly (Side.CLIENT) - public void glVertex() { - GlStateManager.glVertex3f((float) x, (float) y, (float) z); - } - - public Vector3 set(double x1, double y1, double z1) { - x = x1; - y = y1; - z = z1; - return this; - } - - public Vector3 set(double d) { - return set(d, d, d); - } - - public Vector3 set(Vector3 vec) { - return set(vec.x, vec.y, vec.z); - } - - public Vector3 set(double[] da) { - return set(da[0], da[1], da[2]); - } - - public Vector3 set(float[] fa) { - return set(fa[0], fa[1], fa[2]); - } - - public Vector3 add(double dx, double dy, double dz) { - x += dx; - y += dy; - z += dz; - return this; - } - - public Vector3 add(double d) { - return add(d, d, d); - } - - public Vector3 add(Vector3 vec) { - return add(vec.x, vec.y, vec.z); - } - - public Vector3 add(BlockPos pos) { - return add(pos.getX(), pos.getY(), pos.getZ()); - } - - public Vector3 subtract(double dx, double dy, double dz) { - x -= dx; - y -= dy; - z -= dz; - return this; - } - - public Vector3 subtract(double d) { - return subtract(d, d, d); - } - - public Vector3 subtract(Vector3 vec) { - return subtract(vec.x, vec.y, vec.z); - } - - public Vector3 subtract(BlockPos pos) { - return subtract(pos.getX(), pos.getY(), pos.getZ()); - } - - @Deprecated //Use subtract - public Vector3 sub(Vector3 vec) { - return subtract(vec); - } - - @Deprecated //Use subtract - public Vector3 sub(BlockPos pos) { - return subtract(pos); - } - - public Vector3 multiply(double fx, double fy, double fz) { - x *= fx; - y *= fy; - z *= fz; - return this; - } - - public Vector3 multiply(double f) { - return multiply(f, f, f); - } - - public Vector3 multiply(Vector3 f) { - return multiply(f.x, f.y, f.z); - } - - public Vector3 divide(double fx, double fy, double fz) { - x /= fx; - y /= fy; - z /= fz; - return this; - } - - public Vector3 divide(double f) { - return divide(f, f, f); - } - - public Vector3 divide(Vector3 vec) { - return divide(vec.x, vec.y, vec.z); - } - - public Vector3 divide(BlockPos pos) { - return divide(pos.getX(), pos.getY(), pos.getZ()); - } - - public Vector3 floor() { - x = MathHelper.floor(x); - y = MathHelper.floor(y); - z = MathHelper.floor(z); - return this; - } - - public Vector3 celi() { - x = MathHelper.ceil(x); - y = MathHelper.ceil(y); - z = MathHelper.ceil(z); - return this; - } - - public double mag() { - return Math.sqrt(x * x + y * y + z * z); - } - - public double magSquared() { - return x * x + y * y + z * z; - } - - public Vector3 negate() { - x = -x; - y = -y; - z = -z; - return this; - } - - public Vector3 normalize() { - double d = mag(); - if (d != 0) { - multiply(1 / d); - } - return this; - } - - public double dotProduct(double x1, double y1, double z1) { - return x1 * x + y1 * y + z1 * z; - } - - public double dotProduct(Vector3 vec) { - double d = vec.x * x + vec.y * y + vec.z * z; - - if (d > 1 && d < 1.00001) { - d = 1; - } else if (d < -1 && d > -1.00001) { - d = -1; - } - return d; - } - - public Vector3 crossProduct(Vector3 vec) { - double d = y * vec.z - z * vec.y; - double d1 = z * vec.x - x * vec.z; - double d2 = x * vec.y - y * vec.x; - x = d; - y = d1; - z = d2; - return this; - } - - public Vector3 perpendicular() { - if (z == 0) { - return zCrossProduct(); - } - return xCrossProduct(); - } - - public Vector3 xCrossProduct() { - double d = z; - double d1 = -y; - x = 0; - y = d; - z = d1; - return this; - } - - public Vector3 zCrossProduct() { - double d = y; - double d1 = -x; - x = d; - y = d1; - z = 0; - return this; - } - - public Vector3 yCrossProduct() { - double d = -z; - double d1 = x; - x = d; - y = 0; - z = d1; - return this; - } - - public double scalarProject(Vector3 b) { - double l = b.mag(); - return l == 0 ? 0 : dotProduct(b) / l; - } - - public Vector3 project(Vector3 b) { - double l = b.magSquared(); - if (l == 0) { - set(0, 0, 0); - return this; - } - double m = dotProduct(b) / l; - set(b).multiply(m); - return this; - } - - public Vector3 rotate(double angle, Vector3 axis) { - Quat.aroundAxis(axis.copy().normalize(), angle).rotate(this); - return this; - } - - public Vector3 rotate(Quat rotator) { - rotator.rotate(this); - return this; - } - - public double angle(Vector3 vec) { - return Math.acos(copy().normalize().dotProduct(vec.copy().normalize())); - } - - public Vector3 YZintercept(Vector3 end, double px) { - double dx = end.x - x; - double dy = end.y - y; - double dz = end.z - z; - - if (dx == 0) { - return null; - } - - double d = (px - x) / dx; - if (MathHelper.between(-1E-5, d, 1E-5)) { - return this; - } - - if (!MathHelper.between(0, d, 1)) { - return null; - } - - x = px; - y += d * dy; - z += d * dz; - return this; - } - - public Vector3 XZintercept(Vector3 end, double py) { - double dx = end.x - x; - double dy = end.y - y; - double dz = end.z - z; - - if (dy == 0) { - return null; - } - - double d = (py - y) / dy; - if (MathHelper.between(-1E-5, d, 1E-5)) { - return this; - } - - if (!MathHelper.between(0, d, 1)) { - return null; - } - - x += d * dx; - y = py; - z += d * dz; - return this; - } - - public Vector3 XYintercept(Vector3 end, double pz) { - double dx = end.x - x; - double dy = end.y - y; - double dz = end.z - z; - - if (dz == 0) { - return null; - } - - double d = (pz - z) / dz; - if (MathHelper.between(-1E-5, d, 1E-5)) { - return this; - } - - if (!MathHelper.between(0, d, 1)) { - return null; - } - - x += d * dx; - y += d * dy; - z = pz; - return this; - } - - public boolean isZero() { - return x == 0 && y == 0 && z == 0; - } - - public boolean isAxial() { - return x == 0 ? (y == 0 || z == 0) : (y == 0 && z == 0); - } - - public double getSide(int side) { - switch (side) { - case 0: - case 1: - return y; - case 2: - case 3: - return z; - case 4: - case 5: - return x; - } - throw new IndexOutOfBoundsException("Switch Falloff"); - } - - public Vector3 setSide(int s, double v) { - switch (s) { - case 0: - case 1: - y = v; - break; - case 2: - case 3: - z = v; - break; - case 4: - case 5: - x = v; - break; - default: - throw new IndexOutOfBoundsException("Switch Falloff"); - } - return this; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof Vector3)) { - return false; - } - Vector3 v = (Vector3) o; - return x == v.x && y == v.y && z == v.z; - } - - /** - * Equals method with tolerance - * - * @return true if this is equal to v within +-1E-5 - */ - public boolean equalsT(Vector3 v) { - return MathHelper.between(x - 1E-5, v.x, x + 1E-5) && MathHelper.between(y - 1E-5, v.y, y + 1E-5) && MathHelper.between(z - 1E-5, v.z, z + 1E-5); - } - - public Vector3 copy() { - return new Vector3(this); - } - - public String toString() { - MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "Vector3(" + new BigDecimal(x, cont) + ", " + new BigDecimal(y, cont) + ", " + new BigDecimal(z, cont) + ")"; - } - - public Translation translation() { - return new Translation(this); - } - - public Vector3 apply(Transformation t) { - t.apply(this); - return this; - } - - public Vector3 $tilde() { - return normalize(); - } - - public Vector3 unary_$tilde() { - return normalize(); - } - - public Vector3 $plus(Vector3 v) { - return add(v); - } - - public Vector3 $minus(Vector3 v) { - return subtract(v); - } - - public Vector3 $times(double d) { - return multiply(d); - } - - public Vector3 $div(double d) { - return multiply(1 / d); - } - - public Vector3 $times(Vector3 v) { - return crossProduct(v); - } - - public double $dot$times(Vector3 v) { - return dotProduct(v); - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/Vertex5.java b/dependencies/main/java/codechicken/lib/vec/Vertex5.java deleted file mode 100644 index 9f759ac923..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/Vertex5.java +++ /dev/null @@ -1,77 +0,0 @@ -package codechicken.lib.vec; - -import codechicken.lib.util.Copyable; -import codechicken.lib.vec.uv.UV; -import codechicken.lib.vec.uv.UVTransformation; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; - -public class Vertex5 implements Copyable { - - public Vector3 vec; - public UV uv; - - public Vertex5() { - this(new Vector3(), new UV()); - } - - public Vertex5(Vector3 vert, UV uv) { - this.vec = vert; - this.uv = uv; - } - - public Vertex5(Vector3 vert, double u, double v) { - this(vert, new UV(u, v)); - } - - public Vertex5(double x, double y, double z, double u, double v) { - this(x, y, z, u, v, 0); - } - - public Vertex5(double x, double y, double z, double u, double v, int tex) { - this(new Vector3(x, y, z), new UV(u, v, tex)); - } - - public Vertex5 set(double x, double y, double z, double u, double v) { - vec.set(x, y, z); - uv.set(u, v); - return this; - } - - public Vertex5 set(double x, double y, double z, double u, double v, int tex) { - vec.set(x, y, z); - uv.set(u, v, tex); - return this; - } - - public Vertex5 set(Vertex5 vert) { - vec.set(vert.vec); - uv.set(vert.uv); - return this; - } - - public Vertex5(Vertex5 vertex5) { - this(vertex5.vec.copy(), vertex5.uv.copy()); - } - - public Vertex5 copy() { - return new Vertex5(this); - } - - public String toString() { - MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "Vertex: (" + new BigDecimal(vec.x, cont) + ", " + new BigDecimal(vec.y, cont) + ", " + new BigDecimal(vec.z, cont) + ") " + "(" + new BigDecimal(uv.u, cont) + ", " + new BigDecimal(uv.v, cont) + ") (" + uv.tex + ")"; - } - - public Vertex5 apply(Transformation t) { - vec.apply(t); - return this; - } - - public Vertex5 apply(UVTransformation t) { - uv.apply(t); - return this; - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/uv/IconTransformation.java b/dependencies/main/java/codechicken/lib/vec/uv/IconTransformation.java deleted file mode 100644 index a06d97927a..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/uv/IconTransformation.java +++ /dev/null @@ -1,31 +0,0 @@ -package codechicken.lib.vec.uv; - -import codechicken.lib.render.CCRenderState; -import codechicken.lib.vec.IrreversibleTransformationException; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; - -public class IconTransformation extends UVTransformation { - - public TextureAtlasSprite icon; - - public IconTransformation(TextureAtlasSprite icon) { - this.icon = icon; - } - - @Override - public void operate(CCRenderState state) { - super.operate(state); - state.sprite = icon; - } - - @Override - public void apply(UV uv) { - uv.u = icon.getInterpolatedU(uv.u * 16); - uv.v = icon.getInterpolatedV(uv.v * 16); - } - - @Override - public UVTransformation inverse() { - throw new IrreversibleTransformationException(this); - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/uv/IconVertexRangeUVTransform.java b/dependencies/main/java/codechicken/lib/vec/uv/IconVertexRangeUVTransform.java deleted file mode 100644 index 11b94e292c..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/uv/IconVertexRangeUVTransform.java +++ /dev/null @@ -1,112 +0,0 @@ -package codechicken.lib.vec.uv; - -import codechicken.lib.math.MathHelper; -import codechicken.lib.render.CCRenderState; -import codechicken.lib.util.TripleABC; -import codechicken.lib.vec.IrreversibleTransformationException; -import com.google.common.collect.ImmutableList; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; - -import java.util.LinkedList; -import java.util.List; - -/** - * Created by covers1624 on 8/29/2016. - * This UVTransform is used to assign "reserved" vertex indexes for an icon transform. - */ -public class IconVertexRangeUVTransform extends UVTransformation { - - private final ImmutableList> transformMap; - - private IconVertexRangeUVTransform(List> transformMap) { - this.transformMap = ImmutableList.copyOf(transformMap); - } - - /** - * Creates a new Builder for the IconVertexRangeUVTransform. - * - * @return The Builder. - */ - public static Builder builder() { - return new Builder(); - } - - @Override - public void operate(CCRenderState state) { - UV uv = state.vert.uv; - int index = state.vertexIndex; - TextureAtlasSprite sprite = getSpriteForVertexIndex(index); - if (sprite == null) { - return; - } - uv.u = sprite.getInterpolatedU(uv.u * 16); - uv.v = sprite.getInterpolatedV(uv.v * 16); - state.sprite = getSpriteForVertexIndex(state.vertexIndex); - } - - @Override - public void apply(UV uv) { - //We override operate as we need CCRS access. - } - - @Override - public UVTransformation inverse() { - throw new IrreversibleTransformationException(this); - } - - /** - * Retrieves a TextureAtlasSprite from the internal map based on a vertex index. - * - * @param index The vertex index. - * @return Returns the Icon, Null if no transform for the vertex index. - */ - public TextureAtlasSprite getSpriteForVertexIndex(int index) { - for (TripleABC entry : transformMap) { - if (MathHelper.between(entry.getA(), index, entry.getB())) { - return entry.getC(); - } - } - return null; - } - - /** - * Builds a IconVertexRangeUVTransform. - */ - public static class Builder { - - private LinkedList> transformMap; - - private Builder() { - transformMap = new LinkedList>(); - } - - /** - * Builds the IconVertexRangeUVTransform, Should be safe to call this more than once. - * - * @return The IconVertexRangeUVTransform. - */ - public IconVertexRangeUVTransform build() { - return new IconVertexRangeUVTransform(transformMap); - } - - /** - * Reserves a range for a specific transform. - * - * @param start The start index to reserve. - * @param end The end vertex to reserve. - * @param sprite The sprite to transform to in the range. - * @return The same instance of the builder. - * @throws IllegalArgumentException Thrown if the specified vertex range is already reserved. - */ - public Builder addTransform(int start, int end, TextureAtlasSprite sprite) { - for (TripleABC entry : transformMap) { - if (MathHelper.between(entry.getA(), start, entry.getB()) || MathHelper.between(entry.getA(), end, entry.getB())) { - throw new IllegalArgumentException("Unable to have overlapping sprite transforms!"); - } - } - transformMap.add(new TripleABC(start, end, sprite)); - return this; - } - - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/uv/MultiIconTransformation.java b/dependencies/main/java/codechicken/lib/vec/uv/MultiIconTransformation.java deleted file mode 100644 index 77263e46a2..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/uv/MultiIconTransformation.java +++ /dev/null @@ -1,33 +0,0 @@ -package codechicken.lib.vec.uv; - -import codechicken.lib.render.CCRenderState; -import codechicken.lib.vec.IrreversibleTransformationException; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; - -public class MultiIconTransformation extends UVTransformation { - - public TextureAtlasSprite[] icons; - private TextureAtlasSprite icon; - - public MultiIconTransformation(TextureAtlasSprite... icons) { - this.icons = icons; - } - - @Override - public void operate(CCRenderState state) { - super.operate(state); - state.sprite = icon; - } - - @Override - public void apply(UV uv) { - icon = icons[uv.tex % icons.length]; - uv.u = icon.getInterpolatedU(uv.u * 16); - uv.v = icon.getInterpolatedV(uv.v * 16); - } - - @Override - public UVTransformation inverse() { - throw new IrreversibleTransformationException(this); - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/uv/ScaledIconTransformation.java b/dependencies/main/java/codechicken/lib/vec/uv/ScaledIconTransformation.java deleted file mode 100644 index c339b6be78..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/uv/ScaledIconTransformation.java +++ /dev/null @@ -1,29 +0,0 @@ -package codechicken.lib.vec.uv; - -import net.minecraft.client.renderer.texture.TextureAtlasSprite; - -public class ScaledIconTransformation extends IconTransformation { - - double su = 0.0F; - double sv = 0.0F; - - public ScaledIconTransformation(TextureAtlasSprite icon) { - - super(icon); - } - - public ScaledIconTransformation(TextureAtlasSprite icon, double scaleu, double scalev) { - - super(icon); - - su = scaleu; - sv = scalev; - } - - @Override - public void apply(UV texcoord) { - - texcoord.u = icon.getInterpolatedU(texcoord.u % 2 * 16) + su * (icon.getMaxU() - icon.getMinU()); - texcoord.v = icon.getInterpolatedV(texcoord.v % 2 * 16) + sv * (icon.getMaxV() - icon.getMinV()); - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/uv/UV.java b/dependencies/main/java/codechicken/lib/vec/uv/UV.java deleted file mode 100644 index 86e21daa63..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/uv/UV.java +++ /dev/null @@ -1,81 +0,0 @@ -package codechicken.lib.vec.uv; - -import codechicken.lib.util.Copyable; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; - -public class UV implements Copyable { - - public double u; - public double v; - public int tex; - - public UV() { - } - - public UV(double u, double v) { - this(u, v, 0); - } - - public UV(double u, double v, int tex) { - this.u = u; - this.v = v; - this.tex = tex; - } - - public UV(UV uv) { - this(uv.u, uv.v, uv.tex); - } - - public UV set(double u, double v, int tex) { - this.u = u; - this.v = v; - this.tex = tex; - return this; - } - - public UV set(double u, double v) { - return set(u, v, tex); - } - - public UV set(UV uv) { - return set(uv.u, uv.v, uv.tex); - } - - public UV copy() { - return new UV(this); - } - - public UV add(UV uv) { - u += uv.u; - v += uv.v; - return this; - } - - public UV multiply(double d) { - u *= d; - v *= d; - return this; - } - - public String toString() { - MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "UV(" + new BigDecimal(u, cont) + ", " + new BigDecimal(v, cont) + ")"; - } - - public UV apply(UVTransformation t) { - t.apply(this); - return this; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof UV)) { - return false; - } - UV uv = (UV) o; - return u == uv.u && v == uv.v; - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/uv/UVRotation.java b/dependencies/main/java/codechicken/lib/vec/uv/UVRotation.java deleted file mode 100644 index cc5747a0eb..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/uv/UVRotation.java +++ /dev/null @@ -1,53 +0,0 @@ -package codechicken.lib.vec.uv; - -import codechicken.lib.math.MathHelper; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; - -public class UVRotation extends UVTransformation { - - public double angle; - - /** - * @param angle The angle to rotate counterclockwise in radians - */ - public UVRotation(double angle) { - this.angle = angle; - } - - @Override - public void apply(UV uv) { - double c = MathHelper.cos(angle); - double s = MathHelper.sin(angle); - double u2 = c * uv.u + s * uv.v; - uv.v = -s * uv.u + c * uv.v; - uv.u = u2; - } - - @Override - public UVTransformation inverse() { - return new UVRotation(-angle); - } - - @Override - public UVTransformation merge(UVTransformation next) { - if (next instanceof UVRotation) { - return new UVRotation(angle + ((UVRotation) next).angle); - } - - return null; - } - - @Override - public boolean isRedundant() { - return MathHelper.between(-1E-5, angle, 1E-5); - } - - @Override - public String toString() { - MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "UVRotation(" + new BigDecimal(angle, cont) + ")"; - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/uv/UVScale.java b/dependencies/main/java/codechicken/lib/vec/uv/UVScale.java deleted file mode 100644 index 3ce0e0c721..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/uv/UVScale.java +++ /dev/null @@ -1,37 +0,0 @@ -package codechicken.lib.vec.uv; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; - -public class UVScale extends UVTransformation { - - double su; - double sv; - - public UVScale(double scaleu, double scalev) { - su = scaleu; - sv = scalev; - } - - public UVScale(double d) { - this(d, d); - } - - @Override - public void apply(UV uv) { - uv.u *= su; - uv.v *= sv; - } - - @Override - public UVTransformation inverse() { - return new UVScale(1 / su, 1 / sv); - } - - @Override - public String toString() { - MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "UVScale(" + new BigDecimal(su, cont) + ", " + new BigDecimal(sv, cont) + ")"; - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/uv/UVTransformation.java b/dependencies/main/java/codechicken/lib/vec/uv/UVTransformation.java deleted file mode 100644 index 317e347fea..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/uv/UVTransformation.java +++ /dev/null @@ -1,39 +0,0 @@ -package codechicken.lib.vec.uv; - -import codechicken.lib.render.CCRenderState; -import codechicken.lib.render.pipeline.IVertexOperation; -import codechicken.lib.vec.ITransformation; - -/** - * Abstract supertype for any UV transformation - */ -public abstract class UVTransformation extends ITransformation implements IVertexOperation { - - public static final int operationIndex = CCRenderState.registerOperation(); - - public UVTransformation at(UV point) { - return new UVTransformationList(new UVTranslation(-point.u, -point.v), this, new UVTranslation(point.u, point.v)); - } - - public UVTransformationList with(UVTransformation t) { - return new UVTransformationList(this, t); - } - - @Override - public boolean load(CCRenderState state) { - return !isRedundant(); - } - - @Override - public void operate(CCRenderState state) { - apply(state.vert.uv); - state.sprite = null; - } - - @Override - public int operationID() { - return operationIndex; - } -} - - diff --git a/dependencies/main/java/codechicken/lib/vec/uv/UVTransformationList.java b/dependencies/main/java/codechicken/lib/vec/uv/UVTransformationList.java deleted file mode 100644 index 0bee6fa5c1..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/uv/UVTransformationList.java +++ /dev/null @@ -1,113 +0,0 @@ -package codechicken.lib.vec.uv; - -import java.util.ArrayList; -import java.util.Iterator; - -public class UVTransformationList extends UVTransformation { - - private ArrayList transformations = new ArrayList(); - - public UVTransformationList(UVTransformation... transforms) { - for (UVTransformation t : transforms) { - if (t instanceof UVTransformationList) { - transformations.addAll(((UVTransformationList) t).transformations); - } else { - transformations.add(t); - } - } - - compact(); - } - - @Override - public void apply(UV uv) { - for (int i = 0; i < transformations.size(); i++) { - transformations.get(i).apply(uv); - } - } - - @Override - public UVTransformationList with(UVTransformation t) { - if (t.isRedundant()) { - return this; - } - - if (t instanceof UVTransformationList) { - transformations.addAll(((UVTransformationList) t).transformations); - } else { - transformations.add(t); - } - - compact(); - return this; - } - - public UVTransformationList prepend(UVTransformation t) { - if (t.isRedundant()) { - return this; - } - - if (t instanceof UVTransformationList) { - transformations.addAll(0, ((UVTransformationList) t).transformations); - } else { - transformations.add(0, t); - } - - compact(); - return this; - } - - private void compact() { - ArrayList newList = new ArrayList(transformations.size()); - Iterator iterator = transformations.iterator(); - UVTransformation prev = null; - while (iterator.hasNext()) { - UVTransformation t = iterator.next(); - if (t.isRedundant()) { - continue; - } - - if (prev != null) { - UVTransformation m = prev.merge(t); - if (m == null) { - newList.add(prev); - } else if (m.isRedundant()) { - t = null; - } else { - t = m; - } - } - prev = t; - } - if (prev != null) { - newList.add(prev); - } - - if (newList.size() < transformations.size()) { - transformations = newList; - } - } - - @Override - public boolean isRedundant() { - return transformations.size() == 0; - } - - @Override - public UVTransformation inverse() { - UVTransformationList rev = new UVTransformationList(); - for (int i = transformations.size() - 1; i >= 0; i--) { - rev.with(transformations.get(i).inverse()); - } - return rev; - } - - @Override - public String toString() { - String s = ""; - for (UVTransformation t : transformations) { - s += "\n" + t.toString(); - } - return s.trim(); - } -} diff --git a/dependencies/main/java/codechicken/lib/vec/uv/UVTranslation.java b/dependencies/main/java/codechicken/lib/vec/uv/UVTranslation.java deleted file mode 100644 index 728867c255..0000000000 --- a/dependencies/main/java/codechicken/lib/vec/uv/UVTranslation.java +++ /dev/null @@ -1,55 +0,0 @@ -package codechicken.lib.vec.uv; - -import codechicken.lib.math.MathHelper; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.math.RoundingMode; - -public class UVTranslation extends UVTransformation { - - public double du; - public double dv; - - public UVTranslation(double u, double v) { - du = u; - dv = v; - } - - @Override - public void apply(UV uv) { - uv.u += du; - uv.v += dv; - } - - @Override - public UVTransformation at(UV point) { - return this; - } - - @Override - public UVTransformation inverse() { - return new UVTranslation(-du, -dv); - } - - @Override - public UVTransformation merge(UVTransformation next) { - if (next instanceof UVTranslation) { - UVTranslation t = (UVTranslation) next; - return new UVTranslation(du + t.du, dv + t.dv); - } - - return null; - } - - @Override - public boolean isRedundant() { - return MathHelper.between(-1E-5, du, 1E-5) && MathHelper.between(-1E-5, dv, 1E-5); - } - - @Override - public String toString() { - MathContext cont = new MathContext(4, RoundingMode.HALF_UP); - return "UVTranslation(" + new BigDecimal(du, cont) + ", " + new BigDecimal(dv, cont) + ")"; - } -} diff --git a/dependencies/main/java/codechicken/lib/world/ChunkExtension.java b/dependencies/main/java/codechicken/lib/world/ChunkExtension.java deleted file mode 100644 index 28192ed750..0000000000 --- a/dependencies/main/java/codechicken/lib/world/ChunkExtension.java +++ /dev/null @@ -1,71 +0,0 @@ -package codechicken.lib.world; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.Packet; -import net.minecraft.util.math.ChunkPos; -import net.minecraft.world.chunk.Chunk; - -import java.util.HashSet; - -public abstract class ChunkExtension { - - public final Chunk chunk; - public final ChunkPos coord; - public final WorldExtension world; - public HashSet watchedPlayers; - - public ChunkExtension(Chunk chunk, WorldExtension world) { - this.chunk = chunk; - coord = chunk.getChunkCoordIntPair(); - this.world = world; - watchedPlayers = new HashSet(); - } - - public void loadData(NBTTagCompound tag) { - } - - public void saveData(NBTTagCompound tag) { - } - - public void load() { - } - - public void unload() { - } - - public final void sendPacketToPlayers(Packet packet) { - for (EntityPlayerMP player : watchedPlayers) { - player.connection.sendPacket(packet); - } - } - - public final void watchPlayer(EntityPlayerMP player) { - watchedPlayers.add(player); - onWatchPlayer(player); - } - - public void onWatchPlayer(EntityPlayerMP player) { - } - - public final void unwatchPlayer(EntityPlayerMP player) { - watchedPlayers.remove(player); - onUnWatchPlayer(player); - } - - public void onUnWatchPlayer(EntityPlayerMP player) { - } - - public void sendUpdatePackets() { - } - - @Override - public int hashCode() { - return coord.chunkXPos ^ coord.chunkZPos; - } - - @Override - public boolean equals(Object o) { - return (o instanceof ChunkExtension && ((ChunkExtension) o).coord.equals(coord)) || (o instanceof ChunkPos && coord.equals(o)) || (o instanceof Long && (Long) o == (((long) coord.chunkXPos) << 32 | coord.chunkZPos)); - } -} diff --git a/dependencies/main/java/codechicken/lib/world/IChunkLoadTile.java b/dependencies/main/java/codechicken/lib/world/IChunkLoadTile.java deleted file mode 100644 index 459086f919..0000000000 --- a/dependencies/main/java/codechicken/lib/world/IChunkLoadTile.java +++ /dev/null @@ -1,12 +0,0 @@ -package codechicken.lib.world; - -/** - * Provides a callback for tile entities when a chunk is loaded, as an alternative to validate when the chunk hasn't been added to the world. - * To hook all world join/seperate events. Use this, TileEntity.validate with a worldObj.blockExists check, TileEntity.onChunkUnload and TileEntity.invalidate - * Be sure to call TileChunkLoadHook.init() from your mod during initialisation - * You could easily implement this in your own mod, but providing it here reduces the number of times the chunkTileEntityMap needs to be iterated - */ -public interface IChunkLoadTile { - - void onChunkLoad(); -} diff --git a/dependencies/main/java/codechicken/lib/world/TileChunkLoadHook.java b/dependencies/main/java/codechicken/lib/world/TileChunkLoadHook.java deleted file mode 100644 index 0e52a2380f..0000000000 --- a/dependencies/main/java/codechicken/lib/world/TileChunkLoadHook.java +++ /dev/null @@ -1,33 +0,0 @@ -package codechicken.lib.world; - -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.world.ChunkEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -import java.util.ArrayList; -import java.util.List; - -public class TileChunkLoadHook { - - private static boolean init; - - public static void init() { - if (init) { - return; - } - init = true; - - MinecraftForge.EVENT_BUS.register(new TileChunkLoadHook()); - } - - @SubscribeEvent - public void onChunkLoad(ChunkEvent.Load event) { - List list = new ArrayList(event.getChunk().getTileEntityMap().values()); - for (TileEntity t : list) { - if (t instanceof IChunkLoadTile) { - ((IChunkLoadTile) t).onChunkLoad(); - } - } - } -} diff --git a/dependencies/main/java/codechicken/lib/world/WorldExtension.java b/dependencies/main/java/codechicken/lib/world/WorldExtension.java deleted file mode 100644 index c44a0afb40..0000000000 --- a/dependencies/main/java/codechicken/lib/world/WorldExtension.java +++ /dev/null @@ -1,103 +0,0 @@ -package codechicken.lib.world; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; - -import java.util.HashMap; - -public abstract class WorldExtension { - - public final World world; - public HashMap chunkMap = new HashMap(); - - public WorldExtension(World world) { - this.world = world; - } - - public void load() { - } - - public void unload() { - } - - public void save() { - } - - public void preTick() { - } - - public void postTick() { - } - - protected final void addChunk(ChunkExtension extension) { - chunkMap.put(extension.chunk, extension); - } - - protected final void loadChunk(Chunk chunk) { - ChunkExtension extension = chunkMap.get(chunk); - if (extension != null) { - extension.load(); - } - } - - protected final void unloadChunk(Chunk chunk) { - ChunkExtension extension = chunkMap.get(chunk); - if (extension != null) { - extension.unload(); - } - } - - protected final void loadChunkData(Chunk chunk, NBTTagCompound tag) { - ChunkExtension extension = chunkMap.get(chunk); - if (extension != null) { - extension.loadData(tag); - } - } - - protected final void saveChunkData(Chunk chunk, NBTTagCompound tag) { - ChunkExtension extension = chunkMap.get(chunk); - if (extension != null) { - extension.saveData(tag); - } - } - - protected final void remChunk(Chunk chunk) { - chunkMap.remove(chunk); - } - - protected final void watchChunk(Chunk chunk, EntityPlayerMP player) { - ChunkExtension extension = chunkMap.get(chunk); - if (extension != null) { - extension.watchPlayer(player); - } - } - - protected final void unwatchChunk(Chunk chunk, EntityPlayerMP player) { - ChunkExtension extension = chunkMap.get(chunk); - if (extension != null) { - extension.unwatchPlayer(player); - } - } - - protected final void sendChunkUpdates(Chunk chunk) { - ChunkExtension extension = chunkMap.get(chunk); - if (extension != null) { - extension.sendUpdatePackets(); - } - } - - public boolean containsChunk(Chunk chunk) { - return chunkMap.containsKey(chunk); - } - - public ChunkExtension getChunkExtension(int chunkXPos, int chunkZPos) { - if (!world.isBlockLoaded(new BlockPos(chunkXPos << 4, 128, chunkZPos << 4))) { - return null; - } - - return chunkMap.get(world.getChunkFromChunkCoords(chunkXPos, chunkZPos)); - } -} diff --git a/dependencies/main/java/codechicken/lib/world/WorldExtensionInstantiator.java b/dependencies/main/java/codechicken/lib/world/WorldExtensionInstantiator.java deleted file mode 100644 index 38a4582aa9..0000000000 --- a/dependencies/main/java/codechicken/lib/world/WorldExtensionInstantiator.java +++ /dev/null @@ -1,17 +0,0 @@ -package codechicken.lib.world; - -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; - -public abstract class WorldExtensionInstantiator { - - public int instantiatorID; - - public abstract WorldExtension createWorldExtension(World world); - - public abstract ChunkExtension createChunkExtension(Chunk chunk, WorldExtension world); - - public WorldExtension getExtension(World world) { - return WorldExtensionManager.getWorldExtension(world, instantiatorID); - } -} diff --git a/dependencies/main/java/codechicken/lib/world/WorldExtensionManager.java b/dependencies/main/java/codechicken/lib/world/WorldExtensionManager.java deleted file mode 100644 index c28645b6ba..0000000000 --- a/dependencies/main/java/codechicken/lib/world/WorldExtensionManager.java +++ /dev/null @@ -1,208 +0,0 @@ -package codechicken.lib.world; - -import net.minecraft.client.Minecraft; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.world.ChunkDataEvent; -import net.minecraftforge.event.world.ChunkEvent; -import net.minecraftforge.event.world.ChunkWatchEvent.UnWatch; -import net.minecraftforge.event.world.ChunkWatchEvent.Watch; -import net.minecraftforge.event.world.WorldEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import java.util.ArrayList; -import java.util.HashMap; - -public class WorldExtensionManager { - - public static class WorldExtensionEventHandler { - - @SubscribeEvent - public void onChunkDataLoad(ChunkDataEvent.Load event) { - if (!worldMap.containsKey(event.getWorld())) { - WorldExtensionManager.onWorldLoad(event.getWorld()); - } - - createChunkExtension(event.getWorld(), event.getChunk()); - - for (WorldExtension extension : worldMap.get(event.getWorld())) { - extension.loadChunkData(event.getChunk(), event.getData()); - } - } - - @SubscribeEvent - public void onChunkDataSave(ChunkDataEvent.Save event) { - for (WorldExtension extension : worldMap.get(event.getWorld())) { - extension.saveChunkData(event.getChunk(), event.getData()); - } - - if (!event.getChunk().isLoaded()) { - removeChunk(event.getWorld(), event.getChunk()); - } - } - - @SubscribeEvent - public void onChunkLoad(ChunkEvent.Load event) { - if (!worldMap.containsKey(event.getWorld())) { - WorldExtensionManager.onWorldLoad(event.getWorld()); - } - - createChunkExtension(event.getWorld(), event.getChunk()); - - for (WorldExtension extension : worldMap.get(event.getWorld())) { - extension.loadChunk(event.getChunk()); - } - } - - @SubscribeEvent - public void onChunkUnLoad(ChunkEvent.Unload event) { - if (event.getChunk().isEmpty()) { - return; - } - //TODO Maybe gate against worldMap.get returning null. Some dimension may be doing stupid things. - for (WorldExtension extension : worldMap.get(event.getWorld())) { - extension.unloadChunk(event.getChunk()); - } - - if (event.getWorld().isRemote) { - removeChunk(event.getWorld(), event.getChunk()); - } - } - - @SubscribeEvent - public void onWorldSave(WorldEvent.Save event) { - if (worldMap.containsKey(event.getWorld())) { - for (WorldExtension extension : worldMap.get(event.getWorld())) { - extension.save(); - } - } - } - - @SubscribeEvent - public void onWorldLoad(WorldEvent.Load event) { - if (!worldMap.containsKey(event.getWorld())) { - WorldExtensionManager.onWorldLoad(event.getWorld()); - } - } - - @SubscribeEvent - public void onWorldUnLoad(WorldEvent.Unload event) { - if (worldMap.containsKey(event.getWorld()))//because force closing unloads a world twice - { - for (WorldExtension extension : worldMap.remove(event.getWorld())) { - extension.unload(); - } - } - } - - @SubscribeEvent - public void onChunkWatch(Watch event) { - Chunk chunk = event.getPlayer().worldObj.getChunkFromChunkCoords(event.getChunk().chunkXPos, event.getChunk().chunkZPos); - for (WorldExtension extension : worldMap.get(event.getPlayer().worldObj)) { - extension.watchChunk(chunk, event.getPlayer()); - } - } - - @SubscribeEvent - @SideOnly (Side.CLIENT) - public void onChunkUnWatch(UnWatch event) { - Chunk chunk = event.getPlayer().worldObj.getChunkFromChunkCoords(event.getChunk().chunkXPos, event.getChunk().chunkZPos); - for (WorldExtension extension : worldMap.get(event.getPlayer().worldObj)) { - extension.unwatchChunk(chunk, event.getPlayer()); - } - } - - @SubscribeEvent - @SideOnly (Side.CLIENT) - public void clientTick(TickEvent.ClientTickEvent event) { - World world = Minecraft.getMinecraft().theWorld; - if (worldMap.containsKey(world)) { - if (event.phase == TickEvent.Phase.START) { - preTick(world); - } else { - postTick(world); - } - } - } - - @SubscribeEvent - public void serverTick(TickEvent.WorldTickEvent event) { - if (!worldMap.containsKey(event.world)) { - WorldExtensionManager.onWorldLoad(event.world); - } - - if (event.phase == TickEvent.Phase.START) { - preTick(event.world); - } else { - postTick(event.world); - } - } - } - - private static boolean initialised; - private static ArrayList extensionIntialisers = new ArrayList(); - - public static void registerWorldExtension(WorldExtensionInstantiator init) { - if (!initialised) { - init(); - } - - init.instantiatorID = extensionIntialisers.size(); - extensionIntialisers.add(init); - } - - private static void init() { - initialised = true; - MinecraftForge.EVENT_BUS.register(new WorldExtensionEventHandler()); - } - - private static HashMap worldMap = new HashMap(); - - private static void onWorldLoad(World world) { - WorldExtension[] extensions = new WorldExtension[extensionIntialisers.size()]; - for (int i = 0; i < extensions.length; i++) { - extensions[i] = extensionIntialisers.get(i).createWorldExtension(world); - } - - worldMap.put(world, extensions); - - for (WorldExtension extension : extensions) { - extension.load(); - } - } - - private static void createChunkExtension(World world, Chunk chunk) { - WorldExtension[] extensions = worldMap.get(world); - for (int i = 0; i < extensionIntialisers.size(); i++) { - if (!extensions[i].containsChunk(chunk)) { - extensions[i].addChunk(extensionIntialisers.get(i).createChunkExtension(chunk, extensions[i])); - } - } - } - - private static void removeChunk(World world, Chunk chunk) { - for (WorldExtension extension : worldMap.get(world)) { - extension.remChunk(chunk); - } - } - - private static void preTick(World world) { - for (WorldExtension extension : worldMap.get(world)) { - extension.preTick(); - } - } - - private static void postTick(World world) { - for (WorldExtension extension : worldMap.get(world)) { - extension.postTick(); - } - } - - public static WorldExtension getWorldExtension(World world, int instantiatorID) { - return worldMap.get(world)[instantiatorID]; - } -} diff --git a/dependencies/main/java/codechicken/lib/world/placement/BlockPlacementBatcher.java b/dependencies/main/java/codechicken/lib/world/placement/BlockPlacementBatcher.java deleted file mode 100644 index 8141eca48f..0000000000 --- a/dependencies/main/java/codechicken/lib/world/placement/BlockPlacementBatcher.java +++ /dev/null @@ -1,184 +0,0 @@ -package codechicken.lib.world.placement; - -import codechicken.lib.world.placement.lighting.LightingCalcEntry; -import codechicken.lib.world.placement.lighting.LightingCalcEntryBuilder; -import gnu.trove.set.hash.THashSet; -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; -import net.minecraft.network.play.server.SPacketChunkData; -import net.minecraft.server.management.PlayerChunkMap; -import net.minecraft.server.management.PlayerChunkMapEntry; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.EnumSkyBlock; -import net.minecraft.world.WorldServer; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.Chunk.EnumCreateEntityType; -import net.minecraft.world.chunk.storage.ExtendedBlockStorage; - -import java.util.LinkedList; - -/** - * Created by covers1624 on 8/1/2016. - * TODO, Rethink this entire system, we need to cache blocks for the delayed lighting calculation. - */ -public class BlockPlacementBatcher { - - private final WorldServer serverWorld; - private THashSet modifiedChunks = new THashSet(); - private LinkedList blockLightingUpdates = new LinkedList(); - - public BlockPlacementBatcher(WorldServer serverWorld) { - this.serverWorld = serverWorld; - } - - public void setBlockState(BlockPos pos, IBlockState newState) { - if (!hasBlockStorage(pos) && newState.getBlock() == Blocks.AIR) { - return; - } - IBlockState oldState = getChunk(pos).getBlockState(pos); - if (oldState == newState) { - return; - } - setRecalcPrecipitationHeightMap(pos); - LightingCalcEntryBuilder builder = new LightingCalcEntryBuilder(); - builder.setDimension(serverWorld.provider.getDimension()); - builder.setBasePos(pos); - builder.setOldState(oldState); - builder.setNewState(newState); - builder.setOldLightOpacity(oldState.getLightOpacity(serverWorld, pos)); - - createBlockStorageIfNeeded(pos, builder); - ExtendedBlockStorage storage = getBlockStorage(pos); - Chunk chunk = getChunk(pos); - storage.set(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15, newState); - - fireBlockBreak(pos, oldState, newState); - tileEntityRemoveCheck(pos, oldState, newState); - - builder.setNewLightOpacity(newState.getLightOpacity(serverWorld, pos)); - builder.setSkyLight(chunk.getLightFor(EnumSkyBlock.SKY, pos)); - builder.setBlockLight(chunk.getLightFor(EnumSkyBlock.BLOCK, pos)); - - fireBlockPlace(pos, oldState, newState); - tileEntityPlaceCheck(pos, newState); - - setChunkModified(pos); - blockLightingUpdates.add(builder.build()); - } - - public void setChunkModified(BlockPos blockPos) { - Chunk chunk = getChunk(blockPos); - setChunkModified(chunk); - } - - public void setChunkModified(Chunk chunk) { - modifiedChunks.add(chunk); - } - - private Chunk getChunk(BlockPos pos) { - return serverWorld.getChunkFromChunkCoords(pos.getX() >> 4, pos.getZ() >> 4); - } - - private boolean hasBlockStorage(BlockPos pos) { - Chunk chunk = getChunk(pos); - return chunk.storageArrays[pos.getY() >> 4] != null; - } - - private ExtendedBlockStorage getBlockStorage(BlockPos pos) { - Chunk chunk = getChunk(pos); - return chunk.storageArrays[pos.getY() >> 4]; - } - - /** - * Creates a ExtendedBlockStorage for the given BlockPos if needed. - * - * @param pos Position to create a storage for. - * @param builder Lighting Calculation builder, can be null. - */ - private void createBlockStorageIfNeeded(BlockPos pos, LightingCalcEntryBuilder builder) { - Chunk chunk = getChunk(pos); - ExtendedBlockStorage storage = chunk.storageArrays[pos.getY() >> 4]; - if (storage == null) { - int height = chunk.heightMap[(pos.getZ() & 15) << 4 | (pos.getX() & 15)]; - storage = new ExtendedBlockStorage(pos.getY() >> 4 << 4, !serverWorld.provider.getHasNoSky()); - chunk.storageArrays[pos.getY() >> 4] = storage; - builder.setHeight(height); - if (builder != null && pos.getY() >= height) { - builder.setChunkHeightModified(); - } - } - } - - private void setRecalcPrecipitationHeightMap(BlockPos pos) { - Chunk chunk = getChunk(pos); - int i = (pos.getZ() & 15) << 4 | (pos.getX() & 15); - if (pos.getY() >= chunk.precipitationHeightMap[i] - 1) { - chunk.precipitationHeightMap[i] = -999; - } - } - - private void fireBlockBreak(BlockPos pos, IBlockState oldState, IBlockState newState) { - if (oldState.getBlock() != newState.getBlock()) { - oldState.getBlock().breakBlock(serverWorld, pos, oldState); - } - } - - private void fireBlockPlace(BlockPos pos, IBlockState oldState, IBlockState newState) { - if (oldState.getBlock() != newState.getBlock() && newState.getBlock().hasTileEntity(newState)) { - oldState.getBlock().onBlockAdded(serverWorld, pos, oldState); - } - } - - private void tileEntityRemoveCheck(BlockPos pos, IBlockState oldState, IBlockState newState) { - - TileEntity tileEntity = getChunk(pos).getTileEntity(pos, EnumCreateEntityType.CHECK); - if (tileEntity != null && tileEntity.shouldRefresh(serverWorld, pos, oldState, newState)) { - serverWorld.removeTileEntity(pos); - } - } - - private void tileEntityPlaceCheck(BlockPos pos, IBlockState newState) { - if (newState.getBlock().hasTileEntity(newState)) { - TileEntity tileEntity = getChunk(pos).getTileEntity(pos, EnumCreateEntityType.CHECK); - - if (tileEntity == null) { - tileEntity = newState.getBlock().createTileEntity(serverWorld, newState); - serverWorld.setTileEntity(pos, tileEntity); - } else { - tileEntity.updateContainingBlockInfo(); - } - } - } - - /** - * Call when finished placing blocks to que lighting and send chunk updates to the client. - */ - public void finish() { - for (Chunk chunk : modifiedChunks) { - PlayerChunkMap playerChunkMap = serverWorld.getPlayerChunkMap(); - if (playerChunkMap == null) { - return; - } - PlayerChunkMapEntry watcher = playerChunkMap.getEntry(chunk.xPosition, chunk.zPosition); - if (watcher != null) {//TODO Change chunk mask to only the sub chunks changed. - watcher.sendPacket(new SPacketChunkData(chunk, 65535)); - } - } - modifiedChunks.clear(); - BlockPlacementLightingManager.uploadToLightingQue(blockLightingUpdates); - blockLightingUpdates.clear(); - } - - public boolean isAirBlock(BlockPos pos) { - return serverWorld.isAirBlock(pos); - } - - public IBlockState getBlockState(BlockPos pos) { - ExtendedBlockStorage storage = getBlockStorage(pos); - if (storage == null) { - return Blocks.AIR.getDefaultState(); - } - return storage.get(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15); - } -} diff --git a/dependencies/main/java/codechicken/lib/world/placement/BlockPlacementLightingManager.java b/dependencies/main/java/codechicken/lib/world/placement/BlockPlacementLightingManager.java deleted file mode 100644 index 3fe7a265df..0000000000 --- a/dependencies/main/java/codechicken/lib/world/placement/BlockPlacementLightingManager.java +++ /dev/null @@ -1,93 +0,0 @@ -package codechicken.lib.world.placement; - -import codechicken.lib.world.placement.lighting.LightingCalcEntry; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldServer; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; -import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent; - -import java.util.Iterator; -import java.util.LinkedList; - -/** - * Created by covers1624 on 8/1/2016. - */ -public class BlockPlacementLightingManager { - - private static final LinkedList lightingQue = new LinkedList(); - public static final int lightEntriesPerTick = Integer.parseInt(System.getProperty("ccl.lightingEntriesPerTic", "100")); - - static { - MinecraftForge.EVENT_BUS.register(new BlockPlacementLightingManager()); - } - - @SubscribeEvent - public void tickEvent(ServerTickEvent serverTick) { - if (serverTick.phase == Phase.START) { - if (!lightingQue.isEmpty()) { - synchronized (lightingQue) { - FMLLog.info("Que Size: " + lightingQue.size()); - Iterator iterator = lightingQue.iterator(); - int entriesProcessed = 0; - while (iterator.hasNext()) { - if (entriesProcessed >= lightEntriesPerTick) { - break; - } - LightingCalcEntry entry = iterator.next(); - if (entry == null) { - continue; - } - WorldServer world = getServer().worldServerForDimension(entry.dimension); - Chunk chunk = getChunk(world, entry.pos); - if (entry.chunkHeightModified) { - //FMLLog.info("GeneratingSkyLightMap in Chunk: X: %s, Z: %s", entry.pos.getX() >> 4, entry.pos.getX() >> 4); - chunk.generateSkylightMap(); - } else { - if (entry.newLightOpacity > 0) { - if (entry.pos.getY() >= entry.height) { - //FMLLog.info("RelightBlock"); - chunk.relightBlock(entry.pos.getX() & 15, entry.pos.getY() + 1, entry.pos.getZ() & 15); - } - } else if (entry.pos.getY() == entry.height - 1) { - //FMLLog.info("RelightBlock"); - chunk.relightBlock(entry.pos.getX() & 15, entry.pos.getY(), entry.pos.getZ() & 15); - } - - if (entry.newLightOpacity != entry.oldLightOpacity && (entry.newLightOpacity < entry.oldLightOpacity || entry.skyLight > 0 || entry.blockLight > 0)) { - //FMLLog.info("SkyLightOcclusion at: X: %s, Z: %s", entry.pos.getX() & 15, entry.pos.getX() & 15); - chunk.propagateSkylightOcclusion(entry.pos.getX() & 15, entry.pos.getZ() & 15); - } - } - entriesProcessed++; - iterator.remove(); - } - } - } - } - } - - private static MinecraftServer getServer() { - return FMLCommonHandler.instance().getMinecraftServerInstance(); - } - - public static void uploadToLightingQue(LinkedList lightingEntries) { - addEntries(lightingEntries); - } - - public static synchronized void addEntries(LinkedList entries) { - synchronized (lightingQue) { - lightingQue.addAll(entries); - } - } - - protected static Chunk getChunk(WorldServer world, BlockPos pos) { - return world.getChunkFromChunkCoords(pos.getX() >> 4, pos.getZ() >> 4); - } - -} diff --git a/dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntry.java b/dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntry.java deleted file mode 100644 index 4b0f972b04..0000000000 --- a/dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntry.java +++ /dev/null @@ -1,34 +0,0 @@ -package codechicken.lib.world.placement.lighting; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.math.BlockPos; - -/** - * Created by covers1624 on 8/1/2016. - */ -public class LightingCalcEntry { - - public final int dimension; - public final BlockPos pos; - public final boolean chunkHeightModified; - public final IBlockState oldState; - public final IBlockState newState; - public final int oldLightOpacity; - public final int newLightOpacity; - public final int skyLight; - public final int blockLight; - public final int height; - - public LightingCalcEntry(int dimension, BlockPos pos, boolean chunkHeightModified, IBlockState oldState, IBlockState newState, int oldLightOpacity, int newLightOpacity, int skyLight, int blockLight, int height) { - this.dimension = dimension; - this.pos = pos; - this.chunkHeightModified = chunkHeightModified; - this.oldState = oldState; - this.newState = newState; - this.oldLightOpacity = oldLightOpacity; - this.newLightOpacity = newLightOpacity; - this.skyLight = skyLight; - this.blockLight = blockLight; - this.height = height; - } -} diff --git a/dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntryBuilder.java b/dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntryBuilder.java deleted file mode 100644 index ed72af7841..0000000000 --- a/dependencies/main/java/codechicken/lib/world/placement/lighting/LightingCalcEntryBuilder.java +++ /dev/null @@ -1,65 +0,0 @@ -package codechicken.lib.world.placement.lighting; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.math.BlockPos; - -/** - * Created by covers1624 on 8/1/2016. - */ -public class LightingCalcEntryBuilder { - - private int dimension; - private BlockPos pos; - private boolean chunkHeightModified = false; - private IBlockState oldState; - private IBlockState newState; - private int oldLightOpacity; - private int newLightOpacity; - private int skyLight; - private int blockLight; - private int height; - - public void setDimension(int dimension) { - this.dimension = dimension; - } - - public void setBasePos(BlockPos pos) { - this.pos = pos; - } - - public void setChunkHeightModified() { - chunkHeightModified = true; - } - - public void setOldState(IBlockState state) { - oldState = state; - } - - public void setNewState(IBlockState state) { - newState = state; - } - - public void setOldLightOpacity(int lightOpacity) { - oldLightOpacity = lightOpacity; - } - - public void setNewLightOpacity(int lightOpacity) { - newLightOpacity = lightOpacity; - } - - public void setSkyLight(int light) { - skyLight = light; - } - - public void setBlockLight(int light) { - blockLight = light; - } - - public void setHeight(int height) { - this.height = height; - } - - public LightingCalcEntry build() { - return new LightingCalcEntry(dimension, pos, chunkHeightModified, oldState, newState, oldLightOpacity, newLightOpacity, skyLight, blockLight, height); - } -} diff --git a/dependencies/main/java/codechicken/nei/ButtonCycled.java b/dependencies/main/java/codechicken/nei/ButtonCycled.java deleted file mode 100644 index bd963ca2c3..0000000000 --- a/dependencies/main/java/codechicken/nei/ButtonCycled.java +++ /dev/null @@ -1,13 +0,0 @@ -package codechicken.nei; - -import codechicken.nei.widget.Button; - -public abstract class ButtonCycled extends Button { - @Override - public Image getRenderIcon() { - return icons[index]; - } - - public int index; - public Image[] icons; -} diff --git a/dependencies/main/java/codechicken/nei/ClientHandler.java b/dependencies/main/java/codechicken/nei/ClientHandler.java deleted file mode 100644 index 7640e9153f..0000000000 --- a/dependencies/main/java/codechicken/nei/ClientHandler.java +++ /dev/null @@ -1,233 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.packet.PacketCustom; -import codechicken.lib.util.ClientUtils; -import codechicken.nei.api.ItemInfo; -import codechicken.nei.config.KeyBindings; -import codechicken.nei.network.NEIClientPacketHandler; -import codechicken.nei.util.NEIClientUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.*; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.world.World; -import net.minecraftforge.client.event.RenderWorldLastEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.client.CustomModLoadingErrorDisplayException; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; - -import java.util.ArrayList; -import java.util.Iterator; - -public class ClientHandler { - private static ClientHandler instance; - - private ArrayList SMPmagneticItems = new ArrayList(); - private World lastworld; - private GuiScreen lastGui; - - public void addSMPMagneticItem(int i, World world) { - Entity e = world.getEntityByID(i); - if (e instanceof EntityItem) { - SMPmagneticItems.add((EntityItem) e); - } - } - - private void updateMagnetMode(World world, EntityPlayerSP player) { - if (!NEIClientConfig.getMagnetMode()) { - return; - } - - float distancexz = 16; - float distancey = 8; - double maxspeedxz = 0.5; - double maxspeedy = 0.5; - double speedxz = 0.05; - double speedy = 0.07; - - for (Iterator iterator = SMPmagneticItems.iterator(); iterator.hasNext(); ) { - EntityItem item = iterator.next(); - - if (item.cannotPickup()) { - continue; - } - if (item.isDead) { - iterator.remove(); - } - if (!NEIClientUtils.canItemFitInInventory(player, item.getEntityItem())) { - continue; - } - - double dx = player.posX - item.posX; - double dy = player.posY + player.getEyeHeight() - item.posY; - double dz = player.posZ - item.posZ; - double absxz = Math.sqrt(dx * dx + dz * dz); - double absy = Math.abs(dy); - if (absxz > distancexz || absy > distancey) { - continue; - } - - if (absxz > 1) { - dx /= absxz; - dz /= absxz; - } - - if (absy > 1) { - dy /= absy; - } - - double vx = item.motionX + speedxz * dx; - double vy = item.motionY + speedy * dy; - double vz = item.motionZ + speedxz * dz; - - double absvxz = Math.sqrt(vx * vx + vz * vz); - double absvy = Math.abs(vy); - - double rationspeedxz = absvxz / maxspeedxz; - if (rationspeedxz > 1) { - vx /= rationspeedxz; - vz /= rationspeedxz; - } - - double rationspeedy = absvy / maxspeedy; - if (rationspeedy > 1) { - vy /= rationspeedy; - } - - if (absvxz < 0.2 && absxz < 0.2) { - item.setDead(); - } - - item.setVelocity(vx, vy, vz); - } - } - - public static void preInit() { - ItemInfo.preInit(); - } - - public static void init() { - instance = new ClientHandler(); - - //GuiModListScroll.register("NotEnoughItems"); - PacketCustom.assignHandler(NEIClientPacketHandler.channel, new NEIClientPacketHandler()); - -// MinecraftForge.EVENT_BUS.register(new ContainerEventHandler()); - MinecraftForge.EVENT_BUS.register(instance); - - ItemInfo.init(); - //API.registerHighlightHandler(new DefaultHighlightHandler(), ItemInfo.Layout.HEADER); - //HUDRenderer.load(); - WorldOverlayRenderer.load(); - - KeyBindings.register(); - } - - @SubscribeEvent - public void tickEvent(TickEvent.ClientTickEvent event) { - if (event.phase == Phase.END) { - return; - } - - Minecraft mc = Minecraft.getMinecraft(); - if (mc.theWorld != null) { - if (loadWorld(mc.theWorld)) { - NEIClientConfig.setHasSMPCounterPart(false); - NEIClientConfig.setInternalEnabled(false); - - if (!Minecraft.getMinecraft().isSingleplayer() && ClientUtils.inWorld())//wait for server to initiate in singleplayer - { - NEIClientConfig.loadWorld("remote/" + ClientUtils.getServerIP().replace(':', '~')); - } - } - - if (!NEIClientConfig.isEnabled()) { - return; - } - - KeyManager.tickKeyStates(); - - NEIController.updateUnlimitedItems(mc.thePlayer.inventory); - if (mc.currentScreen == null) { - NEIController.processCreativeCycling(mc.thePlayer.inventory); - } - - updateMagnetMode(mc.theWorld, mc.thePlayer); - } - - GuiScreen gui = mc.currentScreen; - if (gui != lastGui) { - if (gui instanceof GuiMainMenu) { - lastworld = null; - } else if (gui instanceof GuiWorldSelection) { - NEIClientConfig.reloadSaves(); - } - } - lastGui = gui; - } - - @SubscribeEvent - public void tickEvent(TickEvent.RenderTickEvent event) { - //if (event.phase == Phase.END && NEIClientConfig.isEnabled()) { - //HUDRenderer.renderOverlay(); - //} - } - - @SubscribeEvent - public void renderLastEvent(RenderWorldLastEvent event) { - if (NEIClientConfig.isEnabled()) { - WorldOverlayRenderer.render(event.getPartialTicks()); - } - } - - public boolean loadWorld(World world) { - if (world != lastworld) { - SMPmagneticItems.clear(); - WorldOverlayRenderer.reset(); - lastworld = world; - return true; - } - return false; - } - - public static ClientHandler instance() { - return instance; - } - - public static RuntimeException throwCME(final String message) { - final GuiScreen errorGui = new GuiErrorScreen(null, null) { - @Override - public void handleMouseInput() { - } - - @Override - public void handleKeyboardInput() { - } - - @Override - public void drawScreen(int par1, int par2, float par3) { - drawDefaultBackground(); - String[] s_msg = message.split("\n"); - for (int i = 0; i < s_msg.length; ++i) { - drawCenteredString(fontRendererObj, s_msg[i], width / 2, height / 3 + 12 * i, 0xFFFFFFFF); - } - } - }; - - @SuppressWarnings("serial") - CustomModLoadingErrorDisplayException e = new CustomModLoadingErrorDisplayException() { - @Override - public void initGui(GuiErrorScreen errorScreen, FontRenderer fontRenderer) { - Minecraft.getMinecraft().displayGuiScreen(errorGui); - } - - @Override - public void drawScreen(GuiErrorScreen errorScreen, FontRenderer fontRenderer, int mouseRelX, int mouseRelY, float tickTime) { - } - }; - throw e; - } -} diff --git a/dependencies/main/java/codechicken/nei/ContainerEnchantmentModifier.java b/dependencies/main/java/codechicken/nei/ContainerEnchantmentModifier.java deleted file mode 100644 index 731c7a7b39..0000000000 --- a/dependencies/main/java/codechicken/nei/ContainerEnchantmentModifier.java +++ /dev/null @@ -1,340 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.texture.TextureUtils; -import codechicken.nei.network.NEIClientPacketHandler; -import codechicken.nei.util.NEIServerUtils; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ContainerEnchantment; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import java.util.ArrayList; - -/** - * This is crap code, don't ever do this. - */ -public class ContainerEnchantmentModifier extends ContainerEnchantment { - public static class EnchantmentHash { - public EnchantmentHash(Enchantment e, int i, int l) { - enchantment = e; - state = i; - level = l; - } - - Enchantment enchantment; - int state; - int level; - } - - public ArrayList slotEnchantment = new ArrayList(); - int level = 5; - - public int scrollclicky = -1; - public float scrollpercent; - public int scrollmousey; - public float percentscrolled; - public int relx = 60; - public int rely = 14; - public int height = 57; - public int cwidth = 101; - public int slotheight = 19; - public GuiEnchantmentModifier parentscreen; - - public ContainerEnchantmentModifier(InventoryPlayer inventoryplayer, World world) { - super(inventoryplayer, world, new BlockPos(0, 0, 0)); - } - - public int getNumSlots() { - return slotEnchantment.size(); - } - - public int getScrollBarHeight() { - int sbarh = (int) ((height / (float) getContentHeight()) * height); - if (sbarh > height) { - return height; - } else if (sbarh < height / 15) { - return height / 15; - } else { - return sbarh; - } - } - - public int getScrollBarWidth() { - return 7; - } - - public int getContentHeight() { - return slotheight * getNumSlots(); - } - - public int getScrolledSlots() { - int slots = getNumSlots(); - int shownslots = height / slotheight; - return (int) (percentscrolled * (slots - shownslots) + 0.5F); - } - - private int getClickedSlot(int mousey) { - return ((mousey - rely) / slotheight) + getScrolledSlots(); - } - - public void calculatePercentScrolled() { - int barempty = height - getScrollBarHeight(); - if (scrollclicky >= 0) { - int scrolldiff = scrollmousey - scrollclicky; - percentscrolled = scrolldiff / (float) barempty + scrollpercent; - } - if (percentscrolled < 0) { - percentscrolled = 0; - } - if (percentscrolled > 1) { - percentscrolled = 1; - } - int sbary = rely + (int) (barempty * percentscrolled + 0.5); - percentscrolled = (sbary - rely) / (float) barempty; - } - - public boolean clickScrollBar(int mousex, int mousey, int button) { - mousex -= parentscreen.guiLeft; - mousey -= parentscreen.guiTop; - - int barempty = height - getScrollBarHeight(); - int sbary = rely + (int) (barempty * percentscrolled + 0.5); - - if (button == 0 && - getScrollBarHeight() < height && //the scroll bar can move (not full length) - mousex >= relx + cwidth && mousex < relx + cwidth + getScrollBarWidth() && - mousey >= rely && mousey < rely + height)//in the scroll pane - { - if (mousey < sbary) { - percentscrolled = (mousey - rely) / (float) barempty; - calculatePercentScrolled(); - } else if (mousey > sbary + getScrollBarHeight()) { - percentscrolled = (mousey - rely - getScrollBarHeight() + 1) / (float) barempty; - calculatePercentScrolled(); - } else { - scrollclicky = mousey; - scrollpercent = percentscrolled; - scrollmousey = mousey; - } - return true; - } - return false; - } - - public void mouseUp(int mousex, int mousey, int button) { - if (scrollclicky >= 0 && button == 0)//we were scrolling and we released mouse - { - scrollclicky = -1; - } - } - - public boolean clickButton(int mousex, int mousey, int button) { - mousex -= parentscreen.guiLeft; - mousey -= parentscreen.guiTop; - if (mousex >= relx && mousex < relx + cwidth && - mousey >= rely && mousey <= rely + height)//in the box - { - int slot = getClickedSlot(mousey); - if (slot >= getNumSlots()) { - return false; - } - toggleSlotEnchantment(slot); - return true; - } - return false; - } - - private void toggleSlotEnchantment(int slot) { - EnchantmentHash e = slotEnchantment.get(slot); - if (e.state == 2) { - NEIClientPacketHandler.sendModifyEnchantment(Enchantment.getEnchantmentID(e.enchantment), 0, false); - e.state = 0; - } else if (e.state == 1) { - return; - } else { - NEIClientPacketHandler.sendModifyEnchantment(Enchantment.getEnchantmentID(e.enchantment), level, true); - e.state = 2; - } - updateEnchantmentOptions(GuiEnchantmentModifier.validateEnchantments()); - } - - @Deprecated - public boolean addEnchantment(int e, int level) { - return addEnchantment(Enchantment.REGISTRY.getNameForObject(Enchantment.getEnchantmentByID(e)).toString(), level); - } - - public boolean addEnchantment(String enchantmentLocation, int level) { - Enchantment enchantment = Enchantment.getEnchantmentByLocation(enchantmentLocation); - if (enchantment != null) { - inventorySlots.get(0).getStack().addEnchantment(enchantment, level); - return true; - } - return false; - } - - @Deprecated - //TODO String variant. - public void removeEnchantment(int e) { - ItemStack stack = inventorySlots.get(0).getStack(); - NBTTagList nbttaglist = stack.getEnchantmentTagList(); - if (nbttaglist != null) { - for (int i = 0; i < nbttaglist.tagCount(); i++) { - int ID = nbttaglist.getCompoundTagAt(i).getShort("id"); - if (ID == e) { - nbttaglist.removeTag(i); - if (nbttaglist.tagCount() == 0) { - stack.getTagCompound().removeTag("ench"); - } - if (stack.getTagCompound().hasNoTags()) { - stack.setTagCompound(null); - } - return; - } - } - } - } - - public boolean canInteractWith(EntityPlayer entityplayer) { - return true; - } - - public void onCraftMatrixChanged(IInventory iinventory) { - if (parentscreen != null) { - updateEnchantmentOptions(GuiEnchantmentModifier.validateEnchantments()); - } - } - - public void updateEnchantmentOptions(boolean validate) { - int numoptions = slotEnchantment.size(); - slotEnchantment.clear(); - - ItemStack toolstack = getSlot(0).getStack(); - if (toolstack == null) { - percentscrolled = 0; - return; - } - - Item item = toolstack.getItem(); - int enchantablity = item.getItemEnchantability(toolstack); - if (enchantablity == 0 && validate) { - percentscrolled = 0; - return; - } - - for (Enchantment enchantment : Enchantment.REGISTRY) { - if (enchantment == null || enchantment.type == null || (!enchantment.type.canEnchantItem(item) && validate)) { - continue; - } - int state = 0; - int level = -1; - if (NEIServerUtils.stackHasEnchantment(toolstack, Enchantment.getEnchantmentID(enchantment))) { - state = 2; - level = NEIServerUtils.getEnchantmentLevel(toolstack, Enchantment.getEnchantmentID(enchantment)); - } else if (NEIServerUtils.doesEnchantmentConflict(NEIServerUtils.getEnchantments(toolstack), enchantment) && validate) { - state = 1; - } - slotEnchantment.add(new EnchantmentHash(enchantment, state, level)); - } - if (numoptions != slotEnchantment.size()) { - percentscrolled = 0; - } - } - - public void drawSlots(GuiEnchantmentModifier gui) { - for (int slot = 0; slot < 3; slot++) { - int shade = 0; - String text = ""; - - int containerslot = slot + getScrolledSlots(); - if (containerslot + 1 > slotEnchantment.size()) { - shade = 1; - } else { - EnchantmentHash e = slotEnchantment.get(containerslot); - shade = e.state; - text = e.enchantment.getTranslatedName(e.level == -1 ? level : e.level); - if (gui.mc.fontRendererObj.getStringWidth(text) > 95 && text.contains("Projectile")) { - text = text.replace("Projectile", "Proj"); - } - if (gui.mc.fontRendererObj.getStringWidth(text) > 95 && text.contains("Protection")) { - text = text.replace("Protection", "Protect"); - } - if (gui.mc.fontRendererObj.getStringWidth(text) > 95 && text.contains("Bane of")) { - text = text.replace("Bane of ", ""); - } - } - - TextureUtils.changeTexture("textures/gui/container/enchanting_table.png"); - GlStateManager.color(1, 1, 1); - if (hasScrollBar()) { - gui.drawTexturedModalRect(relx, rely + slot * slotheight, 0, gui.ySize + slotheight * shade, cwidth - 30, slotheight); - gui.drawTexturedModalRect(relx + cwidth - 30, rely + slot * slotheight, cwidth - 23, gui.ySize + slotheight * shade, 30, slotheight); - } else { - gui.drawTexturedModalRect(relx, rely + slot * slotheight, 0, gui.ySize + slotheight * shade, cwidth + 7, slotheight); - } - - gui.getFontRenderer().drawString(text, relx + 4, rely + slot * slotheight + 5, textColourFromState(shade)); - } - } - - private boolean hasScrollBar() { - return getNumSlots() > 3; - } - - public void drawScrollBar(GuiEnchantmentModifier gui) { - if (!hasScrollBar()) { - return; - } - - int sbary = rely + (int) ((height - getScrollBarHeight()) * percentscrolled + 0.5); - int sbarx = relx + cwidth; - - Gui.drawRect(sbarx, rely, sbarx + getScrollBarWidth(), rely + height, 0xFF202020);//background - Gui.drawRect(sbarx, sbary, sbarx + getScrollBarWidth(), sbary + getScrollBarHeight(), 0xFF8B8B8B);//corners - Gui.drawRect(sbarx, sbary, sbarx + getScrollBarWidth() - 1, sbary + getScrollBarHeight() - 1, 0xFFF0F0F0);//topleft up - Gui.drawRect(sbarx + 1, sbary + 1, sbarx + getScrollBarWidth() - 1, sbary + getScrollBarHeight() - 1, 0xFF555555);//bottom right down - Gui.drawRect(sbarx + 1, sbary + 1, sbarx + getScrollBarWidth() - 2, sbary + getScrollBarHeight() - 2, 0xFFC6C6C6);//scrollbar - } - - private int textColourFromState(int shade) { - switch (shade) { - case 0: - return 0x685e4a; - case 1: - return 0x407f10; - default: - return 0xffff80; - } - } - - public void onUpdate(int mousex, int mousey) { - processScrollMouse(mousey); - } - - public void processScrollMouse(int mousey) { - mousey -= parentscreen.guiTop; - - if (scrollclicky >= 0) { - int scrolldiff = mousey - scrollclicky; - int barupallowed = (int) ((height - getScrollBarHeight()) * scrollpercent + 0.5); - int bardownallowed = (height - getScrollBarHeight()) - barupallowed; - - if (-scrolldiff > barupallowed) { - scrollmousey = scrollclicky - barupallowed; - } else if (scrolldiff > bardownallowed) { - scrollmousey = scrollclicky + bardownallowed; - } else { - scrollmousey = mousey; - } - - calculatePercentScrolled(); - } - } -} diff --git a/dependencies/main/java/codechicken/nei/ContainerPotionCreator.java b/dependencies/main/java/codechicken/nei/ContainerPotionCreator.java deleted file mode 100644 index efb725601b..0000000000 --- a/dependencies/main/java/codechicken/nei/ContainerPotionCreator.java +++ /dev/null @@ -1,171 +0,0 @@ -package codechicken.nei; - -import codechicken.core.inventory.ContainerExtended; -import codechicken.core.inventory.SlotHandleClicks; -import codechicken.lib.inventory.InventoryNBT; -import codechicken.lib.inventory.InventoryUtils; -import codechicken.lib.packet.PacketCustom; -import codechicken.nei.network.NEIClientPacketHandler; -import codechicken.nei.util.NEIClientUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ClickType; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryBasic; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemPotion; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; - -public class ContainerPotionCreator extends ContainerExtended { - public class SlotPotion extends Slot { - public SlotPotion(IInventory inv, int slotIndex, int x, int y) { - super(inv, slotIndex, x, y); - } - - @Override - public boolean isItemValid(ItemStack stack) { - return stack.getItem() instanceof ItemPotion; - } - - @Override - public void onSlotChanged() { - super.onSlotChanged(); - if (getHasStack()) { - ItemStack stack = getStack(); - if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); - } - if (!stack.getTagCompound().hasKey("CustomPotionEffects")) { - stack.getTagCompound().setTag("CustomPotionEffects", new NBTTagList()); - } - } - } - } - - public class SlotPotionStore extends SlotHandleClicks { - public SlotPotionStore(IInventory inv, int slotIndex, int x, int y) { - super(inv, slotIndex, x, y); - } - - @Override - public ItemStack slotClick(ContainerExtended container, EntityPlayer player, int button, ClickType clickType) { - ItemStack held = player.inventory.getItemStack(); - if (button == 0 && clickType == ClickType.QUICK_MOVE) { - NEIClientUtils.cheatItem(getStack(), button, -1); - } else if (button == 1) { - putStack(null); - } else if (held != null) { - if (isItemValid(held)) { - putStack(InventoryUtils.copyStack(held, 1)); - player.inventory.setItemStack(null); - } - } else if (getHasStack()) { - player.inventory.setItemStack(getStack()); - } - - return null; - } - - @Override - public boolean isItemValid(ItemStack stack) { - return stack.getItem() instanceof ItemPotion; - } - } - - public static class InventoryPotionStore extends InventoryNBT { - public InventoryPotionStore() { - super(9, NEIClientConfig.global.nbt.getCompoundTag("potionStore")); - } - - @Override - public void markDirty() { - super.markDirty(); - NEIClientConfig.global.nbt.setTag("potionStore", tag); - NEIClientConfig.global.saveNBT(); - } - } - - InventoryPlayer playerInv; - InventoryBasic potionInv; - IInventory potionStoreInv; - - public ContainerPotionCreator(InventoryPlayer inventoryPlayer, IInventory potionStoreInv) { - playerInv = inventoryPlayer; - potionInv = new InventoryBasic("Potion", true, 1); - this.potionStoreInv = potionStoreInv; - - addSlotToContainer(new SlotPotion(potionInv, 0, 25, 102)); - for (int i = 0; i < 9; i++) { - addSlotToContainer(new SlotPotionStore(potionStoreInv, i, 8 + i * 18, 14)); - } - bindPlayerInventory(inventoryPlayer, 8, 125); - } - - @Override - public boolean doMergeStackAreas(int slotIndex, ItemStack stack) { - if (slotIndex < 10) { - return mergeItemStack(stack, 10, 46, true); - } - return mergeItemStack(stack, 0, 1, false); - } - - @Override - public boolean canInteractWith(EntityPlayer entityplayer) { - return true; - } - - @Override - public void onContainerClosed(EntityPlayer player) { - super.onContainerClosed(player); - - if (!player.worldObj.isRemote) { - InventoryUtils.dropOnClose(player, potionInv); - } - } - - @SuppressWarnings("unchecked") - @Override - public void handleInputPacket(PacketCustom packet) { - ItemStack potion = potionInv.getStackInSlot(0); - if (potion == null) { - return; - } - - boolean add = packet.readBoolean(); - Potion effect = Potion.getPotionById(packet.readUByte()); - - NBTTagList effects = potion.getTagCompound().getTagList("CustomPotionEffects", 10); - NBTTagList newEffects = new NBTTagList(); - for (int i = 0; i < effects.tagCount(); i++) { - NBTTagCompound tag = effects.getCompoundTagAt(i); - PotionEffect e = PotionEffect.readCustomPotionEffectFromNBT(tag); - if (e.getPotion() != effect) { - newEffects.appendTag(tag); - } - } - if (add) { - newEffects.appendTag(new PotionEffect(effect, packet.readInt(), packet.readUByte()).writeCustomPotionEffectToNBT(new NBTTagCompound())); - } - potion.getTagCompound().setTag("CustomPotionEffects", newEffects); - } - - public void setPotionEffect(Potion potion, int duration, int amplifier) { - PacketCustom packet = NEIClientPacketHandler.createContainerPacket(); - packet.writeBoolean(true); - packet.writeByte(Potion.getIdFromPotion(potion)); - packet.writeInt(duration); - packet.writeByte(amplifier); - packet.sendToServer(); - } - - public void removePotionEffect(Potion potion) { - PacketCustom packet = NEIClientPacketHandler.createContainerPacket(); - packet.writeBoolean(false); - packet.writeByte(Potion.getIdFromPotion(potion)); - packet.sendToServer(); - } -} \ No newline at end of file diff --git a/dependencies/main/java/codechicken/nei/DefaultHighlightHandler.java b/dependencies/main/java/codechicken/nei/DefaultHighlightHandler.java deleted file mode 100644 index b2d0f88602..0000000000 --- a/dependencies/main/java/codechicken/nei/DefaultHighlightHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -package codechicken.nei; - -import codechicken.nei.api.IHighlightHandler; -import codechicken.nei.api.ItemInfo; -import codechicken.nei.guihook.GuiContainerManager; -import net.minecraft.block.BlockRedstoneWire; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.world.World; - -import java.util.List; - -@Deprecated -public class DefaultHighlightHandler implements IHighlightHandler { - @Override - public List handleTextData(ItemStack stack, World world, EntityPlayer player, RayTraceResult rayTraceResult, List currenttip, ItemInfo.Layout layout) { - String name = null; - try { - String s = GuiContainerManager.itemDisplayNameShort(stack); - if (s != null && !s.endsWith("Unnamed")) { - name = s; - } - - if (name != null) { - currenttip.add(name); - } - } catch (Exception ignored) { - } - - IBlockState b = world.getBlockState(rayTraceResult.getBlockPos()); - if (name != null && b.getBlock() == Blocks.REDSTONE_WIRE) { - String s = "" + b.getValue(BlockRedstoneWire.POWER); - if (s.length() < 2) { - s = " " + s; - } - currenttip.set(currenttip.size() - 1, name + " " + s); - } - - return currenttip; - } - - @Override - public ItemStack identifyHighlight(World world, EntityPlayer player, RayTraceResult rayTraceResult) { - return null; - } -} diff --git a/dependencies/main/java/codechicken/nei/FastTransferManager.java b/dependencies/main/java/codechicken/nei/FastTransferManager.java deleted file mode 100644 index b31404fd43..0000000000 --- a/dependencies/main/java/codechicken/nei/FastTransferManager.java +++ /dev/null @@ -1,376 +0,0 @@ -package codechicken.nei; - -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.util.NEIClientUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.ClickType; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -import java.util.*; - -import static codechicken.nei.util.NEIServerUtils.*; - -public class FastTransferManager { - /** - * Based on the general assumption that we want to fill top to bottom, left to right - */ - public static class SlotPositionComparator implements Comparator { - Container container; - - public SlotPositionComparator(Container c) { - container = c; - } - - @Override - public int compare(Integer arg0, Integer arg1) { - Slot slot1 = container.getSlot(arg0); - Slot slot2 = container.getSlot(arg1); - - if (slot2.yDisplayPosition != slot1.yDisplayPosition) { - return slot1.yDisplayPosition - slot2.yDisplayPosition; - } - return slot1.xDisplayPosition - slot2.xDisplayPosition; - } - } - - public LinkedList> slotZones = new LinkedList>(); - public HashMap slotZoneMap = new HashMap(); - - private void generateSlotMap(Container container, ItemStack stack) { - stack = stack.copy(); - stack.stackSize = 1; - - for (int slotNo = 0; slotNo < container.inventorySlots.size(); slotNo++) { - if (slotZoneMap.containsKey(slotNo) || !container.getSlot(slotNo).isItemValid(stack)) { - continue; - } - - HashSet connectedSlots = new HashSet(); - findConnectedSlots(container, slotNo, connectedSlots); - - LinkedList zoneSlots = new LinkedList(connectedSlots); - Collections.sort(zoneSlots, new SlotPositionComparator(container)); - slotZones.add(zoneSlots); - - for (int i : zoneSlots) { - slotZoneMap.put(i, slotZones.size() - 1); - } - } - } - - private void findConnectedSlots(Container container, int slotNo, HashSet connectedSlots) { - connectedSlots.add(slotNo); - Slot slot = container.getSlot(slotNo); - final int threshold = 18; - - for (int i = 0; i < container.inventorySlots.size(); i++) { - if (connectedSlots.contains(i)) { - continue; - } - - Slot slot1 = container.getSlot(i); - if (Math.abs(slot.xDisplayPosition - slot1.xDisplayPosition) <= threshold && Math.abs(slot.yDisplayPosition - slot1.yDisplayPosition) <= threshold) { - findConnectedSlots(container, i, connectedSlots); - } - } - } - - public static int findSlotWithItem(Container container, ItemStack teststack) { - for (int slotNo = 0; slotNo < container.inventorySlots.size(); slotNo++) { - ItemStack stack = container.getSlot(slotNo).getStack(); - if (stack != null && areStacksSameType(stack, teststack)) { - return slotNo; - } - } - return -1; - } - - public static void clearSlots(Container container) { - for (int slotNo = 0; slotNo < container.inventorySlots.size(); slotNo++) { - container.inventorySlots.get(slotNo).putStack(null); - } - } - - public void performMassTransfer(GuiContainer window, int fromSlot, int toSlot, ItemStack heldStack) { - generateSlotMap(window.inventorySlots, heldStack); - - Integer fromZone = slotZoneMap.get(fromSlot); - Integer toZone = slotZoneMap.get(toSlot); - - if (fromZone == null || toZone == null || fromZone.equals(toZone)) { - return; - } - - if (NEIClientUtils.getHeldItem() != null && !areStacksSameType(heldStack, NEIClientUtils.getHeldItem())) { - return; - } - - if (!fillZoneWithHeldItem(window, toZone)) { - return; - } - - for (int transferFrom : slotZones.get(fromZone)) { - ItemStack transferStack = window.inventorySlots.getSlot(transferFrom).getStack(); - - if (!areStacksSameType(heldStack, transferStack)) { - continue; - } - - clickSlot(window, transferFrom); - if (!fillZoneWithHeldItem(window, toZone)) { - clickSlot(window, transferFrom); - return; - } - } - } - - /** - * @return The slot that one item from the source slot will end up in apon shift clicking, -1 if none. - */ - public int findShiftClickDestinationSlot(Container container, int fromSlot) { - LinkedList save = saveContainer(container); - - Slot slot = container.getSlot(fromSlot); - ItemStack stack = slot.getStack(); - if (stack == null) { - return -1; - } - - stack.stackSize = 1; - slot.putStack(stack.copy()); - - LinkedList compareBefore = saveContainer(container); - container.slotClick(fromSlot, 0, ClickType.QUICK_MOVE, Minecraft.getMinecraft().thePlayer); - LinkedList compareAfter = saveContainer(container); - - try { - //if(compareAfter.get(fromSlot) != null)//transfer failed - //return -1; - - for (int i = 0; i < compareBefore.size(); i++) { - if (i == fromSlot) { - continue; - } - - ItemStack before = compareBefore.get(i); - ItemStack after = compareAfter.get(i); - - if (!areStacksIdentical(before, after) && after != null) { - if (before == null ? areStacksSameType(stack, after) ://transfered into this empty slot - areStacksSameType(stack, after) && after.stackSize - before.stackSize > 0)//it added to this stack - { - return i; - } - } - } - - return -1; - } finally { - restoreContainer(container, save); - } - } - - public LinkedList saveContainer(Container container) { - LinkedList stacks = new LinkedList(); - for (int i = 0; i < container.inventorySlots.size(); i++) { - stacks.add(copyStack(container.getSlot(i).getStack())); - } - - return stacks; - } - - public void restoreContainer(Container container, LinkedList items) { - for (int i = 0; i < container.inventorySlots.size(); i++) { - container.getSlot(i).putStack(items.get(i)); - } - - container.slotClick(-999, 0, ClickType.PICKUP, Minecraft.getMinecraft().thePlayer); - } - - public void transferItem(GuiContainer window, int fromSlot) { - int toSlot = findShiftClickDestinationSlot(window.inventorySlots, fromSlot); - if (toSlot == -1) { - return; - } - - Slot from = window.inventorySlots.getSlot(fromSlot); - - if (from.isItemValid(from.getStack())) { - moveOneItem(window, fromSlot, toSlot); - } else//slots that you can't put stuff in - { - moveOutputSet(window, fromSlot, toSlot); - } - } - - public void moveOutputSet(GuiContainer window, int fromSlot, int toSlot) { - if (NEIClientUtils.getHeldItem() != null) { - return; - } - - clickSlot(window, fromSlot);//pickup fromSlot - if (NEIClientUtils.getHeldItem() == null)//maybe this container does auto transfers. No need to pick up the final item - { - return; - } - clickSlot(window, toSlot);//place one in toSlot - } - - public void moveOneItem(GuiContainer window, int fromSlot, int toSlot) { - clickSlot(window, fromSlot);//pickup fromSlot - clickSlot(window, toSlot, 1);//place one in toSlot - clickSlot(window, fromSlot);//place down in fromSlot - } - - public void retrieveItem(GuiContainer window, int toSlot) { - Slot slot = window.inventorySlots.getSlot(toSlot); - ItemStack slotStack = slot.getStack(); - if (slotStack == null || - slotStack.stackSize == slot.getSlotStackLimit() || - slotStack.stackSize == slotStack.getMaxStackSize()) { - return; - } - - generateSlotMap(window.inventorySlots, slotStack); - - Integer destZone = slotZoneMap.get(toSlot); - if (destZone == null)//slots that don't accept - { - return; - } - - int firstZoneSlot = findShiftClickDestinationSlot(window.inventorySlots, toSlot); - int firstZone = -1; - if (firstZoneSlot != -1) { - Integer integer = slotZoneMap.get(firstZoneSlot); - if (integer != null) { - firstZone = integer; - if (retrieveItemFromZone(window, firstZone, toSlot)) { - return; - } - } - } - - for (int zone = 0; zone < slotZones.size(); zone++) { - if (zone == destZone || zone == firstZone) { - continue; - } - - if (retrieveItemFromZone(window, zone, toSlot)) { - return; - } - } - - retrieveItemFromZone(window, destZone, toSlot); - } - - private boolean retrieveItemFromZone(GuiContainer window, int zone, int toSlot) { - ItemStack stack = window.inventorySlots.getSlot(toSlot).getStack(); - for (int i : slotZones.get(zone)) { - if (i == toSlot) { - continue; - } - - Slot slot = window.inventorySlots.getSlot(i); - ItemStack stack1 = slot.getStack(); - - if (areStacksSameType(stack, stack1) && - stack1.stackSize != slot.getSlotStackLimit() && //get from full stacks on second pass - stack1.stackSize != stack1.getMaxStackSize()) { - moveOneItem(window, i, toSlot); - return true; - } - } - - for (int i : slotZones.get(zone)) { - if (i == toSlot) { - continue; - } - - Slot slot = window.inventorySlots.getSlot(i); - ItemStack stack1 = slot.getStack(); - - if (areStacksSameType(stack, stack1)) { - moveOneItem(window, i, toSlot); - return true; - } - } - return false; - } - - public static void clickSlot(GuiContainer window, int slotIndex) { - clickSlot(window, slotIndex, 0); - } - - public static void clickSlot(GuiContainer window, int slotIndex, int button) { - clickSlot(window, slotIndex, button, ClickType.PICKUP); - } - - public static void clickSlot(GuiContainer window, int slotIndex, int button, ClickType clickType) { - GuiContainerManager.getManager(window).handleSlotClick(slotIndex, button, clickType); - } - - private boolean fillZoneWithHeldItem(GuiContainer window, int zoneIndex) { - for (int transferTo : slotZones.get(zoneIndex)) { - ItemStack held = NEIClientUtils.getHeldItem(); - - if (held == null) { - break; - } - - ItemStack inToSlot = window.inventorySlots.getSlot(transferTo).getStack(); - - if (!areStacksSameType(inToSlot, held)) { - continue; - } - - clickSlot(window, transferTo); - } - - for (int transferTo : slotZones.get(zoneIndex))//repeat on empty slots - { - ItemStack held = NEIClientUtils.getHeldItem(); - - if (held == null) { - break; - } - - ItemStack inToSlot = window.inventorySlots.getSlot(transferTo).getStack(); - - if (inToSlot != null) { - continue; - } - - clickSlot(window, transferTo); - } - - return NEIClientUtils.getHeldItem() == null; - } - - public void throwAll(GuiContainer window, int pickedUpFromSlot) { - ItemStack held = NEIClientUtils.getHeldItem(); - if (held == null) { - return; - } - - clickSlot(window, -999); - - generateSlotMap(window.inventorySlots, held); - Integer zone = slotZoneMap.get(pickedUpFromSlot); - if (zone == null) //something went wrong and we can't work out where the item was picked up from - { - return; - } - - for (int slotIndex : slotZones.get(zone)) { - Slot slot = window.inventorySlots.getSlot(slotIndex); - if (areStacksSameType(held, slot.getStack())) { - clickSlot(window, slotIndex); - clickSlot(window, -999); - } - } - } -} diff --git a/dependencies/main/java/codechicken/nei/FingerprintChecker.java b/dependencies/main/java/codechicken/nei/FingerprintChecker.java deleted file mode 100644 index 688395937b..0000000000 --- a/dependencies/main/java/codechicken/nei/FingerprintChecker.java +++ /dev/null @@ -1,86 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.fingerprint.FingerprintViolatedCrashCallable; -import com.google.common.collect.ImmutableList; -import net.minecraftforge.fml.common.*; -import org.apache.logging.log4j.Level; - -import java.security.cert.Certificate; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -/** - * Created by covers1624 on 13/12/2016. - * To be packaged in each mod runtime, used to cross verify jar fingerprints. - * Idea behind this: - * A malicious user would have to override the fingerprint data in all mod jars this is packaged with in order to avoid detection. - * This is not to be used as DRM. It is used simply to provide cross verification of jars. - */ -public class FingerprintChecker { - - private static final Map modCertMap = new HashMap(); - private static final List invalidMods = new ArrayList(); - - static { - //@formatter:off - modCertMap.put("CodeChickenLib" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("CodeChickenCore" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("ChickenChunks" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("EnderStorage" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("Translocator" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("NotEnoughItems" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - modCertMap.put("forgemultipartcbe" , "f1850c39b2516232a2108a7bd84d1cb5df93b261"); - //@formatter:on - } - - public static void runFingerprintChecks() { - try { - ModContainer activeContainer = Loader.instance().activeModContainer(); - for (Entry modEntry : Loader.instance().getIndexedModList().entrySet()) { - for (Entry certEntry : modCertMap.entrySet()) { - if (modEntry.getKey().equals(certEntry.getKey())) { - Object modInstance = modEntry.getValue().getMod(); - if (modInstance == null) { - FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "Unable to do Fingerprint Verification for mod %s! ModContainer returned a null mod instance!", modEntry.getKey()); - break; - } - if (modInstance.getClass().getName().contains("net.minecraftforge.")) { - FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "Unable to do Fingerprint Verification for mod %s! ModContainer returned is a suspected FML class! [%s]", modEntry.getKey(), modInstance.getClass().getName()); - } - - Certificate[] certificates = modInstance.getClass().getProtectionDomain().getCodeSource().getCertificates(); - ImmutableList.Builder certBuilder = ImmutableList.builder(); - if (certificates != null) { - for (Certificate cert : certificates) { - certBuilder.add(CertificateHelper.getFingerprint(cert)); - } - } - - ImmutableList certList = certBuilder.build(); - - String expectedFingerprint = certEntry.getValue(); - - if (expectedFingerprint != null && !expectedFingerprint.isEmpty()) { - if (!certList.contains(expectedFingerprint)) { - FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.FATAL, "The fingerprint for mod %s is invalid! Expected: %s", modEntry.getKey(), expectedFingerprint); - invalidMods.add(modEntry.getKey()); - break; - } else { - FMLLog.log(activeContainer.getModId() + " Fingerprint Verification", Level.DEBUG, "Valid fingerprint found for mod %s.", modEntry.getKey()); - } - } - - break; - } - } - } - FMLCommonHandler.instance().registerCrashCallable(new FingerprintViolatedCrashCallable(activeContainer.getModId(), invalidMods)); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/dependencies/main/java/codechicken/nei/GuiEnchantmentModifier.java b/dependencies/main/java/codechicken/nei/GuiEnchantmentModifier.java deleted file mode 100644 index 4438d0afb7..0000000000 --- a/dependencies/main/java/codechicken/nei/GuiEnchantmentModifier.java +++ /dev/null @@ -1,106 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.texture.TextureUtils; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.world.World; - -import java.io.IOException; - -import static codechicken.nei.util.NEIClientUtils.translate; - -public class GuiEnchantmentModifier extends GuiContainer { - ContainerEnchantmentModifier container; - - public GuiEnchantmentModifier(InventoryPlayer inventoryplayer, World world) { - super(new ContainerEnchantmentModifier(inventoryplayer, world)); - container = (ContainerEnchantmentModifier) inventorySlots; - container.parentscreen = this; - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - fontRendererObj.drawString(translate("enchant"), 12, 6, 0x404040); - fontRendererObj.drawString(translate("enchant.level"), 19, 20, 0x404040); - } - - protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { - GlStateManager.color(1, 1, 1, 1); - TextureUtils.changeTexture("textures/gui/container/enchanting_table.png"); - GlStateManager.translate(guiLeft, guiTop, 0); - drawTexturedModalRect(0, 0, 0, 0, xSize, ySize); - - container.onUpdate(i, j); - container.drawSlots(this); - container.drawScrollBar(this); - - String levelstring = "" + container.level; - fontRendererObj.drawString(levelstring, 33 - fontRendererObj.getStringWidth(levelstring) / 2, 34, 0xFF606060); - - GlStateManager.translate(-guiLeft, -guiTop, 0); - } - - public void initGui() { - super.initGui(); - - buttonList.add(new GuiNEIButton(0, width / 2 - 78, height / 2 - 52, 12, 12, "<")); - buttonList.add(new GuiNEIButton(1, width / 2 - 44, height / 2 - 52, 12, 12, ">")); - buttonList.add(new GuiNEIButton(2, width / 2 - 80, height / 2 - 15, 50, 12, lockDisplayString())); - } - - private String lockDisplayString() { - return validateEnchantments() ? translate("enchant.locked") : translate("enchant.unlocked"); - } - - public static boolean validateEnchantments() { - return NEIClientConfig.world.nbt.getBoolean("validateenchantments"); - } - - public static void toggleEnchantmentValidation() { - NEIClientConfig.world.nbt.setBoolean("validateenchantments", !validateEnchantments()); - NEIClientConfig.world.saveNBT(); - } - - protected void actionPerformed(GuiButton guibutton) { - if (guibutton.id == 0) { - changeLevel(-1); - } else if (guibutton.id == 1) { - changeLevel(1); - } else if (guibutton.id == 2) { - toggleEnchantmentValidation(); - container.updateEnchantmentOptions(validateEnchantments()); - guibutton.displayString = lockDisplayString(); - } - } - - private void changeLevel(int i) { - container.level += i; - buttonList.get(0).enabled = container.level != 1; - buttonList.get(1).enabled = container.level != 10; - } - - @Override - protected void mouseClicked(int i, int j, int k) throws IOException { - if (container.clickButton(i, j, k)) { - return; - } - if (container.clickScrollBar(i, j, k)) { - return; - } - - super.mouseClicked(i, j, k); - } - - @Override - protected void mouseReleased(int i, int j, int k) { - container.mouseUp(i, j, k); - super.mouseReleased(i, j, k); - } - - public FontRenderer getFontRenderer() { - return fontRendererObj; - } -} diff --git a/dependencies/main/java/codechicken/nei/GuiExtendedCreativeInv.java b/dependencies/main/java/codechicken/nei/GuiExtendedCreativeInv.java deleted file mode 100644 index 56ec566427..0000000000 --- a/dependencies/main/java/codechicken/nei/GuiExtendedCreativeInv.java +++ /dev/null @@ -1,56 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.texture.TextureUtils; -import codechicken.nei.api.INEIGuiHandler; -import codechicken.nei.api.TaggedInventoryArea; -import codechicken.nei.util.NEIServerUtils; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; - -import java.util.Arrays; -import java.util.List; - -public class GuiExtendedCreativeInv extends GuiContainer implements INEIGuiHandler { - public GuiExtendedCreativeInv(Container par1Container) { - super(par1Container); - ySize = 198; - } - - @Override - protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { - GlStateManager.color(1, 1, 1, 1); - TextureUtils.changeTexture("nei:textures/gui/inv.png"); - - int x = guiLeft; - int y = guiTop - 4; - - drawTexturedModalRect(x - 23, y, 0, 0, 199, 204); - } - - @Override - public VisibilityData modifyVisiblity(GuiContainer gui, VisibilityData currentVisibility) { - return currentVisibility; - } - - @Override - public Iterable getItemSpawnSlots(GuiContainer gui, ItemStack item) { - return NEIServerUtils.getRange(0, 54); - } - - @Override - public List getInventoryAreas(GuiContainer gui) { - return Arrays.asList(new TaggedInventoryArea("ExtendedCreativeInv", 0, 54, inventorySlots)); - } - - @Override - public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button) { - return false; - } - - @Override - public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) { - return false; - } -} diff --git a/dependencies/main/java/codechicken/nei/GuiNEIButton.java b/dependencies/main/java/codechicken/nei/GuiNEIButton.java deleted file mode 100644 index 026cca4af7..0000000000 --- a/dependencies/main/java/codechicken/nei/GuiNEIButton.java +++ /dev/null @@ -1,40 +0,0 @@ -package codechicken.nei; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.ResourceLocation; - -public class GuiNEIButton extends GuiButton { - protected static ResourceLocation guiTex = new ResourceLocation("textures/gui/widgets.png"); - - public GuiNEIButton(int i, int j, int k, int l, int i1, String s) { - super(i, j, k, l, i1, s); - } - - public void drawButton(Minecraft minecraft, int i, int j) { - if (!visible) { - return; - } - - FontRenderer fontrenderer = minecraft.fontRendererObj; - minecraft.renderEngine.bindTexture(guiTex); - GlStateManager.color(1, 1, 1, 1); - boolean flag = i >= xPosition && j >= yPosition && i < xPosition + width && j < yPosition + height; - int k = getHoverState(flag); - drawTexturedModalRect(xPosition, yPosition, 0, 46 + k * 20, width / 2, height / 2);//top left - drawTexturedModalRect(xPosition + width / 2, yPosition, 200 - width / 2, 46 + k * 20, width / 2, height / 2);//top right - drawTexturedModalRect(xPosition, yPosition + height / 2, 0, 46 + k * 20 + 20 - height / 2, width / 2, height / 2);//bottom left - drawTexturedModalRect(xPosition + width / 2, yPosition + height / 2, 200 - width / 2, 46 + k * 20 + 20 - height / 2, width / 2, height / 2);//bottom right - mouseDragged(minecraft, i, j); - - if (!enabled) { - drawCenteredString(fontrenderer, displayString, xPosition + width / 2, yPosition + (height - 8) / 2, 0xffa0a0a0); - } else if (flag) { - drawCenteredString(fontrenderer, displayString, xPosition + width / 2, yPosition + (height - 8) / 2, 0xffffa0); - } else { - drawCenteredString(fontrenderer, displayString, xPosition + width / 2, yPosition + (height - 8) / 2, 0xe0e0e0); - } - } -} diff --git a/dependencies/main/java/codechicken/nei/GuiPotionCreator.java b/dependencies/main/java/codechicken/nei/GuiPotionCreator.java deleted file mode 100644 index 02f11d6284..0000000000 --- a/dependencies/main/java/codechicken/nei/GuiPotionCreator.java +++ /dev/null @@ -1,339 +0,0 @@ -package codechicken.nei; - -import codechicken.core.gui.GuiCCButton; -import codechicken.core.gui.GuiCCTextField; -import codechicken.core.gui.GuiScrollSlot; -import codechicken.core.inventory.GuiContainerWidget; -import codechicken.lib.util.FontUtils; -import codechicken.lib.texture.TextureUtils; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.text.translation.I18n; - -import java.awt.*; -import java.util.ArrayList; - -public class GuiPotionCreator extends GuiContainerWidget { - public class GuiSlotPotionEffects extends GuiScrollSlot { - public int selectedslot = -1; - public boolean enabled = true; - private ArrayList validPotions = new ArrayList(); - - public GuiSlotPotionEffects(int x, int y) { - super(x, y, 108, 76); - for (Potion p : Potion.REGISTRY) { - if (p != null) { - validPotions.add(p); - } - } - setSmoothScroll(false); - setMargins(0, 0, 0, 0); - } - - @Override - public int getSlotHeight(int slot) { - return 19; - } - - @Override - public void drawBackground(float frame) { - super.drawBackground(frame); - drawRect(x, y, x + width, y + height, 0xFF000000); - } - - @Override - public void drawOverlay(float frame) { - } - - @Override - public int scrollbarGuideAlignment() { - return 0; - } - - @Override - public Dimension scrollbarDim() { - Dimension dim = super.scrollbarDim(); - dim.width = 7; - return dim; - } - - @Override - protected void drawSlot(int slot, int x, int y, int mx, int my, float frame) { - GlStateManager.color(1, 1, 1, 1); - Potion potion = validPotions.get(slot); - PotionEffect effect = getEffect(potion); - boolean blank = effect == null; - if (effect == null) { - effect = new PotionEffect(potion, 1200, 0); - } - int shade = selectedslot == slot ? 2 : blank ? 1 : 0; - - TextureUtils.changeTexture("textures/gui/container/enchanting_table.png"); - drawTexturedModalRect(x, y, 0, 166 + getSlotHeight(slot) * shade, width - 30, getSlotHeight(slot)); - drawTexturedModalRect(x + width - 30, y, width - 23, 166 + getSlotHeight(slot) * shade, 30, getSlotHeight(slot)); - - if (potion.hasStatusIcon()) { - TextureUtils.changeTexture("textures/gui/container/inventory.png"); - int icon = potion.getStatusIconIndex(); - drawTexturedModalRect(x + 1, y + 1, icon % 8 * 18, 198 + icon / 8 * 18, 18, 18); - } - - String name = I18n.translateToLocal(potion.getName()); - String amp = effect.getAmplifier() > 0 ? " " + translateAmplifier(effect.getAmplifier()) : ""; - int textColour = shade == 0 ? 0x685e4a : shade == 1 ? 0x407f10 : 0xffff80; - if (fontRenderer.getStringWidth(name + amp) < width - 20) { - fontRenderer.drawString(name + amp, x + 20, y + 1, textColour); - } else { - fontRenderer.drawString(name, x + 20, y + 1, textColour); - FontUtils.drawRightString(amp, x + width - 10, y + 10, textColour); - } - - String duration = Potion.getPotionDurationString(effect, 1.0F); - textColour = shade == 0 ? 0xA0A0A0 : shade == 1 ? 0x808080 : 0xCCCCCC; - fontRenderer.drawStringWithShadow(duration, x + 20, y + 10, textColour); - } - - private PotionEffect getEffect(Potion potion) { - ItemStack potionStack = container.potionInv.getStackInSlot(0); - if (potionStack != null && potionStack.hasTagCompound() && potionStack.getTagCompound().hasKey("CustomPotionEffects")) { - NBTTagList potionTagList = potionStack.getTagCompound().getTagList("CustomPotionEffects", 10); - for (int i = 0; i < potionTagList.tagCount(); i++) { - PotionEffect effect = PotionEffect.readCustomPotionEffectFromNBT(potionTagList.getCompoundTagAt(i)); - if (effect.getPotion() == potion) { - return effect; - } - } - } - return null; - } - - @Override - protected int getNumSlots() { - return validPotions.size(); - } - - @Override - protected void slotClicked(int slot, int button, int mx, int my, int count) { - if (!enabled) { - return; - } - - if (button == 0) { - select(slot); - applyEffect(); - } else if (button == 1) { - deselect(); - container.removePotionEffect(validPotions.get(slot)); - } - } - - public void selectNext() { - if (selectedslot >= 0 && selectedslot + 1 < getNumSlots()) { - select(selectedslot + 1); - showSlot(selectedslot); - } - } - - public void selectPrev() { - if (selectedslot > 0) { - select(selectedslot - 1); - showSlot(selectedslot); - } - } - - public void setEnabled(boolean b) { - if (b == enabled) { - return; - } - enabled = b; - if (!enabled) { - deselect(); - } - } - - private void select(int slot) { - selectedslot = slot; - durationField.setEnabled(true); - PotionEffect effect = getEffect(validPotions.get(slot)); - if (effect == null) { - effect = new PotionEffect(validPotions.get(slot), 1200, 0); - } - durationField.setDurationTicks(effect.getDuration()); - amplifier = effect.getAmplifier(); - validateInputButtons(); - } - - private void deselect() { - selectedslot = -1; - durationField.setEnabled(false); - ampDown.setEnabled(false); - ampUp.setEnabled(false); - } - - public Potion selectedPotion() { - return validPotions.get(selectedslot); - } - } - - public class GuiDurationField extends GuiCCTextField { - private String baseValue; - - public GuiDurationField(int x, int y, int width, int height) { - super(x, y, width, height, "100"); - setMaxStringLength(4); - setAllowedCharacters("0123456789"); - baseValue = getText(); - } - - public void setDurationTicks(int i) { - i /= 20; - String minutes = Integer.toString(i / 60); - String seconds = Integer.toString(i % 60); - if (seconds.length() == 1) { - seconds = '0' + seconds; - } - setText(minutes + seconds); - } - - @Override - public void setEnabled(boolean b) { - super.setEnabled(b); - if (!isEnabled()) { - setText("100"); - } - } - - @Override - public void onFocusChanged() { - if (isFocused()) { - baseValue = getText(); - } else { - if (!validateValue()) { - setText(baseValue); - } else { - applyEffect(); - } - } - } - - @Override - public void onTextChanged(String oldText) { - validateInputButtons(); - } - - private boolean validateValue() { - try { - int i = Integer.parseInt(getText()); - return i > 1 && getDurationTicks() < Short.MAX_VALUE && i / 100 <= 60 && i % 100 < 60; - } catch (NumberFormatException nfe) { - return false; - } - } - - @Override - public void drawText() { - String s = getText(); - String seconds = s.substring(Math.max(0, s.length() - 2), Math.max(0, s.length() - 2) + Math.min(s.length(), 2)); - String minutes = s.length() < 3 ? "" : s.substring(0, s.length() - 2); - int ty = y + height / 2 - 4; - int tcolour = getTextColour(); - FontUtils.drawCenteredString(":", x + width / 2 + 1, ty, tcolour); - FontUtils.drawRightString(seconds, x + width - 3, ty, tcolour); - FontUtils.drawRightString(minutes, x + width / 2 - 1, ty, tcolour); - } - - @Override - public int getTextColour() { - return isFocused() ? 0xCCCCCC : 0x909090; - } - - public int getDurationTicks() { - int i = Integer.parseInt(getText()); - return ((i / 100) * 60 + (i % 100)) * 20; - } - } - - int amplifier = 0; - GuiCCButton ampDown; - GuiCCButton ampUp; - GuiSlotPotionEffects slotPotionEffects; - GuiDurationField durationField; - ContainerPotionCreator container; - - public GuiPotionCreator(InventoryPlayer inventoryplayer) { - super(new ContainerPotionCreator(inventoryplayer, new ContainerPotionCreator.InventoryPotionStore()), 176, 208); - container = (ContainerPotionCreator) inventorySlots; - } - - public void applyEffect() { - if (slotPotionEffects.selectedslot >= 0) { - container.setPotionEffect(slotPotionEffects.selectedPotion(), durationField.getDurationTicks(), amplifier); - } - } - - public String translateAmplifier(int amplifier) { - switch (amplifier) { - case 0: - return "I"; - case 1: - return "II"; - case 2: - return "III"; - case 3: - return "IV"; - case 4: - return "V"; - } - return Integer.toString(amplifier); - } - - public void validateInputButtons() { - ampDown.setEnabled(amplifier > 0); - ampUp.setEnabled(amplifier < 3); - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) { - //fontRenderer.drawString("Potion", 12, 6, 0x404040); - } - - @Override - public void drawBackground() { - TextureUtils.changeTexture("nei:textures/gui/potion.png"); - drawTexturedModalRect(0, 0, 0, 0, xSize, ySize); - - FontUtils.drawCenteredString("Favourite Potions", xSize / 2, 4, 0x404040); - fontRendererObj.drawString("Duration", 12, 40, 0x404040); - fontRendererObj.drawString("Level", 19, 73, 0x404040); - FontUtils.drawCenteredString(translateAmplifier(amplifier), 33, 86, 0xFF606060); - } - - @Override - public void addWidgets() { - add(ampDown = new GuiCCButton(10, 84, 12, 12, "<").setActionCommand("ampDown")); - add(ampUp = new GuiCCButton(44, 84, 12, 12, ">").setActionCommand("ampUp")); - add(durationField = new GuiDurationField(15, 53, 35, 12)); - add(slotPotionEffects = new GuiSlotPotionEffects(60, 38)); - } - - @Override - public void updateScreen() { - super.updateScreen(); - slotPotionEffects.setEnabled(container.potionInv.getStackInSlot(0) != null); - } - - @Override - public void actionPerformed(String ident, Object... params) { - if (ident.equals("ampDown")) { - amplifier--; - } else if (ident.equals("ampUp")) { - amplifier++; - } - applyEffect(); - validateInputButtons(); - } -} diff --git a/dependencies/main/java/codechicken/nei/HUDRenderer.java b/dependencies/main/java/codechicken/nei/HUDRenderer.java deleted file mode 100644 index 023b0b642d..0000000000 --- a/dependencies/main/java/codechicken/nei/HUDRenderer.java +++ /dev/null @@ -1,97 +0,0 @@ -package codechicken.nei; - -import codechicken.nei.KeyManager.IKeyStateTracker; -import codechicken.nei.api.ItemInfo; -import codechicken.nei.guihook.GuiContainerManager; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.world.World; - -import java.awt.*; -import java.util.ArrayList; -import java.util.List; - -import static codechicken.lib.gui.GuiDraw.*; - -@Deprecated -public class HUDRenderer implements IKeyStateTracker { - @Override - public void tickKeyStates() { -// if (KeyBindings.get("nei.options.keys.world.highlight_tips").isPressed()) { -// ConfigTag tag = NEIClientConfig.getSetting("world.highlight_tips"); -// tag.setBooleanValue(!tag.getBooleanValue()); -// } - } - - public static void renderOverlay() { - Minecraft mc = Minecraft.getMinecraft(); - if (mc.currentScreen == null && - mc.theWorld != null && - !mc.gameSettings.keyBindPlayerList.isKeyDown() && - NEIClientConfig.getBooleanSetting("world.highlight_tips") && - mc.objectMouseOver != null && - mc.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK) { - World world = mc.theWorld; - ArrayList items = ItemInfo.getIdentifierItems(world, mc.thePlayer, mc.objectMouseOver); - if (items.isEmpty()) { - return; - } - - int minDamage = Integer.MAX_VALUE; - ItemStack stack = null; - for (ItemStack astack : items) { - if (astack.getItem() != null && astack.getItemDamage() < minDamage) { - stack = astack; - minDamage = stack.getItemDamage(); - } - } - - renderOverlay(stack, ItemInfo.getText(stack, world, mc.thePlayer, mc.objectMouseOver), getPositioning()); - } - } - - public static void renderOverlay(ItemStack stack, List textData, Point pos) { - if ((stack == null || stack.getItem() == null) && textData.isEmpty()) { - return; - } - - int w = 0; - for (String s : textData) { - w = Math.max(w, getStringWidth(s) + 29); - } - int h = Math.max(24, 10 + 10 * textData.size()); - - Dimension size = displaySize(); - int x = (size.width - w - 1) * pos.x / 10000; - int y = (size.height - h - 1) * pos.y / 10000; - - GlStateManager.disableRescaleNormal(); - RenderHelper.disableStandardItemLighting(); - GlStateManager.disableDepth(); - - //drawTooltipBox(x, y, w, h); - - int ty = (h - 8 * textData.size()) / 2; - for (int i = 0; i < textData.size(); i++) { - drawString(textData.get(i), x + 24, y + ty + 10 * i, 0xFFA0A0A0, true); - } - - GlStateManager.enableRescaleNormal(); - RenderHelper.enableGUIStandardItemLighting(); - - if (stack != null && stack.getItem() != null) { - GuiContainerManager.drawItem(x + 5, y + h / 2 - 8, stack); - } - } - - private static Point getPositioning() { - return new Point(NEIClientConfig.getSetting("world.highlight_tips.x").getIntValue(), NEIClientConfig.getSetting("world.highlight_tips.y").getIntValue()); - } - - public static void load() { - //KeyManager.trackers.add(new HUDRenderer()); - } -} diff --git a/dependencies/main/java/codechicken/nei/Image.java b/dependencies/main/java/codechicken/nei/Image.java deleted file mode 100644 index 5290e00b7c..0000000000 --- a/dependencies/main/java/codechicken/nei/Image.java +++ /dev/null @@ -1,15 +0,0 @@ -package codechicken.nei; - -public class Image { - public int x; - public int y; - public int width; - public int height; - - public Image(int i, int j, int k, int l) { - x = i; - y = j; - width = k; - height = l; - } -} diff --git a/dependencies/main/java/codechicken/nei/InfiniteStackSizeHandler.java b/dependencies/main/java/codechicken/nei/InfiniteStackSizeHandler.java deleted file mode 100644 index cae95f8667..0000000000 --- a/dependencies/main/java/codechicken/nei/InfiniteStackSizeHandler.java +++ /dev/null @@ -1,50 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.inventory.InventoryUtils; -import codechicken.nei.api.IInfiniteItemHandler; -import codechicken.nei.util.NEIServerUtils; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; - -public class InfiniteStackSizeHandler implements IInfiniteItemHandler { - @Override - public void onPickup(ItemStack heldItem) { - heldItem.stackSize = 1; - } - - @Override - public void onPlaceInfinite(ItemStack heldItem) { - heldItem.stackSize = 111; - } - - @Override - public boolean canHandleItem(ItemStack stack) { - return !stack.isItemStackDamageable(); - } - - @Override - public boolean isItemInfinite(ItemStack stack) { - return stack.stackSize == -1 || stack.stackSize > 100; - } - - @Override - public void replenishInfiniteStack(InventoryPlayer inv, int slotNo) { - ItemStack stack = inv.getStackInSlot(slotNo); - stack.stackSize = 111; - - for (int i = 0; i < inv.getSizeInventory(); i++) { - if (i == slotNo) { - continue; - } - - if (NEIServerUtils.areStacksSameType(stack, inv.getStackInSlot(i))) { - inv.setInventorySlotContents(i, null); - } - } - } - - @Override - public ItemStack getInfiniteItem(ItemStack typeStack) { - return InventoryUtils.copyStack(typeStack, -1); - } -} diff --git a/dependencies/main/java/codechicken/nei/InfiniteToolHandler.java b/dependencies/main/java/codechicken/nei/InfiniteToolHandler.java deleted file mode 100644 index c55aea6677..0000000000 --- a/dependencies/main/java/codechicken/nei/InfiniteToolHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -package codechicken.nei; - -import codechicken.nei.api.IInfiniteItemHandler; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; - -public class InfiniteToolHandler implements IInfiniteItemHandler { - @Override - public void onPickup(ItemStack heldItem) { - heldItem.setItemDamage(0); - } - - @Override - public void onPlaceInfinite(ItemStack heldItem) { - heldItem.setItemDamage(-32000); - } - - @Override - public void replenishInfiniteStack(InventoryPlayer inv, int slotNo) { - inv.getStackInSlot(slotNo).setItemDamage(-32000); - } - - @Override - public boolean canHandleItem(ItemStack stack) { - return stack.getItem().isDamageable() && stack.getMaxStackSize() == 1; - } - - @Override - public boolean isItemInfinite(ItemStack stack) { - return stack.getItemDamage() < -30000; - } - - @Override - public ItemStack getInfiniteItem(ItemStack typeStack) { - return new ItemStack(typeStack.getItem(), 1, -32000); - } -} diff --git a/dependencies/main/java/codechicken/nei/ItemList.java b/dependencies/main/java/codechicken/nei/ItemList.java deleted file mode 100644 index 0624b2ae08..0000000000 --- a/dependencies/main/java/codechicken/nei/ItemList.java +++ /dev/null @@ -1,266 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.item.filtering.IItemFilter; -import codechicken.lib.item.filtering.IItemFilterProvider; -import codechicken.lib.thread.RestartableTask; -import codechicken.lib.thread.ThreadOperationTimer; -import codechicken.lib.thread.ThreadOperationTimer.TimeoutException; -import codechicken.nei.api.ItemInfo; -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.util.LogHelper; -import codechicken.nei.util.NEIServerUtils; -import codechicken.nei.widget.ItemPanel; -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.ListMultimap; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.regex.Pattern; - -public class ItemList { - /** - * Fields are replaced atomically and contents never modified. - */ - public static volatile List items = new ArrayList(); - /** - * Fields are replaced atomically and contents never modified. - */ - public static volatile ListMultimap itemMap = ArrayListMultimap.create(); - /** - * Updates to this should be synchronised on this - */ - public static final List itemFilterers = new LinkedList(); - public static final List loadCallbacks = new LinkedList(); - - private static HashSet erroredItems = new HashSet(); - private static HashSet stackTraces = new HashSet(); - - public static class EverythingItemFilter implements IItemFilter { - @Override - public boolean matches(ItemStack item) { - return true; - } - } - - public static class NothingItemFilter implements IItemFilter { - @Override - public boolean matches(ItemStack item) { - return false; - } - } - - public static class PatternItemFilter implements IItemFilter { - public Pattern pattern; - - public PatternItemFilter(Pattern pattern) { - this.pattern = pattern; - } - - @Override - public boolean matches(ItemStack item) { - return pattern.matcher(ItemInfo.getSearchName(item)).find(); - } - } - - public static class AllMultiItemFilter implements IItemFilter { - public List filters = new LinkedList(); - - public AllMultiItemFilter(List filters) { - this.filters = filters; - } - - public AllMultiItemFilter() { - this(new LinkedList()); - } - - @Override - public boolean matches(ItemStack item) { - for (IItemFilter filter : filters) { - try { - if (!filter.matches(item)) { - return false; - } - } catch (Exception e) { - LogHelper.errorError("Exception filtering " + item + " with " + filter, e); - } - } - - return true; - } - } - - public static class AnyMultiItemFilter implements IItemFilter { - public List filters = new LinkedList(); - - public AnyMultiItemFilter(List filters) { - this.filters = filters; - } - - public AnyMultiItemFilter() { - this(new LinkedList()); - } - - @Override - public boolean matches(ItemStack item) { - for (IItemFilter filter : filters) { - try { - if (filter.matches(item)) { - return true; - } - } catch (Exception e) { - LogHelper.errorError("Exception filtering " + item + " with " + filter, e); - } - } - - return false; - } - } - - public interface ItemsLoadedCallback { - void itemsLoaded(); - } - - public static boolean itemMatchesAll(ItemStack item, List filters) { - for (IItemFilter filter : filters) { - try { - if (!filter.matches(item)) { - return false; - } - } catch (Exception e) { - LogHelper.errorError("Exception filtering " + item + " with " + filter, e); - } - } - - return true; - } - - /** - * @deprecated use getItemListFilter().matches(item) - */ - @Deprecated - public static boolean itemMatches(ItemStack item) { - return getItemListFilter().matches(item); - } - - public static IItemFilter getItemListFilter() { - return new AllMultiItemFilter(getItemFilters()); - } - - public static List getItemFilters() { - LinkedList filters = new LinkedList(); - synchronized (itemFilterers) { - for (IItemFilterProvider p : itemFilterers) { - filters.add(p.getFilter()); - } - } - return filters; - } - - public static final RestartableTask loadItems = new RestartableTask("NEI Item Loading") { - private void damageSearch(Item item, List permutations) { - HashSet damageIconSet = new HashSet(); - for (int damage = 0; damage < 16; damage++) { - try { - ItemStack stack = new ItemStack(item, 1, damage); - IBakedModel model = GuiContainerManager.getRenderItem().getItemModelMesher().getItemModel(stack); - String name = GuiContainerManager.concatenatedDisplayName(stack, false); - String s = name + "@" + (model == null ? 0 : model.hashCode()); - if (!damageIconSet.contains(s)) { - damageIconSet.add(s); - permutations.add(stack); - } - } catch (TimeoutException t) { - throw t; - } catch (Throwable t) { - NEIServerUtils.logOnce(t, stackTraces, "Ommiting " + item + ":" + damage + " " + item.getClass().getSimpleName(), item.toString()); - } - } - } - - @Override - public void execute() { - ThreadOperationTimer timer = getTimer(500); - - LinkedList items = new LinkedList(); - LinkedList permutations = new LinkedList(); - ListMultimap itemMap = ArrayListMultimap.create(); - - timer.setLimit(500); - for (Item item : Item.REGISTRY) { - if (interrupted()) { - return; - } - - if (item == null || erroredItems.contains(item)) { - continue; - } - - try { - timer.reset(item); - - permutations.clear(); - permutations.addAll(ItemInfo.itemOverrides.get(item)); - - if (permutations.isEmpty()) { - item.getSubItems(item, null, permutations); - } - - if (permutations.isEmpty()) { - damageSearch(item, permutations); - } - - permutations.addAll(ItemInfo.itemVariants.get(item)); - - timer.reset(); - items.addAll(permutations); - itemMap.putAll(item, permutations); - } catch (Throwable t) { - LogHelper.errorError("Removing item: %s from list.", t, item); - erroredItems.add(item); - } - } - - if (interrupted()) { - return; - } - ItemList.items = items; - ItemList.itemMap = itemMap; - for (ItemsLoadedCallback callback : loadCallbacks) { - callback.itemsLoaded(); - } - - updateFilter.restart(); - } - }; - - public static final RestartableTask updateFilter = new RestartableTask("NEI Item Filtering") { - @Override - public void execute() { - ArrayList filtered = new ArrayList(); - IItemFilter filter = getItemListFilter(); - for (ItemStack item : items) { - if (interrupted()) { - return; - } - - if (filter.matches(item)) { - filtered.add(item); - } - } - - if (interrupted()) { - return; - } - ItemSorter.sort(filtered); - if (interrupted()) { - return; - } - ItemPanel.updateItemList(filtered); - } - }; -} diff --git a/dependencies/main/java/codechicken/nei/ItemMobSpawner.java b/dependencies/main/java/codechicken/nei/ItemMobSpawner.java deleted file mode 100644 index b84b174929..0000000000 --- a/dependencies/main/java/codechicken/nei/ItemMobSpawner.java +++ /dev/null @@ -1,155 +0,0 @@ -package codechicken.nei; - - -import codechicken.nei.network.NEIClientPacketHandler; -import codechicken.nei.util.LogHelper; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityList; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.monster.IMob; -import net.minecraft.entity.passive.EntityPig; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntityMobSpawner; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.common.registry.GameRegistry; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -public class ItemMobSpawner extends ItemBlock { - private static Map entityHashMap = new HashMap(); - private static Map IDtoNameMap = new HashMap(); - public static int idPig; - private static boolean loaded; - private static ItemMobSpawner instance; - - public static void register() { - //GameDataManipulator.replaceItemBlock(Blocks.MOB_SPAWNER, instance = new ItemMobSpawner()); - } - - public static void initRender() { - //SpawnerRenderer.load(instance); - } - - public ItemMobSpawner() { - super(Blocks.MOB_SPAWNER); - setHasSubtypes(true); - } - - /** - * Called from BlockMobSpawner on the client via asm generated onBlockPlacedBy - */ - public static void onBlockPlaced(World world, BlockPos pos, ItemStack stack) { - if (!NEIClientConfig.hasSMPCounterPart()) { - return; - } - - TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) world.getTileEntity(pos); - if (tileentitymobspawner != null) { - setDefaultTag(stack); - String mobtype = IDtoNameMap.get(stack.getItemDamage()); - if (mobtype != null) { - NEIClientPacketHandler.sendMobSpawnerID(pos.getX(), pos.getY(), pos.getZ(), mobtype); - tileentitymobspawner.getSpawnerBaseLogic().setEntityName(mobtype); - } - } - } - - @Override - public void addInformation(ItemStack itemstack, EntityPlayer par2EntityPlayer, List list, boolean par4) { - setDefaultTag(itemstack); - int meta = itemstack.getItemDamage(); - if (meta == 0) { - meta = idPig; - } - Entity e = getEntity(meta); - list.add("\u00A7" + (e instanceof IMob ? "4" : "3") + IDtoNameMap.get(meta)); - } - - public static EntityLiving getEntity(int ID) { - EntityLiving e = entityHashMap.get(ID); - if (e == null) { - World world = Minecraft.getMinecraft().theWorld; - Class clazz = EntityList.ID_TO_CLASS.get(ID); - try { - e = (EntityLiving) clazz.getConstructor(World.class).newInstance(world); - } catch (Throwable t) { - if (clazz == null) { - LogHelper.error("Null class for entity (" + ID + ", " + IDtoNameMap.get(ID)); - } else { - LogHelper.errorError("Error creating instance of entity: " + clazz.getName(), t); - } - e = getEntity(idPig); - } - entityHashMap.put(ID, e); - } - return e; - } - - private static void setDefaultTag(ItemStack itemstack) { - if (!IDtoNameMap.containsKey(itemstack.getItemDamage())) { - itemstack.setItemDamage(idPig); - } - } - - public static void loadSpawners(World world) { - if (loaded) { - return; - } - loaded = true; - HashMap, String> classToStringMapping = (HashMap, String>) EntityList.CLASS_TO_NAME; - HashMap, Integer> classToIDMapping = (HashMap, Integer>) EntityList.CLASS_TO_ID; - for (Class entityClass : classToStringMapping.keySet()) { - if (!EntityLiving.class.isAssignableFrom(entityClass)) { - continue; - } - try { - EntityLiving entityliving = (EntityLiving) entityClass.getConstructor(new Class[] { World.class }).newInstance(world); - entityliving.isChild(); - - int id = classToIDMapping.get(entityClass); - String name = classToStringMapping.get(entityClass); - - if (name.equals("EnderDragon")) { - continue; - } - - IDtoNameMap.put(id, name); - - if (name.equals("Pig")) { - idPig = id; - } - } catch (Throwable ignored) { - } - } - - for (Iterator> it = IDtoNameMap.entrySet().iterator(); it.hasNext(); ) { - Entry e = it.next(); - if (getEntity(e.getKey()).getClass() == EntityPig.class && !e.getValue().equals("Pig")) { - it.remove(); - } - } - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - if (!NEIClientConfig.hasSMPCounterPart()) { - list.add(new ItemStack(item)); - } else { - for (int i : IDtoNameMap.keySet()) { - list.add(new ItemStack(item, 1, i)); - } - } - } -} diff --git a/dependencies/main/java/codechicken/nei/ItemQuantityField.java b/dependencies/main/java/codechicken/nei/ItemQuantityField.java deleted file mode 100644 index 2dc8c11f0b..0000000000 --- a/dependencies/main/java/codechicken/nei/ItemQuantityField.java +++ /dev/null @@ -1,48 +0,0 @@ -package codechicken.nei; - -import codechicken.nei.util.NEIClientUtils; - -public class ItemQuantityField extends TextField { - public ItemQuantityField(String ident) { - super(ident); - centered = true; - } - - @Override - public boolean isValid(String string) { - if (string.equals("")) { - return true; - } - - try { - return Integer.parseInt(string) >= 0; - } catch (NumberFormatException nfe) { - return false; - } - } - - public int intValue() { - return intValue(text()); - } - - public int intValue(String s) { - try { - return Integer.parseInt(s); - } catch (NumberFormatException nfe) { - return 0; - } - } - - @Override - public void loseFocus() { - setText(Integer.toString(NEIClientConfig.getItemQuantity())); - } - - @Override - public void onTextChange(String oldText) { - if (intValue(oldText) != intValue())//hacky recursion stopper - { - NEIClientUtils.setItemQuantity(intValue()); - } - } -} diff --git a/dependencies/main/java/codechicken/nei/ItemSorter.java b/dependencies/main/java/codechicken/nei/ItemSorter.java deleted file mode 100644 index bf6b29f217..0000000000 --- a/dependencies/main/java/codechicken/nei/ItemSorter.java +++ /dev/null @@ -1,203 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.config.ConfigTagParent; -import codechicken.nei.ItemList.ItemsLoadedCallback; -import codechicken.nei.api.API; -import codechicken.nei.api.ItemInfo; -import codechicken.nei.config.GuiItemSorter; -import codechicken.nei.config.OptionOpenGui; -import codechicken.nei.util.LogHelper; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.translation.I18n; - -import java.util.*; - -public class ItemSorter implements Comparator, ItemsLoadedCallback { - public static class SortEntry { - public String name; - public Comparator comparator; - - public SortEntry(String name, Comparator comparator) { - this.name = name; - this.comparator = comparator; - } - - public String getLocalisedName() { - return I18n.translateToLocal(name); - } - - public String getTooltip() { - String tipname = name + ".tip"; - String tip = I18n.translateToLocal(tipname); - return !tip.equals(tipname) ? tip : null; - } - } - - public static ArrayList entries = new ArrayList(); - public static ArrayList list = new ArrayList(); - public static final ItemSorter instance = new ItemSorter(); - - //optimisations - public HashMap ordering = null; - - public static void sort(ArrayList items) { - try { - Collections.sort(items, instance); - } catch (Exception e) { - LogHelper.errorError("Exception sorting item list", e); - } - } - - @Override - public int compare(ItemStack o1, ItemStack o2) { - for (SortEntry e : list) { - int c = e.comparator.compare(o1, o2); - if (c != 0) { - return c; - } - } - return 0; - } - - @Override - public void itemsLoaded() { - HashMap newMap = new HashMap(); - int i = 0; - for (ItemStack stack : ItemList.items) { - newMap.put(stack, i++); - } - ordering = newMap; - } - - public static SortEntry find(String name) { - for (SortEntry e : entries) { - if (e.name.equals(name)) { - return e; - } - } - - return null; - } - - public static int compareInt(int a, int b) { - return a == b ? 0 : a < b ? -1 : 1; - } - - public static void add(String name, Comparator comparator) { - SortEntry e = new SortEntry(name, comparator); - entries.add(e); - ArrayList nlist = new ArrayList(list); - nlist.add(e); - list = nlist;//concurrency - } - - public static void initConfig(ConfigTagParent tag) { - //minecraft, mod, id, default, meta, name - API.addSortOption("nei.itemsort.minecraft", new Comparator() { - @Override - public int compare(ItemStack o1, ItemStack o2) { - boolean m1 = "minecraft".equals(ItemInfo.itemOwners.get(o1.getItem())); - boolean m2 = "minecraft".equals(ItemInfo.itemOwners.get(o2.getItem())); - return m1 == m2 ? 0 : m1 ? -1 : 1; - } - }); - API.addSortOption("nei.itemsort.mod", new Comparator() { - @Override - public int compare(ItemStack o1, ItemStack o2) { - String mod1 = ItemInfo.itemOwners.get(o1.getItem()); - String mod2 = ItemInfo.itemOwners.get(o2.getItem()); - if (mod1 == null) { - return mod2 == null ? 0 : 1; - } - if (mod2 == null) { - return -1; - } - return mod1.compareTo(mod2); - } - }); - API.addSortOption("nei.itemsort.id", new Comparator() { - @Override - public int compare(ItemStack o1, ItemStack o2) { - int id1 = Item.getIdFromItem(o1.getItem()); - int id2 = Item.getIdFromItem(o2.getItem()); - return compareInt(id1, id2); - } - }); - API.addSortOption("nei.itemsort.default", new Comparator() { - @Override - public int compare(ItemStack o1, ItemStack o2) { - Integer order1 = instance.ordering.get(o1); - Integer order2 = instance.ordering.get(o2); - if (order1 == null) { - return order2 == null ? 0 : 1; - } - if (order2 == null) { - return -1; - } - return compareInt(order1, order2); - } - }); - API.addSortOption("nei.itemsort.damage", new Comparator() { - @Override - public int compare(ItemStack o1, ItemStack o2) { - int id1 = o1.getItemDamage(); - int id2 = o2.getItemDamage(); - return compareInt(id1, id2); - } - }); - API.addSortOption("nei.itemsort.name", new Comparator() { - @Override - public int compare(ItemStack o1, ItemStack o2) { - String name1 = ItemInfo.getSearchName(o1); - String name2 = ItemInfo.getSearchName(o2); - return name1.compareTo(name2); - } - }); - tag.getTag("inventory.itemsort").setDefaultValue(getSaveString(list)); - API.addOption(new OptionOpenGui("inventory.itemsort", GuiItemSorter.class) { - @Override - public void useGlobals() { - super.useGlobals(); - list = fromSaveString(activeTag().getValue()); - } - }); - ItemList.loadCallbacks.add(instance); - } - - public static String getSaveString(List list) { - StringBuilder sb = new StringBuilder(); - for (SortEntry e : list) { - if (sb.length() > 0) { - sb.append(','); - } - sb.append(e.name); - } - return sb.toString(); - } - - public static ArrayList fromSaveString(String s) { - if (s == null) { - return new ArrayList(entries); - } - - ArrayList list = new ArrayList(); - for (String s2 : s.split(",")) { - SortEntry e = find(s2.trim()); - if (e != null) { - list.add(e); - } - } - for (SortEntry e : entries) { - if (!list.contains(e)) { - list.add(e); - } - } - - return list; - } - - public static void loadConfig() { - list = fromSaveString(NEIClientConfig.getStringSetting("inventory.itemsort")); - } -} diff --git a/dependencies/main/java/codechicken/nei/ItemStackMap.java b/dependencies/main/java/codechicken/nei/ItemStackMap.java deleted file mode 100644 index 42c1067b31..0000000000 --- a/dependencies/main/java/codechicken/nei/ItemStackMap.java +++ /dev/null @@ -1,308 +0,0 @@ -package codechicken.nei; - -import com.google.common.base.Objects; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import static codechicken.lib.inventory.InventoryUtils.actualDamage; -import static codechicken.lib.inventory.InventoryUtils.newItemStack; -import static net.minecraftforge.oredict.OreDictionary.WILDCARD_VALUE; - -/** - * A maplike class for ItemStack keys with wildcard damage/NBT. Optimised for lookup - */ -public class ItemStackMap { - public static class StackMetaKey { - public int damage; - public NBTTagCompound tag; - - public StackMetaKey(int damage, NBTTagCompound tag) { - this.damage = damage; - this.tag = tag; - } - - public StackMetaKey(ItemStack key) { - this(actualDamage(key), key.getTagCompound()); - } - - public int hashCode() { - return Objects.hashCode(damage, tag); - } - - public boolean equals(Object o) { - if (!(o instanceof StackMetaKey)) { - return false; - } - StackMetaKey t = (StackMetaKey) o; - return damage == t.damage && Objects.equal(tag, t.tag); - } - } - - public static class Entry { - public ItemStack key; - public T value; - - public Entry(ItemStack key, T value) { - this.key = key; - this.value = value; - } - } - - public class DetailMap { - private boolean hasWildcard; - private T wildcard; - private HashMap damageMap; - private HashMap tagMap; - private HashMap metaMap; - private int size; - - public T get(ItemStack key) { - if (wildcard != null) { - return wildcard; - } - - if (damageMap != null) { - T ret = damageMap.get(actualDamage(key)); - if (ret != null) { - return ret; - } - } - if (tagMap != null) { - T ret = tagMap.get(key.getTagCompound()); - if (ret != null) { - return ret; - } - } - if (metaMap != null) { - return metaMap.get(new StackMetaKey(key)); - } - - return null; - } - - public T put(ItemStack key, T value) { - try { - switch (getKeyType(actualDamage(key), key.getTagCompound())) { - case 0: - if (metaMap == null) { - metaMap = new HashMap(); - } - return metaMap.put(new StackMetaKey(key), value); - case 1: - if (tagMap == null) { - tagMap = new HashMap(); - } - return tagMap.put(key.getTagCompound(), value); - case 2: - if (damageMap == null) { - damageMap = new HashMap(); - } - return damageMap.put(actualDamage(key), value); - case 3: - T ret = wildcard; - wildcard = value; - hasWildcard = true; - return ret; - } - } finally { - updateSize(); - } - return null; - } - - public T remove(ItemStack key) { - try { - switch (getKeyType(actualDamage(key), key.getTagCompound())) { - case 0: - return metaMap != null ? metaMap.remove(new StackMetaKey(key)) : null; - case 1: - return tagMap != null ? tagMap.remove(key.getTagCompound()) : null; - case 2: - return damageMap != null ? damageMap.remove(actualDamage(key)) : null; - case 3: - T ret = wildcard; - wildcard = null; - hasWildcard = false; - return ret; - } - } finally { - updateSize(); - } - return null; - } - - private void updateSize() { - int newSize = (hasWildcard ? 1 : 0) + - (metaMap != null ? metaMap.size() : 0) + - (tagMap != null ? tagMap.size() : 0) + - (damageMap != null ? damageMap.size() : 0); - - if (newSize != size) { - ItemStackMap.this.size += newSize - size; - size = newSize; - } - } - - public void addKeys(Item item, List list) { - if (wildcard != null) { - list.add(wildcard(item)); - } - if (damageMap != null) { - for (int damage : damageMap.keySet()) { - list.add(newItemStack(item, 1, damage, WILDCARD_TAG)); - } - } - if (tagMap != null) { - for (NBTTagCompound tag : tagMap.keySet()) { - list.add(newItemStack(item, 1, WILDCARD_VALUE, tag)); - } - } - if (metaMap != null) { - for (StackMetaKey key : metaMap.keySet()) { - list.add(newItemStack(item, 1, key.damage, key.tag)); - } - } - } - - public void addValues(List list) { - if (wildcard != null) { - list.add(wildcard); - } - if (damageMap != null) { - list.addAll(damageMap.values()); - } - if (tagMap != null) { - list.addAll(tagMap.values()); - } - if (metaMap != null) { - list.addAll(metaMap.values()); - } - } - - public void addEntries(Item item, List> list) { - if (wildcard != null) { - list.add(new Entry(newItemStack(item, 1, WILDCARD_VALUE, WILDCARD_TAG), wildcard)); - } - if (damageMap != null) { - for (Map.Entry entry : damageMap.entrySet()) { - list.add(new Entry(newItemStack(item, 1, entry.getKey(), WILDCARD_TAG), entry.getValue())); - } - } - if (tagMap != null) { - for (Map.Entry entry : tagMap.entrySet()) { - list.add(new Entry(newItemStack(item, 1, WILDCARD_VALUE, entry.getKey()), entry.getValue())); - } - } - if (metaMap != null) { - for (Map.Entry entry : metaMap.entrySet()) { - list.add(new Entry(newItemStack(item, 1, entry.getKey().damage, entry.getKey().tag), entry.getValue())); - } - } - } - } - - public static int getKeyType(int damage, NBTTagCompound tag) { - int i = 0; - if (isWildcard(damage)) { - i = 1; - } - if (isWildcard(tag)) { - i |= 2; - } - return i; - } - - public static ItemStack wildcard(Item item) { - return newItemStack(item, 1, WILDCARD_VALUE, WILDCARD_TAG); - } - - public static boolean isWildcard(int damage) { - return damage == WILDCARD_VALUE; - } - - public static boolean isWildcard(NBTTagCompound tag) { - return tag != null && tag.getBoolean("*"); - } - - public static NBTTagCompound WILDCARD_TAG; - - static { - WILDCARD_TAG = new NBTTagCompound(); - WILDCARD_TAG.setBoolean("*", true); - } - - private HashMap itemMap = new HashMap(); - private int size; - - public T get(ItemStack key) { - if (key == null || key.getItem() == null) { - return null; - } - - DetailMap map = itemMap.get(key.getItem()); - return map == null ? null : map.get(key); - } - - public void put(ItemStack key, T value) { - if (key == null || key.getItem() == null) { - return; - } - - DetailMap map = itemMap.get(key.getItem()); - if (map == null) { - itemMap.put(key.getItem(), map = new DetailMap()); - } - map.put(key, value); - } - - public void clear() { - itemMap.clear(); - } - - public T remove(ItemStack key) { - if (key == null || key.getItem() == null) { - return null; - } - - DetailMap map = itemMap.get(key.getItem()); - return map == null ? null : map.remove(key); - } - - public List keys() { - LinkedList list = new LinkedList(); - for (Map.Entry entry : itemMap.entrySet()) { - entry.getValue().addKeys(entry.getKey(), list); - } - return list; - } - - public List values() { - LinkedList list = new LinkedList(); - for (DetailMap map : itemMap.values()) { - map.addValues(list); - } - return list; - } - - public List> entries() { - LinkedList> list = new LinkedList>(); - for (Map.Entry entry : itemMap.entrySet()) { - entry.getValue().addEntries(entry.getKey(), list); - } - return list; - } - - public int size() { - return size; - } - - public boolean isEmpty() { - return size == 0; - } -} diff --git a/dependencies/main/java/codechicken/nei/ItemStackSet.java b/dependencies/main/java/codechicken/nei/ItemStackSet.java deleted file mode 100644 index 5d28e33cce..0000000000 --- a/dependencies/main/java/codechicken/nei/ItemStackSet.java +++ /dev/null @@ -1,58 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.item.filtering.IItemFilter; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public class ItemStackSet extends ItemStackMap implements IItemFilter { - public ItemStackSet with(ItemStack... items) { - for (ItemStack item : items) { - add(item); - } - return this; - } - - public ItemStackSet with(Item... items) { - for (Item item : items) { - add(ItemStackMap.wildcard(item)); - } - return this; - } - - public ItemStackSet with(Block... blocks) { - for (Block block : blocks) { - add(ItemStackMap.wildcard(Item.getItemFromBlock(block))); - } - return this; - } - - public void add(ItemStack item) { - put(item, item); - } - - public boolean contains(ItemStack item) { - return get(item) != null; - } - - public boolean containsAll(Item item) { - return get(ItemStackMap.wildcard(item)) != null; - } - - @Override - public boolean matches(ItemStack item) { - return contains(item); - } - - public static ItemStackSet of(Block... blocks) { - return new ItemStackSet().with(blocks); - } - - public static ItemStackSet of(Item... items) { - return new ItemStackSet().with(items); - } - - public static ItemStackSet of(ItemStack... items) { - return new ItemStackSet().with(items); - } -} diff --git a/dependencies/main/java/codechicken/nei/KeyManager.java b/dependencies/main/java/codechicken/nei/KeyManager.java deleted file mode 100644 index e55e32ca89..0000000000 --- a/dependencies/main/java/codechicken/nei/KeyManager.java +++ /dev/null @@ -1,20 +0,0 @@ -package codechicken.nei; - -import java.util.LinkedList; - -/** - * Good old key ticker - */ -public class KeyManager { - public interface IKeyStateTracker { - void tickKeyStates(); - } - - public static LinkedList trackers = new LinkedList(); - - public static void tickKeyStates() { - for (IKeyStateTracker tracker : trackers) { - tracker.tickKeyStates(); - } - } -} diff --git a/dependencies/main/java/codechicken/nei/LayoutManager.java b/dependencies/main/java/codechicken/nei/LayoutManager.java deleted file mode 100644 index 50d50e1acd..0000000000 --- a/dependencies/main/java/codechicken/nei/LayoutManager.java +++ /dev/null @@ -1,877 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.KeyManager.IKeyStateTracker; -import codechicken.nei.api.*; -import codechicken.nei.api.layout.LayoutStyle; -import codechicken.nei.config.KeyBindings; -import codechicken.nei.guihook.*; -import codechicken.nei.layout.LayoutStyleMinecraft; -import codechicken.nei.layout.LayoutStyleTMIOld; -import codechicken.nei.network.NEIClientPacketHandler; -import codechicken.nei.widget.Button; -import codechicken.nei.widget.ItemPanel; -import codechicken.nei.widget.Label; -import codechicken.nei.widget.Widget; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.gui.inventory.GuiContainerCreative; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.InventoryEffectRenderer; -import net.minecraft.inventory.Slot; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import org.lwjgl.opengl.GL11; - -import java.util.HashMap; -import java.util.List; -import java.util.TreeSet; - -import static codechicken.lib.gui.GuiDraw.*; -import static codechicken.nei.NEIClientConfig.*; -import static codechicken.nei.util.NEIClientUtils.*; - -public class LayoutManager implements IContainerInputHandler, IContainerTooltipHandler, IContainerDrawHandler, IContainerObjectHandler, IKeyStateTracker { - private static LayoutManager instance; - - private static Widget inputFocused; - /** - * Sorted bottom first - */ - private static TreeSet drawWidgets; - /** - * Sorted top first - */ - private static TreeSet controlWidgets; - - private static boolean showItemPanel; - - public static ItemPanel itemPanel; - public static SubsetWidget dropDown; - public static TextField searchField; - - public static Button options; - - public static Button prev; - public static Button next; - public static Label pageLabel; - public static Button more; - public static Button less; - public static ItemQuantityField quantity; - - public static SaveLoadButton[] stateButtons; - public static Button[] deleteButtons; - - public static Button delete; - public static ButtonCycled gamemode; - public static Button rain; - public static Button magnet; - public static Button[] timeButtons = new Button[4]; - public static Button heal; - - public static IRecipeOverlayRenderer overlayRenderer; - - public static HashMap layoutStyles = new HashMap(); - - public static void load() { - API.addLayoutStyle(0, new LayoutStyleMinecraft()); - API.addLayoutStyle(1, new LayoutStyleTMIOld()); - - instance = new LayoutManager(); - KeyManager.trackers.add(instance); - GuiContainerManager.addInputHandler(instance); - GuiContainerManager.addTooltipHandler(instance); - GuiContainerManager.addDrawHandler(instance); - GuiContainerManager.addObjectHandler(instance); - init(); - } - - @Override - public void onPreDraw(GuiContainer gui) { - if (!isHidden() && isEnabled() && gui instanceof InventoryEffectRenderer)//Reset the gui to the center of the screen, for potion effect offsets etc - { - gui.guiLeft = (gui.width - gui.xSize) / 2; - gui.guiTop = (gui.height - gui.ySize) / 2; - - if (gui instanceof GuiContainerCreative && gui.buttonList.size() >= 2) { - GuiButton button1 = gui.buttonList.get(0); - GuiButton button2 = gui.buttonList.get(1); - button1.xPosition = gui.guiLeft; - button2.xPosition = gui.guiLeft + gui.xSize - 20; - } - } - } - - @Override - public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) { - if (isHidden()) { - return; - } - - for (Widget widget : controlWidgets) { - widget.onGuiClick(mousex, mousey); - } - } - - @Override - public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) { - if (isHidden()) { - return false; - } - - if (!isEnabled()) { - return options.contains(mousex, mousey) && options.handleClick(mousex, mousey, button); - } - - for (Widget widget : controlWidgets) { - widget.onGuiClick(mousex, mousey); - if (widget.contains(mousex, mousey) ? widget.handleClick(mousex, mousey, button) : widget.handleClickExt(mousex, mousey, button)) { - return true; - } - } - - return false; - } - - @Override - public boolean objectUnderMouse(GuiContainer gui, int mousex, int mousey) { - if (!isHidden() && isEnabled()) { - for (Widget widget : controlWidgets) { - if (widget.contains(mousex, mousey)) { - return true; - } - } - } - - return false; - } - - public boolean keyTyped(GuiContainer gui, char keyChar, int keyID) { - if (isEnabled() && !isHidden()) { - if (inputFocused != null) { - return inputFocused.handleKeyPress(keyID, keyChar); - } - - for (Widget widget : controlWidgets) { - if (widget.handleKeyPress(keyID, keyChar)) { - return true; - } - } - } - - return false; - } - - @Override - public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) { - } - - @Override - public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) { - if (KeyBindings.get("nei.options.keys.gui.hide").isActiveAndMatches(keyID)) { - toggleBooleanSetting("inventory.hidden"); - return true; - } - if (isEnabled() && !isHidden()) { - for (Widget widget : controlWidgets) { - if (inputFocused == null) { - widget.lastKeyTyped(keyID, keyChar); - } - } - } - return false; - } - - public void onMouseUp(GuiContainer gui, int mx, int my, int button) { - if (!isHidden() && isEnabled()) { - for (Widget widget : controlWidgets) { - widget.mouseUp(mx, my, button); - } - } - } - - @Override - public void onMouseDragged(GuiContainer gui, int mx, int my, int button, long heldTime) { - if (!isHidden() && isEnabled()) { - for (Widget widget : controlWidgets) { - widget.mouseDragged(mx, my, button, heldTime); - } - } - } - - @Override - public ItemStack getStackUnderMouse(GuiContainer gui, int mousex, int mousey) { - if (!isHidden() && isEnabled()) { - for (Widget widget : controlWidgets) { - ItemStack stack = widget.getStackMouseOver(mousex, mousey); - if (stack != null) { - return stack; - } - } - } - return null; - } - - public void renderObjects(GuiContainer gui, int mousex, int mousey) { - if (!isHidden()) { - layout(gui); - if (isEnabled()) { - getLayoutStyle().drawBackground(GuiContainerManager.getManager(gui)); - for (Widget widget : drawWidgets) { - widget.draw(mousex, mousey); - } - } else { - options.draw(mousex, mousey); - } - - GlStateManager.enableLighting(); - GlStateManager.disableDepth(); - } else { - showItemPanel = false; - } - } - - @Override - public void postRenderObjects(GuiContainer gui, int mousex, int mousey) { - if (!isHidden() && isEnabled()) { - for (Widget widget : drawWidgets) { - widget.postDraw(mousex, mousey); - } - } - } - - @Override - public List handleTooltip(GuiContainer gui, int mousex, int mousey, List currenttip) { - if (!isHidden() && isEnabled() && GuiContainerManager.shouldShowTooltip(gui)) { - for (Widget widget : controlWidgets) { - currenttip = widget.handleTooltip(mousex, mousey, currenttip); - } - } - return currenttip; - } - - @Override - public List handleItemDisplayName(GuiContainer gui, ItemStack stack, List currenttip) { - String overridename = ItemInfo.getNameOverride(stack); - if (overridename != null) { - currenttip.set(0, overridename); - } - - String mainname = currenttip.get(0); - if (showIDs()) { - mainname += " " + Item.getIdFromItem(stack.getItem()); - if (stack.getItemDamage() != 0) { - mainname += ":" + stack.getItemDamage(); - } - - currenttip.set(0, mainname); - } - - return currenttip; - } - - @Override - public List handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey, List currenttip) { - return currenttip; - } - - public static void layout(GuiContainer gui) { - VisibilityData visiblity = new VisibilityData(); - if (isHidden()) { - //showItemPanel = false; - visiblity.showNEI = false; - } - if (gui.height - gui.ySize <= 40) { - visiblity.showSearchSection = false; - } - if (gui.guiLeft - 4 < 76) { - visiblity.showWidgets = false; - } - - for (INEIGuiHandler handler : GuiInfo.guiHandlers) { - handler.modifyVisiblity(gui, visiblity); - } - - visiblity.translateDependancies(); - - getLayoutStyle().layout(gui, visiblity); - - updateWidgetVisiblities(gui, visiblity); - } - - private static void init() { - itemPanel = new ItemPanel(); - dropDown = new SubsetWidget(); - searchField = new SearchField("search"); - - options = new Button("Options") { - @Override - public boolean onButtonPress(boolean rightclick) { - if (!rightclick) { - getOptionList().openGui(getGuiContainer(), false); - return true; - } - return false; - } - - @Override - public String getRenderLabel() { - return translate("inventory.options"); - } - }; - prev = new Button("Prev") { - public boolean onButtonPress(boolean rightclick) { - if (!rightclick) { - LayoutManager.itemPanel.scroll(-1); - return true; - } - return false; - } - - @Override - public String getRenderLabel() { - return translate("inventory.prev"); - } - }; - next = new Button("Next") { - public boolean onButtonPress(boolean rightclick) { - if (!rightclick) { - LayoutManager.itemPanel.scroll(1); - return true; - } - return false; - } - - @Override - public String getRenderLabel() { - return translate("inventory.next"); - } - }; - pageLabel = new Label("(0/0)", true); - more = new Button("+") { - @Override - public boolean onButtonPress(boolean rightclick) { - if (rightclick) { - return false; - } - - int modifier = controlKey() ? 64 : shiftKey() ? 10 : 1; - - int quantity = getItemQuantity() + modifier; - if (quantity < 0) { - quantity = 0; - } - - setItemQuantity(quantity); - return true; - } - }; - less = new Button("-") { - @Override - public boolean onButtonPress(boolean rightclick) { - if (rightclick) { - return false; - } - - int modifier = controlKey() ? -64 : shiftKey() ? -10 : -1; - - int quantity = getItemQuantity() + modifier; - if (quantity < 0) { - quantity = 0; - } - - setItemQuantity(quantity); - return true; - } - }; - quantity = new ItemQuantityField("quantity"); - - stateButtons = new SaveLoadButton[7]; - deleteButtons = new Button[7]; - - for (int i = 0; i < 7; i++) { - final int savestate = i; - stateButtons[i] = new SaveLoadButton("") { - @Override - public boolean onButtonPress(boolean rightclick) { - if (isStateSaved(savestate)) { - loadState(savestate); - } else { - saveState(savestate); - } - return true; - } - - @Override - public void onTextChange() { - NBTTagCompound statelist = global.nbt.getCompoundTag("statename"); - global.nbt.setTag("statename", statelist); - - statelist.setString("" + savestate, label); - global.saveNBT(); - } - }; - deleteButtons[i] = new Button("x") { - @Override - public boolean onButtonPress(boolean rightclick) { - if (!rightclick) { - clearState(savestate); - return true; - } - return false; - } - }; - } - - delete = new Button() { - @Override - public boolean onButtonPress(boolean rightclick) { - if ((state & 0x3) == 2) { - return false; - } - - ItemStack held = getHeldItem(); - if (held != null) { - if (shiftKey()) { - deleteHeldItem(); - deleteItemsOfType(held); - } else if (rightclick) { - decreaseSlotStack(-999); - } else { - deleteHeldItem(); - } - } else if (shiftKey()) { - deleteEverything(); - } else { - NEIController.toggleDeleteMode(); - } - - return true; - } - - public String getButtonTip() { - if ((state & 0x3) != 2) { - if (shiftKey()) { - return translate("inventory.delete.inv"); - } - if (NEIController.canUseDeleteMode()) { - return getStateTip("delete", state); - } - } - return null; - } - - @Override - public void postDraw(int mousex, int mousey) { - if (contains(mousex, mousey) && getHeldItem() != null && (state & 0x3) != 2) { - GuiDraw.drawTip(mousex + 9, mousey, translate("inventory.delete." + (shiftKey() ? "all" : "one"), GuiContainerManager.itemDisplayNameShort(getHeldItem()))); - } - } - }; - gamemode = new ButtonCycled() { - @Override - public boolean onButtonPress(boolean rightclick) { - if (!rightclick) { - cycleGamemode(); - return true; - } - return false; - } - - public String getButtonTip() { - return translate("inventory.gamemode." + getNextGamemode()); - } - }; - gamemode.icons = new Image[3]; - rain = new Button() { - @Override - public boolean onButtonPress(boolean rightclick) { - if (handleDisabledButtonPress("rain", rightclick)) { - return true; - } - - if (!rightclick) { - toggleRaining(); - return true; - } - return false; - } - - public String getButtonTip() { - return getStateTip("rain", state); - } - }; - magnet = new Button() { - @Override - public boolean onButtonPress(boolean rightclick) { - if (!rightclick) { - toggleMagnetMode(); - return true; - } - return false; - } - - public String getButtonTip() { - return getStateTip("magnet", state); - } - }; - for (int i = 0; i < 4; i++) { - final int zone = i; - timeButtons[i] = new Button() { - @Override - public boolean onButtonPress(boolean rightclick) { - if (handleDisabledButtonPress(NEIActions.timeZones[zone], rightclick)) { - return true; - } - - if (!rightclick) { - setHourForward(zone * 6); - return true; - } - return false; - } - - @Override - public String getButtonTip() { - return getTimeTip(NEIActions.timeZones[zone], state); - } - - }; - } - heal = new Button() { - @Override - public boolean onButtonPress(boolean rightclick) { - if (!rightclick) { - healPlayer(); - return true; - } - return false; - } - - @Override - public String getButtonTip() { - return translate("inventory.heal"); - } - }; - - delete.state |= 0x4; - gamemode.state |= 0x4; - rain.state |= 0x4; - magnet.state |= 0x4; - } - - private static String getStateTip(String name, int state) { - String sfx = (state & 0x3) == 2 ? "enable" : (state & 0x3) == 1 ? "0" : "1"; - - return translate("inventory." + name + "." + sfx); - } - - private static String getTimeTip(String name, int state) { - String sfx = (state & 0x3) == 2 ? "enable" : "set"; - return translate("inventory." + name + "." + sfx); - } - - private static boolean handleDisabledButtonPress(String ident, boolean rightclick) { - if (!NEIActions.canDisable.contains(ident)) { - return false; - } - if (rightclick != disabledActions.contains(ident)) { - return setPropertyDisabled(ident, rightclick); - } - return false; - } - - private static boolean setPropertyDisabled(String ident, boolean disable) { - if (disable && NEIActions.base(ident).equals("time")) { - int count = 0; - for (int i = 0; i < 4; i++) { - if (disabledActions.contains(NEIActions.timeZones[i])) { - count++; - } - } - if (count == 3) { - return false; - } - } - if (hasSMPCounterPart()) { - NEIClientPacketHandler.sendSetPropertyDisabled(ident, disable); - } - - return true; - } - - @Override - public void load(GuiContainer gui) { - if (isEnabled()) { - setInputFocused(null); - - ItemList.loadItems.restart(); - overlayRenderer = null; - - getLayoutStyle().init(); - layout(gui); - } - - NEIController.load(gui); - - if (checkCreativeInv(gui) && gui.mc.currentScreen instanceof GuiContainerCreative)//override creative with creative+ - { - gui.mc.displayGuiScreen(null);//close the screen and wait for the server to open it for us - } - } - - @Override - public void refresh(GuiContainer gui) { - } - - public boolean checkCreativeInv(GuiContainer gui) { - if (gui instanceof GuiContainerCreative && invCreativeMode()) { - NEIClientPacketHandler.sendCreativeInv(true); - return true; - } else if (gui instanceof GuiExtendedCreativeInv && !invCreativeMode()) { - NEIClientPacketHandler.sendCreativeInv(false); - return true; - } - return false; - } - - public static void updateWidgetVisiblities(GuiContainer gui, VisibilityData visiblity) { - drawWidgets = new TreeSet(new WidgetZOrder(false)); - controlWidgets = new TreeSet(new WidgetZOrder(true)); - - if (!visiblity.showNEI) { - //showItemPanel = false; - return; - } - - addWidget(options); - showItemPanel = visiblity.showItemPanel; - if (visiblity.showItemPanel) { - addWidget(itemPanel); - addWidget(prev); - addWidget(next); - addWidget(pageLabel); - if (canPerformAction("item")) { - addWidget(more); - addWidget(less); - addWidget(quantity); - } - } - - if (visiblity.showSearchSection) { - addWidget(dropDown); - addWidget(searchField); - } - - if (canPerformAction("item") && hasSMPCounterPart() && visiblity.showStateButtons) { - for (int i = 0; i < 7; i++) { - addWidget(stateButtons[i]); - if (isStateSaved(i)) { - addWidget(deleteButtons[i]); - } - } - } - if (visiblity.showUtilityButtons) { - if (canPerformAction("time")) { - for (int i = 0; i < 4; i++) { - addWidget(timeButtons[i]); - } - } - if (canPerformAction("rain")) { - addWidget(rain); - } - if (canPerformAction("heal")) { - addWidget(heal); - } - if (canPerformAction("magnet")) { - addWidget(magnet); - } - if (isValidGamemode("creative") || - isValidGamemode("creative+") || - isValidGamemode("adventure")) { - addWidget(gamemode); - } - if (canPerformAction("delete")) { - addWidget(delete); - } - } - } - - public static LayoutStyle getLayoutStyle(int id) { - LayoutStyle style = layoutStyles.get(id); - if (style == null) { - style = layoutStyles.get(0); - } - return style; - } - - public static LayoutStyle getLayoutStyle() { - return getLayoutStyle(NEIClientConfig.getLayoutStyle()); - } - - private static void addWidget(Widget widget) { - drawWidgets.add(widget); - controlWidgets.add(widget); - } - - @Override - public void guiTick(GuiContainer gui) { - if (checkCreativeInv(gui)) { - return; - } - - if (!isEnabled()) { - return; - } - - for (Widget widget : controlWidgets) { - widget.update(); - } - } - - @Override - public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { - if (isHidden() || !isEnabled()) { - return false; - } - - for (Widget widget : controlWidgets) { - if (widget.onMouseWheel(scrolled, mousex, mousey)) { - return true; - } - } - - return false; - } - - @Override - public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { - } - - @Override - public boolean shouldShowTooltip(GuiContainer gui) { - return itemPanel.draggedStack == null; - } - - public static Widget getInputFocused() { - return inputFocused; - } - - public static void setInputFocused(Widget widget) { - if (inputFocused != null) { - inputFocused.loseFocus(); - } - - inputFocused = widget; - if (inputFocused != null) { - inputFocused.gainFocus(); - } - } - - @Override - public void renderSlotUnderlay(GuiContainer gui, Slot slot) { - if (overlayRenderer != null) { - overlayRenderer.renderOverlay(GuiContainerManager.getManager(gui), slot); - } - } - - @Override - public void renderSlotOverlay(GuiContainer window, Slot slot) { - ItemStack item = slot.getStack(); - if (world.nbt.getBoolean("searchinventories") && (item == null ? !getSearchExpression().equals("") : !ItemList.getItemListFilter().matches(item))) { - GlStateManager.disableLighting(); - GlStateManager.translate(0, 0, 200); - drawRect(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, 0x80000000); - GlStateManager.translate(0, 0, -200); - GlStateManager.enableLighting(); - } - } - - public static void drawIcon(int x, int y, Image image) { - changeTexture("nei:textures/nei_sprites.png"); - GlStateManager.color(1, 1, 1, 1); - GlStateManager.enableBlend(); - GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - drawTexturedModalRect(x, y, image.x, image.y, image.width, image.height); - GlStateManager.disableBlend(); - } - - public static void drawButtonBackground(int x, int y, int w, int h, boolean edges, int type) { - int wtiles = 0; - int ew = w;//end width - if (w / 2 > 100) { - wtiles = (w - 200) / 50 + 1; - ew = 200; - } - - int w1 = ew / 2; - int h1 = h / 2; - int w2 = (ew + 1) / 2; - int h2 = (h + 1) / 2; - - int x2 = x + w - w2; - int y2 = y + h - h2; - - int ty = 46 + type * 20; - int te = (edges ? 0 : 1);//tex edges - - int ty1 = ty + te; - int tx1 = te; - int tx3 = 75; - //halfway the 1 is for odd number adjustment - int ty2 = ty + 20 - h2 - te; - int tx2 = 200 - w2 - te; - - changeTexture("textures/gui/widgets.png"); - drawTexturedModalRect(x, y, tx1, ty1, w1, h1);//top left - drawTexturedModalRect(x, y2, tx1, ty2, w1, h2);//bottom left - - for (int tile = 0; tile < wtiles; tile++) { - int tilex = x + w1 + 50 * tile; - drawTexturedModalRect(tilex, y, tx3, ty1, 50, h1);//top - drawTexturedModalRect(tilex, y2, tx3, ty2, 50, h2);//bottom - } - - drawTexturedModalRect(x2, y, tx2, ty1, w2, h1);//top right - drawTexturedModalRect(x2, y2, tx2, ty2, w2, h2);//bottom right - } - - public static LayoutManager instance() { - return instance; - } - - @Override - public void tickKeyStates() { - if (Minecraft.getMinecraft().currentScreen != null) { - return; - } - - if (KeyBindings.get("nei.options.keys.world.dawn").isPressed()) { - timeButtons[0].onButtonPress(false); - } - if (KeyBindings.get("nei.options.keys.world.noon").isPressed()) { - timeButtons[1].onButtonPress(false); - } - if (KeyBindings.get("nei.options.keys.world.dusk").isPressed()) { - timeButtons[2].onButtonPress(false); - } - if (KeyBindings.get("nei.options.keys.world.midnight").isPressed()) { - timeButtons[3].onButtonPress(false); - } - if (KeyBindings.get("nei.options.keys.world.rain").isPressed()) { - rain.onButtonPress(false); - } - if (KeyBindings.get("nei.options.keys.world.heal").isPressed()) { - heal.onButtonPress(false); - } - if (KeyBindings.get("nei.options.keys.world.creative").isPressed()) { - gamemode.onButtonPress(false); - } - } - - public static boolean isItemPanelActive() { - return showItemPanel; - } -} diff --git a/dependencies/main/java/codechicken/nei/NEIActions.java b/dependencies/main/java/codechicken/nei/NEIActions.java deleted file mode 100644 index 296027cc71..0000000000 --- a/dependencies/main/java/codechicken/nei/NEIActions.java +++ /dev/null @@ -1,86 +0,0 @@ -package codechicken.nei; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; - -public class NEIActions { - public static final int protocol = 0; - - public static HashMap nameActionMap = new HashMap(); - public static HashSet canDisable = new HashSet(); - - public static void addAction(String name, String base, boolean smpreq) { - NEIActions action = new NEIActions(name, base, smpreq); - nameActionMap.put(name, action); - } - - private static void addAction(String name, String base) { - addAction(name, base, false); - } - - public static void addAction(String name) { - addAction(name, name); - } - - private static void addAction(String name, boolean smpreq) { - addAction(name, name, smpreq); - } - - public static String base(String name) { - NEIActions action = nameActionMap.get(name); - return action == null ? name : action.base; - } - - public static boolean smpRequired(String name) { - return nameActionMap.get(name).smpreq; - } - - public static void init() { - addAction("time"); - addAction("dawn", "time"); - addAction("noon", "time"); - addAction("dusk", "time"); - addAction("midnight", "time"); - addAction("creative"); - addAction("creative+", true); - addAction("adventure", "creative"); - addAction("rain"); - addAction("item"); - addAction("heal"); - addAction("delete", true); - addAction("magnet", true); - addAction("enchant", true); - addAction("potion", true); - - canDisable.add("dawn"); - canDisable.add("noon"); - canDisable.add("dusk"); - canDisable.add("midnight"); - canDisable.add("rain"); - } - - public static final String[] timeZones = new String[] { "dawn", "noon", "dusk", "midnight" }; - public static final String[] gameModes = new String[] { "survival", "creative", "creative+", "adventure" }; - - public String name; - public String base; - public boolean smpreq; - - public NEIActions(String name, String base, boolean smpreq) { - this.name = name; - this.base = base; - this.smpreq = smpreq; - } - - public static List baseActions() { - List list = new LinkedList(); - for (NEIActions a : nameActionMap.values()) { - if (a.base.equals(a.name)) { - list.add(a.name); - } - } - return list; - } -} diff --git a/dependencies/main/java/codechicken/nei/NEIChestGuiHandler.java b/dependencies/main/java/codechicken/nei/NEIChestGuiHandler.java deleted file mode 100644 index 11429062f5..0000000000 --- a/dependencies/main/java/codechicken/nei/NEIChestGuiHandler.java +++ /dev/null @@ -1,29 +0,0 @@ -package codechicken.nei; - -import codechicken.nei.api.INEIGuiAdapter; -import codechicken.nei.api.TaggedInventoryArea; -import codechicken.nei.util.NEIServerUtils; -import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.ContainerChest; -import net.minecraft.item.ItemStack; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -public class NEIChestGuiHandler extends INEIGuiAdapter { - public int chestSize(GuiContainer gui) { - return ((ContainerChest) gui.inventorySlots).getLowerChestInventory().getSizeInventory(); - } - - @Override - public Iterable getItemSpawnSlots(GuiContainer gui, ItemStack item) { - return gui instanceof GuiChest ? NEIServerUtils.getRange(0, chestSize(gui)) : Collections.emptyList(); - } - - @Override - public List getInventoryAreas(GuiContainer gui) { - return gui instanceof GuiChest ? Arrays.asList(new TaggedInventoryArea("Chest", 0, chestSize(gui), gui.inventorySlots)) : null; - } -} diff --git a/dependencies/main/java/codechicken/nei/NEIClientConfig.java b/dependencies/main/java/codechicken/nei/NEIClientConfig.java deleted file mode 100644 index 7ea85d65a4..0000000000 --- a/dependencies/main/java/codechicken/nei/NEIClientConfig.java +++ /dev/null @@ -1,578 +0,0 @@ -package codechicken.nei; - -import codechicken.core.*; -import codechicken.lib.asm.discovery.ClassDiscoverer; -import codechicken.lib.asm.discovery.IStringMatcher; -import codechicken.lib.config.ConfigFile; -import codechicken.lib.config.ConfigTag; -import codechicken.lib.config.ConfigTagParent; -import codechicken.lib.util.ClientUtils; -import codechicken.lib.util.CommonUtils; -import codechicken.nei.api.*; -import codechicken.nei.api.layout.LayoutStyle; -import codechicken.nei.config.*; -import codechicken.nei.recipe.RecipeInfo; -import codechicken.nei.util.LogHelper; -import codechicken.nei.util.NEIClientUtils; -import codechicken.obfuscator.ObfuscationRun; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.world.World; -import net.minecraft.world.storage.WorldSummary; - -import java.io.File; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Map.Entry; - -public class NEIClientConfig { - private static boolean configLoaded; - private static boolean enabledOverride; - - //public static Logger logger = LogManager.getLogger("NotEnoughItems"); - public static File configDir = new File(CommonUtils.getMinecraftDir(), "config/NEI/"); - public static ConfigSet global = new ConfigSet(new File("saves/NEI/client.dat"), new ConfigFile(new File(configDir, "client.cfg"))); - public static ConfigSet world; - - public static ItemStack creativeInv[]; - private static boolean statesSaved[] = new boolean[7]; - - public static boolean hasSMPCounterpart; - public static HashSet permissableActions = new HashSet(); - public static HashSet disabledActions = new HashSet(); - public static HashSet enabledActions = new HashSet(); - - public static ItemStackSet bannedBlocks = new ItemStackSet(); - - static { - if (global.config.getTag("checkUpdates").getBooleanValue(true)) { - CCUpdateChecker.updateCheck("NotEnoughItems"); - } - linkOptionList(); - setDefaults(); - } - - private static void setDefaults() { - ConfigTagParent tag = global.config; - tag.setComment("Main configuration of NEI.\nMost of these options can be changed ingame.\nDeleting any element will restore it to it's default value"); - - tag.getTag("command").useBraces().setComment("Change these options if you have a different mod installed on the server that handles the commands differently, Eg. Bukkit Essentials"); - tag.setNewLineMode(1); - - tag.getTag("inventory.widgetsenabled").getBooleanValue(true); - API.addOption(new OptionToggleButton("inventory.widgetsenabled")); - - tag.getTag("inventory.hidden").getBooleanValue(false); - tag.getTag("inventory.cheatmode").getIntValue(2); - tag.getTag("inventory.lockmode").setComment("For those who can't help themselves.\nSet this to a mode and you will be unable to change it ingame").getIntValue(-1); - API.addOption(new OptionCycled("inventory.cheatmode", 3) { - @Override - public boolean optionValid(int index) { - return getLockedMode() == -1 || getLockedMode() == index && NEIInfo.isValidMode(index); - } - }); - checkCheatMode(); - - tag.getTag("inventory.utilities").setDefaultValue("delete, magnet"); - API.addOption(new OptionUtilities("inventory.utilities")); - - tag.getTag("inventory.gamemodes").setDefaultValue("creative, creative+, adventure"); - API.addOption(new OptionGamemodes("inventory.gamemodes")); - - tag.getTag("inventory.layoutstyle").getIntValue(0); - API.addOption(new OptionCycled("inventory.layoutstyle", 0) { - @Override - public String getPrefix() { - return translateN(name); - } - - @Override - public String getButtonText() { - return NEIClientUtils.translate("layoutstyle." + LayoutManager.getLayoutStyle(renderTag().getIntValue()).getName()); - } - - @Override - public boolean cycle() { - LinkedList list = new LinkedList(); - for (Entry entry : LayoutManager.layoutStyles.entrySet()) { - list.add(entry.getKey()); - } - - Collections.sort(list); - - int nextLayout = renderTag().getIntValue(); - if (nextLayout == list.getLast())//loop list - { - nextLayout = -1; - } - for (Integer i : list) { - if (i > nextLayout) { - nextLayout = i; - break; - } - } - - getTag().setIntValue(nextLayout); - return true; - } - }); - - ItemSorter.initConfig(tag); - - tag.getTag("inventory.itemIDs").getIntValue(1); - API.addOption(new OptionCycled("inventory.itemIDs", 3, true)); - - tag.getTag("inventory.searchmode").getIntValue(1); - API.addOption(new OptionCycled("inventory.searchmode", 3, true)); - - //tag.getTag("world.highlight_tips").getBooleanValue(false); - //tag.getTag("world.highlight_tips.x").getIntValue(5000); - //tag.getTag("world.highlight_tips.y").getIntValue(100); - //API.addOption(new OptionOpenGui("world.highlight_tips", GuiHighlightTips.class)); - - tag.getTag("inventory.profileRecipes").getBooleanValue(false); - API.addOption(new OptionToggleButton("inventory.profileRecipes", true)); - - tag.getTag("command.creative").setDefaultValue("/gamemode {0} {1}"); - API.addOption(new OptionTextField("command.creative")); - tag.getTag("command.item").setDefaultValue("/give {0} {1} {2} {3} {4}"); - API.addOption(new OptionTextField("command.item")); - tag.getTag("command.time").setDefaultValue("/time set {0}"); - API.addOption(new OptionTextField("command.time")); - tag.getTag("command.rain").setDefaultValue("/toggledownfall"); - API.addOption(new OptionTextField("command.rain")); - tag.getTag("command.heal").setDefaultValue(""); - API.addOption(new OptionTextField("command.heal")); - -// JEIIntegrationManager.initConfig(tag); -// -// API.addOption(new ItemBrowserButton("jei.itemPanel") { -// @Override -// protected void setValue(EnumItemBrowser itemBrowser) { -// JEIIntegrationManager.setItemPanelOwner(itemBrowser); -// } -// }); -// -// API.addOption(new ItemBrowserButton("jei.searchBox") { -// @Override -// public boolean isEnabled() { -// return JEIIntegrationManager.itemPannelOwner == EnumItemBrowser.JEI; -// } -// -// @Override -// protected void setValue(EnumItemBrowser itemBrowser) { -// JEIIntegrationManager.setSearchBoxOwner(itemBrowser); -// } -// }); - } - - private static void linkOptionList() { - OptionList.setOptionList(new OptionList("nei.options") { - @Override - public ConfigSet globalConfigSet() { - return global; - } - - @Override - public ConfigSet worldConfigSet() { - return world; - } - - @Override - public OptionList configBase() { - return this; - } - - @Override - public GuiOptionList getGui(GuiScreen parent, OptionList list, boolean world) { - return new GuiNEIOptionList(parent, list, world); - } - }); - } - - public static OptionList getOptionList() { - return OptionList.getOptionList("nei.options"); - } - - public static void loadWorld(String saveName) { - setInternalEnabled(true); - LogHelper.debug("Loading " + (Minecraft.getMinecraft().isSingleplayer() ? "Local" : "Remote") + " World"); - bootNEI(ClientUtils.getWorld()); - - File saveDir = new File(CommonUtils.getMinecraftDir(), "saves/NEI/" + saveName); - boolean newWorld = !saveDir.exists(); - if (newWorld) { - saveDir.mkdirs(); - } - - world = new ConfigSet(new File(saveDir, "NEI.dat"), new ConfigFile(new File(saveDir, "NEI.cfg"))); - onWorldLoad(newWorld); - } - - private static void onWorldLoad(boolean newWorld) { - world.config.setComment("World based configuration of NEI.\nMost of these options can be changed ingame.\nDeleting any element will restore it to it's default value"); - - setWorldDefaults(); - creativeInv = new ItemStack[54]; - LayoutManager.searchField.setText(getSearchExpression()); - LayoutManager.quantity.setText(Integer.toString(getItemQuantity())); - SubsetWidget.loadHidden(); - - if (newWorld && Minecraft.getMinecraft().isSingleplayer()) { - world.config.getTag("inventory.cheatmode").setIntValue(Minecraft.getMinecraft().playerController.isInCreativeMode() ? 2 : 0); - } - - NEIInfo.load(ClientUtils.getWorld()); - } - - private static void setWorldDefaults() { - NBTTagCompound nbt = world.nbt; - if (!nbt.hasKey("search")) { - nbt.setString("search", ""); - } - if (!nbt.hasKey("quantity")) { - nbt.setInteger("quantity", 0); - } - if (!nbt.hasKey("validateenchantments")) { - nbt.setBoolean("validateenchantments", false); - } - - world.saveNBT(); - } - - public static void bootNEI(World world) { - if (configLoaded) { - return; - } - - loadStates(); - //ItemVisibilityHash.loadStates(); - //vishash = new ItemVisibilityHash(); - ItemInfo.load(world); - GuiInfo.load(); - RecipeInfo.load(); - LayoutManager.load(); - NEIController.load(); - - configLoaded = true; - - ClassDiscoverer classDiscoverer = new ClassDiscoverer(new IStringMatcher() { - public boolean matches(String test) { - return test.startsWith("NEI") && test.endsWith("Config.class"); - } - }, IConfigureNEI.class); - - classDiscoverer.findClasses(); - - for (Class clazz : classDiscoverer.classes) { - try { - IConfigureNEI config = (IConfigureNEI) clazz.newInstance(); - config.loadConfig(); - NEIModContainer.plugins.add(config); - LogHelper.debug("Loaded " + clazz.getName()); - } catch (Exception e) { - LogHelper.errorError("Failed to Load " + clazz.getName(), e); - } - } - - ItemSorter.loadConfig(); - } - - public static void loadStates() { - for (int state = 0; state < 7; state++) { - statesSaved[state] = !global.nbt.getCompoundTag("save" + state).hasNoTags(); - } - } - - public static boolean isWorldSpecific(String setting) { - if (world == null) { - return false; - } - ConfigTag tag = world.config.getTag(setting, false); - return tag != null && tag.value != null; - } - - public static boolean isStateSaved(int i) { - return statesSaved[i]; - } - - public static ConfigTag getSetting(String s) { - return isWorldSpecific(s) ? world.config.getTag(s) : global.config.getTag(s); - } - - public static boolean getBooleanSetting(String s) { - return getSetting(s).getBooleanValue(); - } - - public static boolean isHidden() { - return !enabledOverride || getBooleanSetting("inventory.hidden"); - } - - public static boolean isEnabled() { - return enabledOverride && getBooleanSetting("inventory.widgetsenabled"); - } - - public static void setEnabled(boolean flag) { - getSetting("inventory.widgetsenabled").setBooleanValue(flag); - } - - public static int getItemQuantity() { - return world.nbt.getInteger("quantity"); - } - - public static int getCheatMode() { - return getIntSetting("inventory.cheatmode"); - } - - private static void checkCheatMode() { - if (getLockedMode() != -1) { - setIntSetting("inventory.cheatmode", getLockedMode()); - } - } - - public static int getLockedMode() { - return getIntSetting("inventory.lockmode"); - } - - public static int getLayoutStyle() { - return getIntSetting("inventory.layoutstyle"); - } - - public static String getStringSetting(String s) { - return getSetting(s).getValue(); - } - - public static boolean showIDs() { - int i = getIntSetting("inventory.itemIDs"); - return i == 2 || (i == 1 && isEnabled() && !isHidden()); - } - - public static void toggleBooleanSetting(String setting) { - ConfigTag tag = getSetting(setting); - tag.setBooleanValue(!tag.getBooleanValue()); - } - - public static void cycleSetting(String setting, int max) { - ConfigTag tag = getSetting(setting); - tag.setIntValue((tag.getIntValue() + 1) % max); - } - - public static int getIntSetting(String setting) { - return getSetting(setting).getIntValue(); - } - - public static void setIntSetting(String setting, int val) { - getSetting(setting).setIntValue(val); - } - - public static String getSearchExpression() { - return world.nbt.getString("search"); - } - - public static void setSearchExpression(String expression) { -// JEIIntegrationManager.setFilterText(expression); - world.nbt.setString("search", expression); - world.saveNBT(); - } - - /** - * A split off of setSearchExpression that avoids a JEI update. - * - * @param expression Search term. - */ - public static void setSearchExpression(String expression, boolean updateJEI) { - if (updateJEI) { - setSearchExpression(expression); - } else { - world.nbt.setString("search", expression); - world.saveNBT(); - } - } - - public static boolean getMagnetMode() { - return enabledActions.contains("magnet"); - } - - public static boolean invCreativeMode() { - return enabledActions.contains("creative+") && canPerformAction("creative+"); - } - - public static boolean areDamageVariantsShown() { - return hasSMPCounterPart() || getSetting("command.item").getValue().contains("{3}"); - } - - public static void clearState(int state) { - statesSaved[state] = false; - global.nbt.setTag("save" + state, new NBTTagCompound()); - global.saveNBT(); - } - - public static void loadState(int state) { - if (!statesSaved[state]) { - return; - } - - NBTTagCompound statesave = global.nbt.getCompoundTag("save" + state); - GuiContainer currentContainer = NEIClientUtils.getGuiContainer(); - LinkedList saveAreas = new LinkedList(); - saveAreas.add(new TaggedInventoryArea(Minecraft.getMinecraft().thePlayer.inventory)); - - for (INEIGuiHandler handler : GuiInfo.guiHandlers) { - List areaList = handler.getInventoryAreas(currentContainer); - if (areaList != null) { - saveAreas.addAll(areaList); - } - } - - for (TaggedInventoryArea area : saveAreas) { - if (!statesave.hasKey(area.tagName)) { - continue; - } - - for (int slot : area.slots) { - NEIClientUtils.setSlotContents(slot, null, area.isContainer()); - } - - NBTTagList areaTag = statesave.getTagList(area.tagName, 10); - for (int i = 0; i < areaTag.tagCount(); i++) { - NBTTagCompound stacksave = areaTag.getCompoundTagAt(i); - int slot = stacksave.getByte("Slot") & 0xFF; - if (!area.slots.contains(slot)) { - continue; - } - - NEIClientUtils.setSlotContents(slot, ItemStack.loadItemStackFromNBT(stacksave), area.isContainer()); - } - } - } - - public static void saveState(int state) { - NBTTagCompound statesave = global.nbt.getCompoundTag("save" + state); - GuiContainer currentContainer = NEIClientUtils.getGuiContainer(); - LinkedList saveAreas = new LinkedList(); - saveAreas.add(new TaggedInventoryArea(Minecraft.getMinecraft().thePlayer.inventory)); - - for (INEIGuiHandler handler : GuiInfo.guiHandlers) { - List areaList = handler.getInventoryAreas(currentContainer); - if (areaList != null) { - saveAreas.addAll(areaList); - } - } - - for (TaggedInventoryArea area : saveAreas) { - NBTTagList areaTag = new NBTTagList(); - - for (int i : area.slots) { - ItemStack stack = area.getStackInSlot(i); - if (stack == null) { - continue; - } - NBTTagCompound stacksave = new NBTTagCompound(); - stacksave.setByte("Slot", (byte) i); - stack.writeToNBT(stacksave); - areaTag.appendTag(stacksave); - } - statesave.setTag(area.tagName, areaTag); - } - - global.nbt.setTag("save" + state, statesave); - global.saveNBT(); - statesSaved[state] = true; - } - - public static boolean hasSMPCounterPart() { - return hasSMPCounterpart; - } - - public static void setHasSMPCounterPart(boolean flag) { - hasSMPCounterpart = flag; - permissableActions.clear(); - bannedBlocks.clear(); - disabledActions.clear(); - enabledActions.clear(); - } - - public static boolean canCheatItem(ItemStack stack) { - return canPerformAction("item") && !bannedBlocks.contains(stack); - } - - public static boolean canPerformAction(String name) { - if (!isEnabled()) { - return false; - } - - if (!modePermitsAction(name)) { - return false; - } - - String base = NEIActions.base(name); - if (hasSMPCounterpart) { - return permissableActions.contains(base); - } - - if (NEIActions.smpRequired(name)) { - return false; - } - - String cmd = getStringSetting("command." + base); - return !(cmd == null || !cmd.startsWith("/")); - - } - - private static boolean modePermitsAction(String name) { - if (getCheatMode() == 0) { - return false; - } - if (getCheatMode() == 2) { - return true; - } - - String[] actions = getStringArrSetting("inventory.utilities"); - for (String action : actions) { - if (action.equalsIgnoreCase(name)) { - return true; - } - } - - return false; - } - - public static String[] getStringArrSetting(String s) { - return getStringSetting(s).replace(" ", "").split(","); - } - - public static void setInternalEnabled(boolean b) { - enabledOverride = b; - } - - public static void reloadSaves() { - File saveDir = new File(CommonUtils.getMinecraftDir(), "saves/NEI/local"); - if (!saveDir.exists()) { - return; - } - - List saves; - try { - saves = Minecraft.getMinecraft().getSaveLoader().getSaveList(); - } catch (Exception e) { - LogHelper.errorError("Error loading saves", e); - return; - } - HashSet saveFileNames = new HashSet(); - for (WorldSummary save : saves) { - saveFileNames.add(save.getFileName()); - } - - for (File file : saveDir.listFiles()) { - if (file.isDirectory() && !saveFileNames.contains(file.getName())) { - ObfuscationRun.deleteDir(file, true); - } - } - } -} diff --git a/dependencies/main/java/codechicken/nei/NEICompatibility.java b/dependencies/main/java/codechicken/nei/NEICompatibility.java deleted file mode 100644 index 9b1c59b87e..0000000000 --- a/dependencies/main/java/codechicken/nei/NEICompatibility.java +++ /dev/null @@ -1,4 +0,0 @@ -package codechicken.nei; - -public class NEICompatibility { -} diff --git a/dependencies/main/java/codechicken/nei/NEIController.java b/dependencies/main/java/codechicken/nei/NEIController.java deleted file mode 100644 index 02d3d26269..0000000000 --- a/dependencies/main/java/codechicken/nei/NEIController.java +++ /dev/null @@ -1,305 +0,0 @@ -package codechicken.nei; - -import codechicken.nei.api.*; -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.guihook.IContainerInputHandler; -import codechicken.nei.guihook.IContainerSlotClickHandler; -import codechicken.nei.network.NEIClientPacketHandler; -import codechicken.nei.util.NEIClientUtils; -import codechicken.nei.util.NEIServerUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.gui.inventory.GuiContainerCreative; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ClickType; -import net.minecraft.inventory.Slot; -import net.minecraft.inventory.SlotCrafting; -import net.minecraft.item.ItemStack; - -import java.awt.*; -import java.util.LinkedList; - -import static codechicken.lib.gui.GuiDraw.getMousePosition; - -public class NEIController implements IContainerSlotClickHandler, IContainerInputHandler { - private static NEIController instance = new NEIController(); - - public static GuiContainerManager manager; - public static FastTransferManager fastTransferManager; - - private static boolean deleteMode; - private static int pickedUpFromSlot; - private static IInfiniteItemHandler heldStackInfinite; - - private static int selectedItem; - private ItemStack firstheld; - - public static void load() { - GuiContainerManager.addSlotClickHandler(instance); - GuiContainerManager.addInputHandler(instance); - } - - public static void load(GuiContainer gui) { - manager = GuiContainerManager.getManager(gui); - deleteMode = false; - GuiInfo.clearGuiHandlers(); - fastTransferManager = null; - if (!NEIClientConfig.isEnabled()) { - return; - } - - fastTransferManager = new FastTransferManager(); - if (gui instanceof INEIGuiHandler) { - API.registerNEIGuiHandler((INEIGuiHandler) gui); - } - } - - public static boolean isSpreading(GuiContainer gui) { - return gui.dragSplitting && gui.dragSplittingSlots.size() > 1; - } - - public static void updateUnlimitedItems(InventoryPlayer inventory) { - if (!NEIClientConfig.canPerformAction("item") || !NEIClientConfig.hasSMPCounterPart()) { - return; - } - - LinkedList beforeStacks = new LinkedList(); - for (int i = 0; i < inventory.getSizeInventory(); i++) { - beforeStacks.add(NEIServerUtils.copyStack(inventory.getStackInSlot(i))); - } - - for (int i = 0; i < inventory.getSizeInventory(); i++) { - ItemStack stack = inventory.getStackInSlot(i); - if (stack == null) { - continue; - } - - for (IInfiniteItemHandler handler : ItemInfo.infiniteHandlers) { - if (handler.canHandleItem(stack) && handler.isItemInfinite(stack)) { - handler.replenishInfiniteStack(inventory, i); - } - } - } - - for (int i = 0; i < inventory.getSizeInventory(); i++) { - ItemStack newstack = inventory.getStackInSlot(i); - - if (!NEIServerUtils.areStacksIdentical(beforeStacks.get(i), newstack)) { - inventory.setInventorySlotContents(i, beforeStacks.get(i));//restore in case of SMP fail - NEIClientUtils.setSlotContents(i, newstack, false);//sends via SMP handler ;) - } - } - } - - public static void processCreativeCycling(InventoryPlayer inventory) { - if (NEIClientConfig.invCreativeMode() && NEIClientUtils.controlKey()) { - if (selectedItem != inventory.currentItem) { - if (inventory.currentItem == selectedItem + 1 || (inventory.currentItem == 0 && selectedItem == 8))//foward - { - NEIClientPacketHandler.sendCreativeScroll(1); - inventory.currentItem = selectedItem; - } else if (inventory.currentItem == selectedItem - 1 || (inventory.currentItem == 8 && selectedItem == 0)) { - NEIClientPacketHandler.sendCreativeScroll(-1); - inventory.currentItem = selectedItem; - } - } - } - - selectedItem = inventory.currentItem; - } - - @Override - public void beforeSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, ClickType clickType) { - if (!NEIClientConfig.isEnabled()) { - return; - } - - firstheld = NEIClientUtils.getHeldItem(); - } - - @Override - public boolean handleSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, ClickType clickType, boolean eventConsumed) { - if (eventConsumed || - !NEIClientConfig.isEnabled() || - isSpreading(gui)) { - return eventConsumed; - } - - if (deleteMode && slotIndex >= 0 && slot != null) { - if (NEIClientUtils.shiftKey() && button == 0) { - ItemStack itemstack1 = slot.getStack(); - if (itemstack1 != null) { - NEIClientUtils.deleteItemsOfType(itemstack1); - } - - } else if (button == 1) { - NEIClientUtils.decreaseSlotStack(slot.slotNumber); - } else { - NEIClientUtils.deleteSlotStack(slot.slotNumber); - } - return true; - } - - if (button == 1 && slot instanceof SlotCrafting)//right click - { - for (int i1 = 0; i1 < 64; i1++)//click this slot 64 times - { - manager.handleSlotClick(slot.slotNumber, button, ClickType.PICKUP); - } - return true; - } - - if (NEIClientUtils.controlKey() && slot != null && slot.getStack() != null && slot.isItemValid(slot.getStack())) { - NEIClientUtils.cheatItem(slot.getStack(), button, 1); - return true; - } - - if (GuiInfo.hasCustomSlots(gui)) { - return false; - } - - if (slotIndex >= 0 && NEIClientUtils.shiftKey() && NEIClientUtils.getHeldItem() != null && !slot.getHasStack()) { - ItemStack held = NEIClientUtils.getHeldItem(); - manager.handleSlotClick(slot.slotNumber, button, ClickType.PICKUP); - if (slot.isItemValid(held) && !ItemInfo.fastTransferExemptions.contains(slot.getClass()) && !ItemInfo.fastTransferContainerExemptions.contains(gui.getClass())) { - fastTransferManager.performMassTransfer(gui, pickedUpFromSlot, slotIndex, held); - } - - return true; - } - - if (slotIndex == -999 && NEIClientUtils.shiftKey() && button == 0 && !ItemInfo.fastTransferContainerExemptions.contains(gui.getClass())) { - fastTransferManager.throwAll(gui, pickedUpFromSlot); - return true; - } - - return false; - } - - @Override - public void afterSlotClick(GuiContainer gui, int slotIndex, int button, Slot slot, ClickType clickType) { - if (!NEIClientConfig.isEnabled()) { - return; - } - - ItemStack nowHeld = NEIClientUtils.getHeldItem(); - - if (firstheld != nowHeld) { - pickedUpFromSlot = slotIndex; - } - - if (NEIClientConfig.canPerformAction("item") && NEIClientConfig.hasSMPCounterPart()) { - if (heldStackInfinite != null && slot != null && slot.inventory == Minecraft.getMinecraft().thePlayer.inventory) { - ItemStack stack = slot.getStack(); - if (stack != null) { - heldStackInfinite.onPlaceInfinite(stack); - } - NEIClientUtils.setSlotContents(slotIndex, stack, true); - } - - if (firstheld != nowHeld) { - heldStackInfinite = null; - } - - if (firstheld != nowHeld && nowHeld != null) { - for (IInfiniteItemHandler handler : ItemInfo.infiniteHandlers) { - if (handler.canHandleItem(nowHeld) && handler.isItemInfinite(nowHeld)) { - handler.onPickup(nowHeld); - NEIClientUtils.setSlotContents(-999, nowHeld, true); - heldStackInfinite = handler; - break; - } - } - } - } - } - - @Override - public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode) { - if (!NEIClientConfig.isEnabled() || - GuiInfo.hasCustomSlots(gui) || - isSpreading(gui)) { - return false; - } - - Slot slot = GuiContainerManager.getSlotMouseOver(gui); - if (slot == null) { - return false; - } - - int slotIndex = slot.slotNumber; - - if (keyCode == Minecraft.getMinecraft().gameSettings.keyBindDrop.getKeyCode() && NEIClientUtils.shiftKey() && !ItemInfo.fastTransferContainerExemptions.contains(gui.getClass())) { - FastTransferManager.clickSlot(gui, slotIndex); - fastTransferManager.throwAll(gui, slotIndex); - FastTransferManager.clickSlot(gui, slotIndex); - - return true; - } - - return false; - } - - @Override - public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { - if (!NEIClientConfig.isEnabled() || GuiInfo.hasCustomSlots(gui)) { - return false; - } - - Point mousePos = getMousePosition(); - Slot mouseover = manager.window.getSlotAtPosition(mousePos.x, mousePos.y); - if (mouseover != null && mouseover.getHasStack() && !ItemInfo.fastTransferContainerExemptions.contains(gui.getClass())) { - if (scrolled > 0) { - fastTransferManager.transferItem(manager.window, mouseover.slotNumber); - } else { - fastTransferManager.retrieveItem(manager.window, mouseover.slotNumber); - } - return true; - } - return false; - } - - @Override - public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) { - return false; - } - - @Override - public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) { - return false; - } - - @Override - public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) { - } - - @Override - public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) { - } - - @Override - public void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime) { - } - - @Override - public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { - } - - @Override - public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) { - } - - public static boolean canUseDeleteMode() { - return !(NEIClientUtils.getGuiContainer() instanceof GuiContainerCreative); - } - - public static void toggleDeleteMode() { - if (canUseDeleteMode()) { - deleteMode = !deleteMode; - } - } - - public static boolean getDeleteMode() { - return deleteMode; - } -} diff --git a/dependencies/main/java/codechicken/nei/NEICreativeGuiHandler.java b/dependencies/main/java/codechicken/nei/NEICreativeGuiHandler.java deleted file mode 100644 index 564ceb2be7..0000000000 --- a/dependencies/main/java/codechicken/nei/NEICreativeGuiHandler.java +++ /dev/null @@ -1,22 +0,0 @@ -package codechicken.nei; - -import codechicken.nei.api.INEIGuiAdapter; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.gui.inventory.GuiContainerCreative; -import net.minecraft.creativetab.CreativeTabs; - -public class NEICreativeGuiHandler extends INEIGuiAdapter { - @Override - public VisibilityData modifyVisiblity(GuiContainer gui, VisibilityData currentVisibility) { - if (!(gui instanceof GuiContainerCreative)) { - return currentVisibility; - } - - if (((GuiContainerCreative) gui).getSelectedTabIndex() != CreativeTabs.INVENTORY.getTabIndex()) { - currentVisibility.showItemPanel = currentVisibility.enableDeleteMode = false; - } - - return currentVisibility; - } - -} diff --git a/dependencies/main/java/codechicken/nei/NEIDummySlotHandler.java b/dependencies/main/java/codechicken/nei/NEIDummySlotHandler.java deleted file mode 100644 index 25900bcf3d..0000000000 --- a/dependencies/main/java/codechicken/nei/NEIDummySlotHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -package codechicken.nei; - -import codechicken.core.inventory.ContainerExtended; -import codechicken.core.inventory.SlotDummy; -import codechicken.nei.api.INEIGuiAdapter; -import codechicken.nei.network.NEIClientPacketHandler; -import codechicken.nei.util.NEIClientUtils; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class NEIDummySlotHandler extends INEIGuiAdapter { - @Override - public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button) { - Slot slot = gui.getSlotAtPosition(mousex, mousey); - if (slot instanceof SlotDummy && slot.isItemValid(draggedStack) && gui.inventorySlots instanceof ContainerExtended) { - ((SlotDummy) slot).slotClick(draggedStack, button, NEIClientUtils.shiftKey()); - NEIClientPacketHandler.sendDummySlotSet(slot.slotNumber, slot.getStack()); - return true; - } - return false; - } -} diff --git a/dependencies/main/java/codechicken/nei/NEIModContainer.java b/dependencies/main/java/codechicken/nei/NEIModContainer.java deleted file mode 100644 index 69ecd3af20..0000000000 --- a/dependencies/main/java/codechicken/nei/NEIModContainer.java +++ /dev/null @@ -1,120 +0,0 @@ -package codechicken.nei; - -import codechicken.core.launch.CodeChickenCorePlugin; -import codechicken.lib.CodeChickenLib; -import codechicken.nei.api.IConfigureNEI; -import codechicken.nei.asm.NEICorePlugin; -import com.google.common.eventbus.EventBus; -import com.google.common.eventbus.Subscribe; -import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.client.FMLFileResourcePack; -import net.minecraftforge.fml.client.FMLFolderResourcePack; -import net.minecraftforge.fml.common.*; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.versioning.ArtifactVersion; -import net.minecraftforge.fml.common.versioning.VersionParser; -import net.minecraftforge.fml.common.versioning.VersionRange; - -import java.io.File; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - -@Mod(modid = "nei")// Fixes no resource domain being registered. -public class NEIModContainer extends DummyModContainer { - public static LinkedList plugins = new LinkedList(); - - public NEIModContainer() { - super(MetadataCollection.from(MetadataCollection.class.getResourceAsStream("/neimod.info"), "NotEnoughItems").getMetadataForId("NotEnoughItems", null)); - loadMetadata(); - } - - @Override - public Set getRequirements() { - Set deps = new HashSet(); - if (!super.getMetadata().version.contains("$")) { - deps.add(VersionParser.parseVersionReference("CodeChickenLib@[" + CodeChickenLib.version + ",)")); - deps.add(VersionParser.parseVersionReference("CodeChickenCore@[" + CodeChickenCorePlugin.version + ",)")); - deps.add(VersionParser.parseVersionReference("JEI@[3.13.2,)")); - } - return deps; - } - - @Override - public List getDependencies() { - return new LinkedList(getRequirements()); - } - - private String description; - - private void loadMetadata() { - description = super.getMetadata().description.replace("Supporters:", TextFormatting.AQUA + "Supporters:"); - } - - @Override - public ModMetadata getMetadata() { - String s_plugins = ""; - if (plugins.size() == 0) { - s_plugins += TextFormatting.RED + "No installed plugins."; - } else { - s_plugins += TextFormatting.GREEN + "Installed plugins: "; - for (int i = 0; i < plugins.size(); i++) { - if (i > 0) { - s_plugins += ", "; - } - IConfigureNEI plugin = plugins.get(i); - s_plugins += plugin.getName() + " " + plugin.getVersion(); - } - s_plugins += "."; - } - - ModMetadata meta = super.getMetadata(); - meta.description = description.replace("", s_plugins); - return meta; - } - - @Override - public boolean registerBus(EventBus bus, LoadController controller) { - bus.register(this); - return true; - } - - @Subscribe - public void preInit(FMLPreInitializationEvent event) { - FingerprintChecker.runFingerprintChecks(); - if (event.getSide().isClient()) { - ClientHandler.preInit(); - } - } - - @Subscribe - public void init(FMLInitializationEvent event) { - if (event.getSide().isClient()) { - ClientHandler.init(); - } - - ServerHandler.init(); - } - - @Override - public VersionRange acceptableMinecraftVersionRange() { - return VersionParser.parseRange(CodeChickenLib.mcVersion); - } - - @Override - public File getSource() { - return NEICorePlugin.location; - } - - @Override - public Class getCustomResourcePackClass() { - return getSource().isFile() ? FMLFileResourcePack.class : FMLFolderResourcePack.class; - } - - @Override - public Object getMod() { - return this; - } -} diff --git a/dependencies/main/java/codechicken/nei/NEIServerConfig.java b/dependencies/main/java/codechicken/nei/NEIServerConfig.java deleted file mode 100644 index 9634a823d7..0000000000 --- a/dependencies/main/java/codechicken/nei/NEIServerConfig.java +++ /dev/null @@ -1,300 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.util.CommonUtils; -import codechicken.lib.config.ConfigFile; -import codechicken.lib.inventory.InventoryUtils; -import codechicken.lib.packet.PacketCustom; -import codechicken.lib.util.ServerUtils; -import codechicken.nei.network.NEIServerPacketHandler; -import codechicken.nei.util.LogHelper; -import codechicken.nei.util.NEIServerUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.JsonToNBT; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; -import org.apache.commons.io.IOUtils; - -import java.io.File; -import java.io.FileReader; -import java.io.PrintWriter; -import java.util.*; - -public class NEIServerConfig { - private static MinecraftServer server; - - public static File saveDir; - public static ConfigFile serverConfig; - public static Map dimTags = new HashMap(); - public static HashMap playerSaves = new HashMap(); - public static ItemStackMap> bannedItems = new ItemStackMap>(); - - public static void load(World world) { - if (ServerUtils.mc() != server) { - LogHelper.debug("Loading NEI Server"); - server = ServerUtils.mc(); - saveDir = new File(DimensionManager.getCurrentSaveRootDirectory(), "NEI"); - - dimTags.clear(); - loadConfig(); - loadBannedItems(); - } - loadWorld(world); - } - - public static File getSaveDir(World world) { - return new File(CommonUtils.getSaveLocation(world), "NEI"); - } - - private static void loadWorld(World world) { - try { - File file = new File(getSaveDir(world), "world.dat"); - NBTTagCompound tag = NEIServerUtils.readNBT(file); - if (tag == null) { - tag = new NBTTagCompound(); - } - dimTags.put(world.provider.getDimension(), tag); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private static void loadConfig() { - File file = new File(saveDir, "server.cfg"); - serverConfig = new ConfigFile(file); - - serverConfig.setNewLineMode(1); - serverConfig.getTag("permissions").useBraces(); - serverConfig.getTag("permissions").setComment("List of players who can use these features.\nEg. time=CodeChicken, Friend1"); - - setDefaultFeature("time"); - setDefaultFeature("rain"); - setDefaultFeature("heal"); - setDefaultFeature("magnet"); - setDefaultFeature("creative"); - setDefaultFeature("creative+"); - setDefaultFeature("adventure"); - setDefaultFeature("enchant"); - setDefaultFeature("potion"); - setDefaultFeature("save-state"); - setDefaultFeature("item"); - setDefaultFeature("delete"); - setDefaultFeature("notify-item", "CONSOLE, OP"); - } - - private static void setDefaultFeature(String featurename, String... names) { - if (names.length == 0) { - names = new String[] { "OP" }; - } - - String list = ""; - for (int i = 0; i < names.length; i++) { - if (i >= 1) { - list += ", "; - } - list += names[i]; - } - serverConfig.getTag("permissions." + featurename).setDefaultValue(list); - } - - private static void saveWorld(int dim) { - try { - File file = new File(getSaveDir(DimensionManager.getWorld(dim)), "world.dat"); - NEIServerUtils.writeNBT(dimTags.get(dim), file); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public static boolean canPlayerPerformAction(String playername, String name) { - return isPlayerInList(playername, getPlayerList("permissions." + NEIActions.base(name)), true); - } - - public static boolean isPlayerInList(String playername, Set list, boolean allowCards) { - if (playername.equals("CONSOLE")) { - return list.contains(playername); - } - - playername = playername.toLowerCase(); - - if (allowCards) { - if (list.contains("ALL")) { - return true; - } - if ((ServerUtils.isPlayerOP(playername) || ServerUtils.isPlayerOwner(playername)) && list.contains("OP")) { - return true; - } - } - - return list.contains(playername); - } - - public static boolean isActionDisabled(int dim, String name) { - return dimTags.get(dim).getBoolean("disabled" + name); - } - - public static void disableAction(int dim, String name, boolean disable) { - dimTags.get(dim).setBoolean("disabled" + name, disable); - NEIServerPacketHandler.sendActionDisabled(dim, name, disable); - saveWorld(dim); - } - - public static HashSet getPlayerList(String tag) { - String[] list = serverConfig.getTag(tag).getValue("").replace(" ", "").split(","); - return new HashSet(Arrays.asList(list)); - } - - public static void addPlayerToList(String playername, String tag) { - HashSet list = getPlayerList(tag); - - if (!playername.equals("CONSOLE") && !playername.equals("ALL") && !playername.equals("OP")) { - playername = playername.toLowerCase(); - } - - list.add(playername); - savePlayerList(tag, list); - } - - public static void remPlayerFromList(String playername, String tag) { - HashSet list = getPlayerList(tag); - - if (!playername.equals("CONSOLE") && !playername.equals("ALL") && !playername.equals("OP")) { - playername = playername.toLowerCase(); - } - - list.remove(playername); - savePlayerList(tag, list); - } - - private static void savePlayerList(String tag, Collection list) { - StringBuilder sb = new StringBuilder(); - int i = 0; - for (Iterator iterator = list.iterator(); iterator.hasNext(); i++) { - if (i != 0) { - sb.append(", "); - } - - sb.append(iterator.next()); - } - - serverConfig.getTag(tag).setValue(sb.toString()); - } - - private static void loadBannedItems() { - bannedItems.clear(); - File file = new File(saveDir, "banneditems.cfg"); - if (!file.exists()) { - bannedItems.put(new ItemStack(Blocks.COMMAND_BLOCK), new HashSet(Arrays.asList("NONE"))); - saveBannedItems(); - return; - } - try { - FileReader r = new FileReader(file); - int line = 0; - for (String s : IOUtils.readLines(r)) { - if (s.charAt(0) == '#' || s.trim().length() == 0) { - continue; - } - int delim = s.lastIndexOf('='); - if (delim < 0) { - LogHelper.error("line %s: Missing =", line); - continue; - } - try { - NBTTagCompound key = JsonToNBT.getTagFromJson(s.substring(0, delim)); - Set values = new HashSet(); - for (String s2 : s.substring(delim + 1).split(",")) { - values.add(s2.trim()); - } - bannedItems.put(InventoryUtils.loadPersistant(key), values); - } catch (Exception e) { - LogHelper.error("line %s: %s", line, e.getMessage()); - } - } - r.close(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public static void saveBannedItems() { - File file = new File(saveDir, "banneditems.cfg"); - try { - if (!file.exists()) { - file.createNewFile(); - } - - PrintWriter p = new PrintWriter(file); - p.println("#Saved in this format for external editing. The format isn't that hard to figure out. If you think you're up to it, modify it here!"); - - for (ItemStackMap.Entry> entry : bannedItems.entries()) { - NBTTagCompound key = InventoryUtils.savePersistant(entry.key, new NBTTagCompound()); - key.removeTag("Count"); - if (key.getByte("Damage") == 0) { - key.removeTag("Damage"); - } - - p.print(key.toString()); - p.print("=["); - int i = 0; - for (String s : entry.value) { - if (i++ != 0) { - p.print(", "); - } - p.print(s); - } - p.println("]"); - } - p.close(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public static PlayerSave forPlayer(String username) { - return playerSaves.get(username); - } - - public static void loadPlayer(EntityPlayer player) { - LogHelper.debug("Loading Player: " + player.getGameProfile().getName()); - playerSaves.put(player.getName(), new PlayerSave((EntityPlayerMP) player, new File(saveDir, "players"))); - } - - public static void unloadPlayer(EntityPlayer player) { - LogHelper.debug("Unloading Player: " + player.getName()); - PlayerSave playerSave = playerSaves.remove(player.getName()); - if (playerSave != null) { - playerSave.save(); - } - } - - public static boolean authenticatePacket(EntityPlayerMP sender, PacketCustom packet) { - switch (packet.getType()) { - case 1: - return canPlayerPerformAction(sender.getName(), "item"); - case 4: - return canPlayerPerformAction(sender.getName(), "delete"); - case 6: - return canPlayerPerformAction(sender.getName(), "magnet"); - case 7: - return canPlayerPerformAction(sender.getName(), "time"); - case 8: - return canPlayerPerformAction(sender.getName(), "heal"); - case 9: - return canPlayerPerformAction(sender.getName(), "rain"); - case 14: - case 23: - return canPlayerPerformAction(sender.getName(), "creative+"); - case 21: - case 22: - return canPlayerPerformAction(sender.getName(), "enchant"); - case 24: - return canPlayerPerformAction(sender.getName(), "potion"); - } - return true; - } -} diff --git a/dependencies/main/java/codechicken/nei/OffsetPositioner.java b/dependencies/main/java/codechicken/nei/OffsetPositioner.java deleted file mode 100644 index 8f54695c54..0000000000 --- a/dependencies/main/java/codechicken/nei/OffsetPositioner.java +++ /dev/null @@ -1,25 +0,0 @@ -package codechicken.nei; - -import codechicken.nei.api.IStackPositioner; -import codechicken.nei.api.stack.PositionedStack; - -import java.util.ArrayList; - -public class OffsetPositioner implements IStackPositioner { - public OffsetPositioner(int x, int y) { - offsetx = x; - offsety = y; - } - - @Override - public ArrayList positionStacks(ArrayList ai) { - for (PositionedStack stack : ai) { - stack.relx += offsetx; - stack.rely += offsety; - } - return ai; - } - - public int offsetx; - public int offsety; -} diff --git a/dependencies/main/java/codechicken/nei/PlayerSave.java b/dependencies/main/java/codechicken/nei/PlayerSave.java deleted file mode 100644 index 0a6bedbe74..0000000000 --- a/dependencies/main/java/codechicken/nei/PlayerSave.java +++ /dev/null @@ -1,129 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.inventory.InventoryUtils; -import codechicken.lib.util.ServerUtils; -import codechicken.nei.network.NEIServerPacketHandler; -import codechicken.nei.util.LogHelper; -import codechicken.nei.util.NEIServerUtils; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; - -import java.io.File; -import java.util.HashSet; - -public class PlayerSave { - public EntityPlayerMP player; - - private File saveFile; - private NBTTagCompound nbt; - - public ItemStack[] creativeInv; - private boolean creativeInvDirty; - - private boolean isDirty; - private boolean wasOp; - - //runtime things - public HashSet magneticItems = new HashSet(); - - public PlayerSave(EntityPlayerMP player, File saveLocation) { - this.player = player; - wasOp = ServerUtils.mc().getPlayerList().canSendCommands(player.getGameProfile()); - - saveFile = new File(saveLocation, player.getName() + ".dat"); - if (!saveFile.getParentFile().exists()) { - saveFile.getParentFile().mkdirs(); - } - load(); - } - - private void load() { - nbt = new NBTTagCompound(); - try { - if (!saveFile.exists()) { - saveFile.createNewFile(); - } - if (saveFile.length() > 0) { - nbt = NEIServerUtils.readNBT(saveFile); - } - } catch (Exception e) { - LogHelper.errorError("Error loading player save: " + player, e); - } - - loadCreativeInv(); - } - - private void loadCreativeInv() { - creativeInv = new ItemStack[54]; - NBTTagList itemList = nbt.getTagList("creativeitems", 10); - if (itemList != null) { - InventoryUtils.readItemStacksFromTag(creativeInv, itemList); - } - } - - public void save() { - if (!isDirty) { - return; - } - - if (creativeInvDirty) { - saveCreativeInv(); - } - - try { - NEIServerUtils.writeNBT(nbt, saveFile); - isDirty = false; - } catch (Exception e) { - LogHelper.errorError("Error saving player: " + player, e); - } - } - - private void saveCreativeInv() { - NBTTagList invsave = InventoryUtils.writeItemStacksToTag(creativeInv); - nbt.setTag("creativeitems", invsave); - - creativeInvDirty = false; - } - - public void setCreativeDirty() { - creativeInvDirty = isDirty = true; - } - - public void setDirty() { - isDirty = true; - } - - public void updateOpChange() { - boolean isOp = ServerUtils.mc().getPlayerList().canSendCommands(player.getGameProfile()); - if (isOp != wasOp) { - NEIServerPacketHandler.sendHasServerSideTo(player); - wasOp = isOp; - } - } - - public boolean isActionEnabled(String name) { - return getEnabledActions().getBoolean(name); - } - - private NBTTagCompound getEnabledActions() { - NBTTagCompound tag = nbt.getCompoundTag("enabledActions"); - if (!nbt.hasKey("enabledActions")) { - nbt.setTag("enabledActions", tag); - } - return tag; - } - - public void enableAction(String name, boolean enabled) { - getEnabledActions().setBoolean(name, enabled); - NEIServerPacketHandler.sendActionEnabled(player, name, enabled); - setDirty(); - } - - public void onWorldReload() { - NEIServerPacketHandler.sendHasServerSideTo(player); - magneticItems.clear(); - } -} diff --git a/dependencies/main/java/codechicken/nei/PopupInputHandler.java b/dependencies/main/java/codechicken/nei/PopupInputHandler.java deleted file mode 100644 index 1e84bb0790..0000000000 --- a/dependencies/main/java/codechicken/nei/PopupInputHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -package codechicken.nei; - -import codechicken.nei.config.KeyBindings; -import codechicken.nei.guihook.IContainerInputHandler; -import codechicken.nei.network.NEIClientPacketHandler; -import net.minecraft.client.gui.inventory.GuiContainer; - -import static codechicken.nei.NEIClientConfig.canPerformAction; - -public class PopupInputHandler implements IContainerInputHandler { - @Override - public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) { - return false; - } - - @Override - public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) { - return false; - } - - @Override - public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) { - } - - @Override - public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) { - if (KeyBindings.get("nei.options.keys.gui.enchant").isActiveAndMatches(keyID) && canPerformAction("enchant")) { - NEIClientPacketHandler.sendOpenEnchantmentWindow(); - return true; - } - if (KeyBindings.get("nei.options.keys.gui.potion").isActiveAndMatches(keyID) && canPerformAction("potion")) { - NEIClientPacketHandler.sendOpenPotionWindow(); - return true; - } - return false; - } - - @Override - public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) { - } - - @Override - public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) { - } - - @Override - public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { - return false; - } - - @Override - public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { - } - - @Override - public void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime) { - } -} diff --git a/dependencies/main/java/codechicken/nei/SaveLoadButton.java b/dependencies/main/java/codechicken/nei/SaveLoadButton.java deleted file mode 100644 index 4479cc1528..0000000000 --- a/dependencies/main/java/codechicken/nei/SaveLoadButton.java +++ /dev/null @@ -1,105 +0,0 @@ -package codechicken.nei; - -import codechicken.nei.util.NEIClientUtils; -import codechicken.nei.widget.Button; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.util.ChatAllowedCharacters; -import org.lwjgl.input.Keyboard; - -import static codechicken.lib.gui.GuiDraw.drawString; -import static codechicken.lib.gui.GuiDraw.getStringWidth; -import static codechicken.nei.util.NEIClientUtils.translate; - -public abstract class SaveLoadButton extends Button { - public SaveLoadButton(String s) { - super(s); - } - - @Override - public boolean handleClick(int mousex, int mousey, int button) { - if (button == 1) { - label = ""; - onTextChange(); - focused = true; - NEIClientUtils.playClickSound(); - return true; - } - return super.handleClick(mousex, mousey, button); - } - - public abstract void onTextChange(); - - @Override - public void onGuiClick(int i, int j) { - if (!contains(i, j)) { - focused = false; - } - } - - @Override - public boolean handleKeyPress(int keyID, char keyChar) { - if (!focused) { - return false; - } - - if (keyID == Keyboard.KEY_BACK) { - if (label.length() > 0) { - label = label.substring(0, label.length() - 1); - onTextChange(); - backdowntime = System.currentTimeMillis(); - } - } else if (keyID == Keyboard.KEY_RETURN) { - focused = false; - } else if (keyChar == 22)//paste - { - String pastestring = GuiScreen.getClipboardString(); - if (pastestring == null) { - pastestring = ""; - } - - label = label + pastestring; - onTextChange(); - } else if (ChatAllowedCharacters.isAllowedCharacter(keyChar)) { - label = label + keyChar; - onTextChange(); - } - return true; - } - - @Override - public void update() { - cursorCounter++; - if (backdowntime > 0) { - if (Keyboard.isKeyDown(Keyboard.KEY_BACK) && label.length() > 5) { - if (System.currentTimeMillis() - backdowntime > 200 / (1 + backs * 0.3F)) { - label = label.substring(0, label.length() - 1); - onTextChange(); - backdowntime = System.currentTimeMillis(); - backs++; - } - } else { - backdowntime = 0; - backs = 0; - } - } - } - - @Override - public void draw(int mousex, int mousey) { - super.draw(mousex, mousey); - if (focused && (cursorCounter / 6) % 2 == 0) { - drawString("_", x + (w + getStringWidth(getRenderLabel())) / 2, y + (h - 8) / 2, 0xFFFFFFFF); - } - } - - @Override - public String getRenderLabel() { - return translate(saved ? "load" : "save") + " " + label; - } - - public boolean saved; - public long backdowntime; - public int backs; - public int cursorCounter; - public boolean focused; -} diff --git a/dependencies/main/java/codechicken/nei/SearchField.java b/dependencies/main/java/codechicken/nei/SearchField.java deleted file mode 100644 index e3f2f7c9de..0000000000 --- a/dependencies/main/java/codechicken/nei/SearchField.java +++ /dev/null @@ -1,152 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.item.filtering.IItemFilter; -import codechicken.lib.item.filtering.IItemFilterProvider; -import codechicken.nei.ItemList.AnyMultiItemFilter; -import codechicken.nei.ItemList.EverythingItemFilter; -import codechicken.nei.ItemList.PatternItemFilter; -import codechicken.nei.api.API; -import codechicken.nei.config.KeyBindings; -import net.minecraft.util.text.TextFormatting; - -import java.util.LinkedList; -import java.util.List; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; - -import static codechicken.lib.gui.GuiDraw.drawGradientRect; -import static codechicken.lib.gui.GuiDraw.drawRect; -import static codechicken.nei.NEIClientConfig.world; - -public class SearchField extends TextField implements IItemFilterProvider { - /** - * Interface for returning a custom filter based on search field text - */ - public interface ISearchProvider { - /** - * @return false if this filter should only be used if no other non-default filters match the search string - */ - boolean isPrimary(); - - /** - * @return An item filter for items matching SearchTex null to ignore this provider - */ - IItemFilter getFilter(String searchText); - } - - private static class DefaultSearchProvider implements ISearchProvider { - @Override - public boolean isPrimary() { - return false; - } - - @Override - public IItemFilter getFilter(String searchText) { - Pattern pattern = getPattern(searchText); - return pattern == null ? null : new PatternItemFilter(pattern); - } - } - - public static List searchProviders = new LinkedList(); - - long lastclicktime; - - public SearchField(String ident) { - super(ident); - API.addItemFilter(this); - API.addSearchProvider(new DefaultSearchProvider()); - } - - public static boolean searchInventories() { - return world.nbt.getBoolean("searchinventories"); - } - - @Override - public int getTextColour() { -// if (JEIIntegrationManager.itemPannelOwner == EnumItemBrowser.JEI ? JEIIntegrationManager.getFilteredItems().size() == 0 : ItemPanel.items.size() == 0) { -// return Color.red.getRGB(); -// } - return super.getTextColour(); - } - - @Override - public void drawBox() { - if (searchInventories()) { - drawGradientRect(x, y, w, h, 0xFFFFFF00, 0xFFC0B000); - } else { - drawRect(x, y, w, h, 0xffA0A0A0); - } - drawRect(x + 1, y + 1, w - 2, h - 2, 0xFF000000); - } - - @Override - public boolean handleClick(int mousex, int mousey, int button) { - if (button == 0) { - if (focused() && (System.currentTimeMillis() - lastclicktime < 500)) {//double click - NEIClientConfig.world.nbt.setBoolean("searchinventories", !searchInventories()); - NEIClientConfig.world.saveNBT(); - } else { - lastclicktime = System.currentTimeMillis(); - } - } - return super.handleClick(mousex, mousey, button); - } - - @Override - public void onTextChange(String oldText) { - NEIClientConfig.setSearchExpression(text()); - ItemList.updateFilter.restart(); - } - - @Override - public void lastKeyTyped(int keyID, char keyChar) { - if (KeyBindings.get("nei.options.keys.gui.search").isActiveAndMatches(keyID)) { - setFocus(true); - } - } - - @Override - public String filterText(String s) { - return TextFormatting.getTextWithoutFormattingCodes(s); - } - - public static Pattern getPattern(String search) { - switch (NEIClientConfig.getIntSetting("inventory.searchmode")) { - case 0://plain - search = "\\Q" + search + "\\E"; - break; - case 1: - search = search.replace(".", "").replace("?", ".").replace("*", ".+?"); - break; - } - - Pattern pattern = null; - try { - pattern = Pattern.compile(search); - } catch (PatternSyntaxException ignored) { - } - return pattern == null || pattern.toString().length() == 0 ? null : pattern; - } - - @Override - public IItemFilter getFilter() { - String s_filter = text().toLowerCase(); - - List primary = new LinkedList(); - List secondary = new LinkedList(); - for (ISearchProvider p : searchProviders) { - IItemFilter filter = p.getFilter(s_filter); - if (filter != null) { - (p.isPrimary() ? primary : secondary).add(filter); - } - } - - if (!primary.isEmpty()) { - return new AnyMultiItemFilter(primary); - } - if (!secondary.isEmpty()) { - return new AnyMultiItemFilter(secondary); - } - return new EverythingItemFilter(); - } -} diff --git a/dependencies/main/java/codechicken/nei/ServerHandler.java b/dependencies/main/java/codechicken/nei/ServerHandler.java deleted file mode 100644 index 06a384e8e8..0000000000 --- a/dependencies/main/java/codechicken/nei/ServerHandler.java +++ /dev/null @@ -1,164 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.packet.PacketCustom; -import codechicken.nei.network.NEIClientPacketHandler; -import codechicken.nei.network.NEIServerPacketHandler; -import codechicken.nei.util.NEIServerUtils; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.world.WorldEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerChangedDimensionEvent; -import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; -import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent; -import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; - -import java.util.List; - -public class ServerHandler { - private static ServerHandler instance; - - public static void init() { - instance = new ServerHandler(); - - PacketCustom.assignHandler(NEIClientPacketHandler.channel, new NEIServerPacketHandler()); - //FMLCommonHandler.instance().bus().register(instance); - MinecraftForge.EVENT_BUS.register(instance); - - Item.getItemFromBlock(Blocks.MOB_SPAWNER).setHasSubtypes(true); - NEIActions.init(); - } - - @SubscribeEvent - public void tickEvent(TickEvent.WorldTickEvent event) { - if (event.phase == Phase.START && !event.world.isRemote && - NEIServerConfig.dimTags.containsKey(event.world.provider.getDimension()))//fake worlds that don't call Load - { - processDisabledProperties(event.world); - } - } - - @SubscribeEvent - public void loadEvent(WorldEvent.Load event) { - if (!event.getWorld().isRemote) { - NEIServerConfig.load(event.getWorld()); - } - } - - @SubscribeEvent - public void tickEvent(TickEvent.PlayerTickEvent event) { - if (event.phase == Phase.START && event.player instanceof EntityPlayerMP) { - EntityPlayerMP player = (EntityPlayerMP) event.player; - PlayerSave save = NEIServerConfig.forPlayer(player.getName()); - if (save == null) { - return; - } - updateMagneticPlayer(player, save); - save.updateOpChange(); - save.save(); - } - } - - private void processDisabledProperties(World world) { - NEIServerUtils.advanceDisabledTimes(world); - if (NEIServerUtils.isRaining(world) && NEIServerConfig.isActionDisabled(world.provider.getDimension(), "rain")) { - NEIServerUtils.toggleRaining(world, false); - } - } - - private void updateMagneticPlayer(EntityPlayerMP player, PlayerSave save) { - if (!save.isActionEnabled("magnet") || player.isDead) { - return; - } - - float distancexz = 16; - float distancey = 8; - double maxspeedxz = 0.5; - double maxspeedy = 0.5; - double speedxz = 0.05; - double speedy = 0.07; - List items = player.worldObj.getEntitiesWithinAABB(EntityItem.class, player.getEntityBoundingBox().expand(distancexz, distancey, distancexz)); - for (EntityItem item : items) { - if (item.cannotPickup()) { - continue; - } - if (!NEIServerUtils.canItemFitInInventory(player, item.getEntityItem())) { - continue; - } - if (save.magneticItems.add(item)) { - NEIServerPacketHandler.sendAddMagneticItemTo(player, item); - } - - double dx = player.posX - item.posX; - double dy = player.posY + player.getEyeHeight() - item.posY; - double dz = player.posZ - item.posZ; - double absxz = Math.sqrt(dx * dx + dz * dz); - double absy = Math.abs(dy); - if (absxz > distancexz) { - continue; - } - - if (absxz < 1) { - item.onCollideWithPlayer(player); - } - - if (absxz > 1) { - dx /= absxz; - dz /= absxz; - } - - if (absy > 1) { - dy /= absy; - } - - double vx = item.motionX + speedxz * dx; - double vy = item.motionY + speedy * dy; - double vz = item.motionZ + speedxz * dz; - - double absvxz = Math.sqrt(vx * vx + vz * vz); - double absvy = Math.abs(vy); - - double rationspeedxz = absvxz / maxspeedxz; - if (rationspeedxz > 1) { - vx /= rationspeedxz; - vz /= rationspeedxz; - } - - double rationspeedy = absvy / maxspeedy; - if (absvy > 1) { - vy /= rationspeedy; - } - - item.motionX = vx; - item.motionY = vy; - item.motionZ = vz; - } - } - - @SubscribeEvent - public void loginEvent(PlayerLoggedInEvent event) { - NEIServerConfig.loadPlayer(event.player); - NEIServerPacketHandler.sendHasServerSideTo((EntityPlayerMP) event.player); - } - - @SubscribeEvent - public void logoutEvent(PlayerLoggedOutEvent event) { - NEIServerConfig.unloadPlayer(event.player); - } - - @SubscribeEvent - public void dimChangeEvent(PlayerChangedDimensionEvent event) { - NEIServerConfig.forPlayer(event.player.getName()).onWorldReload(); - } - - @SubscribeEvent - public void loginEvent(PlayerRespawnEvent event) { - NEIServerConfig.forPlayer(event.player.getName()).onWorldReload(); - } -} diff --git a/dependencies/main/java/codechicken/nei/SlotOP.java b/dependencies/main/java/codechicken/nei/SlotOP.java deleted file mode 100644 index bc1828303f..0000000000 --- a/dependencies/main/java/codechicken/nei/SlotOP.java +++ /dev/null @@ -1,9 +0,0 @@ -package codechicken.nei; - -public abstract class SlotOP { - public abstract String getDescription(); - - public abstract int[] getKeyBind(); - - public abstract void operate(); -} diff --git a/dependencies/main/java/codechicken/nei/SpawnerRenderer.java b/dependencies/main/java/codechicken/nei/SpawnerRenderer.java deleted file mode 100644 index 125b65ffe3..0000000000 --- a/dependencies/main/java/codechicken/nei/SpawnerRenderer.java +++ /dev/null @@ -1,121 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.model.ModelRegistryHelper; -import codechicken.lib.render.item.IItemRenderer; -import codechicken.lib.texture.TextureUtils; -import codechicken.lib.util.TransformUtils; -import codechicken.lib.util.ClientUtils; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.block.model.*; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; -import net.minecraftforge.client.model.IPerspectiveAwareModel; -import org.apache.commons.lang3.tuple.Pair; - -import javax.vecmath.Matrix4f; -import java.util.ArrayList; -import java.util.List; - -//import net.minecraft.entity.boss.BossStatus; - -public class SpawnerRenderer implements IItemRenderer, IPerspectiveAwareModel { - public static void load(ItemMobSpawner item) { - ModelRegistryHelper.registerItemRenderer(item, new SpawnerRenderer()); - } - - public void renderItem(ItemStack stack) { - int meta = stack.getItemDamage(); - - if (meta == 0) { - meta = ItemMobSpawner.idPig; - } - - //String bossName = BossStatus.bossName; - //int bossTimeout = BossStatus.statusBarTime; - Minecraft mc = Minecraft.getMinecraft(); - World world = mc.theWorld; - - IBakedModel baseModel = mc.getRenderItem().getItemModelMesher().getModelManager().getModel(new ModelResourceLocation("mob_spawner")); - GlStateManager.pushMatrix(); - GlStateManager.translate(.5, .5, .5); - GlStateManager.scale(2, 2, 2); - mc.getRenderItem().renderItem(stack, baseModel); - GlStateManager.popMatrix(); - - try { - Entity entity = ItemMobSpawner.getEntity(meta); - entity.setWorld(world); - float scale = 0.6F / Math.max(entity.height, entity.width); - - GlStateManager.pushMatrix(); - GlStateManager.translate(0.5, 0.4, 0.5); - GlStateManager.rotate((float) (ClientUtils.getRenderTime() * 10), 0, 1, 0); - GlStateManager.rotate(-20, 1, 0, 0); - GlStateManager.translate(0, -0.4, 0); - GlStateManager.scale(scale, scale, scale); - entity.setLocationAndAngles(0, 0, 0, 0, 0); - mc.getRenderManager().doRenderEntity(entity, 0, 0, 0, 0, 0, false); - GlStateManager.disableLighting(); - GlStateManager.popMatrix(); - - GlStateManager.enableRescaleNormal(); - OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GlStateManager.disableTexture2D(); - OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); - } catch (Exception e) { - if (Tessellator.getInstance().getBuffer().isDrawing) { - Tessellator.getInstance().draw(); - } - } - //BossStatus.bossName = bossName; - //BossStatus.statusBarTime = bossTimeout; - } - - @Override - public List getQuads(IBlockState state, EnumFacing side, long rand) { - return new ArrayList(); - } - - @Override - public boolean isAmbientOcclusion() { - return false; - } - - @Override - public boolean isGui3d() { - return true; - } - - @Override - public boolean isBuiltInRenderer() { - return true; - } - - @Override - public TextureAtlasSprite getParticleTexture() { - return TextureUtils.getBlockTexture("mob_spawner"); - } - - @Override - public ItemCameraTransforms getItemCameraTransforms() { - return ItemCameraTransforms.DEFAULT; - } - - @Override - public ItemOverrideList getOverrides() { - return ItemOverrideList.NONE; - } - - @Override - public Pair handlePerspective(TransformType cameraTransformType) { - return MapWrapper.handlePerspective(this, TransformUtils.DEFAULT_BLOCK.getTransforms(), cameraTransformType); - } -} diff --git a/dependencies/main/java/codechicken/nei/SubsetWidget.java b/dependencies/main/java/codechicken/nei/SubsetWidget.java deleted file mode 100644 index c6e4f58204..0000000000 --- a/dependencies/main/java/codechicken/nei/SubsetWidget.java +++ /dev/null @@ -1,798 +0,0 @@ -package codechicken.nei; - -import codechicken.core.gui.GuiScrollSlot; -import codechicken.lib.gui.GuiDraw; -import codechicken.lib.item.filtering.IItemFilter; -import codechicken.lib.item.filtering.IItemFilterProvider; -import codechicken.lib.thread.RestartableTask; -import codechicken.lib.vec.Rectangle4i; -import codechicken.nei.ItemList.AnyMultiItemFilter; -import codechicken.nei.ItemList.ItemsLoadedCallback; -import codechicken.nei.ItemList.NothingItemFilter; -import codechicken.nei.SearchField.ISearchProvider; -import codechicken.nei.api.API; -import codechicken.nei.api.ItemInfo; -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.util.LogHelper; -import codechicken.nei.util.NEIClientUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.text.TextFormatting; - -import java.awt.*; -import java.util.*; -import java.util.List; -import java.util.concurrent.atomic.AtomicReference; -import java.util.regex.Pattern; - -public class SubsetWidget extends codechicken.nei.widget.Button implements IItemFilterProvider, ItemsLoadedCallback, ISearchProvider { - public static class SubsetState { - int state = 2; - ArrayList items = new ArrayList(); - } - - public static class SubsetTag { - protected class SubsetSlot extends GuiScrollSlot { - public SubsetSlot() { - super(0, 0, 0, 0); - setSmoothScroll(false); - } - - @Override - public int getSlotHeight(int slot) { - return 18; - } - - @Override - protected int getNumSlots() { - return children.size() + state.items.size(); - } - - @Override - protected void slotClicked(int slot, int button, int mx, int my, int count) { - if (slot < sorted.size()) { - SubsetTag tag = sorted.get(slot); - if (NEIClientUtils.shiftKey()) { - String searchTag = tag.fullname;//TODO - if (searchTag.startsWith("Mod.")/* && JEIIntegrationManager.itemPannelOwner == EnumItemBrowser.JEI*/){ - searchTag = searchTag.replace("Mod.", "").replace(" ", ""); - } - LayoutManager.searchField.setText("@" + searchTag); - } else if (button == 0 && count >= 2) { - SubsetWidget.showOnly(tag); - } else { - SubsetWidget.setHidden(tag, button == 1); - } - } else { - ItemStack item = state.items.get(slot - sorted.size()); - if (NEIClientUtils.controlKey()) { - NEIClientUtils.cheatItem(item, button, -1); - } else { - SubsetWidget.setHidden(state.items.get(slot - sorted.size()), button == 1); - } - } - } - - @Override - protected void drawSlot(int slot, int x, int y, int mx, int my, float frame) { - int w = windowBounds().width; - Rectangle4i r = new Rectangle4i(x, y, w, getSlotHeight(slot)); - if (slot < sorted.size()) { - SubsetTag tag = sorted.get(slot); - LayoutManager.getLayoutStyle().drawSubsetTag(tag.displayName(), x, y, r.w, r.h, tag.state.state, r.contains(mx, my)); - } else { - ItemStack stack = state.items.get(slot - sorted.size()); - boolean hidden = SubsetWidget.isHidden(stack); - - int itemx = w / 2 - 8; - int itemy = 1; - - LayoutManager.getLayoutStyle().drawSubsetTag(null, x, y, r.w, r.h, hidden ? 0 : 2, false); - - GuiContainerManager.drawItem(x + itemx, y + itemy, stack); - if (new Rectangle4i(itemx, itemy, 16, 16).contains(mx, my)) { - SubsetWidget.hoverStack = stack; - } - } - } - - @Override - public void drawOverlay(float frame) { - } - - @Override - public void drawBackground(float frame) { - drawRect(x, y, x + width, y + height, 0xFF202020); - } - - @Override - public int scrollbarAlignment() { - return -1; - } - - @Override - public void drawScrollbar(float frame) { - if (hasScrollbar()) { - super.drawScrollbar(frame); - } - } - - @Override - public int scrollbarGuideAlignment() { - return 0; - } - } - - public final String fullname; - public final IItemFilter filter; - public TreeMap children = new TreeMap(); - public List sorted = Collections.emptyList(); - private int childwidth; - - protected String displayName; - protected SubsetState state = new SubsetState(); - protected final SubsetSlot slot = new SubsetSlot(); - private SubsetTag selectedChild; - private int visible; - - public SubsetTag(String fullname) { - this(fullname, new NothingItemFilter()); - } - - public SubsetTag(String fullname, IItemFilter filter) { - assert filter != null : "Filter cannot be null"; - this.fullname = TextFormatting.getTextWithoutFormattingCodes(fullname); - this.filter = filter; - - if (fullname != null) { - int idx = fullname.lastIndexOf('.'); - displayName = idx < 0 ? fullname : fullname.substring(idx + 1); - } - } - - public String displayName() { - return displayName; - } - - public String name() { - int idx = fullname.indexOf('.'); - return idx < 0 ? fullname : fullname.substring(idx + 1); - } - - public String parent() { - int idx = fullname.lastIndexOf('.'); - return idx < 0 ? null : fullname.substring(0, idx); - } - - private SubsetTag getTag(String name) { - int idx = name.indexOf('.'); - String childname = idx > 0 ? name.substring(0, idx) : name; - SubsetTag child = children.get(childname.toLowerCase()); - if (child == null) { - return null; - } - - return idx > 0 ? child.getTag(name.substring(idx + 1)) : child; - } - - private void recacheChildren() { - sorted = new ArrayList(children.values()); - childwidth = 0; - for (SubsetTag tag : sorted) { - childwidth = Math.max(childwidth, tag.nameWidth() + 2); - } - } - - private void addTag(SubsetTag tag) { - String name = fullname == null ? tag.fullname : tag.fullname.substring(fullname.length() + 1); - int idx = name.indexOf('.'); - - if (idx < 0) {//add or replace tag - SubsetTag prev = children.put(name.toLowerCase(), tag); - if (prev != null) {//replaced, load children - tag.children = prev.children; - tag.sorted = prev.sorted; - } - recacheChildren(); - } else { - String childname = name.substring(0, idx); - SubsetTag child = children.get(childname.toLowerCase()); - if (child == null) { - children.put(childname.toLowerCase(), child = new SubsetTag(fullname == null ? childname : fullname + '.' + childname)); - } - recacheChildren(); - child.addTag(tag); - } - } - - protected void cacheState() { - state = SubsetWidget.getState(this); - for (SubsetTag tag : sorted) { - tag.cacheState(); - } - } - - public void addFilters(List filters) { - if (filter != null) { - filters.add(filter); - } - - for (SubsetTag child : sorted) { - child.addFilters(filters); - } - } - - public void search(List tags, Pattern p) { - if (fullname != null && p.matcher(fullname.toLowerCase()).find()) { - tags.add(this); - } else { - for (SubsetTag child : sorted) { - child.search(tags, p); - } - } - } - - public void updateVisiblity(int mx, int my) { - if (selectedChild != null) { - selectedChild.updateVisiblity(mx, my); - if (!selectedChild.isVisible()) { - selectedChild = null; - } - } - - if (slot.contains(mx, my) && (selectedChild == null || !selectedChild.contains(mx, my))) { - int mslot = slot.getClickedSlot(my); - if (mslot >= 0 && mslot < sorted.size()) { - SubsetTag mtag = sorted.get(mslot); - if (mtag != null) { - if (mtag != selectedChild && selectedChild != null) { - selectedChild.setHidden(); - } - selectedChild = mtag; - selectedChild.setVisible(); - } - } - - setVisible(); - } - - if (selectedChild == null) { - countdownVisible(); - } - } - - public void setHidden() { - visible = 0; - slot.mouseReleased(0, 0, 0);//cancel any scrolling - if (selectedChild != null) { - selectedChild.setHidden(); - selectedChild = null; - } - } - - public void setVisible() { - visible = 10; - cacheState(); - } - - private void countdownVisible() { - if (visible > 0 && --visible == 0) { - setHidden(); - } - } - - public void resize(int x, int pwidth, int y) { - int mheight = area.h; - int dheight = area.y2() - y; - int cheight = slot.contentHeight(); - int height = cheight; - if (cheight > mheight) { - y = area.y; - height = mheight; - } else if (cheight > dheight) { - y = area.y2() - cheight; - } - - height = height / slot.getSlotHeight(0) * slot.getSlotHeight(0);//floor to a multiple of slot height - - int width = childwidth; - if (!state.items.isEmpty()) { - width = Math.max(childwidth, 18); - } - if (slot.contentHeight() > height) { - width += slot.scrollbarDim().width; - } - - boolean fitLeft = x - width >= area.x1(); - boolean fitRight = x + width + pwidth <= area.x2(); - if (pwidth >= 0 ? !fitRight && fitLeft : !fitLeft) { - pwidth *= -1;//swap - } - x += pwidth >= 0 ? pwidth : -width; - - slot.setSize(x, y, width, height); - slot.setMargins(slot.hasScrollbar() ? slot.scrollbarDim().width : 0, 0, 0, 0); - - if (selectedChild != null) { - y = slot.getSlotY(sorted.indexOf(selectedChild)) - slot.scrolledPixels() + slot.y; - selectedChild.resize(x, pwidth >= 0 ? width : -width, y); - } - } - - protected int nameWidth() { - return Minecraft.getMinecraft().fontRendererObj.getStringWidth(displayName()); - } - - public boolean isVisible() { - return visible > 0; - } - - public void draw(int mx, int my) { - slot.draw(mx, my, 0); - if (selectedChild != null) { - selectedChild.draw(mx, my); - } - } - - public boolean contains(int px, int py) { - return slot.contains(px, py) || selectedChild != null && selectedChild.contains(px, py); - } - - public void mouseClicked(int mx, int my, int button) { - if (selectedChild != null && selectedChild.contains(mx, my)) { - selectedChild.mouseClicked(mx, my, button); - } else if (slot.contains(mx, my)) { - slot.mouseClicked(mx, my, button); - } - } - - public void mouseDragged(int mx, int my, int button, long heldTime) { - slot.mouseDragged(mx, my, button, heldTime); - if (selectedChild != null) { - selectedChild.mouseDragged(mx, my, button, heldTime); - } - } - - public void mouseUp(int mx, int my, int button) { - slot.mouseReleased(mx, my, button); - if (selectedChild != null) { - selectedChild.mouseUp(mx, my, button); - } - } - - public boolean mouseScrolled(int mx, int my, int scroll) { - if (slot.hasScrollbar() && slot.contains(mx, my)) { - slot.scroll(scroll); - return true; - } - - if (selectedChild != null && selectedChild.mouseScrolled(mx, my, scroll)) { - return true; - } - - if (slot.hasScrollbar() && !contains(mx, my)) { - slot.scroll(scroll); - return true; - } - - return false; - } - - public boolean isScrolling() { - return slot.isScrolling() || selectedChild != null && selectedChild.isScrolling(); - } - } - - protected static final SubsetTag root = new SubsetTag(null); - public static Rectangle4i area = new Rectangle4i(); - public static ItemStack hoverStack; - - private static HashMap subsetState = new HashMap(); - /** - * All operations on this variable should be synchronised. - */ - private static final ItemStackSet hiddenItems = new ItemStackSet(); - private static final AtomicReference dirtyHiddenItems = new AtomicReference(); - - public static SubsetState getState(SubsetTag tag) { - SubsetState state = subsetState.get(tag.fullname); - return state == null ? new SubsetState() : state; - } - - public static void addTag(SubsetTag tag) { - updateState.stop(); - synchronized (root) { - root.addTag(tag); - updateState.reallocate(); - } - } - - public static SubsetTag getTag(String name) { - return name == null ? root : root.getTag(name); - } - - public static boolean isHidden(ItemStack item) { - synchronized (hiddenItems) { - return hiddenItems.contains(item); - } - } - - private static void _setHidden(SubsetTag tag, boolean hidden) { - for (ItemStack item : getState(tag).items) { - _setHidden(item, hidden); - } - for (SubsetTag child : tag.sorted) { - _setHidden(child, hidden); - } - } - - private static void _setHidden(ItemStack item, boolean hidden) { - if (hidden) { - hiddenItems.add(item); - } else { - hiddenItems.remove(item); - } - } - - public static void showOnly(SubsetTag tag) { - synchronized (hiddenItems) { - for (ItemStack item : ItemList.items) { - _setHidden(item, true); - } - setHidden(tag, false); - } - } - - public static void setHidden(SubsetTag tag, boolean hidden) { - synchronized (hiddenItems) { - _setHidden(tag, hidden); - updateHiddenItems(); - } - } - - public static void setHidden(ItemStack item, boolean hidden) { - synchronized (hiddenItems) { - _setHidden(item, hidden); - updateHiddenItems(); - } - } - - public static void unhideAll() { - synchronized (hiddenItems) { - hiddenItems.clear(); - updateHiddenItems(); - } - } - - private static void updateHiddenItems() { - prepareDirtyHiddenItems.restart(); - updateState.restart(); - } - - public static void loadHidden() { - synchronized (hiddenItems) { - hiddenItems.clear(); - } - - List itemList = new LinkedList(); - try { - NBTTagList list = NEIClientConfig.world.nbt.getTagList("hiddenItems", 10); - for (int i = 0; i < list.tagCount(); i++) { - itemList.add(ItemStack.loadItemStackFromNBT(list.getCompoundTagAt(i))); - } - } catch (Exception e) { - LogHelper.errorError("Error loading hiddenItems", e); - return; - } - - synchronized (hiddenItems) { - for (ItemStack item : itemList) { - hiddenItems.add(item); - } - } - updateState.restart(); - } - - private static void saveHidden() { - NBTTagList list = dirtyHiddenItems.getAndSet(null); - if (list != null) { - NEIClientConfig.world.nbt.setTag("hiddenItems", list); - NEIClientConfig.world.saveNBT(); - } - } - - private static final RestartableTask prepareDirtyHiddenItems = new RestartableTask("NEI Subset Save Thread") { - private List getList() { - synchronized (hiddenItems) { - return hiddenItems.values(); - } - } - - @Override - public void execute() { - NBTTagList list = new NBTTagList(); - for (ItemStack item : getList()) { - if (interrupted()) { - return; - } - NBTTagCompound tag = new NBTTagCompound(); - item.writeToNBT(tag); - list.appendTag(tag); - } - dirtyHiddenItems.set(list); - } - }; - - private static final UpdateStateTask updateState = new UpdateStateTask(); - - private static class UpdateStateTask extends RestartableTask { - private volatile boolean reallocate; - - public UpdateStateTask() { - super("NEI Subset Item Allocation"); - } - - @Override - public void clearTasks() { - super.clearTasks(); - reallocate = false; - } - - public synchronized void reallocate() { - reallocate = true; - restart(); - } - - @Override - public void execute() { - HashMap state = new HashMap(); - List tags = new LinkedList(); - synchronized (root) { - cloneStates(root, tags, state); - if (interrupted()) { - return; - } - } - - if (reallocate) { - for (ItemStack item : ItemList.items) { - if (interrupted()) { - return; - } - if (ItemInfo.isHidden(item)) { - continue; - } - for (SubsetTag tag : tags) { - if (tag.filter.matches(item)) { - state.get(tag.fullname).items.add(item); - } - } - } - } - - synchronized (root) { - calculateVisibility(root, state); - if (interrupted()) { - return; - } - } - - subsetState = state; - ItemList.updateFilter.restart(); - } - - private void cloneStates(SubsetTag tag, List tags, HashMap state) { - for (SubsetTag child : tag.sorted) { - if (interrupted()) { - return; - } - cloneStates(child, tags, state); - } - - tags.add(tag); - SubsetState sstate = new SubsetState(); - if (!reallocate) { - sstate.items = SubsetWidget.getState(tag).items; - } - state.put(tag.fullname, sstate); - } - - private void calculateVisibility(SubsetTag tag, Map state) { - SubsetState sstate = state.get(tag.fullname); - int hidden = 0; - for (SubsetTag child : tag.sorted) { - if (interrupted()) { - return; - } - calculateVisibility(child, state); - int cstate = state.get(child.fullname).state; - if (cstate == 1) { - sstate.state = 1; - } else if (cstate == 0) { - hidden++; - } - } - - if (sstate.state == 1) { - return; - } - - List items = sstate.items; - for (ItemStack item : items) { - if (interrupted()) { - return; - } - if (isHidden(item)) { - hidden++; - } - } - - if (hidden == tag.sorted.size() + items.size()) { - sstate.state = 0; - } else if (hidden > 0) { - sstate.state = 1; - } - } - } - - private long lastclicktime; - - public SubsetWidget() { - super("NEI Subsets"); - API.addItemFilter(this); - API.addSearchProvider(this); - ItemList.loadCallbacks.add(this); - } - - @Override - public void draw(int mx, int my) { - super.draw(mx, my); - - area.set(x, y + h, w, LayoutManager.searchField.y - h - y); //23 for the search box - - hoverStack = null; - if (root.isVisible()) { - root.resize(area.x, 0, area.y); - root.cacheState(); - root.draw(mx, my); - } - } - - @Override - public void update() { - Point mouse = GuiDraw.getMousePosition(); - updateVisiblity(mouse.x, mouse.y); - saveHidden(); - } - - private void updateVisiblity(int mx, int my) { - if (!root.isVisible() || root.isScrolling()) { - return; - } - - root.updateVisiblity(mx, my); - - if (!root.isVisible() && bounds().contains(mx, my)) { - root.setVisible(); - } - } - - @Override - public boolean contains(int px, int py) { - return super.contains(px, py) || root.isVisible() && root.contains(px, py); - } - - @Override - public boolean handleClick(int mx, int my, int button) { - if (root.isVisible() && root.contains(mx, my)) { - root.mouseClicked(mx, my, button); - return true; - } - - if (button == 0) { - if (System.currentTimeMillis() - lastclicktime < 500) { - unhideAll(); - } else { - root.setVisible(); - } - - NEIClientUtils.playClickSound(); - lastclicktime = System.currentTimeMillis(); - } - - return true; - } - - /** - * Not called - */ - @Override - public boolean onButtonPress(boolean rightclick) { - return false; - } - - @Override - public void mouseDragged(int mx, int my, int button, long heldTime) { - if (root.isVisible()) { - root.mouseDragged(mx, my, button, heldTime); - } - } - - @Override - public void mouseUp(int mx, int my, int button) { - if (root.isVisible()) { - root.mouseUp(mx, my, button); - } - } - - @Override - public boolean onMouseWheel(int i, int mx, int my) { - return root.isVisible() && root.mouseScrolled(mx, my, -i); - } - - @Override - public void onGuiClick(int mx, int my) { - if (!contains(mx, my)) { - root.setHidden(); - } - } - - @Override - public ItemStack getStackMouseOver(int mx, int my) { - return hoverStack; - } - - @Override - public IItemFilter getFilter() { - return new IItemFilter()//synchronise access on hiddenItems - { - @Override - public boolean matches(ItemStack item) { - synchronized (hiddenItems) { - return !hiddenItems.matches(item); - } - } - }; - } - - @Override - public boolean isPrimary() { - return true; - } - - @Override - public IItemFilter getFilter(String searchText) { - if (!searchText.startsWith("@")) { - return null; - } - - searchText = searchText.substring(1); - AnyMultiItemFilter filter = new AnyMultiItemFilter(); - SubsetTag tag = getTag(searchText); - if (tag != null) { - tag.addFilters(filter.filters); - } else { - Pattern p = SearchField.getPattern(searchText); - if (p == null) { - return null; - } - - List matching = new LinkedList(); - root.search(matching, p); - if (matching.isEmpty()) { - return null; - } - for (SubsetTag tag2 : matching) { - tag2.addFilters(filter.filters); - } - } - return filter; - } - - @Override - public void itemsLoaded() { - updateState.reallocate(); - } -} diff --git a/dependencies/main/java/codechicken/nei/TextField.java b/dependencies/main/java/codechicken/nei/TextField.java deleted file mode 100644 index d035317006..0000000000 --- a/dependencies/main/java/codechicken/nei/TextField.java +++ /dev/null @@ -1,159 +0,0 @@ -package codechicken.nei; - -import codechicken.nei.widget.Widget; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.util.ChatAllowedCharacters; -import org.lwjgl.input.Keyboard; - -import static codechicken.lib.gui.GuiDraw.*; - -public abstract class TextField extends Widget { - public TextField(String ident) { - identifier = ident; - } - - private String text = ""; - public boolean centered; - public long backdowntime; - public int backs; - public String identifier; - public int cursorCounter; - - public int getTextColour() { - return focused() ? 0xFFE0E0E0 : 0xFF909090; - } - - public void drawBox() { - drawRect(x, y, w, h, 0xffA0A0A0); - drawRect(x + 1, y + 1, w - 2, h - 2, 0xFF000000); - } - - @Override - public void draw(int mousex, int mousey) { - drawBox(); - - String drawtext = text; - - int textWidth; - while ((textWidth = getStringWidth(drawtext)) > w - 14) { - drawtext = drawtext.substring(1); - } - - if (focused() && (cursorCounter / 6) % 2 == 0) { - drawtext = drawtext + '_'; - } - - int textx = centered ? x + (w - textWidth) / 2 : x + 4; - int texty = y + (h + 1) / 2 - 3; - - drawString(drawtext, textx, texty, getTextColour()); - } - - @Override - public void onGuiClick(int mousex, int mousey) { - if (!contains(mousex, mousey)) { - setFocus(false); - } - } - - @Override - public boolean handleClick(int mousex, int mousey, int button) { - if (button == 1) { - setText(""); - } - setFocus(true); - return true; - } - - @Override - public boolean handleKeyPress(int keyID, char keyChar) { - if (!focused()) { - return false; - } - - if (keyID == Keyboard.KEY_BACK) { - if (text.length() > 0) { - setText(text.substring(0, text.length() - 1)); - backdowntime = System.currentTimeMillis(); - } - } else if (keyID == Keyboard.KEY_RETURN || keyID == Keyboard.KEY_ESCAPE) { - setFocus(false); - onExit(); - } else if (keyChar == 22)//paste - { - String pastestring = GuiScreen.getClipboardString(); - if (pastestring == null) { - pastestring = ""; - } - - if (isValid(text + pastestring)) { - setText(text + pastestring); - } - } else if (isValid(text + keyChar)) { - setText(text + keyChar); - } - - return true; - } - - public void onExit() { - } - - public abstract void onTextChange(String oldText); - - public boolean isValid(String string) { - // Solve the problem that Minecraft can't post Chinese characters - return ChatAllowedCharacters.isAllowedCharacter(string.charAt(string.length() - 1)); - } - - @Override - public void update() { - cursorCounter++; - if (backdowntime > 0) { - if (Keyboard.isKeyDown(Keyboard.KEY_BACK) && text.length() > 0) { - if (System.currentTimeMillis() - backdowntime > 200 / (1 + backs * 0.3F)) { - setText(text.substring(0, text.length() - 1)); - backdowntime = System.currentTimeMillis(); - backs++; - } - } else { - backdowntime = 0; - backs = 0; - } - } - } - - public void setText(String s) { - String oldText = text; - text = filterText(s); - onTextChange(oldText); - } - - public void setText(String s, boolean updateJEI) { - if (updateJEI) { - setText(s); - } else { - text = filterText(s); - } - } - - public String filterText(String s) { - return s; - } - - public void setFocus(boolean focus) { - if (focus) { - LayoutManager.setInputFocused(this); - } else if (focused()) { - LayoutManager.setInputFocused(null); - } - } - - public boolean focused() { - return LayoutManager.getInputFocused() == this; - } - - public String text() { - return text; - } -} diff --git a/dependencies/main/java/codechicken/nei/VisibilityData.java b/dependencies/main/java/codechicken/nei/VisibilityData.java deleted file mode 100644 index 43da0020e6..0000000000 --- a/dependencies/main/java/codechicken/nei/VisibilityData.java +++ /dev/null @@ -1,44 +0,0 @@ -package codechicken.nei; - -public class VisibilityData { - public boolean showUtilityButtons = true; - public boolean showStateButtons = true; - /** - * Item panel and associated buttons - */ - public boolean showItemPanel = true; - /** - * Item and search section - */ - @Deprecated - public boolean showItemSection = true; - /** - * Dropdown and Item search field - */ - public boolean showSearchSection = true; - /** - * All widgets except options button - */ - public boolean showWidgets = true; - /** - * The entire NEI interface, aka hidden - */ - public boolean showNEI = true; - public boolean enableDeleteMode = true; - - public void translateDependancies() { - if (!showNEI) { - showWidgets = false; - } - if (!showWidgets) { - showSearchSection = showItemPanel = showUtilityButtons = showStateButtons = false; - } -// JEIIntegrationManager.pushChanges(this); - - //if (!showItemSection){ - // showSearchSection = showItemPanel = false; - //} else { - // showSearchSection = showItemPanel = true; - //} - } -} diff --git a/dependencies/main/java/codechicken/nei/WidgetZOrder.java b/dependencies/main/java/codechicken/nei/WidgetZOrder.java deleted file mode 100644 index 3631a6724b..0000000000 --- a/dependencies/main/java/codechicken/nei/WidgetZOrder.java +++ /dev/null @@ -1,17 +0,0 @@ -package codechicken.nei; - -import codechicken.nei.widget.Widget; - -import java.util.Comparator; - -public class WidgetZOrder implements Comparator { - boolean topFirst; - - public WidgetZOrder(boolean topFirst) { - this.topFirst = topFirst; - } - - public int compare(Widget w1, Widget w2) { - return w1.z != w2.z ? ((topFirst ? w1.z > w2.z : w1.z < w2.z) ? 1 : -1) : 1; - } -} diff --git a/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java b/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java deleted file mode 100644 index 2def5ce147..0000000000 --- a/dependencies/main/java/codechicken/nei/WorldOverlayRenderer.java +++ /dev/null @@ -1,233 +0,0 @@ -package codechicken.nei; - -import codechicken.lib.math.MathHelper; -import codechicken.lib.render.RenderUtils; -import codechicken.lib.render.state.GlStateManagerHelper; -import codechicken.lib.vec.Cuboid6; -import codechicken.nei.KeyManager.IKeyStateTracker; -import codechicken.nei.config.KeyBindings; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving.SpawnPlacementType; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.EnumSkyBlock; -import net.minecraft.world.World; -import net.minecraft.world.WorldEntitySpawner; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.chunk.Chunk; - -import static org.lwjgl.opengl.GL11.*; - -public class WorldOverlayRenderer implements IKeyStateTracker { - public static int mobOverlay = 0; - public static int chunkOverlay = 0; - - public static void reset() { - mobOverlay = 0; - chunkOverlay = 0; - } - - @Override - public void tickKeyStates() { - if (Minecraft.getMinecraft().currentScreen != null) { - return; - } - - if (KeyBindings.get("nei.options.keys.world.moboverlay").isPressed()) { - mobOverlay = (mobOverlay + 1) % 2; - } - if (KeyBindings.get("nei.options.keys.world.chunkoverlay").isPressed()) { - chunkOverlay = (chunkOverlay + 1) % 3; - } - } - - public static void render(float frame) { - GlStateManager.pushMatrix(); - GlStateManagerHelper.pushState(); - Entity entity = Minecraft.getMinecraft().getRenderViewEntity(); - RenderUtils.translateToWorldCoords(entity, frame); - - renderChunkBounds(entity); - renderMobSpawnOverlay(entity); - GlStateManagerHelper.popState(); - GlStateManager.popMatrix(); - } - - //TODO Improve the performance of this. - private static void renderMobSpawnOverlay(Entity entity) { - if (mobOverlay == 0) { - return; - } - - GlStateManager.disableTexture2D(); - GlStateManager.disableLighting(); - glLineWidth(1.5F); - glBegin(GL_LINES); - - GlStateManager.color(1, 0, 0); - - World world = entity.worldObj; - int x1 = (int) entity.posX; - int z1 = (int) entity.posZ; - int y1 = (int) MathHelper.clip(entity.posY, 16, world.getHeight() - 16); - - for (int x = x1 - 16; x <= x1 + 16; x++) { - for (int z = z1 - 16; z <= z1 + 16; z++) { - BlockPos pos = new BlockPos(x, y1, z); - Chunk chunk = world.getChunkFromBlockCoords(pos); - Biome biome = world.getBiome(pos); - if (biome.getSpawnableList(EnumCreatureType.MONSTER).isEmpty() || biome.getSpawningChance() <= 0) { - continue; - } - - for (int y = y1 - 16; y < y1 + 16; y++) { - int spawnMode = getSpawnMode(chunk, x, y, z); - if (spawnMode == 0) { - continue; - } - - if (spawnMode == 1) { - GlStateManager.color(1, 1, 0); - } else { - GlStateManager.color(1, 0, 0); - } - - glVertex3d(x, y + 0.004, z); - glVertex3d(x + 1, y + 0.004, z + 1); - glVertex3d(x + 1, y + 0.004, z); - glVertex3d(x, y + 0.004, z + 1); - } - } - } - - glEnd(); - GlStateManager.enableLighting(); - GlStateManager.enableTexture2D(); - } - - //private static Entity dummyEntity = new EntityPig(null); - private static Cuboid6 c = new Cuboid6(); - - private static int getSpawnMode(Chunk chunk, int x, int y, int z) { - World world = chunk.getWorld(); - BlockPos pos = new BlockPos(x, y, z); - if (!WorldEntitySpawner.canCreatureTypeSpawnAtLocation(SpawnPlacementType.ON_GROUND, world, pos) || chunk.getLightFor(EnumSkyBlock.BLOCK, pos) >= 8) { - return 0; - } - - c.set(x + 0.2, y + 0.01, z + 0.2, x + 0.8, y + 1.8, z + 0.8); - AxisAlignedBB aabb = c.aabb(); - if (!world.checkNoEntityCollision(aabb) || !world.getEntitiesWithinAABBExcludingEntity(null, aabb).isEmpty() || world.containsAnyLiquid(aabb)) { - return 0; - } - - if (chunk.getLightFor(EnumSkyBlock.SKY, pos) >= 8) { - return 1; - } - return 2; - } - - private static void renderChunkBounds(Entity entity) { - if (chunkOverlay == 0) { - return; - } - - GlStateManager.disableTexture2D(); - GlStateManager.enableBlend(); - GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.disableLighting(); - glLineWidth(1.5F); - glBegin(GL_LINES); - - for (int cx = -4; cx <= 4; cx++) { - for (int cz = -4; cz <= 4; cz++) { - double x1 = (entity.chunkCoordX + cx) << 4; - double z1 = (entity.chunkCoordZ + cz) << 4; - double x2 = x1 + 16; - double z2 = z1 + 16; - - double dy = 128; - double y1 = Math.floor(entity.posY - dy / 2); - double y2 = y1 + dy; - if (y1 < 0) { - y1 = 0; - y2 = dy; - } - - if (y1 > entity.worldObj.getHeight()) { - y2 = entity.worldObj.getHeight(); - y1 = y2 - dy; - } - - double dist = Math.pow(1.5, -(cx * cx + cz * cz)); - - GlStateManager.color(0.9F, 0, 0, (float) dist); - if (cx >= 0 && cz >= 0) { - glVertex3d(x2, y1, z2); - glVertex3d(x2, y2, z2); - } - if (cx >= 0 && cz <= 0) { - glVertex3d(x2, y1, z1); - glVertex3d(x2, y2, z1); - } - if (cx <= 0 && cz >= 0) { - glVertex3d(x1, y1, z2); - glVertex3d(x1, y2, z2); - } - if (cx <= 0 && cz <= 0) { - glVertex3d(x1, y1, z1); - glVertex3d(x1, y2, z1); - } - - if (chunkOverlay == 2 && cx == 0 && cz == 0) { - dy = 32; - y1 = Math.floor(entity.posY - dy / 2); - y2 = y1 + dy; - if (y1 < 0) { - y1 = 0; - y2 = dy; - } - - if (y1 > entity.worldObj.getHeight()) { - y2 = entity.worldObj.getHeight(); - y1 = y2 - dy; - } - - GlStateManager.color(0, 0.9F, 0, 0.4F); - for (double y = (int) y1; y <= y2; y++) { - glVertex3d(x2, y, z1); - glVertex3d(x2, y, z2); - glVertex3d(x1, y, z1); - glVertex3d(x1, y, z2); - glVertex3d(x1, y, z2); - glVertex3d(x2, y, z2); - glVertex3d(x1, y, z1); - glVertex3d(x2, y, z1); - } - for (double h = 1; h <= 15; h++) { - glVertex3d(x1 + h, y1, z1); - glVertex3d(x1 + h, y2, z1); - glVertex3d(x1 + h, y1, z2); - glVertex3d(x1 + h, y2, z2); - glVertex3d(x1, y1, z1 + h); - glVertex3d(x1, y2, z1 + h); - glVertex3d(x2, y1, z1 + h); - glVertex3d(x2, y2, z1 + h); - } - } - } - } - - glEnd(); - GlStateManager.enableLighting(); - GlStateManager.disableBlend(); - GlStateManager.enableTexture2D(); - } - - public static void load() { - KeyManager.trackers.add(new WorldOverlayRenderer()); - } -} diff --git a/dependencies/main/java/codechicken/nei/api/API.java b/dependencies/main/java/codechicken/nei/api/API.java deleted file mode 100644 index 3f13601f0d..0000000000 --- a/dependencies/main/java/codechicken/nei/api/API.java +++ /dev/null @@ -1,295 +0,0 @@ -package codechicken.nei.api; - -import codechicken.lib.item.filtering.IItemFilter; -import codechicken.lib.item.filtering.IItemFilterProvider; -import codechicken.nei.*; -import codechicken.nei.SearchField.ISearchProvider; -import codechicken.nei.SubsetWidget.SubsetTag; -import codechicken.nei.api.layout.LayoutStyle; -import codechicken.nei.config.KeyBindings; -import codechicken.nei.config.Option; -import codechicken.nei.recipe.*; -import net.minecraft.block.Block; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.settings.KeyBinding; -import net.minecraft.inventory.Slot; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.client.settings.IKeyConflictContext; -import net.minecraftforge.client.settings.KeyModifier; -import net.minecraftforge.fml.client.registry.ClientRegistry; -import org.lwjgl.input.Keyboard; - -import java.util.Collections; -import java.util.Comparator; - -/** - * This is the main class that handles item property configuration. - * WARNING: DO NOT access this class until the world has been loaded - * These methods should be called from INEIConfig implementors - */ -public class API { - /** - * Register a new Crafting Recipe handler; - * - * @param handler The handler to register - */ - public static void registerRecipeHandler(ICraftingHandler handler) { - GuiCraftingRecipe.registerRecipeHandler(handler); - } - - /** - * Register a new Usage Recipe handler; - * - * @param handler The handler to register - */ - public static void registerUsageHandler(IUsageHandler handler) { - GuiUsageRecipe.registerUsageHandler(handler); - } - - /** - * Add a gui to the default overlay renderer with the default position - * - * @param classz The class of your gui - * @param ident The identification string, currently - * {crafting, crafting2x2, smelting, fuel, brewing} - */ - public static void registerGuiOverlay(Class classz, String ident) { - registerGuiOverlay(classz, ident, 5, 11); - } - - /** - * Add a gui to the default overlay renderer with an offset - * - * @param classz The class of your gui - * @param ident The identification string, currently - * {crafting, crafting2x2, smelting, fuel, brewing} - * @param x x-offset - * @param y y-offset - */ - public static void registerGuiOverlay(Class classz, String ident, int x, int y) { - registerGuiOverlay(classz, ident, new OffsetPositioner(x, y)); - } - - /** - * Add a gui to the default overlay renderer - * - * @param classz The class of your gui - * @param ident The identification string, currently - * {crafting, crafting2x2, smelting, fuel, brewing} - * @param positioner A Stack Repositioner for moving the items to the right place - */ - public static void registerGuiOverlay(Class classz, String ident, IStackPositioner positioner) { - RecipeInfo.registerGuiOverlay(classz, ident, positioner); - } - - /** - * @param classz The class of your gui - * @param handler The handler to register - * @param ident The recipe identification string - */ - public static void registerGuiOverlayHandler(Class classz, IOverlayHandler handler, String ident) { - RecipeInfo.registerOverlayHandler(classz, handler, ident); - } - - /** - * Set the offset to be added to items to translate them into recipe coords on the actual gui, default is 5, 11. Primarily RecipeTransferRects - * - * @param classz The class of your gui - * @param x - * @param y - */ - public static void setGuiOffset(Class classz, int x, int y) { - RecipeInfo.setGuiOffset(classz, x, y); - } - - public static void registerNEIGuiHandler(INEIGuiHandler handler) { - GuiInfo.guiHandlers.add(handler); - } - - /** - * Hide an item from the item panel - * Damage values of OreDictionary.WILDCARD_VALUE and ItemStackMap.WILDCARD_TAG tags function as wildcards for their respective variables - */ - public static void hideItem(ItemStack item) { - ItemInfo.hiddenItems.add(item); - } - - /** - * Add or replace the name normally shown on the item tooltip - */ - public static void setOverrideName(ItemStack item, String name) { - ItemInfo.nameOverrides.put(item, name); - } - - /** - * Adds an item to the item panel. Any items added using this function will override the default search pattern. - * - * @param item an item with data - */ - public static void addItemListEntry(ItemStack item) { - ItemInfo.itemOverrides.put(item.getItem(), item); - } - - /** - * Sets the item variants to appear in the item panel, overriding the default search pattern for a given item - */ - public static void setItemListEntries(Item item, Iterable items) { - if (items == null) { - items = Collections.emptyList(); - } - ItemInfo.itemOverrides.replaceValues(item, items); - } - - /** - * Add a custom KeyBinding to be configured in the Controls menu. - * - * @param ident An identifier for your key, eg "shoot" - * @param defaultKey The default value, commonly obtained from {@link Keyboard} - * @deprecated use {@link ClientRegistry#registerKeyBinding(KeyBinding)} - */ - @Deprecated - public static void addKeyBind(String ident, int defaultKey) { - KeyBindings.setDefaultKeyBinding(ident, defaultKey); - } - - public static void addOption(Option option) { - NEIClientConfig.getOptionList().addOption(option); - } - - /** - * Add a new Layout Style for the NEI interface - * - * @param styleID The Unique ID to be used for storing your style in the config and cycling through avaliable styles - * @param style The style to add. - */ - public static void addLayoutStyle(int styleID, LayoutStyle style) { - LayoutManager.layoutStyles.put(styleID, style); - } - - /** - * Registers a new Infinite Item Handler. - * - * @param handler The handler to be registered. - */ - public static void addInfiniteItemHandler(IInfiniteItemHandler handler) { - ItemInfo.infiniteHandlers.addFirst(handler); - } - - /** - * Registers a new Infinite Item Handler. - * - * @param block The block to handle, null for all. - * @param handler The handler to be registered. - */ - @Deprecated - public static void registerHighlightIdentifier(Block block, IHighlightHandler handler) { - ItemInfo.highlightIdentifiers.put(block, handler); - } - - /** - * Tells NEI not to perform any Fast Transfer operations on slots of a particular class - * - * @param slotClass The class of slot to be exempted - */ - public static void addFastTransferExemptSlot(Class slotClass) { - ItemInfo.fastTransferExemptions.add(slotClass); - } - - /** - * Tells NEI not to perform any Fast Transfer operations on a GuiContainer of a specific class. - * - * @param guiClass The class of the container to be exempted - */ - public static void addFastTransferExemptContainer(Class guiClass) { - ItemInfo.fastTransferContainerExemptions.add(guiClass); - } - - /** - * Register a new text handler for the block highlight tooltip with a layout specification (HEADER, BODY or FOOTER). - * - * @param handler The handler to be registered. - * @param layout A HUDAugmenterRegistry.Layout entry. HEADER is displayed before BODY which is displayed before FOOTER. - */ - @Deprecated - public static void registerHighlightHandler(IHighlightHandler handler, ItemInfo.Layout... layout) { - ItemInfo.registerHighlightHandler(handler, layout); - } - - /** - * Register a mode handler for overriding NEI recipe/utility/cheat mode settings. - * - * @param handler The handler to be registered. - */ - public static void registerModeHandler(INEIModeHandler handler) { - NEIInfo.modeHandlers.add(handler); - } - - /** - * Register a filter provider for the item panel. - * - * @param filterProvider The filter provider to be registered. - */ - public static void addItemFilter(IItemFilterProvider filterProvider) { - synchronized (ItemList.itemFilterers) { - ItemList.itemFilterers.add(filterProvider); - } - } - - /** - * Adds a new tag to the item subset dropdown. - * - * @param name The fully qualified name, Eg Blocks.MobSpawners. NOT case sensitive - * @param filter A filter for matching items that fit in this subset - */ - public static void addSubset(String name, IItemFilter filter) { - addSubset(new SubsetTag(name, filter)); - } - - /** - * Adds a new tag to the item subset dropdown. - * - * @param name The fully qualified name, Eg Blocks.MobSpawners. NOT case sensitive - * @param items An iterable of itemstacks to be added as a subset - */ - public static void addSubset(String name, Iterable items) { - ItemStackSet filter = new ItemStackSet(); - for (ItemStack item : items) { - filter.add(item); - } - addSubset(new SubsetTag(name, filter)); - } - - /** - * Adds a new tag to the item subset dropdown. - */ - public static void addSubset(SubsetTag tag) { - SubsetWidget.addTag(tag); - } - - /** - * Adds a new search provider to the search field - */ - public static void addSearchProvider(ISearchProvider provider) { - SearchField.searchProviders.add(provider); - } - - /** - * Adds a new sorting option to the item panel sort menu - * - * @param name A unique id for this sort option. Will be used in the config for saving and translated in the options gui. Note that if the translation key name.tip exists, it will be used for a tooltip - */ - public static void addSortOption(String name, Comparator comparator) { - ItemSorter.add(name, comparator); - } - - /** - * Adds an additional item list entry for an item, sorted after the rest of the items are found through the normal process - * - * @param item The item to add the variant for - * @param variant The stack to appear in the item panel - */ - public static void addItemVariant(Item item, ItemStack variant) { - ItemInfo.itemVariants.put(item, variant); - } -} diff --git a/dependencies/main/java/codechicken/nei/api/DefaultOverlayRenderer.java b/dependencies/main/java/codechicken/nei/api/DefaultOverlayRenderer.java deleted file mode 100644 index fb37cad9c8..0000000000 --- a/dependencies/main/java/codechicken/nei/api/DefaultOverlayRenderer.java +++ /dev/null @@ -1,41 +0,0 @@ -package codechicken.nei.api; - -import codechicken.nei.api.stack.PositionedStack; -import codechicken.nei.guihook.GuiContainerManager; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.inventory.Slot; -import org.lwjgl.opengl.GL11; - -import java.util.ArrayList; -import java.util.List; - -public class DefaultOverlayRenderer implements IRecipeOverlayRenderer { - IStackPositioner positioner; - ArrayList ingreds; - - public DefaultOverlayRenderer(List ai, IStackPositioner positioner) { - positioner = this.positioner = positioner; - ingreds = new ArrayList(); - for (PositionedStack stack : ai) { - ingreds.add(stack.copy()); - } - ingreds = positioner.positionStacks(ingreds); - } - - @Override - public void renderOverlay(GuiContainerManager gui, Slot slot) { - GlStateManager.enableBlend(); - GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); - - GuiContainerManager.setItemRenderColour(0xA0A0A0B0); - for (PositionedStack stack : ingreds) { - if (stack.relx == slot.xDisplayPosition && stack.rely == slot.yDisplayPosition) { - GuiContainerManager.drawItem(stack.relx, stack.rely, stack.item); - } - } - GuiContainerManager.setItemRenderColour(-1); - - GlStateManager.disableBlend(); - GlStateManager.enableLighting(); - } -} diff --git a/dependencies/main/java/codechicken/nei/api/GuiInfo.java b/dependencies/main/java/codechicken/nei/api/GuiInfo.java deleted file mode 100644 index b0b5ca1f8f..0000000000 --- a/dependencies/main/java/codechicken/nei/api/GuiInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -package codechicken.nei.api; - -import codechicken.nei.NEIChestGuiHandler; -import codechicken.nei.NEICreativeGuiHandler; -import codechicken.nei.NEIDummySlotHandler; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.gui.inventory.GuiContainerCreative; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; - -public class GuiInfo { - public static LinkedList guiHandlers = new LinkedList(); - public static HashSet> customSlotGuis = new HashSet>(); - - public static void load() { - API.registerNEIGuiHandler(new NEICreativeGuiHandler()); - API.registerNEIGuiHandler(new NEIChestGuiHandler()); - API.registerNEIGuiHandler(new NEIDummySlotHandler()); - customSlotGuis.add(GuiContainerCreative.class); - } - - public static void clearGuiHandlers() { - for (Iterator iterator = guiHandlers.iterator(); iterator.hasNext(); ) { - if (iterator.next() instanceof GuiContainer) { - iterator.remove(); - } - } - } - - public static boolean hasCustomSlots(GuiContainer gui) { - return customSlotGuis.contains(gui.getClass()); - } -} diff --git a/dependencies/main/java/codechicken/nei/api/IConfigureNEI.java b/dependencies/main/java/codechicken/nei/api/IConfigureNEI.java deleted file mode 100644 index 604ba82eab..0000000000 --- a/dependencies/main/java/codechicken/nei/api/IConfigureNEI.java +++ /dev/null @@ -1,13 +0,0 @@ -package codechicken.nei.api; - -/** - * An nei configuration entry point should implement this class and have name "NEIConfig" - * loadConfig will only be called when NEI is installed. - */ -public interface IConfigureNEI { - void loadConfig(); - - String getName(); - - String getVersion(); -} diff --git a/dependencies/main/java/codechicken/nei/api/IGuiContainerOverlay.java b/dependencies/main/java/codechicken/nei/api/IGuiContainerOverlay.java deleted file mode 100644 index 6d5a5a6efc..0000000000 --- a/dependencies/main/java/codechicken/nei/api/IGuiContainerOverlay.java +++ /dev/null @@ -1,7 +0,0 @@ -package codechicken.nei.api; - -import net.minecraft.client.gui.inventory.GuiContainer; - -public interface IGuiContainerOverlay { - GuiContainer getFirstScreen(); -} diff --git a/dependencies/main/java/codechicken/nei/api/IHighlightHandler.java b/dependencies/main/java/codechicken/nei/api/IHighlightHandler.java deleted file mode 100644 index d47476e5b2..0000000000 --- a/dependencies/main/java/codechicken/nei/api/IHighlightHandler.java +++ /dev/null @@ -1,15 +0,0 @@ -package codechicken.nei.api; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.world.World; - -import java.util.List; - -@Deprecated -public interface IHighlightHandler { - ItemStack identifyHighlight(World world, EntityPlayer player, RayTraceResult rayTraceResult); - - List handleTextData(ItemStack itemStack, World world, EntityPlayer player, RayTraceResult rayTraceResult, List currentTip, ItemInfo.Layout layout); -} diff --git a/dependencies/main/java/codechicken/nei/api/IInfiniteItemHandler.java b/dependencies/main/java/codechicken/nei/api/IInfiniteItemHandler.java deleted file mode 100644 index a130a25afa..0000000000 --- a/dependencies/main/java/codechicken/nei/api/IInfiniteItemHandler.java +++ /dev/null @@ -1,18 +0,0 @@ -package codechicken.nei.api; - -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.item.ItemStack; - -public interface IInfiniteItemHandler { - void onPickup(ItemStack heldItem); - - void onPlaceInfinite(ItemStack heldItem); - - boolean canHandleItem(ItemStack stack); - - boolean isItemInfinite(ItemStack stack); - - void replenishInfiniteStack(InventoryPlayer inventory, int slotNo); - - ItemStack getInfiniteItem(ItemStack typeStack); -} diff --git a/dependencies/main/java/codechicken/nei/api/INEIGuiAdapter.java b/dependencies/main/java/codechicken/nei/api/INEIGuiAdapter.java deleted file mode 100644 index 2bf4aed79b..0000000000 --- a/dependencies/main/java/codechicken/nei/api/INEIGuiAdapter.java +++ /dev/null @@ -1,38 +0,0 @@ -package codechicken.nei.api; - -import codechicken.nei.VisibilityData; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.item.ItemStack; - -import java.util.Collections; -import java.util.List; - -/** - * Lets you just override those things you want to - */ -public class INEIGuiAdapter implements INEIGuiHandler { - @Override - public VisibilityData modifyVisiblity(GuiContainer gui, VisibilityData currentVisibility) { - return currentVisibility; - } - - @Override - public Iterable getItemSpawnSlots(GuiContainer gui, ItemStack item) { - return Collections.emptyList(); - } - - @Override - public List getInventoryAreas(GuiContainer gui) { - return null; - } - - @Override - public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button) { - return false; - } - - @Override - public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) { - return false; - } -} diff --git a/dependencies/main/java/codechicken/nei/api/INEIGuiHandler.java b/dependencies/main/java/codechicken/nei/api/INEIGuiHandler.java deleted file mode 100644 index ac8af74aa9..0000000000 --- a/dependencies/main/java/codechicken/nei/api/INEIGuiHandler.java +++ /dev/null @@ -1,50 +0,0 @@ -package codechicken.nei.api; - -import codechicken.nei.VisibilityData; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.item.ItemStack; - -import java.util.List; - -/** - * If this is implemented on a gui, it will be automatically registered - */ -public interface INEIGuiHandler { - VisibilityData modifyVisiblity(GuiContainer gui, VisibilityData currentVisibility); - - /** - * NEI will give the specified item to the InventoryRange returned if the player's inventory is full. - * Should not return null, just an empty list - */ - Iterable getItemSpawnSlots(GuiContainer gui, ItemStack item); - - /** - * @return A list of TaggedInventoryAreas that will be used with the savestates. - */ - List getInventoryAreas(GuiContainer gui); - - /** - * Handles clicks while an itemstack has been dragged from the item panel. Use this to set configurable slots and the like. - * Changes made to the stackSize of the dragged stack will be kept - * - * @param gui The current gui instance - * @param mousex The x position of the mouse - * @param mousey The y position of the mouse - * @param draggedStack The stack being dragged from the item panel - * @param button The button presed - * @return True if the drag n drop was handled. False to resume processing through other routes. The held stack will be deleted if draggedStack.stackSize == 0 - */ - boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button); - - /** - * Used to prevent the item panel from drawing on top of other gui elements. - * This function will also be called with a 1x1 size rectangle on the mouse position for determining if the given coordinate should override item panel functions such as scrolling - * - * @param x The x coordinate of the rectangle bounding the slot - * @param y The y coordinate of the rectangle bounding the slot - * @param w The w coordinate of the rectangle bounding the slot - * @param h The h coordinate of the rectangle bounding the slot - * @return true if the item panel slot within the specified rectangle should not be rendered. - */ - boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h); -} diff --git a/dependencies/main/java/codechicken/nei/api/INEIModeHandler.java b/dependencies/main/java/codechicken/nei/api/INEIModeHandler.java deleted file mode 100644 index 80355dba14..0000000000 --- a/dependencies/main/java/codechicken/nei/api/INEIModeHandler.java +++ /dev/null @@ -1,5 +0,0 @@ -package codechicken.nei.api; - -public interface INEIModeHandler { - boolean isModeValid(int mode); -} diff --git a/dependencies/main/java/codechicken/nei/api/IOverlayHandler.java b/dependencies/main/java/codechicken/nei/api/IOverlayHandler.java deleted file mode 100644 index 6bceaef4d3..0000000000 --- a/dependencies/main/java/codechicken/nei/api/IOverlayHandler.java +++ /dev/null @@ -1,8 +0,0 @@ -package codechicken.nei.api; - -import codechicken.nei.recipe.IRecipeHandler; -import net.minecraft.client.gui.inventory.GuiContainer; - -public interface IOverlayHandler { - void overlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex, boolean shift); -} diff --git a/dependencies/main/java/codechicken/nei/api/IRecipeOverlayRenderer.java b/dependencies/main/java/codechicken/nei/api/IRecipeOverlayRenderer.java deleted file mode 100644 index 431942c02f..0000000000 --- a/dependencies/main/java/codechicken/nei/api/IRecipeOverlayRenderer.java +++ /dev/null @@ -1,8 +0,0 @@ -package codechicken.nei.api; - -import codechicken.nei.guihook.GuiContainerManager; -import net.minecraft.inventory.Slot; - -public interface IRecipeOverlayRenderer { - void renderOverlay(GuiContainerManager gui, Slot slot); -} diff --git a/dependencies/main/java/codechicken/nei/api/IStackPositioner.java b/dependencies/main/java/codechicken/nei/api/IStackPositioner.java deleted file mode 100644 index bb42cce39c..0000000000 --- a/dependencies/main/java/codechicken/nei/api/IStackPositioner.java +++ /dev/null @@ -1,12 +0,0 @@ -package codechicken.nei.api; - -import codechicken.nei.api.stack.PositionedStack; - -import java.util.ArrayList; - -/** - * For repositioning recipes in overlay renderers. - */ -public interface IStackPositioner { - ArrayList positionStacks(ArrayList ai); -} diff --git a/dependencies/main/java/codechicken/nei/api/ItemInfo.java b/dependencies/main/java/codechicken/nei/api/ItemInfo.java deleted file mode 100644 index 0c455af309..0000000000 --- a/dependencies/main/java/codechicken/nei/api/ItemInfo.java +++ /dev/null @@ -1,544 +0,0 @@ -package codechicken.nei.api; - -import codechicken.lib.item.filtering.IItemFilter; -import codechicken.lib.item.filtering.IItemFilterProvider; -import codechicken.nei.*; -import codechicken.nei.ItemList.ItemsLoadedCallback; -import codechicken.nei.config.ItemPanelDumper; -import codechicken.nei.config.dumps.FluidRegistryDumper; -import codechicken.nei.config.dumps.ForgeRegistryDumper; -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.recipe.BrewingRecipeHandler; -import codechicken.nei.recipe.RecipeItemInputHandler; -import codechicken.nei.recipe.potion.PotionRecipeHelper; -import codechicken.nei.thirdparty.colossalchests.ColossalChestsConfig; -import codechicken.nei.util.LogHelper; -import com.google.common.collect.ArrayListMultimap; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.resources.I18n; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityList; -import net.minecraft.entity.EntityList.EntityEggInfo; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.inventory.EntityEquipmentSlot; -import net.minecraft.inventory.Slot; -import net.minecraft.item.*; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionHelper; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.SoundEvent; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.World; -import net.minecraft.world.biome.Biome; -import net.minecraftforge.common.BiomeDictionary; -import net.minecraftforge.common.IShearable; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.common.registry.ForgeRegistries; -import net.minecraftforge.fml.common.registry.IForgeRegistry; - -import java.util.*; -import java.util.Map.Entry; - -/** - * This is an internal class for storing information about items, to be accessed by the API - */ -public class ItemInfo { - public enum Layout { - HEADER, - BODY, - FOOTER - } - - @Deprecated - public static final ArrayListMultimap highlightHandlers = ArrayListMultimap.create(); - public static final ItemStackMap nameOverrides = new ItemStackMap(); - public static final ItemStackSet hiddenItems = new ItemStackSet(); - public static final ItemStackSet finiteItems = new ItemStackSet(); - public static final ArrayListMultimap itemOverrides = ArrayListMultimap.create(); - public static final ArrayListMultimap itemVariants = ArrayListMultimap.create(); - - public static final LinkedList infiniteHandlers = new LinkedList(); - @Deprecated - public static final ArrayListMultimap highlightIdentifiers = ArrayListMultimap.create(); - public static final HashSet> fastTransferExemptions = new HashSet>(); - public static final HashSet> fastTransferContainerExemptions = new HashSet>(); - - public static final HashMap itemOwners = new HashMap(); - - //lookup optimisation - public static final HashMap itemSearchNames = new HashMap(); - - public static boolean isHidden(ItemStack stack) { - return hiddenItems.contains(stack); - } - - public static boolean isHidden(Item item) { - return hiddenItems.containsAll(item); - } - - public static String getNameOverride(ItemStack stack) { - return nameOverrides.get(stack); - } - - public static boolean canBeInfinite(ItemStack stack) { - return !finiteItems.contains(stack); - } - - /** - * @deprecated Use field directly - */ - @Deprecated - public static List getItemOverrides(Item item) { - return itemOverrides.get(item); - } - - public static void preInit() { - ItemMobSpawner.register(); - } - - public static void init() { - ItemMobSpawner.initRender(); - } - - public static void load(World world) { - ColossalChestsConfig.init(); - PotionRecipeHelper.init(); - addVanillaBlockProperties(); - addDefaultDropDowns(); - searchItems(); - parseModItems(); - ItemMobSpawner.loadSpawners(world); - addSpawnEggs(); - addInfiniteHandlers(); - addInputHandlers(); - addIDDumps(); - addHiddenItemFilter(); - addSearchOptimisation(); - } - - private static void addVanillaBlockProperties() { - API.hideItem(new ItemStack(Blocks.FARMLAND)); - API.hideItem(new ItemStack(Blocks.LIT_FURNACE)); - } - - private static void addSearchOptimisation() { - ItemList.loadCallbacks.add(new ItemsLoadedCallback() { - @Override - public void itemsLoaded() { - itemSearchNames.clear(); - } - }); - } - - private static void addHiddenItemFilter() { - API.addItemFilter(new IItemFilterProvider() { - @Override - public IItemFilter getFilter() { - return new IItemFilter() { - @Override - public boolean matches(ItemStack item) { - return !hiddenItems.contains(item); - } - }; - } - }); - } - - private static void addIDDumps() { - API.addOption(new ForgeRegistryDumper("tools.dump.item") { - @Override - public IForgeRegistry registry() { - return ForgeRegistries.ITEMS; - } - - @Override - public String[] dump(Item obj, ResourceLocation registryName) { - int id = Item.getIdFromItem(obj); - boolean hasBlock = Block.getBlockFromItem(obj) != null && Block.getBlockFromItem(obj) != Blocks.AIR; - return new String[] { registryName.toString(), Integer.toString(id), Boolean.toString(hasBlock), obj.getClass().getCanonicalName() }; - } - - @Override - public String[] header() { - return new String[] { "Registry Name", "ID", "Has Block", "Class" }; - } - }); - API.addOption(new ForgeRegistryDumper("tools.dump.block") { - @Override - public IForgeRegistry registry() { - return ForgeRegistries.BLOCKS; - } - - @Override - public String[] dump(Block obj, ResourceLocation registryName) { - int id = Block.getIdFromBlock(obj); - boolean hasBlock = Item.getItemFromBlock(obj) != null; //&& Block.getBlockFromItem(obj) != Blocks.AIR; - return new String[] { registryName.toString(), Integer.toString(id), Boolean.toString(hasBlock), obj.getClass().getCanonicalName() }; - } - - @Override - public String[] header() { - return new String[] { "Registry Name", "ID", "Has Item", "Class" }; - } - }); - API.addOption(new FluidRegistryDumper()); - API.addOption(new ForgeRegistryDumper("tools.dump.potion") { - @Override - public IForgeRegistry registry() { - return ForgeRegistries.POTIONS; - } - - @Override - public String[] dump(Potion obj, ResourceLocation registryName) { - int id = Potion.getIdFromPotion(obj); - return new String[] { registryName.toString(), Integer.toString(id), Boolean.toString(obj.isBadEffect()), Boolean.toString(obj.isBeneficial()), obj.getClass().getCanonicalName() }; - } - - @Override - public String[] header() { - return new String[] { "Registry Name", "ID", "Is bad Effect", "Is beneficial", "Class" }; - } - }); - API.addOption(new ForgeRegistryDumper("tools.dump.biome") { - @Override - public IForgeRegistry registry() { - return ForgeRegistries.BIOMES; - } - - @Override - public String[] dump(Biome obj, ResourceLocation registryName) { - int id = Biome.getIdForBiome(obj); - - BiomeDictionary.Type[] types = BiomeDictionary.getTypesForBiome(obj); - StringBuilder s_types = new StringBuilder(); - for (BiomeDictionary.Type t : types) { - if (s_types.length() > 0) { - s_types.append(", "); - } - s_types.append(t.name()); - } - return new String[] { registryName.toString(), Integer.toString(id), obj.getBiomeName(), Float.toString(obj.getFloatTemperature(BlockPos.ORIGIN)), Float.toString(obj.getRainfall()), Float.toString(obj.getSpawningChance()), Float.toString(obj.getBaseHeight()), Float.toString(obj.getHeightVariation()), s_types.toString(), obj.getClass().getCanonicalName() }; - } - - @Override - public String[] header() { - return new String[] { "Registry Name", "ID", "Name", "Temperature", "Rainfall", "Spawn Chance", "Root Height", "Height Variation", "Types", "Class" }; - } - }); - API.addOption(new ForgeRegistryDumper("tools.dump.sound_event") { - @Override - public IForgeRegistry registry() { - return ForgeRegistries.SOUND_EVENTS; - } - - @Override - public String[] dump(SoundEvent obj, ResourceLocation registryName) { - int id = SoundEvent.REGISTRY.getIDForObject(obj); - return new String[] { registryName.toString(), Integer.toString(id), obj.getClass().getCanonicalName() }; - } - - @Override - public String[] header() { - return new String[] { "Registry Name", "ID", "Class" }; - } - }); - API.addOption(new ForgeRegistryDumper("tools.dump.enchantment") { - @Override - public IForgeRegistry registry() { - return null; - } - - @Override - public String[] dump(Enchantment obj, ResourceLocation registryName) { - int id = Enchantment.getEnchantmentID(obj); - StringBuilder s_slots = new StringBuilder(); - for (EntityEquipmentSlot slot : obj.applicableEquipmentTypes) { - if (s_slots.length() > 0) { - s_slots.append(", "); - } - s_slots.append(slot.getName()); - } - return new String[] { registryName.toString(), Integer.toString(id), obj.getName(), obj.type.toString(), Integer.toString(obj.getMinLevel()), Integer.toString(obj.getMinLevel()), obj.getRarity().name(), s_slots.toString(), obj.getClass().getCanonicalName() }; - } - - @Override - public String[] header() { - return new String[] { "Registry Name", "ID", "Name", "Type", "Min Level", "Max Level", "Rarity", "Slots", "Class" }; - } - }); - API.addOption(new ItemPanelDumper("tools.dump.itempanel")); - } - - private static void parseModItems() { - HashMap modSubsets = new HashMap(); - for (Item item : Item.REGISTRY) { - ResourceLocation ident = Item.REGISTRY.getNameForObject(item); - if (ident == null) { - LogHelper.error("Failed to find identifier for: " + item); - continue; - } - String modId = ident.getResourceDomain(); - itemOwners.put(item, modId); - ItemStackSet itemset = modSubsets.get(modId); - if (itemset == null) { - modSubsets.put(modId, itemset = new ItemStackSet()); - } - itemset.with(item); - } - - API.addSubset("Mod.Minecraft", modSubsets.remove("minecraft")); - for (Entry entry : modSubsets.entrySet()) { - ModContainer mc = FMLCommonHandler.instance().findContainerFor(entry.getKey()); - if (mc == null) { - LogHelper.error("Missing container for " + entry.getKey()); - } else { - API.addSubset("Mod." + mc.getName(), entry.getValue()); - } - } - } - - private static void addInputHandlers() { - GuiContainerManager.addInputHandler(new RecipeItemInputHandler()); - GuiContainerManager.addInputHandler(new PopupInputHandler()); - } - - private static void addInfiniteHandlers() { - API.addInfiniteItemHandler(new InfiniteStackSizeHandler()); - API.addInfiniteItemHandler(new InfiniteToolHandler()); - } - - private static void addDefaultDropDowns() { - API.addSubset("Items", new IItemFilter() { - @Override - public boolean matches(ItemStack item) { - return Block.getBlockFromItem(item.getItem()) == Blocks.AIR; - } - }); - API.addSubset("Blocks", new IItemFilter() { - @Override - public boolean matches(ItemStack item) { - return Block.getBlockFromItem(item.getItem()) != Blocks.AIR; - } - }); - API.addSubset("Blocks.MobSpawners", ItemStackSet.of(Blocks.MOB_SPAWNER)); - } - - private static void searchItems() { - ItemStackSet tools = new ItemStackSet(); - ItemStackSet picks = new ItemStackSet(); - ItemStackSet shovels = new ItemStackSet(); - ItemStackSet axes = new ItemStackSet(); - ItemStackSet hoes = new ItemStackSet(); - ItemStackSet swords = new ItemStackSet(); - ItemStackSet chest = new ItemStackSet(); - ItemStackSet helmets = new ItemStackSet(); - ItemStackSet legs = new ItemStackSet(); - ItemStackSet boots = new ItemStackSet(); - ItemStackSet other = new ItemStackSet(); - ItemStackSet ranged = new ItemStackSet(); - ItemStackSet food = new ItemStackSet(); - ItemStackSet potioningredients = new ItemStackSet(); - - ArrayList creativeTabRanges = new ArrayList(CreativeTabs.CREATIVE_TAB_ARRAY.length); - List stackList = new LinkedList(); - - for (Item item : Item.REGISTRY) { - if (item == null) { - continue; - } - - for (CreativeTabs itemTab : item.getCreativeTabs()) { - if (itemTab != null) { - while (itemTab.getTabIndex() >= creativeTabRanges.size()) { - creativeTabRanges.add(null); - } - ItemStackSet set = creativeTabRanges.get(itemTab.getTabIndex()); - if (set == null) { - creativeTabRanges.set(itemTab.getTabIndex(), set = new ItemStackSet()); - } - stackList.clear(); - item.getSubItems(item, itemTab, stackList); - for (ItemStack stack : stackList) { - set.add(stack); - } - } - } - - //TODO EntityEquipmentSlot - if (item.isDamageable()) { - tools.with(item); - if (item instanceof ItemPickaxe) { - picks.with(item); - } else if (item instanceof ItemSpade) { - shovels.with(item); - } else if (item instanceof ItemAxe) { - axes.with(item); - } else if (item instanceof ItemHoe) { - hoes.with(item); - } else if (item instanceof ItemSword) { - swords.with(item); - } else if (item instanceof ItemArmor) { - switch (((ItemArmor) item).armorType) { - case HEAD: - helmets.with(item); - break; - case CHEST: - chest.with(item); - break; - case LEGS: - legs.with(item); - break; - case FEET: - boots.with(item); - break; - } - } else if (item == Items.ARROW || item == Items.BOW) { - ranged.with(item); - } else if (item == Items.FISHING_ROD || item == Items.FLINT_AND_STEEL || item == Items.SHEARS) { - other.with(item); - } - } - - if (item instanceof ItemFood) { - food.with(item); - } - - try { - LinkedList subItems = new LinkedList(); - item.getSubItems(item, null, subItems); - for (ItemStack stack : subItems) { - if (PotionHelper.isReagent(stack)) { - BrewingRecipeHandler.ingredients.add(stack); - potioningredients.add(stack); - } - } - - } catch (Exception e) { - LogHelper.errorError("Error loading brewing ingredients for: " + item, e); - } - } - API.addSubset("Items.Tools.Pickaxes", picks); - API.addSubset("Items.Tools.Shovels", shovels); - API.addSubset("Items.Tools.Axes", axes); - API.addSubset("Items.Tools.Hoes", hoes); - API.addSubset("Items.Tools.Other", other); - API.addSubset("Items.Weapons.Swords", swords); - API.addSubset("Items.Weapons.Ranged", ranged); - API.addSubset("Items.Armor.ChestPlates", chest); - API.addSubset("Items.Armor.Leggings", legs); - API.addSubset("Items.Armor.Helmets", helmets); - API.addSubset("Items.Armor.Boots", boots); - API.addSubset("Items.Food", food); - API.addSubset("Items.Potions.Ingredients", potioningredients); - - for (CreativeTabs tab : CreativeTabs.CREATIVE_TAB_ARRAY) { - if (tab.getTabIndex() >= creativeTabRanges.size()) { - continue; - } - ItemStackSet set = creativeTabRanges.get(tab.getTabIndex()); - if (set != null && !set.isEmpty()) { - API.addSubset("CreativeTabs." + I18n.format(tab.getTranslatedTabLabel()), set); - } - } - - BrewingRecipeHandler.searchPotions(); - } - - //TODO - private static void addSpawnEggs() { - //addEntityEgg(EntitySnowman.class, 0xEEFFFF, 0xffa221); - //addEntityEgg(EntityIronGolem.class, 0xC5C2C1, 0xffe1cc); - } - - private static void addEntityEgg(Class entity, int i, int j) { - String id = EntityList.getEntityStringFromClass(entity); - EntityList.ENTITY_EGGS.put(id, new EntityEggInfo(id, i, j)); - } - - @Deprecated - public static ArrayList getIdentifierItems(World world, EntityPlayer player, RayTraceResult hit) { - BlockPos pos = hit.getBlockPos(); - IBlockState state = world.getBlockState(pos); - Block block = state.getBlock(); - - ArrayList items = new ArrayList(); - - ArrayList handlers = new ArrayList(); - if (highlightIdentifiers.containsKey(null)) { - handlers.addAll(highlightIdentifiers.get(null)); - } - if (highlightIdentifiers.containsKey(block)) { - handlers.addAll(highlightIdentifiers.get(block)); - } - for (IHighlightHandler ident : handlers) { - ItemStack item = ident.identifyHighlight(world, player, hit); - if (item != null) { - items.add(item); - } - } - - if (items.size() > 0) { - return items; - } - - ItemStack pick = block.getPickBlock(state, hit, world, pos, player); - if (pick != null) { - items.add(pick); - } - - try { - items.addAll(block.getDrops(world, pos, state, 0)); - } catch (Exception ignored) { - } - if (block instanceof IShearable) { - IShearable shearable = (IShearable) block; - if (shearable.isShearable(new ItemStack(Items.SHEARS), world, pos)) { - items.addAll(shearable.onSheared(new ItemStack(Items.SHEARS), world, pos, 0)); - } - } - - if (items.size() == 0) { - items.add(0, new ItemStack(block, 1, block.getMetaFromState(state))); - } - - return items; - } - - @Deprecated - public static void registerHighlightHandler(IHighlightHandler handler, ItemInfo.Layout... layouts) { - for (ItemInfo.Layout layout : layouts) { - ItemInfo.highlightHandlers.get(layout).add(handler); - } - } - - @Deprecated - public static List getText(ItemStack itemStack, World world, EntityPlayer player, RayTraceResult rayTraceResult) { - List retString = new ArrayList(); - - for (ItemInfo.Layout layout : ItemInfo.Layout.values()) { - for (IHighlightHandler handler : ItemInfo.highlightHandlers.get(layout)) { - retString = handler.handleTextData(itemStack, world, player, rayTraceResult, retString, layout); - } - } - - return retString; - } - - public static String getSearchName(ItemStack stack) { - String s = itemSearchNames.get(stack); - if (s == null) { - s = TextFormatting.getTextWithoutFormattingCodes(GuiContainerManager.concatenatedDisplayName(stack, true).toLowerCase()); - itemSearchNames.put(stack, s); - } - return s; - } -} diff --git a/dependencies/main/java/codechicken/nei/api/NEIInfo.java b/dependencies/main/java/codechicken/nei/api/NEIInfo.java deleted file mode 100644 index a1c3ee44de..0000000000 --- a/dependencies/main/java/codechicken/nei/api/NEIInfo.java +++ /dev/null @@ -1,30 +0,0 @@ -package codechicken.nei.api; - -import codechicken.nei.NEIClientConfig; -import codechicken.nei.config.OptionCycled; -import net.minecraft.world.World; - -import java.util.LinkedList; - -public class NEIInfo { - public static final LinkedList modeHandlers = new LinkedList(); - - public static void load(World world) { - OptionCycled modeOption = (OptionCycled) NEIClientConfig.getOptionList().getOption("inventory.cheatmode"); - modeOption.parent.synthesizeEnvironment(false); - if (!modeOption.optionValid(modeOption.value())) { - modeOption.copyGlobals(); - modeOption.cycle(); - } - } - - public static boolean isValidMode(int mode) { - for (INEIModeHandler handler : modeHandlers) { - if (!handler.isModeValid(mode)) { - return false; - } - } - - return true; - } -} diff --git a/dependencies/main/java/codechicken/nei/api/TaggedInventoryArea.java b/dependencies/main/java/codechicken/nei/api/TaggedInventoryArea.java deleted file mode 100644 index 326950c688..0000000000 --- a/dependencies/main/java/codechicken/nei/api/TaggedInventoryArea.java +++ /dev/null @@ -1,45 +0,0 @@ -package codechicken.nei.api; - -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -import java.util.HashSet; - -public class TaggedInventoryArea { - public HashSet slots = new HashSet(); - public String tagName; - /** - * Only for player inventories. - */ - private IInventory inventory; - /** - * Other inventories - */ - private Container container; - - public TaggedInventoryArea(InventoryPlayer invPlayer) { - this("InventoryPlayer", 0, 39, null); - inventory = invPlayer; - } - - public TaggedInventoryArea(String name, int first, int last, Container container) { - this.container = container; - tagName = name; - for (int i = first; i <= last; i++) { - slots.add(i); - } - } - - public ItemStack getStackInSlot(int i) { - if (inventory != null) { - return inventory.getStackInSlot(i); - } - return container.getSlot(i).getStack(); - } - - public boolean isContainer() { - return inventory == null; - } -} diff --git a/dependencies/main/java/codechicken/nei/api/layout/LayoutStyle.java b/dependencies/main/java/codechicken/nei/api/layout/LayoutStyle.java deleted file mode 100644 index 18581935da..0000000000 --- a/dependencies/main/java/codechicken/nei/api/layout/LayoutStyle.java +++ /dev/null @@ -1,23 +0,0 @@ -package codechicken.nei.api.layout; - -import codechicken.nei.VisibilityData; -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.widget.Button; -import net.minecraft.client.gui.inventory.GuiContainer; - -public abstract class LayoutStyle { - public abstract void init(); - - public abstract void reset(); - - public abstract void layout(GuiContainer gui, VisibilityData visibility); - - public abstract String getName(); - - public void drawBackground(GuiContainerManager gui) { - } - - public abstract void drawButton(Button button, int mouseX, int mouseY); - - public abstract void drawSubsetTag(String text, int x, int y, int w, int h, int state, boolean mouseover); -} diff --git a/dependencies/main/java/codechicken/nei/api/stack/PositionedStack.java b/dependencies/main/java/codechicken/nei/api/stack/PositionedStack.java deleted file mode 100644 index 8680dc393b..0000000000 --- a/dependencies/main/java/codechicken/nei/api/stack/PositionedStack.java +++ /dev/null @@ -1,119 +0,0 @@ -package codechicken.nei.api.stack; - -import codechicken.nei.ItemList; -import codechicken.nei.util.NEIServerUtils; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.ArrayList; -import java.util.List; - -/** - * Simply an {@link ItemStack} with position. - * Mainly used in the recipe handlers. - */ -public class PositionedStack { - public int relx; - public int rely; - public ItemStack items[]; - //compatibility dummy - public ItemStack item; - - private boolean permutated = false; - - public PositionedStack(Object object, int x, int y, boolean genPerms) { - items = NEIServerUtils.extractRecipeItems(object); - relx = x; - rely = y; - - if (genPerms) { - generatePermutations(); - } else { - setPermutationToRender(0); - } - } - - public PositionedStack(Object object, int x, int y) { - this(object, x, y, true); - } - - public void generatePermutations() { - if (permutated) { - return; - } - - ArrayList stacks = new ArrayList(); - for (ItemStack item : items) { - if (item == null || item.getItem() == null) { - continue; - } - - if (item.getItemDamage() == Short.MAX_VALUE) { - List permutations = ItemList.itemMap.get(item.getItem()); - if (!permutations.isEmpty()) { - for (ItemStack stack : permutations) { - stacks.add(stack.copy()); - } - } else { - ItemStack base = new ItemStack(item.getItem(), item.stackSize); - base.setTagCompound(item.getTagCompound()); - stacks.add(base); - } - continue; - } - - stacks.add(item.copy()); - } - items = stacks.toArray(new ItemStack[0]); - - if (items.length == 0) { - items = new ItemStack[] { new ItemStack(Blocks.FIRE) }; - } - - permutated = true; - setPermutationToRender(0); - } - - public void setMaxSize(int i) { - for (ItemStack item : items) { - if (item.stackSize > i) { - item.stackSize = i; - } - } - } - - public PositionedStack copy() { - return new PositionedStack(items, relx, rely); - } - - public void setPermutationToRender(int index) { - item = items[index].copy(); - if (item.getItem() == null) { - item = new ItemStack(Blocks.FIRE); - } else if (item.getItemDamage() == OreDictionary.WILDCARD_VALUE) { - item.setItemDamage(0); - } - } - - public boolean contains(ItemStack ingredient) { - for (ItemStack item : items) { - if (NEIServerUtils.areStacksSameTypeCrafting(item, ingredient)) { - return true; - } - } - - return false; - } - - public boolean contains(Item ingred) { - for (ItemStack item : items) { - if (item.getItem() == ingred) { - return true; - } - } - - return false; - } -} diff --git a/dependencies/main/java/codechicken/nei/asm/NEICorePlugin.java b/dependencies/main/java/codechicken/nei/asm/NEICorePlugin.java deleted file mode 100644 index 9836e07171..0000000000 --- a/dependencies/main/java/codechicken/nei/asm/NEICorePlugin.java +++ /dev/null @@ -1,66 +0,0 @@ -package codechicken.nei.asm; - -import net.minecraftforge.fml.common.FMLLog; -import net.minecraftforge.fml.relauncher.IFMLCallHook; -import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; -import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions; -import org.apache.logging.log4j.Level; - -import java.io.File; -import java.util.Map; - -@TransformerExclusions({ "codechicken.nei.asm" }) -public class NEICorePlugin implements IFMLLoadingPlugin, IFMLCallHook { - public static File location; - public static boolean missingCCL = false; - - public NEICorePlugin() { - cclCheck(); - } - - @Override - public String[] getASMTransformerClass() { - if (missingCCL) { - FMLLog.log("NotEnoughItems", Level.FATAL, "Missing CCL! not registering class transformer."); - return new String[0]; - } - return new String[] { "codechicken.nei.asm.NEITransformer" }; - } - - @Override - public String getModContainerClass() { - return "codechicken.nei.NEIModContainer"; - } - - @Override - public String getSetupClass() { - return "codechicken.nei.asm.NEICorePlugin"; - } - - @Override - public void injectData(Map data) { - location = (File) data.get("coremodLocation"); - if (location == null) { - location = new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath()); - } - } - - @Override - public String getAccessTransformerClass() { - return null; - } - - @Override - public Void call() { - return null; - } - private static void cclCheck() { - try { - Class.forName("codechicken.lib.asm.ASMHelper", false, NEICorePlugin.class.getClassLoader()); - missingCCL = false; - } catch (ClassNotFoundException cNFE) { - cNFE.printStackTrace(); - missingCCL = true; - } - } -} diff --git a/dependencies/main/java/codechicken/nei/asm/NEITransformer.java b/dependencies/main/java/codechicken/nei/asm/NEITransformer.java deleted file mode 100644 index de5e593c28..0000000000 --- a/dependencies/main/java/codechicken/nei/asm/NEITransformer.java +++ /dev/null @@ -1,226 +0,0 @@ -package codechicken.nei.asm; - -import codechicken.lib.asm.*; -import codechicken.lib.asm.ModularASMTransformer.*; -import net.minecraft.launchwrapper.IClassTransformer; -import net.minecraftforge.fml.relauncher.FMLLaunchHandler; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.*; - -import java.util.Map; - -import static codechicken.lib.asm.InsnComparator.*; -import static org.objectweb.asm.ClassWriter.COMPUTE_FRAMES; -import static org.objectweb.asm.ClassWriter.COMPUTE_MAXS; -import static org.objectweb.asm.Opcodes.*; - -public class NEITransformer implements IClassTransformer { - private ModularASMTransformer transformer = new ModularASMTransformer(); - private Map asmblocks = ASMReader.loadResource("/assets/nei/asm/blocks.asm"); - - public NEITransformer() { - if (FMLLaunchHandler.side().isClient()) { - //Generates method to set the placed position of a mob spawner for the item callback. More portable than copying vanilla placement code - //transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping("net/minecraft/block/BlockMobSpawner", "func_180633_a", "(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/entity/EntityLivingBase;Lnet/minecraft/item/ItemStack;)V"), asmblocks.get("spawnerPlaced"))); - transformer.add(new MethodInjector(new ObfMapping("net/minecraft/client/gui/inventory/GuiContainerCreative", "func_147053_i", "()V"), asmblocks.get("i_creativeTabSearch"), true)); - } - - //Removes trailing seperators from NBTTagList/Compound.toString because OCD - //TODO - //transformer.add(new MethodInjector(new ObfMapping("net/minecraft/nbt/NBTTagCompound", "toString", "()Ljava/lang/String;"), asmblocks.get("n_commaFix"), asmblocks.get("commaFix"), true)); - //transformer.add(new MethodInjector(new ObfMapping("net/minecraft/nbt/NBTTagList", "toString", "()Ljava/lang/String;"), asmblocks.get("n_commaFix"), asmblocks.get("commaFix"), true)); - - //fix workbench container losing items on shift click output without room for the full stack - transformer.add(new MethodTransformer(new ObfMapping("net/minecraft/inventory/ContainerWorkbench", "func_82846_b", "(Lnet/minecraft/entity/player/EntityPlayer;I)Lnet/minecraft/item/ItemStack;")) { - @Override - public void transform(MethodNode mv) { - ASMHelper.logger.debug("NEI: Applying workbench fix"); - InsnListSection key = findN(mv.instructions, asmblocks.get("n_workbenchFix").list).get(0); - key.insertBefore(asmblocks.get("workbenchFix").rawListCopy()); - } - }); - - String guiContainer = "net/minecraft/client/gui/inventory/GuiContainer"; - //add manager field - transformer.add(new FieldWriter(ACC_PUBLIC, new ObfMapping(guiContainer, "manager", "Lcodechicken/nei/guihook/GuiContainerManager;"))); - - //Fill out getManager in GuiContainerManager - transformer.add(new MethodWriter(ACC_PUBLIC | ACC_STATIC, new ObfMapping("codechicken/nei/guihook/GuiContainerManager", "getManager", "(Lnet/minecraft/client/gui/inventory/GuiContainer;)Lcodechicken/nei/guihook/GuiContainerManager;"), asmblocks.get("m_getManager"))); - - //Generate load method - transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(guiContainer, "func_146280_a", "(Lnet/minecraft/client/Minecraft;II)V"), asmblocks.get("m_setWorldAndResolution"))); - - //Generate handleKeyboardInput method - transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(guiContainer, "func_146282_l", "()V"), asmblocks.get("m_handleKeyboardInput"))); - - //Generate handleKeyboardInput method - transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(guiContainer, "func_146282_l", "()V"), asmblocks.get("m_handleKeyboardInput"))); - - //Generate handleKeyboardInput method - transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(guiContainer, "func_146282_l", "()V"), asmblocks.get("m_handleKeyboardInput"))); - - //Generate handleMouseInput method - transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(guiContainer, "func_146274_d", "()V"), asmblocks.get("m_handleMouseInput"))); - - addProtectedForwarder(new ObfMapping(guiContainer, "func_73869_a", "(CI)V"), new ObfMapping("codechicken/nei/guihook/GuiContainerManager", "callKeyTyped", "(Lnet/minecraft/client/gui/inventory/GuiContainer;CI)V")); - - addProtectedForwarder(new ObfMapping(guiContainer, "func_184098_a", "(Lnet/minecraft/inventory/Slot;IILnet/minecraft/inventory/ClickType;)V"), new ObfMapping("codechicken/nei/guihook/DefaultSlotClickHandler", "callHandleMouseClick", "(Lnet/minecraft/client/gui/inventory/GuiContainer;Lnet/minecraft/inventory/Slot;IILnet/minecraft/inventory/ClickType;)V")); - - //Inject preDraw at the start of drawScreen - transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_73863_a", "(IIF)V"), asmblocks.get("preDraw"), true)); - - //Inject objectUnderMouse check before drawing slot highlights - transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_73863_a", "(IIF)V"), asmblocks.get("n_objectUnderMouse"), asmblocks.get("objectUnderMouse"), false)); - - //Inject renderObjects after drawGuiContainerForegroundLayer - transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_73863_a", "(IIF)V"), asmblocks.get("n_renderObjects"), asmblocks.get("renderObjects"), false)); - - //Replace default renderToolTip with delegate - ASMBlock d_renderToolTip = Boolean.parseBoolean(System.getProperty("nei.altRenderToolTipNeedle", "false")) ? asmblocks.get("d_renderToolTipIntellijEclipseCompilerFix") : asmblocks.get("d_renderToolTip"); - transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_73863_a", "(IIF)V"), d_renderToolTip, asmblocks.get("renderTooltips"))); - - //Replace zLevel = 200 with zLevel = 500 in drawItemStack - transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_146982_a", "(Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V"), asmblocks.get("d_zLevel"), asmblocks.get("zLevel"))); - - //Replace default renderItem with delegate and slot overlay/underlay - transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_146977_a", "(Lnet/minecraft/inventory/Slot;)V"), asmblocks.get("d_drawSlot"), asmblocks.get("drawSlot"))); - - //Inject mouseClicked hook at the start of mouseClicked - transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_73864_a", "(III)V"), asmblocks.get("mouseClicked"), true)); - - //Replace general handleMouseClicked call with delegate - transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_73864_a", "(III)V"), asmblocks.get("d_handleMouseClick"), asmblocks.get("handleMouseClick")));//mouseClicked - transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_146273_a", "(IIIJ)V"), asmblocks.get("d_handleMouseClick"), asmblocks.get("handleMouseClick")));//mouseClickMove - transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_146286_b", "(III)V"), asmblocks.get("d_handleMouseClick"), asmblocks.get("handleMouseClick")));//mouseReleased - transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_73869_a", "(CI)V"), asmblocks.get("d_handleMouseClick"), asmblocks.get("handleMouseClick")));//keyTyped - transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_146983_a", "(I)Z"), asmblocks.get("d_handleMouseClick"), asmblocks.get("handleMouseClick")));//checkHotbarKeys - - //Write delegate for handleMouseClicked - transformer.add(new MethodWriter(ACC_PUBLIC, new ObfMapping(guiContainer, "managerHandleMouseClick", "(Lnet/minecraft/inventory/Slot;IILnet/minecraft/inventory/ClickType;)V"), asmblocks.get("m_managerHandleMouseClick"))); - - //Inject mouseDragged hook after super call in mouseDragged - transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_146273_a", "(IIIJ)V"), asmblocks.get("n_mouseDragged"), asmblocks.get("mouseDragged"), false)); - - //Inject overrideMouseUp at the start of mouseReleased - transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_146286_b", "(III)V"), asmblocks.get("overrideMouseUp"), true)); - - //Inject mouseUp at the end of main elseif chain in mouseReleased - transformer.add(new MethodTransformer(new ObfMapping(guiContainer, "func_146286_b", "(III)V")) { - @Override - public void transform(MethodNode mv) { - ASMHelper.logger.debug("NEI: Injecting mouseUp call"); - ASMBlock gotoBlock = asmblocks.get("n_mouseUpGoto"); - ASMBlock needleBlock = asmblocks.get("n_mouseUp"); - ASMBlock injectionBlock = asmblocks.get("mouseUp"); - - gotoBlock.mergeLabels(injectionBlock); - findOnce(mv.instructions, gotoBlock.list).replace(gotoBlock.list.list); - - InsnListSection needle = findOnce(mv.instructions, needleBlock.list); - injectionBlock.mergeLabels(needleBlock.applyLabels(needle)); - needle.insertBefore(injectionBlock.list.list); - } - }); - - //Replace general handleMouseClick call with delegate - transformer.add(new MethodReplacer(new ObfMapping(guiContainer, "func_184098_a", "(Lnet/minecraft/inventory/Slot;IILnet/minecraft/inventory/ClickType;)V"), asmblocks.get("d_handleSlotClick"), asmblocks.get("handleSlotClick"))); - - //Inject lastKeyTyped at the start of keyTyped - transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_73869_a", "(CI)V"), asmblocks.get("lastKeyTyped"), true)); - - //Inject updateScreen hook after super call - transformer.add(new MethodInjector(new ObfMapping(guiContainer, "func_73876_c", "()V"), asmblocks.get("n_updateScreen"), asmblocks.get("updateScreen"), false)); - - //Cancel tab click calls when tabs are obscured - transformer.add(new MethodInjector(new ObfMapping("net/minecraft/client/gui/inventory/GuiContainerCreative", "func_147049_a", "(Lnet/minecraft/creativetab/CreativeTabs;II)Z"), asmblocks.get("handleTabClick"), true)); - - //Cancel tab tooltip rendering when tabs are obscured - transformer.add(new MethodInjector(new ObfMapping("net/minecraft/client/gui/inventory/GuiContainerCreative", "func_147052_b", "(Lnet/minecraft/creativetab/CreativeTabs;II)Z"), asmblocks.get("renderTabTooltip"), true)); - - String[] buttons = new String[] { "CancelButton", "ConfirmButton", "PowerButton" }; - String[] this_fields = new String[] { "field_146146_o", "field_146147_o", "field_146150_o" }; - for (int i = 0; i < 3; i++) { - ObfMapping m = new ObfMapping("net/minecraft/client/gui/inventory/GuiBeacon$" + buttons[i], "func_146111_b", "(II)V"); - InsnListSection l = asmblocks.get("beaconButtonObscured").list.copy(); - FieldInsnNode this_ref = ((FieldInsnNode) l.get(1)); - this_ref.owner = m.toClassloading().s_owner; - if (ObfMapping.obfuscated) //missing srg mappings for inner outer reference fields - { - this_ref.name = ObfMapping.obfMapper.mapFieldName(null, this_fields[i], null); - } - transformer.add(new MethodInjector(m, l.list, true)); - } - } - - private void addProtectedForwarder(ObfMapping called, ObfMapping caller) { - - InsnList forward1 = new InsnList(); - InsnList forward2 = new InsnList(); - - ObfMapping publicCall = new ObfMapping(called.s_owner, "public_" + called.s_name, called.s_desc); - Type[] args = Type.getArgumentTypes(caller.s_desc); - for (int i = 0; i < args.length; i++) { - forward1.add(new VarInsnNode(args[i].getOpcode(ILOAD), i)); - forward2.add(new VarInsnNode(args[i].getOpcode(ILOAD), i)); - } - - forward1.add(publicCall.toInsn(INVOKEVIRTUAL)); - forward2.add(called.toClassloading().toInsn(INVOKEVIRTUAL)); - forward1.add(new InsnNode(Type.getReturnType(called.s_desc).getOpcode(IRETURN))); - forward2.add(new InsnNode(Type.getReturnType(called.s_desc).getOpcode(IRETURN))); - - transformer.add(new MethodWriter(ACC_PUBLIC | ACC_STATIC, caller, forward1)); - transformer.add(new MethodWriter(ACC_PUBLIC, publicCall, forward2)); - } - - private ObfMapping c_GuiContainer = new ObfMapping("net/minecraft/client/gui/inventory/GuiContainer").toClassloading(); - - /** - * Adds super.updateScreen() to non implementing GuiContainer subclasses - */ - public byte[] transformSubclasses(String name, byte[] bytes) { - if (ClassHeirachyManager.classExtends(name, c_GuiContainer.javaClass())) { - ClassNode cnode = ASMHelper.createClassNode(bytes); - - ObfMapping methodmap = new ObfMapping(cnode.superName, "func_73876_c", "()V").toClassloading(); - - InsnListSection supercall = new InsnListSection(); - supercall.add(new VarInsnNode(ALOAD, 0)); - supercall.add(methodmap.toInsn(INVOKESPECIAL)); - - boolean changed = false; - for (MethodNode mv : cnode.methods) { - if (methodmap.matches(mv)) { - if (matches(new InsnListSection(mv.instructions), supercall, getControlFlowLabels(mv.instructions)) == null) { - mv.instructions.insert(supercall.list); - ASMHelper.logger.debug("Inserted super call into " + methodmap); - changed = true; - } - } - } - - if (changed) { - bytes = ASMHelper.createBytes(cnode, COMPUTE_MAXS | COMPUTE_FRAMES); - } - } - return bytes; - } - - @Override - public byte[] transform(String name, String tname, byte[] bytes) { - if (bytes == null) { - return null; - } - try { - if (FMLLaunchHandler.side().isClient()) { - bytes = transformSubclasses(name, bytes); - } - - bytes = transformer.transform(name, bytes); - } catch (Exception e) { - throw new RuntimeException(e); - } - - return bytes; - } -} diff --git a/dependencies/main/java/codechicken/nei/config/ArrayDumper.java b/dependencies/main/java/codechicken/nei/config/ArrayDumper.java deleted file mode 100644 index 0388d1da17..0000000000 --- a/dependencies/main/java/codechicken/nei/config/ArrayDumper.java +++ /dev/null @@ -1,32 +0,0 @@ -package codechicken.nei.config; - -import java.util.LinkedList; - -public abstract class ArrayDumper extends DataDumper { - public ArrayDumper(String name) { - super(name); - } - - @Override - public Iterable dump(int mode) { - LinkedList list = new LinkedList(); - T[] array = array(); - for (int i = 0; i < array.length; i++) { - T obj = array[i]; - if (obj == null) { - if (mode == 1 || mode == 2) { - list.add(new String[] { Integer.toString(i), null, null, null, null }); - } - } else { - if (mode == 0 || mode == 2) { - list.add(dump(obj, i)); - } - } - } - return list; - } - - public abstract T[] array(); - - public abstract String[] dump(T obj, int id); -} \ No newline at end of file diff --git a/dependencies/main/java/codechicken/nei/config/ConfigSet.java b/dependencies/main/java/codechicken/nei/config/ConfigSet.java deleted file mode 100644 index d30d0c9dd4..0000000000 --- a/dependencies/main/java/codechicken/nei/config/ConfigSet.java +++ /dev/null @@ -1,44 +0,0 @@ -package codechicken.nei.config; - -import codechicken.lib.config.ConfigTagParent; -import codechicken.nei.util.NEIServerUtils; -import net.minecraft.nbt.NBTTagCompound; - -import java.io.File; - -public class ConfigSet { - private File nbtFile; - public NBTTagCompound nbt; - public ConfigTagParent config; - - public ConfigSet(File nbtFile, ConfigTagParent config) { - this.nbtFile = nbtFile; - this.config = config; - loadNBT(); - } - - public void loadNBT() { - nbt = new NBTTagCompound(); - try { - if (!nbtFile.getParentFile().exists()) { - nbtFile.getParentFile().mkdirs(); - } - if (!nbtFile.exists()) { - nbtFile.createNewFile(); - } - if (nbtFile.length() > 0) { - nbt = NEIServerUtils.readNBT(nbtFile); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void saveNBT() { - try { - NEIServerUtils.writeNBT(nbt, nbtFile); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/dependencies/main/java/codechicken/nei/config/DataDumper.java b/dependencies/main/java/codechicken/nei/config/DataDumper.java deleted file mode 100644 index f31814f038..0000000000 --- a/dependencies/main/java/codechicken/nei/config/DataDumper.java +++ /dev/null @@ -1,153 +0,0 @@ -package codechicken.nei.config; - -import codechicken.lib.util.CommonUtils; -import codechicken.lib.vec.Rectangle4i; -import codechicken.nei.LayoutManager; -import codechicken.nei.util.LogHelper; -import codechicken.nei.util.NEIClientUtils; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentTranslation; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; - -import static codechicken.lib.gui.GuiDraw.drawString; -import static codechicken.lib.gui.GuiDraw.drawStringC; - -public abstract class DataDumper extends Option { - public DataDumper(String name) { - super(name); - } - - public abstract String[] header(); - - public abstract Iterable dump(int mode); - - public String renderName() { - return translateN(name + "s"); - } - - public void dumpFile() { - try { - File file = new File(CommonUtils.getMinecraftDir(), "dumps/" + getFileName(name.replaceFirst(".+\\.", ""))); - if (!file.getParentFile().exists()) { - file.getParentFile().mkdirs(); - } - if (!file.exists()) { - file.createNewFile(); - } - - dumpTo(file); - - NEIClientUtils.printChatMessage(dumpMessage(file)); - } catch (Exception e) { - LogHelper.errorError("Error dumping " + renderName() + " mode: " + getMode(), e); - } - } - - public String getFileName(String prefix) { - return prefix + getFileExtension(); - } - - public String getFileExtension() { - return ".csv"; - } - - public ITextComponent dumpMessage(File file) { - return new TextComponentTranslation("nei.options.tools.dump.dumped", translateN(name), "dumps/" + file.getName()); - } - - public void dumpTo(File file) throws IOException { - int mode = getMode(); - PrintWriter w = new PrintWriter(file); - w.println(concat(header())); - for (String[] line : dump(mode)) { - w.println(concat(line)); - } - w.close(); - } - - public static String concat(String[] header) { - StringBuilder sb = new StringBuilder(); - for (String s : header) { - if (sb.length() > 0) { - sb.append(','); - } - if (s == null) { - s = "null"; - } - if (s.indexOf(',') > 0 || s.indexOf('\"') > 0) { - s = '\"' + s.replace("\"", "\"\"") + '\"'; - } - sb.append(s); - } - return sb.toString(); - } - - @Override - public void draw(int mousex, int mousey, float frame) { - drawPrefix(); - if (modeCount() > 1) { - drawButton(mousex, mousey, modeButtonSize(), modeButtonText()); - } - drawButton(mousex, mousey, dumpButtonSize(), dumpButtonText()); - } - - public void drawPrefix() { - drawString(renderName(), 10, 6, -1); - } - - public Rectangle4i dumpButtonSize() { - int width = 80; - return new Rectangle4i(slot.slotWidth() - width, 0, width, 20); - } - - public Rectangle4i modeButtonSize() { - int width = 60; - return new Rectangle4i(dumpButtonSize().x - width - 6, 0, width, 20); - } - - public String dumpButtonText() { - return NEIClientUtils.lang.translate("options.tools.dump.dump"); - } - - public String modeButtonText() { - return NEIClientUtils.lang.translate("options.tools.dump.mode." + getMode()); - } - - public int getMode() { - return renderTag().getIntValue(0); - } - - public void drawButton(int mousex, int mousey, Rectangle4i b, String text) { - GlStateManager.color(1, 1, 1, 1); - boolean hover = b.contains(mousex, mousey); - LayoutManager.drawButtonBackground(b.x, b.y, b.w, b.h, true, getButtonTex(hover)); - drawStringC(text, b.x, b.y, b.w, b.h, getTextColour(hover)); - } - - public int getButtonTex(boolean hover) { - return hover ? 2 : 1; - } - - public int getTextColour(boolean hover) { - return hover ? 0xFFFFFFA0 : 0xFFE0E0E0; - } - - @Override - public void mouseClicked(int mousex, int mousey, int button) { - if (modeCount() > 1 && modeButtonSize().contains(mousex, mousey)) { - NEIClientUtils.playClickSound(); - getTag().setIntValue((getMode() + 1) % modeCount()); - } else if (dumpButtonSize().contains(mousex, mousey)) { - NEIClientUtils.playClickSound(); - dumpFile(); - } - } - - public int modeCount() { - return 3; - } -} diff --git a/dependencies/main/java/codechicken/nei/config/GuiHighlightTips.java b/dependencies/main/java/codechicken/nei/config/GuiHighlightTips.java deleted file mode 100644 index 3f7e71563b..0000000000 --- a/dependencies/main/java/codechicken/nei/config/GuiHighlightTips.java +++ /dev/null @@ -1,152 +0,0 @@ -package codechicken.nei.config; - -import codechicken.core.gui.GuiCCButton; -import codechicken.core.gui.GuiScreenWidget; -import codechicken.lib.math.MathHelper; -import codechicken.lib.vec.Rectangle4i; -import codechicken.nei.HUDRenderer; -import codechicken.nei.util.NEIClientUtils; -import net.minecraft.client.Minecraft; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.TextFormatting; -import org.lwjgl.input.Keyboard; - -import java.awt.*; -import java.io.IOException; -import java.util.Arrays; - -import static codechicken.lib.gui.GuiDraw.displaySize; -import static codechicken.lib.gui.GuiDraw.getMousePosition; - -@Deprecated//Waila is a thing now. -public class GuiHighlightTips extends GuiScreenWidget { - private String name; - private GuiCCButton toggleButton; - private Option opt; - private Point dragDown; - - public GuiHighlightTips(Option opt) { - super(80, 20); - this.opt = opt; - name = opt.name; - } - - @Override - public boolean doesGuiPauseGame() { - return true; - } - - public void addWidgets() { - add(toggleButton = new GuiCCButton(0, 0, 80, 20, "").setActionCommand("show")); - updateNames(); - } - - @Override - public void actionPerformed(String ident, Object... params) { - if (ident.equals("show")) { - opt.getTag(name).setBooleanValue(!show()); - updateNames(); - } - } - - private void updateNames() { - toggleButton.text = NEIClientUtils.translate("options." + name + "." + (show() ? "show" : "hide")); - } - - private boolean show() { - return opt.renderTag(name).getBooleanValue(); - } - - @Override - public void keyTyped(char c, int keycode) throws IOException { - if (keycode == Keyboard.KEY_ESCAPE || keycode == Keyboard.KEY_BACK) { - Minecraft.getMinecraft().displayGuiScreen(opt.slot.getGui()); - return; - } - super.keyTyped(c, keycode); - } - - @Override - public void drawScreen(int mousex, int mousey, float f) { - super.drawScreen(mousex, mousey, f); - if (show()) { - //HUDRenderer.renderOverlay(new ItemStack(Blocks.REDSTONE_BLOCK), Arrays.asList("RedstoneBlock", TextFormatting.RED + "Sample"), renderPos()); - } - } - - public Point getPos() { - return new Point(opt.renderTag(name + ".x").getIntValue(), opt.renderTag(name + ".y").getIntValue()); - } - - public Dimension sampleSize()//copied from HUDManager when running with the sample for this gui - { - return new Dimension(101, 30); - } - - public Point getDrag() { - Point mouse = getMousePosition(); - Point drag = new Point(mouse.x - dragDown.x, mouse.y - dragDown.y); - Dimension size = displaySize(); - Dimension sample = sampleSize(); - drag.x *= 10000; - drag.y *= 10000; - drag.x /= (size.width - sample.width); - drag.y /= (size.height - sample.height); - Point pos = getPos(); - drag.x = (int) MathHelper.clip(drag.x, -pos.x, 10000 - pos.x); - drag.y = (int) MathHelper.clip(drag.y, -pos.y, 10000 - pos.y); - return drag; - } - - public Point renderPos() { - Point pos = getPos(); - if (dragDown != null) { - Point drag = getDrag(); - pos.x += drag.x; - pos.y += drag.y; - } - - for (int i = 25; i < 100; i += 25)//snapping - { - if (pos.x / 100 == i) { - pos.x = i * 100; - } - if (pos.y / 100 == i) { - pos.y = i * 100; - } - } - - return pos; - } - - @Override - protected void mouseReleased(int x, int y, int button) { - if (button == 0 && dragDown != null) { - setPos(renderPos()); - dragDown = null; - } - } - - public Rectangle4i selectionBox() { - Point pos = renderPos(); - Dimension size = displaySize(); - Dimension rect = sampleSize(); - return new Rectangle4i((size.width - rect.width) * pos.x / 10000, (size.height - rect.height) * pos.y / 10000, rect.width, rect.height); - } - - @Override - protected void mouseClicked(int x, int y, int button) throws IOException { - if (button == 0 && selectionBox().contains(x, y)) { - dragDown = getMousePosition(); - } else { - super.mouseClicked(x, y, button); - } - } - - private void setPos(Point p) { - opt.getTag(name).setBooleanValue(show());//duplicates global tag for the option gui if in world mode - opt.getTag(name + ".x").setIntValue(p.x); - opt.getTag(name + ".y").setIntValue(p.y); - } -} diff --git a/dependencies/main/java/codechicken/nei/config/GuiItemIconDumper.java b/dependencies/main/java/codechicken/nei/config/GuiItemIconDumper.java deleted file mode 100644 index 3e4225dd6c..0000000000 --- a/dependencies/main/java/codechicken/nei/config/GuiItemIconDumper.java +++ /dev/null @@ -1,202 +0,0 @@ -package codechicken.nei.config; - -import codechicken.lib.util.CommonUtils; -import codechicken.lib.gui.GuiDraw; -import codechicken.nei.guihook.GuiContainerManager; -import codechicken.nei.util.LogHelper; -import codechicken.nei.util.NEIClientUtils; -import codechicken.nei.widget.ItemPanel; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.texture.TextureUtil; -import net.minecraft.client.shader.Framebuffer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentTranslation; -import net.minecraft.util.text.TextFormatting; -import org.lwjgl.BufferUtils; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import javax.imageio.ImageIO; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.nio.IntBuffer; -import java.util.Arrays; - -public class GuiItemIconDumper extends GuiScreen { - final static int[] illegalChars = { 34, 60, 62, 124, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 58, 42, 63, 92, 47 }; - - static { - Arrays.sort(illegalChars); - } - - private Option opt; - private int drawIndex; - private int parseIndex; - private File dir = new File(CommonUtils.getMinecraftDir(), "dumps/itempanel_icons"); - private int iconSize; - private int borderSize; - private int boxSize; - - public GuiItemIconDumper(Option opt, int iconSize) { - this.opt = opt; - this.iconSize = iconSize; - borderSize = iconSize / 16; - boxSize = iconSize + borderSize * 2; - - if (dir.exists()) { - for (File f : dir.listFiles()) { - if (f.isFile()) { - f.delete(); - } - } - } else { - dir.mkdirs(); - } - - } - - private void returnScreen(ITextComponent msg) { - Minecraft.getMinecraft().displayGuiScreen(opt.slot.getGui()); - NEIClientUtils.printChatMessage(msg); - } - - @Override - protected void keyTyped(char c, int keycode) throws IOException { - if (keycode == Keyboard.KEY_ESCAPE || keycode == Keyboard.KEY_BACK) { - returnScreen(new TextComponentTranslation(opt.fullName() + ".icon.cancelled")); - return; - } - super.keyTyped(c, keycode); - } - - @Override - public void drawScreen(int mousex, int mousey, float frame) { - try { - drawItems(); - exportItems(); - } catch (Exception e) { - LogHelper.errorError("Error dumping item icons", e); - } - } - - private void drawItems() { - Dimension d = GuiDraw.displayRes(); - - GlStateManager.matrixMode(GL11.GL_PROJECTION); - GlStateManager.loadIdentity(); - GlStateManager.ortho(0, d.width * 16D / iconSize, d.height * 16D / iconSize, 0, 1000, 3000); - GlStateManager.matrixMode(GL11.GL_MODELVIEW); - GlStateManager.clearColor(0, 0, 0, 0); - GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); - - int rows = d.height / boxSize; - int cols = d.width / boxSize; - int fit = rows * cols; - - RenderHelper.enableGUIStandardItemLighting(); - GlStateManager.enableRescaleNormal(); - GlStateManager.color(1, 1, 1, 1); - - for (int i = 0; drawIndex < ItemPanel.items.size() && i < fit; drawIndex++, i++) { - int x = i % cols * 18; - int y = i / cols * 18; - GuiContainerManager.drawItem(x + 1, y + 1, ItemPanel.items.get(drawIndex)); - } - - GL11.glFlush(); - } - - private void exportItems() throws IOException { - BufferedImage img = screenshot(); - int rows = img.getHeight() / boxSize; - int cols = img.getWidth() / boxSize; - int fit = rows * cols; - for (int i = 0; parseIndex < ItemPanel.items.size() && i < fit; parseIndex++, i++) { - int x = i % cols * boxSize; - int y = i / cols * boxSize; - exportImage(dir, img.getSubimage(x + borderSize, y + borderSize, iconSize, iconSize), ItemPanel.items.get(parseIndex)); - } - - if (parseIndex >= ItemPanel.items.size()) { - returnScreen(new TextComponentTranslation(opt.fullName() + ".icon.dumped", "dumps/itempanel_icons")); - } - } - - public static String cleanFileName(String name) { - StringBuilder cleanName = new StringBuilder(); - for (int i = 0; i < name.length(); i++) { - int c = (int) name.charAt(i); - if (Arrays.binarySearch(illegalChars, c) < 0) { - cleanName.append((char) c); - } else { - cleanName.append('_'); - } - } - return cleanName.toString(); - } - - private void exportImage(File dir, BufferedImage img, ItemStack stack) throws IOException { - String name = TextFormatting.getTextWithoutFormattingCodes(GuiContainerManager.itemDisplayNameShort(stack)); - name = cleanFileName(name); - File file = new File(dir, name + ".png"); - for (int i = 2; file.exists(); i++) { - file = new File(dir, name + '_' + i + ".png"); - } - ImageIO.write(img, "png", file); - } - - private IntBuffer pixelBuffer; - private int[] pixelValues; - - private BufferedImage screenshot() { - Framebuffer fb = Minecraft.getMinecraft().getFramebuffer(); - Dimension mcSize = GuiDraw.displayRes(); - Dimension texSize = mcSize; - - if (OpenGlHelper.isFramebufferEnabled()) { - texSize = new Dimension(fb.framebufferTextureWidth, fb.framebufferTextureHeight); - } - - int k = texSize.width * texSize.height; - if (pixelBuffer == null || pixelBuffer.capacity() < k) { - pixelBuffer = BufferUtils.createIntBuffer(k); - pixelValues = new int[k]; - } - - GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1); - GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1); - pixelBuffer.clear(); - - if (OpenGlHelper.isFramebufferEnabled()) { - GlStateManager.bindTexture(fb.framebufferTexture); - GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer); - } else { - GL11.glReadPixels(0, 0, texSize.width, texSize.height, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer); - } - - pixelBuffer.get(pixelValues); - TextureUtil.processPixelValues(pixelValues, texSize.width, texSize.height); - - BufferedImage img = new BufferedImage(mcSize.width, mcSize.height, BufferedImage.TYPE_INT_ARGB); - if (OpenGlHelper.isFramebufferEnabled()) { - int yOff = texSize.height - mcSize.height; - for (int y = 0; y < mcSize.height; ++y) { - for (int x = 0; x < mcSize.width; ++x) { - img.setRGB(x, y, pixelValues[(y + yOff) * texSize.width + x]); - } - } - } else { - img.setRGB(0, 0, texSize.width, height, pixelValues, 0, texSize.width); - } - - return img; - } -} diff --git a/dependencies/main/java/codechicken/nei/config/GuiItemSorter.java b/dependencies/main/java/codechicken/nei/config/GuiItemSorter.java deleted file mode 100644 index 77f843ba5f..0000000000 --- a/dependencies/main/java/codechicken/nei/config/GuiItemSorter.java +++ /dev/null @@ -1,184 +0,0 @@ -package codechicken.nei.config; - -import codechicken.lib.math.MathHelper; -import codechicken.nei.ItemSorter; -import codechicken.nei.ItemSorter.SortEntry; -import codechicken.nei.LayoutManager; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.GlStateManager; - -import java.awt.*; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import static codechicken.lib.gui.GuiDraw.drawStringC; -import static codechicken.lib.gui.GuiDraw.getMousePosition; - -public class GuiItemSorter extends GuiOptionPane { - public class SortItem { - public double ya; - public double y; - public SortEntry e; - - public SortItem(SortEntry e) { - this.e = e; - y = slotY(); - } - - public int slotY() { - return GuiItemSorter.this.slotY(list.indexOf(e)); - } - - public void update(int my) { - ya = y; - if (dragging && this == dragged) { - y = dragstarty + my - mouseclickedy; - } else { - y = MathHelper.approachExp(y, slotY(), 0.4, 20); - } - } - - public boolean contains(int my) { - my -= drawBounds().y; - return my >= y && my < y + 20; - } - } - - public Option opt; - public List slots = new ArrayList(); - public List list; - - boolean dragging; - public SortItem dragged; - public int mouseclickedy; - public double dragstarty; - - public GuiItemSorter(Option opt) { - this.opt = opt; - list = ItemSorter.fromSaveString(opt.renderTag().getValue()); - for (SortEntry e : list) { - slots.add(new SortItem(e)); - } - } - - public int slotY(int slot) { - return 2 + slot * 24; - } - - @Override - public int contentHeight() { - return slots.size() * 24; - } - - @Override - public void drawContent(int mx, int my, float frame) { - Rectangle w = drawBounds(); - - for (SortItem item : slots) { - if (item != dragged) { - drawItem(w, item, mx, my, frame); - } - } - - if (dragged != null) { - drawItem(w, dragged, mx, my, frame); - } - } - - public void drawItem(Rectangle w, SortItem item, int mx, int my, float frame) { - double y = MathHelper.interpolate(item.ya, item.y, frame); - GlStateManager.translate(0, y, 0); - Rectangle b = new Rectangle(w.x, w.y, w.width, 20); - boolean mouseOver = itemAt(w.x + mx, w.y + my) == item; - - GlStateManager.color(1, 1, 1, 1); - LayoutManager.drawButtonBackground(b.x, b.y, b.width, b.height, true, mouseOver ? 2 : 1); - drawStringC(item.e.getLocalisedName(), b.x, b.y, b.width, b.height, mouseOver ? 0xFFFFFFA0 : 0xFFE0E0E0); - - GlStateManager.translate(0, -y, 0); - } - - @Override - public String getTitle() { - return opt.translateN(opt.name); - } - - @Override - public GuiScreen getParentScreen() { - return opt.slot.getGui(); - } - - @Override - public void updateScreen() { - super.updateScreen(); - - int my = getMousePosition().y; - for (SortItem item : slots) { - item.update(my); - } - - if (dragging) { - int nslot = (int) MathHelper.clip((dragged.y - (2 - 12)) / 24, 0, slots.size() - 1); - if (nslot != list.indexOf(dragged.e)) { - list.remove(dragged.e); - list.add(nslot, dragged.e); - opt.getTag().setValue(ItemSorter.getSaveString(list)); - if (opt.activeTag() == opt.getTag()) { - ItemSorter.list = new ArrayList(list); - } - } - } - } - - public SortItem itemAt(int mx, int my) { - if (!pane.windowBounds().contains(mx, my)) { - return null; - } - - if (dragged != null && dragged.contains(my)) { - return dragged; - } - - for (SortItem item : slots) { - if (item.contains(my)) { - return item; - } - } - - return null; - } - - @Override - protected void mouseClicked(int x, int y, int button) throws IOException { - super.mouseClicked(x, y, button); - - if (!dragging && button == 0) { - SortItem item = itemAt(x, y); - if (item != null) { - dragging = true; - dragged = item; - mouseclickedy = y; - dragstarty = item.y; - } - } - } - - @Override - protected void mouseReleased(int x, int y, int button) { - if (button == 0) { - dragging = false; - } - } - - @Override - public List handleTooltip(int mx, int my, List tooltip) { - if (!dragging) { - SortItem item = itemAt(mx, my); - if (item != null && item.e.getTooltip() != null) { - tooltip.add(item.e.getTooltip()); - } - } - return tooltip; - } -} diff --git a/dependencies/main/java/codechicken/nei/config/GuiNEIOptionList.java b/dependencies/main/java/codechicken/nei/config/GuiNEIOptionList.java deleted file mode 100644 index ca751a0012..0000000000 --- a/dependencies/main/java/codechicken/nei/config/GuiNEIOptionList.java +++ /dev/null @@ -1,54 +0,0 @@ -package codechicken.nei.config; - -import codechicken.core.gui.GuiCCButton; -import codechicken.nei.util.LogHelper; -import net.minecraft.client.gui.GuiConfirmOpenLink; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.GuiYesNoCallback; - -import java.awt.*; -import java.net.URI; - -public class GuiNEIOptionList extends GuiOptionList implements GuiYesNoCallback { - private GuiCCButton patreonButton; - - public GuiNEIOptionList(GuiScreen parent, OptionList optionList, boolean world) { - super(parent, optionList, world); - } - - @Override - public void resize() { - super.resize(); - patreonButton.x = width - 73; - patreonButton.y = height - 23; - } - - @Override - public void addWidgets() { - super.addWidgets(); - add(patreonButton = new PatreonButton(0, 0, 70, 20).setActionCommand("patreon")); - } - - @Override - public void actionPerformed(String ident, Object... params) { - if (ident.equals("patreon")) { - GuiConfirmOpenLink gui = new GuiConfirmOpenLink(this, "patreon.com/cb", 0, true); - gui.disableSecurityWarning(); - mc.displayGuiScreen(gui); - } else { - super.actionPerformed(ident, params); - } - } - - @Override - public void confirmClicked(boolean yes, int id) { - if (yes && id == 0) { - try { - Desktop.getDesktop().browse(new URI("http://patreon.com/cb")); - } catch (Exception e) { - LogHelper.errorError("Failed to open patreon page", e); - } - } - mc.displayGuiScreen(this); - } -} diff --git a/dependencies/main/java/codechicken/nei/config/GuiOptionList.java b/dependencies/main/java/codechicken/nei/config/GuiOptionList.java deleted file mode 100644 index dd9f25bd30..0000000000 --- a/dependencies/main/java/codechicken/nei/config/GuiOptionList.java +++ /dev/null @@ -1,284 +0,0 @@ -package codechicken.nei.config; - -import codechicken.core.gui.GuiCCButton; -import codechicken.core.gui.GuiScreenWidget; -import codechicken.core.gui.GuiScrollSlot; -import codechicken.lib.vec.Rectangle4i; -import codechicken.nei.LayoutManager; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.GlStateManager; - -import java.awt.*; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; - -import static codechicken.lib.gui.GuiDraw.*; -import static net.minecraft.util.text.translation.I18n.translateToLocal; - -public class GuiOptionList extends GuiScreenWidget { - public class OptionScrollSlot extends GuiScrollSlot { - public ArrayList